# Are \to and \mapsto mathbin or mathrel?

What class of symbols are \to and \mapsto— mathbin or mathrel?

(Sorry for such a basic and naive question!)

I'm pretty sure that usage indicates they ought to be mathrel, but in some posts about redefining \to, I've seen mathbin instead.

• @Milo: Yes, I know what the difference is between mathbin and mathrel. So far as I can see, the answer you cite does not answer my question about which of the two classes \to and \mapsto fall into. Jul 31 '18 at 14:57
• Note that the "→" in "f(x) → c as x → 0" is a relation, but the "→" in "f : S→T" is a binary operation. Too bad mathematicians used the same right-arrow for both... Oct 8 '20 at 18:49

\to and \mapsto are defined by the LaTeX kernel. Their definition can be found in the file fontmath.ltx:

\DeclareMathSymbol{\rightarrow}{\mathrel}{symbols}{"21}
\let\to=\rightarrow
\DeclareMathSymbol{\mapstochar}{\mathrel}{symbols}{"37}
\def\mapsto{\mapstochar\rightarrow}


As you can see, \to is just a synonym for \rightarrow, which is defined as a \mathrel. On the other hand, \mapsto is obtained by juxtaposing two relation symbols, \mapstochar and \rightarrow; it is a low-level feature of TeX that the juxtaposition of two relation symbols acts as a single relation symbol.

Note that there is a command, named latexdef, that you can execute from the command line to find out the definition of LaTeX commands (for further details, run

latexdef -h


always from the command line). Now, running

latexdef \to


returns

\to:
\mathchar"3221

\the\to:
12833


You can see that \to is defined to be a symbol of class 3 (you have to look at the first hexadecimal digit of the math code following \mathchar), that is, a relation symbol. Had \to been a binary operator, the answer would have been

\to:
\mathchar"2221


instead. Similar remarks apply to \mapstochar.

• Wow, +1 for latexdef! I've been using TeX for years and this is a great new find for me. Jul 31 '18 at 5:33
• Extremely informative about everything. For example, I knew about \show used in interactive mode when one hits an "unknown" error, but not about latexdef. Jul 31 '18 at 13:50
• \latexdef \mapsto gives macro:->\mapstochar \rightarrow; both \rightarrow and \mapstochar are of class 3 (mathrel). What rule implies then that \mapsto in fact yields a math relation symbol? Jul 31 '18 at 14:03