mass@garfield.caltech.edu (Mass Sivilotti) (06/15/90)
A question for the net.tex.experts: I need to generate (in a \special) only the NUMERIC part of a TeX dimension. For example, if \the\pagewidth gives 350.642pt, I would like something like \thenumber\pagewidth to give 350.642 Along the way, I have been able to strip off just the INTEGER part, with the following macros: \def\integerpart#1.#2\end{#1} \newcommand{\theinteger}[1]{\expandafter\integerpart\the#1\end} \typeout{integer part of \the\pagewidth\space = \theinteger\pagewidth} Any suggestions? Thanks in advance, mass sivilotti (mass@hobiecat.cs.caltech.edu)
lambert@spectrum.eecs.unsw.oz (Tim Lambert) (06/15/90)
>>>>> On 15 Jun 90 01:58:02 GMT, mass@garfield.caltech.edu (Mass Sivilotti) said: In article <MASS.90Jun14185802@garfield.caltech.edu> mass@garfield.caltech.edu (Mass Sivilotti) writes: > I need to generate (in a \special) only the NUMERIC part of > a TeX dimension. For example, if \the\pagewidth gives 350.642pt, > I would like something like \thenumber\pagewidth to give 350.642 Page 375 of the TeXbook shows you how to do this: {\catcode`p=12 \catcode`t=12 \gdef\EATPT#1pt{#1}} \def\thenumber#1{\expandafter\EATPT\the#1} The tricky bit is that the `p' and the `t' that `\the' give you are of category 12. Tim