2

The following code

 \documentclass{article}
 \usepackage{amsmath}
 \begin{document}
 \begin{align*}
 a=&
   \begin{cases}
   b,&\ \text{if}\ c\,;\\
   d,&\ \text{if}\ e\,;\\
   f,&\ \text{otherwise}\,.
   \end{cases}\\[3mm]
 g=&
   \begin{cases}
   h,&\ \text{if}\ i\,;\\
   j,&\ \text{if}\ k\,;\\
   l,&\ \text{otherwise}\,,
   \end{cases}
 \end{align*}
 \end{document}

yields

output with braces but not completely aligned

What I really want is to align the clauses of the two sets of cases as well, that is, I want something like this, including the two left braces (which, of course, are missing; otherwise I wouldn't be asking):

desired output, except for the lacking braces

By the way, the code for the "aligned but without braces" example above is the following:

 \documentclass{article}
 \usepackage{amsmath}
 \begin{document}
 \begin{equation*}
 \begin{aligned}
   &\ \ bbbb,\ & &\text{if}\ c\,;\\
 a=&\ \ dd,\ & &\text{if}\ e\,;\\
   &\ \ fffff,\ & &\text{otherwise}\,.\\[3mm]
   &\ \ h,\ & &\text{if}\ i\,;\\
 g=&\ \ jjjjjjjjj,\ & &\text{if}\ k\,;\\
   &\ \ l,\ & &\text{otherwise}\,,
 \end{aligned}
 \end{equation*}
 \end{document}

I tried to introduce \left\{ (resp. \right) at the most natural places, namely, right before "bbbb" and "h" (resp. right after the two instances of "otherwise."), without success.

3

If you know the longest entry, a solution may be as follows:

\documentclass{article}
 \usepackage{amsmath}
 \begin{document}


 \newlength{\myjjj}
 \begin{equation*}
  \settowidth{\myjjj}{$jjjjjjjjj,$} %longest entry
 \begin{aligned}
 &
 a=\begin{cases}
 \makebox[\myjjj][l]{$bbbb,$}\ &\text{if}\ c\,;\\
 dd,\ &\text{if}\ e\,;\\
 fffff,\ &\text{otherwise}\,.\\[3mm]
 \end{cases}\\
 &g=\begin{cases}
    h,\  &\text{if}\ i\,;\\
 jjjjjjjjj,\  &\text{if}\ k\,;\\
 l,\ & \text{otherwise}\,,
\end{cases}
\end{aligned}
 \end{equation*}
 \end{document}

enter image description here

  • 1
    Btw mathtools have a mathmakebox, then you do not need to wrap the contents in dollars – daleif May 23 '16 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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