0

How do I do something like this:

enter image description here

where the $p\leq x$ and $p\equiv\pmod{q}$ are on separate lines?

1
  • 1
    \substack{<line_1>\\<line_2>\\...\\<line_n>} as in \[ \sum_{\substack{p \leq x\\p \equiv a \mod q}} \] (needs \usepackage{amsmath}).
    – moewe
    Mar 6 at 17:07
4

You can try this:

\[
\sum_{\shortstack{$p\leq x$\\ $p\equiv a \mod q $ }}
\]

or

\[
\sum_{\begin{aligned} & p\leq x \\ & p\equiv a \pmod q \end{aligned}}
\]

enter image description here

1
  • 1
    The "correct" answer is \substack or subarray. Besides, $$ should never be used in LaTeX.
    – egreg
    Mar 6 at 22:30

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