Debian Codegraph @

texmf-dist/tex/latex/circuit-macros/boxdims.sty

raw
1 %
2 % boxdims.sty, for use with Circuit_macros. Last modified 30 Apr 2004.
3 %
4 % \boxdims{arg1}{arg2} expands to arg2, but writes into file \jobname.dim
5 % the m4 definitions for macros arg1_h, arg1_w, arg1_d, the height, width
6 % and depth of \hbox{arg2}.
7 %
8 % \defboxdim{arg1}{arg2} writes the definitions but expands to nothing.
9 %
10 % \boxdimfile{filename} sets the output file to filename, default \jobname.dim
11 %
12 \ProvidesPackage{boxdims}
13 [2004/04/30 v2.0 Macros: boxdimfile, boxdims, defboxdim (DA)]
14
15 \newwrite\@dimensionfile
16 \newif\if@dimfile
17 \newbox\dimbox
18
19 \def\boxdimfile#1{\immediate\openout\@dimensionfile=#1\global\@dimfiletrue%
20 \typeout{ boxdims.sty v2.0: Writing dimension file #1 }}%
21
22 \def\boxdims#1#2{\defboxdim{#1}{#2}#2}
23
24 \def\defboxdim#1#2{\if@dimfile\else%
25 \immediate\openout\@dimensionfile=\jobname.dim\global\@dimfiletrue%
26 \typeout{ boxdims.sty v2.0: Writing dimension file \jobname.dim }\fi%
27 \setbox\dimbox=\hbox{#2}%
28 \begingroup\@sanitize\edef\@tempa{\write\@dimensionfile{%
29 \@defboxdim{#1}}}\expandafter\endgroup\@tempa}
30 \def\@defboxdim#1{%
31 define(`#1_w',\the\wd\dimbox__)%
32 define(`#1_h',\the\ht\dimbox__)%
33 define(`#1_d',\the\dp\dimbox__)dnl}