Jesteś w: Start / Przedsięwzięcia/Projects / TeX Pearls / 2007 Pearls / hans-hagen / bachotex2007-hans-hagen-pearl1.tex

bachotex2007-hans-hagen-pearl1.tex

TeX document icon bachotex2007-hans-hagen-pearl1.tex — TeX document, 1 KB

Zawartość pliku

%%% Multi-signed numbers

% \TeX\ handles multiple signs properly:

\newdimen\scratchdimen
\scratchdimen 1pt \the\scratchdimen,
\scratchdimen -1pt \the\scratchdimen,
\scratchdimen --1pt \the\scratchdimen,
\scratchdimen ---1pt \the\scratchdimen,
\scratchdimen -+-+-+++-----+1pt \the\scratchdimen,

% So, there never is a need to use an intermediate variable to negate a value. All
% digits, $+$/$-$ signs and units can be faked in macros:

\def\neg{-} \def\p{p}
\scratchdimen \neg\space\neg\space\space00001\empty\p\empty\empty tttt \the\scratchdimen

% One may also notice that white characters are allowed between multiple signs
% (but not between digits!), leading zeros are ignored, and the unit is
% properly interpreted regardless of the very next character.

\end