[texhax] def vs newlength

Philip G. Ratcliffe philip.ratcliffe at uninsubria.it
Tue Jun 14 09:44:52 CEST 2005

> I would like to create a new length in my cls file and I found two
> alternatives which both work:
> \newlength{\PositionColumn}\setlength{\PositionColumn}{2.2cm}
> and
> \def\PositionColumn{2.2cm}
> The second is shorter while the first looks more LaTeX-like to me.
> Could you explain the difference please?

The first defines a fully fledged length, which can then be used with
commands like \setlength and \addtolength; moreover, a construction like
\hspace{0.5\PositionColumn} will be interpretted correctly.  The second
will, at best, be brutally expanded as 2.2cm whenever it is encountered.

So, if all you need is a definition that holds a static value, the second is
fine; if you need a more dynamic object, then the first is necessary.

Cheers,  Phil

More information about the texhax mailing list