[Tex/LaTex] Equation: How to create nested/multiple cases in LaTeX to align the qualifiers

alignamsmathcasesequations

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:

enter image description here

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.)

\begin{equation}
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
\end{equation}

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

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

Any advice would be incredibly helpful.

Best Answer

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}
\begin{equation}
  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{equation}
\end{document} 

enter image description here

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.