Notation for lengths

I've noticed that when you set length, you can not only write \setlength{X}{3.14cm} but \setlength{X}{=3.14cm} as well. It looks like there is not any difference between those notations but I'd like to know why there is a possibility to use notation with "=" sign.

• You could as well type \setlength{\X}{\@firstoftwo{3.14}{Hey! It's pi}cm} if in a \makeatletter context, but this doesn't mean you should. ;-) – egreg Oct 23 '16 at 19:30
• how did you notice that?????? (without starting from the implementation and just inferring that the = would drop through by accident? )Surely no documentation suggests that does it? – David Carlisle Oct 23 '16 at 22:53
• @DavidCarlisle I knew \setlength{X}{Y} expands to {X Y\relax} (I've read it in documentation) and then when experimenting with those notations I discovered the possibility of using =. – Bartłomiej Sługocki Oct 24 '16 at 9:22

\setlength is a LaTeX macro which is defined as:

\def\setlength#1#2{#1 #2\relax}


So \setlength{\mylength}{1cm} expands to \mylength 1cm.

\mylength 1cm

 \mylength=1cm

• @BartłomiejSługocki Other than the TeX Book itself, (which is not freely available), the best free source for TeX itself is Victor Eijkhout's TeX by Topic which you can find using texdoc in your distribution. For the source documentation of the LaTeX kernel, you can look at source2e, also available as part of your distribution via texdoc. – Alan Munn Oct 23 '16 at 19:25