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
  • 1
    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.

The equals sign in assignments is optional, in TeX so:

\mylength 1cm

is equivalent to

  • Thank you very much. Could you please give me the source of this information? I've searched for assignments syntax in TeX but I didn't found anything helpful. – Bartłomiej Sługocki Oct 23 '16 at 19:23
  • 1
    @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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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