4

When I use different summation indices in a double sum the limits are not vertically aligend, for instance:

\begin{equation}
\Delta K_T^i = \sum_{t=1}^{T}\sum_{k=1}^{m}{\Delta K_t^{i,k}} = \sum_{t=1}^{T} {\Delta K_t^k}
\end{equation}

and

\begin{equation}
\Delta K_T^k =\sum_{t=1}^{T}\sum_{i = 1}^{n}{\Delta K_t^{i, k}} = \sum_{t=1}^{T}{\Delta K_t^i}
\end{equation}

The limits below the summation symbol are misaligned vertically while the superscripts seem ok. Also the misalignment is bigger in the first example than in the second one.

If I use the same letter as subscript index the alignment works as expected.

\begin{equation}
\Delta K_T^i = \sum_{t=1}^{T}\sum_{t=1}^{m}{\Delta K_t^{i,t}} 
\end{equation}

I use the following packages, could any of these be the cause, or is this a bug/feature that could be handled in any way? I am using MikTex 2.9

\documentclass[a4paper,twoside,10pt]{article}
\usepackage[swedish]{babel} 
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
mafp
  • 19,096

2 Answers2

6

Short answer: You can use \adjustlimits from the mathtools package as Stefan Kottwitz explains in this answer.


This is an interesting observation! As egreg indicates in his comment, the slight misalignment appears to be by design. There has to be some compromise between variation in the vertical position and variation in the distance between subscript and summation sign.

For the standard CM fonts, the design is such that the vertical position will usually vary no more than 0.52776pt. This is coded in the \fontdimen parameters 10 and 12 of \textfont3: \fontdimen10 is 1.66666pt by default and gives the minimum distance between subscript and summation sign, \fontdimen12 is 6pt by default and gives the minimum distance between the baseline of the subscript and the summation sign. Thus, subscripts with a height of less than 4.33334pt (coming from 6-1.66666) are perfectly aligned, but the k is 4.8611pt high, which is 0.52776pt more.

To obtain perfect alignment also for higher subscripts like k, you can modify the \fontdimen parameters. The price you pay is of course that the distance between subscript and summation sign will vary more. Here's a suggestion that's just enough for the usual letters:

\documentclass{article}
\makeatletter
\AtBeginDocument{%
  \check@mathfonts
  \fontdimen10\textfont3=1.4pt
  \fontdimen12\textfont3=6.2611pt
  }
\makeatother
\begin{document}
\begin{equation}
\Delta K_T^i = \sum_{t=1}^{T}\sum_{k=1}^{m}{\Delta K_t^{i,k}} = \sum_{t=1}^{T} {\Delta K_t^k}
\end{equation}
\end{document}
Hendrik Vogt
  • 37,935
4

The reason is the different height of the subscripts, t is smaller than k. One way to fix this (not beautiful, I know) is to put an invisible k below the first sum via \vphantom:

\begin{equation}
\Delta K_T^i = \sum_{\vphantom{k}t=1}^{T}\sum_{k=1}^{m}{\Delta K_t^{i,k}} = \sum_{t=1}^{T} {\Delta K_t^k}
\end{equation}
mafp
  • 19,096