Possible Duplicate:
Separate long math text under sum symbol into different lines?

I'm trying to produce a product which has two subindices. Like this:

\[ \phi_n(X)=\prod_{z\in \mu_n \\ z \textup{primitive}} (X-z) \]

That doesn't work: the \\ is not recognized.

  • 3
    See if tex.stackexchange.com/questions/12344 explains what you need. Mar 27, 2011 at 17:15
  • Wonderful, that's exactly what I needed. I guess I didn't search using the correct terms. Thanks! Mar 27, 2011 at 17:18
  • If the above linked question solved your problem this question should be closed as duplicate. I can do that if you don't mind. Mar 27, 2011 at 17:58

1 Answer 1


The line break \\ doesn't work inside math like that. You can use e.g. \shortstack to stack the indices:


\[ \phi_n(X)=\prod_{\shortstack{$\scriptstyle z\in \mu_n $\\$\scriptstyle z \textup{primitive}$}} (X-z) \]

  • 1
    What's the difference between this and \prod_{\substack{z\in \mu_n \\ z \textup{ primitive}}} (X-z) ? Mar 27, 2011 at 17:23
  • 1
    @Bruno: I didn't now \substack before. It seems to be the better solution. The \shortstack macro is however also useful in other situations (e.g. textmode) where things have to be stacked. Mar 27, 2011 at 17:25

Not the answer you're looking for? Browse other questions tagged .