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.

  • 6
    Short answer: it does nothing, but is not expandable.
    – egreg
    Commented Feb 2, 2013 at 18:59
  • 1
    It's often used after some "fragile" commands and in \if constructions.
    – Eddy_Em
    Commented Feb 2, 2013 at 19:01
  • 3
    What you often see on this site, is to make TeX stop collecting for an argument of specific type (very very roughly speaking). Suppose your macro is looking for some number in the argument \mymacro12345\relax 678 would make it stop at five and then do whatever else it's supposed to do. There are many more usecases but that's pretty much the main reason of its appearance in the answers here.
    – percusse
    Commented Feb 2, 2013 at 19:05
  • 3
    see tex.stackexchange.com/questions/86385/… Commented Feb 2, 2013 at 19:08
  • 1
    It is probably the same as -- for command line options in most Unix shell tools.
    – ceving
    Commented Nov 21, 2020 at 11:44

2 Answers 2


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

Not the answer you're looking for? Browse other questions tagged .