7

The code

\documentclass{article}
\begin{document}
$x_\mapsto$
\end{document}

results in the following:

enter image description here

Changing x_\mapsto to x_{\mapsto} does what one would probably hope, but I wonder: is this the expected behavior?

2

1 Answer 1

10

Yes, it's the expected behavior, because, after macro expansion, the input

x_\mapsto

is the same as

x_\mapstochar\rightarrow

Has it ever worked in the past? No, at least with 8-bit engines (latex or pdflatex), because \mapsto has been equivalent to the combination \mapstochar followed by \rightarrow from day one.

A similar phenomenon happens if you try

x_\notin

only worse because it raises an error.

Doing x_1,x_2,\dots,x_n is fine (and I use it all the time), but when the subscript (or superscript) is not a single character, all bets are off. Omitting the braces around a command used for a subscript can work or not and only knowing the internal meaning of the command can tell you.

The problem with x_\mapsto or x_\notin doesn't show up if you use LuaLaTeX and unicode-math, because in this case both symbols correspond to a single character. But it's not guaranteed to work with every possible command.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.