[Tex/LaTex] What does \relax do?


Possible Duplicate:
What is the difference between \relax and {}?

The title suggest the question. On and off, I see macros here in TeX.SE and I see the \relax command frequently.

  1. I was wondering what it does and where/when should I used it?
  2. Are there any precautions that I should take while using it? (Are there side-effects?)

It would be great if you support your answers with a simple example.

Best Answer

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.)