[Tex/LaTex] What does “rel” in `\mathrel` and `\stackrel` stands for

math-modemath-operators

Most latex tags have straightforward meanings, for instance,

\sqrt stands for/comes from "square root"

\equiv stands for/comes from "equivalent to"

What does "rel" in \mathrel and \stackrel stands for?

Best Answer

You asked,

What does rel in \mathrel and \stackrel stand for?

The meaning of rel in mathrel quickly becomes fairly obvious if one considers the entire list of 13 types of math atoms; see also p. 158 of the TeXbook:

mathord, 'ord' for short -- something like 'x' and 'y'
mathop, 'op' for short -- large operators, e.g., '\sum' and '\prod'
bin   -- binary operation atoms, e.g., '+' and '-'
rel   -- relation operation atoms, e.g, '=', '<', and '>'
open  -- opening atom, e.g,, '(' and '['
close -- closing atom, e.g., ')' and ']'
punct -- punctuation atom, e.g., ','
inner -- (leading example: anything between '\left' and '\right')
over  -- overline atom, as in '\overline{x}'
under -- underline atome, as in '\underline{x}'
acc   -- accent atoms, as in '\hat{x}' and '\tilde{x}'
rad   -- radical atom, as in '\sqrt{x}'
vcent -- (argument of \vcenter directives)

One area where the status of the math atoms matters is in the spacing around binary and relational operators. E.g., if you examine the typeset output of a+b and a=b, you'll notice that the spacing around the + and = symbols is not the same; the space around the latter symbol is slightly greater (unless the symbols are encountered in scriptstyle or scriptscriptstyle mode). This difference in spacing embodies typographic rules developed over decades (centuries?) of fine math typesetting.


The \mathrel directive, which is a "TeX primitive" command, serves to change the math status of its argument to, you guessed it, mathrel. For example, writing \mathrel+ changes the math status of + from bin (which is the default in most (all?) TeX systems) to rel. Aside: This is just an example; I am not suggesting that anyone would actually want to run this instruction. A more realistic example: Suppose that you want to denote the open interval from -a to b with ]-a,b[. Writing the open interval directly in this way would, however, cause incorrect spacing between ] (remember that its default math status is close) and the - symbol. To get the correct spacing between ] and the unary - symbol, you could write

\mathopen] -a,b \mathclose[

thereby overriding the default math status of the [ and ] symbols. Better still, load the mathtools package and use its \DeclarePairedDelimiter macro to define a macro called, say, \openint with variable-sized delimiters as follows:

\DeclarePairedDelimiter{\openint}{]}{[}

This setup would allow you to write \openint{-a,b} in the body of the document.


Then there is \stackrel macro: It's a LaTeX command that allows placing superscript terms above some object (often, but not necessarily, an = symbol), making the math status of the combined object mathrel; e.g,, \stackrel{!}{=} places ! above =, and the status of the combined object is mathrel. There is also a package called stackrel, which extends the functionality of \stackrel in two ways. First, it allows placing subscript terms below a main object, while setting the status of the combined object to mathrel. E.g.,

B \stackrel[x]{!}{=} C

places x below and ! above the = symbol, and the math status of the combined object is set to mathrel. Second, it provides an additional macro called \stackbin, which allows placing subscript and superscript terms alongside a main object and setting the math status of the combined object to mathbin.

Related Question