What does \relax do?

Although \relax does nothing by itself, it is a safe command to stop expansion of another command. Some examples:

  • (plain tex) \hskip 5pt\relax -- in the absence of \relax, the \hskip will keep looking for plus or minus

  • (latex) at the end of a line, \\ \relax [...] will prevent what is in brackets from being interpreted as a dimension that would add vertical space

(actually, this is pretty well explained by answers to this question.)


It is what's called a no-op: It does nothing, and it's used in various places where you don't want anything done, but the syntax requires something. TeX's rules also dictate that in an \if statement, an undefined macro will compare equal to \relax. So it's sort of a general-purpose nothing.

(The empty brace group {} is another kind of nothing, as the question linked to by David Carlisle illustrates).