TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to typeset the formula below in a way that m_j=m_i and z_j=z_i have the same scriptsize, the = are aligned, and j: is before both, larger and with vertical position between the lines. How can this be done?




share|improve this question
up vote 4 down vote accepted

You may also want to consider using the subarray environment provided by the amsmath package.

In the MWE below, the first equation uses this environment to typeset the "inner" formula of your example. The second equation, which places this inner formula into the full expression, looks cramped because, by TeX's rules, the contents of the inner formula are all set in scriptscriptstyle/scriptstyle. At the same time, the parentheses that surround the numerator are over-sized because they use \left and \right directives. Relative to the second equation, the third equation uses (i) the \dfrac command to restore the overall look of the inner formula, (ii) a pair of \bigl( and \bigr) parentheses to help distinguish visually among the plethora of parentheses, (iii) a pair of \Biggl( and \Biggr) directives to surround the numerator, and (iv) the \mathlarger command (which is provided by the relsize package) to increase the size of the outer summation sign.

           m_j=m_i \\ z_j=z_i
    f(m(j),z(j),s(j)) \\
y = \sum_i \frac{\left( 1-\frac{1}{
            m_j=m_i \\ z_j=z_i
y = \mathlarger{\sum}_i \frac{\Biggl( 1-\dfrac{1}{
    \sum\nolimits_{j: \,
            m_j=m_i \\ z_j=z_i

enter image description here

share|improve this answer
I like in @egreg's response that the conditions are smaller than the j, but the larger sum sign is definitively a good idea. – Markus Schmassmann May 3 '12 at 14:58
To get the conditions typeset smaller than the letter j, just replace the line m_j=m_i \\ z_j=z_i with \scriptscriptstyle m_j=m_i \\ \scriptscriptstyle z_j=z_i (i.e., precede each condition with its own \scriptscriptstyle directive). – Mico May 3 '12 at 15:29

This is possible also with standard LaTeX methods, but in this case a direct approach with TeX primitives is handier


      \mathstrut m_j&=m_i\cr\noalign{\kern1pt}



Notice the use of \dfrac and of \biggl and \biggr rather than \left and \right that would unbalance the parentheses, because the denominator is much taller than the numerator. enter image description here

share|improve this answer
Why m^{}_j instead of just m_j? – Markus Schmassmann May 3 '12 at 12:33
@MarkusSchmassmann It's a remain of a previous attempt. The \mathstrut in the first line is better for getting the j: in the middle, as it compensates for the subscript j at the bottom. – egreg May 3 '12 at 12:34
@MarkusSchmassmann Sorry, but I don't think that a larger summation symbol is a good idea. – egreg May 5 '12 at 12:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.