Similarly, is there any difference between \rightarrow and \to?
From what I could see, they are just aliases.
Asked
Active
Viewed 8,722 times
1 Answers
15
fontmath.ltx (generated by fontdef.dtx) defines
\DeclareMathSymbol{\leftarrow}{\mathrel}{symbols}{"20}
\let\gets=\leftarrow
\DeclareMathSymbol{\rightarrow}{\mathrel}{symbols}{"21}
\let\to=\rightarrow
so they print exactly the same glyph in the LaTeX format.
EDIT As clemens points out, there is a semantic difference. I use \to and \gets when dealing with functions, like in
$f\colon A \to B$
On the other hand, if I had to define some symbol containing an arrow to the right, I would never use \to but rather \rightarrow.
campa
- 31,130
-
1Maybe worth mentioning that the difference is semantics: one name describes the symbol the other the function – cgnieder Dec 14 '15 at 14:59
-
Yes. You can also see that with the
\showcommand. See http://tex.stackexchange.com/questions/11907/how-do-i-use-show – Denis Dec 14 '15 at 15:01 -
@clemens Good point, thanks. Feel free to edit if you've got a better explanation. – campa Dec 14 '15 at 15:08
-
Thanks. Just to give some context: the purpose is to write a script that would convert
\to/\gets/\leftarrow/\writearrowinto the appropriate Unicode characater – Yossi Gil Dec 14 '15 at 15:23 -
4I wish
\toand\getswere documented in the LaTeX manual. I started using plain TeX and then AMSTeX, where the commands are documented. The first versions of LaTeX loaded a slightly modifiedplain.texfile, so it was quite easy to port plain TeX files. In particular it kept\toand\gets, which never found their way in the manual. – egreg Dec 14 '15 at 16:15 -
1The term "plain LaTeX format" is a bit confusing, as there is the "Plain TeX format". (The latter is described in great detail in the TeXbook.) Better to omit the modifier "plain" when referring to LaTeX. Thus, do write "in the basic LaTeX format" or, if you want to be more specific, "in the file
fontmath.ltx" -- as you have, in fact, done already in your answer. – Mico Dec 14 '15 at 21:52 -
@Mico Thanks; fixed that. It did sound a wee bit strange: what I meant is that I'm not sure whether some package may mess with that. – campa Dec 15 '15 at 07:45