The cases
environment works very well for enumerating cases within a large left bracket. I'd like to be able to combine it with the align
environment so that equals-signs and conditions also line up:
\item \begin{align*}
T_{in\ general}\left(n\right)&=aT\left(\frac{n}{b}\right) + n^{c},\ &a\geq1, b\geq1, c>0
\end{align*}
\[T_{cases}\left(n\right)=
\begin{cases}
\Theta\left(n^{\log_{b}a}\right) &a>b^{c}\\
\Theta\left(n^{c}\log_{b}n\right) &a=b^{c}\\
\Theta\left(n^{c}\right) &a<b^{c}
\end{cases}\]
Separate align
and case
environments do not share alignments:
Is there a reasonably simple way to get (say) the leftmost equals-signs in the two equations here to line up, and separately from them the conditions ("a…")?
Best Answer
It is fairly elementary to align both equations, as well as their variable domains, when defining your own "
cases
environment" via anarray
:Some minor alignment adjustments were made (like using additional
&
alignment specifiers), as well as\smash
ing the "cases
environment" and adding the[\jot]
line skip.\smash
removed any vertical height from it's argument, while\jot
is a specific3pt
skip provided by LaTeX.From a typesetting point of view, note the use of
\text{...}
in the subscripts. This macro is offered byamsmath
and allows text to be typeset in the regular way, while still adjusting for the relative size of the font depending on the placement.