# Correct placement of sum limits

this is maybe some captious question like the correct placement of := but I always notice the unattractive placement of the limits between two sums.

Lower limit example (The same holds for the upper limit as well.):

\sum_{j=1}^m \sum_{\langle i,j \rangle}


I know its due to the different shapes but is there any way to adapt that?

Thanks a lot in advance!

-

You can use a \mathstrut to give the both subscripts the same height and depth:

\documentclass{article}

\begin{document}

\begin{displaymath}
\sum_{\mathstrut j=1}^m \sum_{\mathstrut \langle i,j \rangle}
\end{displaymath}

\end{document}


A \strut is a vertical rule of zero width, so invisible, defined by latex each time a font is set, however these don't change with different parts of mathematics expressions such as subscritps. In mathmode the latex kernel defines

\def\mathstrut{\vphantom(}


which produces a vertical rule of the same height and depth as a bracket in the current math style, but again with zero width. Thus adding \mathstrut to an expression will guarantee that it has height and depth at least that of the bracket (. If your expressions have greater height, then it would be more appropriate to use \vphantom{...} with the ... a copy of the expression with most height.

-
Could you please add some information what \mathstrut does and where it get its size from? A static height or relative to something? Thanks. –  LaRiFaRi Jul 8 at 13:07
This answer gives more information about \mathstrut. It says it is equivalent to \vphantom( –  TonioElGringo Jul 8 at 13:13
Ok, thanks for the info, you two. But in this case, the second \mathstrut would be redundant if $($ and $\langle$ are of same height (they are) or disabling the "optimal" inter space if they aren't. No offence, your solution works perfectly. Just heard of that macro the first time... –  LaRiFaRi Jul 8 at 13:32
@LaRiFaRi Yes, the \langle is about the same height and depth, and so the \mathstrut is not necessary on that term. However, adding it uniformly to both terms, produces a solution that will work with different content. –  Andrew Swann Jul 8 at 13:37
A blessing for the eyes! Thanks a lot! :-) –  smoneck Jul 8 at 16:35

It seems like LaTeX tries to keep a minimum distance between the summation symbol and the top of the lower limit symbol. Therefore you should correct the left side, as the right side is using bigger symbols in the limit. I just took the vertical size of the right side and added it to the left side.

% arara: pdflatex

\documentclass{article}

\begin{document}
$\sum_{j=1\vphantom{\langle}}^m \sum_{\langle i,j \rangle}$
\end{document}


-