26

I have formula:

\[ A_k = \bigcup_{I \subset \{ 1,...,k \} \text{card} J = K} B_j\]

which generates

formula

I would like ask how to make the new line inside subscript. It should look like formula below:

correct formula

I've tried with \newline and \begin{align*} but it doesn't work.

MC2DX
  • 2,447

2 Answers2

36

You can use \substack

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\[ A_k = \bigcup_{\substack{I \subset \{ 1,\dots,k \}\\ \text{card} J = K}} B_j\]
\end{document}

enter image description here

If you feel that there is lot of empty space, here is how to get it out. This one uses \mathclap from mathtools.

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\[ A_k = \bigcup_{\mathclap{\substack{I \subset \{ 1,\dots,k \}\\ \text{card} J = K}}} B_j\]
\end{document}

enter image description here

Response to comment

It works inside align*:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{align*}
    A_k &= \bigcup_{\mathclap{\substack{I \subset \{ 1,\dots,k \}\\ \text{card} J = K}}} B_j\\
    A_k &= \bigcup_{\mathclap{\substack{I \subset \{ 1,\dots,k \}\\ \text{card} J = K}}} B_j
\end{align*}
\end{document}

enter image description here

David Carlisle
  • 757,742
  • Inside align* block is conflict between \ using by aling* and this which is used in substack block. How can I use substack inside align* block ? – MC2DX Aug 17 '13 at 06:30
  • @MateuszCzerwiński: It works inside align*. See the update to my answer. If it is not working for you, please post the offending complete code to your question. –  Aug 17 '13 at 09:14
  • If you are using the mathtools package, it is better to use smaahoperator rather than mathcalp – Aditya Aug 17 '13 at 15:17
5

While not as streamlined as the accepted solution, I add this solution to the mix, because it shows the 2-line subscript left justified, as was provided in your example, which the accepted solution (to this point) does not. I also made the subscript in \scriptscriptstyle, which may be preferable for a multi-line subscript. Vertical gaps between the stacked lines are adjustable.

\documentclass{article}
\usepackage{stackengine}
\usepackage{amsmath}
\parskip 1em
\begin{document}
\[ \def\useanchorwidth{T}\stackMath
  A_k = \mathop{\stackunder{\bigcup}{\def\stackalignment{l}%
    \stackunder[2pt]{\scriptscriptstyle I \subset \{ 1,...,k \}}
                    {\scriptscriptstyle\text{card} J = K}
  }} B_j\]

\[ \def\useanchorwidth{F}\stackMath
  A_k = \mathop{\stackunder{\bigcup}{\def\stackalignment{l}%
    \stackunder[2pt]{\scriptscriptstyle I \subset \{ 1,...,k \}}
                    {\scriptscriptstyle\text{card} J = K}
  }} B_j\]
\end{document}

enter image description here