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.
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.
\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.
latexdef! I've been using TeX for years and this is a great new find for me.
– wchargin
Jul 31 '18 at 05:33
\show used in interactive mode when one hits an "unknown" error, but not about latexdef.
– murray
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?
– murray
Jul 31 '18 at 14:03
\toand\mapstofall into. – murray Jul 31 '18 at 14:57