[Tex/LaTex] Weird relative positioning of superscript and subscript with \dot, \bar

math-modesubscriptssuperscripts

Minimal working example:

\documentclass[12pt]{article}
\usepackage{amsmath}

\begin{document}

\[ {A^\mu}_\nu \]
\[ {\bar{A}^\mu}_\nu \]

\end{document}

The result isenter image description here.

Why is the placement of upper and lower indices in the second one wrong?

Best Answer

From the TeXbook, p. 290:

A <math field> is used to specify the nucleus, superscript, or subscript of an atom. When a <math field> is a <math symbol>, the f and a numbers of that symbol go into the atomic field. Otherwise the <math field> begins with a {, which causes TeX to enter a new level of grouping and to begin a new math list; the ensuing <math mode material> is terminated by a }, at which point the group ends and the resulting math list goes into the atomic field. If the math list turns out to be simply a single Ord atom without subscripts or superscripts, or an Acc whose nucleus is an Ord, the enclosing braces are effectively removed.

So in the first example

\[ {A^\mu}_\nu \]

the <math field> is A^\mu which has a superscript, so the braces are not removed. In the second example,

\[ {\bar{A}^\mu}_\nu \]

we are in the other situation, because \bar{A} is an Acc atom. So the braces are removed and ineffective.

Why did Knuth choose to do this? I don't really know, but the main reason could be the connected to making double accents. In a case such as

\bar{\bar{A}^\mu}

one would like to put the second bar over \bar{A}, rather than over the whole subformulas. Actually the Plain TeX macros don't easily allow for making double math accents, problem which is solved by amsmath.