As I understand it, the point of \relax
is to stop a macro from swallowing up subsequent material (such as whitespace). But {}
(\bgroup\egroup
) serves the same function. Why do we need both?
[Tex/LaTex] the difference between \relax and {}
macrostex-core
Best Answer
Try the following couple examples:
\\
alone, the[+9mm]
is interpreted as an optional argument to\\
and transformed into a vertical space.{}
, then it inserts an "empty thing" into the formula and the+
is improperly spaced.\relax
works correctly here, because it really does nothing.Very similar examples can be used to show that
\relax
is the correct terminator of\dimexpr
and\numexpr
expansion etc.