Synopsis

edit

\relax

Description

edit

Donald Knuth describes this as telling TeX to "do nothing." This seems like a pointless control sequence at first thought. However, some control sequences act on tokens that follow it, and \relax tells TeX to stop accepting new tokens for this control sequence. This is sometimes necessary to resolve otherwise ambiguous expressions.

Examples

edit

The following piece of code looks just fine, but...

 \begin{tabular}{ll}
 Number & Text \\
 [a] & lorem ipsum \\
 [b] & lorem ipsum \\
 \end{tabular}

... TeX throws an Error "! Missing number, treated as zero. <to be read again> a". TeX just ignores the end-of-line and reads the tokens "\\[a]" as \\[length]. To stop TeX reading into such things just tell it to \relax

 \begin{tabular}{ll}
 Number & Text \\ \relax
 [a] & lorem ipsum \\ \relax
 [b] & lorem ipsum \\
 \end{tabular}

so TeX (and you) keep it cool.

Exercises

edit