ltlength.dtx

Johannes Braams  David Carlisle  Alan Jeffrey
Leslie Lamport  Frank Mittelbach  Chris Rowley

Rainer Schöpf

1995/08/11

1 Lengths

\newlength Declare #1 to be a new length command.

\setlength Set the length command, #1, to the value #2. \addtolength Increase the value of the length command, #1, by the value #2. \settowidth Set the length, #1 to the width of a box containing #2. \settoheight Set the length, #1 to the height of a box containing #2. \settodepth Set the length, #1 to the depth of a box containing #2.

1 ⟨∗2ekernel⟩

               2 \message{lengths,}
  \newlength
               3 \def\newlength#1{\@ifdefinable#1{\newskip#1}}
  \setlength
               4 \def\setlength#1#2{#1#2\relax}
\addtolength  \relax added 24 Mar 86
               5 \def\addtolength#1#2{\advance#1 #2\relax}
\settoheight \settodepth \settowidth \@settodim The obvious analogs of \settowidth.
               6 \def\@settodim#1#2#3{\setbox\@tempboxa\hbox{{#3}}#2#1\@tempboxa

Clear the memory afterwards (which might be a lot).

               7  \setbox\@tempboxa\box\voidb@x}
               8 \def\settoheight{\@settodim\ht}
               9 \def\settodepth {\@settodim\dp}
              10 \def\settowidth {\@settodim\wd}

\@settopoint This macro takes the contents of the skip register that is supplied as its argument and removes the fractional part to make it a whole number of points. This can be used in class files to avoid values like 345.4666666pt when calulating a dimension.

              11 \def\@settopoint#1{\divide#1\p@\multiply#1\p@}

12 ⟨/2ekernel⟩