1

This is a very general question. Apparently a duplicate of:

Other than syntax what is the difference between \dimen0= and \setlength{}{}?

What is the difference between \fboxsep=1cm and \setlength{\fboxsep}{1cm}?

In order to set lengths, in the documentation and in the various posts, the following syntax is used, where x is the target measure value:

\setlength{\lengthname}{x}

However, it is also possible to type, much more simply:

\lengthname=x

Is there any reason why the \setlength variant, while heavier, less convenient, is apparently widely favored?

Is there any difference with respect to the effect of either command, or potential restrictions?

\documentclass{article}

\begin{document}

\noindent
First Paragraph. 

Second Paragraph.

\setlength{\parindent}{3em}

Third Paragraph.

\parindent=5em

Fourth Paragraph.

\end{document}

enter image description here

  • 2
    This looks like a duplicate. See: https://tex.stackexchange.com/questions/63050/other-than-syntax-what-is-the-difference-between-dimen0-and-setlength?rq=1 and https://tex.stackexchange.com/questions/7784/what-is-the-difference-between-fboxsep-1cm-and-setlength-fboxsep1cm?rq=1 I hope this answers your question. :) – User23456234 Feb 14 '23 at 01:36
  • 1
    Thanks! -------- – Vincent Krebs Feb 14 '23 at 01:46
  • 1
    I did not see anyone mention this in the linked posts, also \parindent 5em is a valid syntax (i.e. the = is optional), similar to the case with \let – Udi Fogiel Feb 14 '23 at 01:50
  • @Udi Just like with penalties (\xpenalty10000)! But can the space be removed then? Does \parindent5cm work? Apparently yes! It becomes much lighter than \setlength, I think it is safe to use this simplified syntax inside a document. – Vincent Krebs Feb 14 '23 at 01:52
  • 1
    Indeed...... :) – Udi Fogiel Feb 14 '23 at 01:55
  • 2
    I wouldn't say it is 100% safe,if you don't know what you are doing. For example, if I would want to insert some horizontal space before the word plus, I would get into troubles with yello \hskip 10pt plus blue gives the color green. In this case you would need to add \relax, just as \setlength does. – Udi Fogiel Feb 14 '23 at 02:03
  • @Udi Yes I saw that in the other post. I was assuming that this case was specific enough as to be safely overlooked ;) – Vincent Krebs Feb 14 '23 at 02:09

0 Answers0