3

I am trying to get stacked indices using subarray/substack using the following snippet, but I am not seeing stacking beneath the sum symbol. This is the type of output I am expecting, good output

but this is what I am getting:

bad output

Here is the code:

\documentclass{report}
\usepackage{amsmath, amsfonts, amssymb}
\begin{document}
    \[
          \frac{\sum_{\begin{subarray}{l}\forall x \\
          \mathcal{D}(x)=\mathcal{D}_i\end{subarray}} \sum_{\substack{\forall
              y\in\Omega(x) \\
   \mathcal{D}(y)=\mathcal{D}_j}} 1}
    {\sum_{\forall x }\mathcal{D}(x)}
   \]
\end{document}

What should I do to get proper stacking?

Jey
  • 133
  • 1
  • 6

1 Answers1

4

You need to add the directive \displaystyle at the start of both the numerator and denominator. I would also add \, (thinspace) between the two main terms in the numerator.

enter image description here

\documentclass{report}
\usepackage{amsmath, amsfonts, amssymb}
\begin{document}
\[
   \frac{\displaystyle\sum_{\begin{subarray}{l}\forall x \\
                             \mathcal{D}(x)=\mathcal{D}_i\end{subarray}}  \, 
      \sum_{\substack{\forall y\in\Omega(x) \\ \mathcal{D}(y)=\mathcal{D}_j}} 1}
   {\displaystyle\sum_{\forall x }\mathcal{D}(x)}
\]
\end{document}

For more on this subject, you may want to consult the posting Fractions with large elements.

Mico
  • 506,678