# Double superscript and \bar

it's several groups that I think of a solution for this little problem, but I can't find the optimal solution.

I did several tests, using some combinations, but without getting a good result.

 \documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{mwe}

%%---------------------Riduzione apici e pedici--------------------------------------
\usepackage{lmodern}
\makeatletter
\DeclareMathSizes{\@xpt}{\@xpt}{5}{4}
\DeclareMathSizes{\@xipt}{\@xipt}{6}{5}
\DeclareMathSizes{\@xiipt}{\@xiipt}{6}{5}
\DeclareMathSizes{\@xivpt}{\@xivpt}{\@xpt}{6}
\makeatother

\begin{document}
\begin{enumerate}
\item $\bar{e}_{ij}'$
\item $\bar{e}^{'2}_{ij}$
\item $\bar{e'}^{2}_{\!\!ij}$
\item $\bar{e}_{\!\!ij}^{'2}$
\end{enumerate}

\end{document}


I would like to get a combination of 1 and 3, which is similar to the one in the box.

Could you give any suggestions on this?

Thanks

\documentclass{article}
\begin{document}
$\bar e_{ij}'^2$
\end{document}


Incidentally, this is the same output as $\bar e_{ij}^{\prime2}$. So you see, there is no double superscript, and TeX can figure that out if the ' (which is a superscripted \prime) is given immediately prior to the rest of the superscript.

• thanks, the right combination was missing. but why \bar and not \bar{}? – Antonio Apr 11 at 18:25
• @Antonio In this case, there is no difference between the two. However, in some cases, braces can prevent math information from being properly transferred to surrounding material. For example, compare $a - b$ to $a {-b}$, in terms of spacing. In this case, the braces prevent the minus sign from knowing about the preceding a and therefore causing it to act as a negative rather than a minus. – Steven B. Segletes Apr 11 at 18:43
• \bar{e} has no problem and is better than \bar e, particularly when sub/superscripts follow. By the way, {\bar{e}} would do the same. – egreg Apr 11 at 20:06
• @Antonio Listen to egreg, not me. He has chimed in on this train. – Steven B. Segletes Apr 11 at 20:17
• @StevenB.Segletes thanks. these details are important. there is always something to learn. latex is a world and you are a fundamental resource for us inexperienced – Antonio Apr 12 at 10:00