# Equation: How to create nested/multiple cases in LaTeX to align the qualifiers

I am having trouble with a particular equation as the cases are nested within a case. It would also be cool if I could align the qualifiers.

I tried to post an image of the equation but I could not because I do not have a reputation score of 10. I have attached a link to the paper below ... equation 28 is the one I am having trouble with from this http://csr.sdsu.edu/wp-content/uploads/2013/02/Waves-as-a-Common-Pool-Resource.pdf:

Here is an example of what I have been using. I have tried a few variants {\text{} instead of \mbox{}, \dcases instead of \cases, etc.)

$$S_{i,t}=\begin{cases} \begin{cases} [x_{i,t}=X^*, r_{i,t}=1] & \mbox{if } \max\{X_{i,t}\}=X^* \\ [x_{i,t}=\max\{X_{i,t}\}, r_{i,t}=0] & \mbox{if } \max\{X_{i,t}\} \neq X^* \end{cases} \text{if } \sum_{i=1}^I u_{i,t-1}= \theta^{t-2} X^* \begin{cases} [x_{i,t}= 1, r_{i,t}=1] & text{if } \min \{X_{i,t}\}=1 \\ [x_{i,t} = \min \{X_{i,t}\}, r_{i,t}=0] & \text{if } \min \{X_{i,t}\} \neq 1 \end{cases} otherwise$$


I have tried several different ways but I always get an error message ...

"overfull \hbox (14.0154pt too wide) in alignment at line ..."


• Welcome to TeX.SX. That is just a warning, not an error, and it means that something sticks a little bit into the right margin. Would be nice if you added the code of what you've attempted (a minimal working example (MWE)). – Torbjørn T. Aug 13 '13 at 17:36
• Nested alignment of cases is covered in How to align nested cases? – Werner Aug 13 '13 at 17:43
• not any answer, but it's more accepted practice to have "if" and "otherwise" as ordinary (usually roman) text; since you're using amsmath, you can just designate them as \text{...}. even better if you use \text{if $...$} for the whole condition. also, \max to match \min. – barbara beeton Aug 13 '13 at 18:07

If you want a result really good-looking, adopt this way:

\documentclass{article}
\usepackage{amsmath}
\usepackage{calc}
\newlength{\maxmin}
\setlength{\maxmin}{\widthof{$\max$}-\widthof{$\min$}}

\begin{document}
$$S_{i,t}= \begin{cases} \begin{cases} [x_{i,t}=X^*, r_{i,t}=1] & \text{if \max\{X_{i,t}\}=X^*} \\ [x_{i,t}=\max\{X_{i,t}\}, r_{i,t}=0] & \text{if \max\{X_{i,t}\} \neq X^*} \end{cases} &\text{if \sum_{i=1}^I u_{i,t-1}= \theta^{t-2} X^*}\\ \begin{cases} [x_{i,t}=1, r_{i,t}=1] & \hspace{\maxmin} \text{if \min\{X_{i,t}\}=1} \\ [x_{i,t}=\min\{X_{i,t}\}, r_{i,t}=0] & \hspace{\maxmin} \text{if \min\{X_{i,t}\} \neq 1} \end{cases} &\text{otherwise} \end{cases}$$
\end{document}


You can notice the perfect alignment of ifs. This has been obtained (thanks to the package calc) calculating the difference of spacing between \max and \min and adding the corresponding difference in the second cases environment.

I think you are just missing the \\and & of the outer case.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$$S_{i,t}= \begin{cases} \begin{cases} [x_{i,t}=X^*, r_{i,t}=1] & \text{if \max\{X_{i,t}\}=X^*} \\ [x_{i,t}=\max\{X_{i,t}\}, r_{i,t}=0] & \text{if \max\{X_{i,t}\} \neq X^*} \end{cases} &\text{if \sum_{i=1}^I u_{i,t-1}= \theta^{t-2} X^*}\\ \begin{cases} [x_{i,t}= 1, r_{i,t}=1] & \text{if \min \{X_{i,t}\}=1} \\ [x_{i,t} = \min \{X_{i,t}\}, r_{i,t}=0] & \text{if  \min \{X_{i,t}\} \neq 1} \end{cases} &\text{otherwise} \end{cases}$$
\end{document}
`
• The code provided by papabravo worked perfect. Thank you so much – Erick P Aug 13 '13 at 20:54