TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the TeXbook Knuth set parameters for dimensions mostly as follows:


Other package authors define such parameters without using the equal sign


Many later authors use the LaTeX \setlength


You can even define a constant somewhere and write:


Even \parskip30PT or even \parskip10Pt works!

I favour \parskip30pt for macros in a package and \newlength for preamble commands in a document. Is there a right way to set a dimension parameter?

Note: here is a short minimal example of all the above commands for anyone wishing to try them out.


share|improve this question
up vote 17 down vote accepted

At the TeX level there are two register types to worry about, dimensions and skips. The former only take a dimension (not surprisingly), whereas the later also have a rubber component. LaTeX's 'lengths' are TeX skips and so can have a rubber component. This is important when you consider how to terminate the setting instructions. For example:

\def\setmyskip#1{\myskip #1} % Bad!
\setmyskip{10 pt} plus some other context

Here, TeX will think that 'plus' is part of the skip information and will complain about a missing number. So LaTeX includes a \relax in the definition of \setlength to avoid this:

> \setlength=macro:
#1#2->#1#2\relax .

This termination question does not apply in the case where you are setting one length from another:

\parskip\parsep plus 

will not treat the plus as part of the setting. Whenever you set one register from another TeX 'knows' that there is nothing else to look for. (Note: if you try the same with a constant stored as a macro, you are back needing the \relax.)

Now, on the 'right' way to do this I'm not aware of a case where the = is vital (contrast the situation with \let, where sometimes that optional = is significant). So I would not use one.

As LaTeX provides proper termination of the setting, I would prefer it's method over the plain TeX approach if we are talking about a LaTeX document. That said, if I want a fixed length I will tend to prefer a dimension, and use \newdimen followed by the plain TeX setting method with \relax inserted as appropriate.

share|improve this answer
The LaTeX version of \setlength of file latex.ltx contains the bug latex/3066 that is fixed by package fixltx2e. It inserts a space between #1 and #2. – Heiko Oberdiek Jan 20 '13 at 3:28
@HeikoOberdiek I guess 'bug' here is slightly questionable: \dimen0 is not LaTeX syntax, so there is no reason (reading LaTeX: A Document Preparation System) to expect this to work. There was dicussion ages ago within the team about whether expl3 (\dim_set:Nn, etc.) should support register numbers. We decided it should not, i.e. that anything that goes wrong if you do \dim_set:Nn { \dimen0 } { 10 pt } is not a bug. – Joseph Wright Jan 20 '13 at 9:23
@JosephWright Please give an example when \let needs an equal sign. – marczellm Jan 20 '13 at 13:41
@marczellm Usual answer is for awkward cases: \let\foo== would be a trivial one! (Without the first =, you end up with \foo equal to whatever the next token is). – Joseph Wright Jan 20 '13 at 15:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.