Aligning plain `align` and `cases`?

It is fairly elementary to align both equations, as well as their variable domains, when defining your own "cases environment" via an array:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align*}
  T_{\text{in general}}\left(n\right) &= aT\left(\frac{n}{b}\right) + n^{c}, && a\geq 1, b\geq 1, c>0 \\
  & && a>b^{c} \\
  T_{\text{cases}}\left(n\right) &= 
    \smash{\left\{\begin{array}{@{}l@{}}
      \Theta\left(n^{\log_{b}a}\right) \\[\jot]
      \Theta\left(n^{c}\log_{b}n\right) \\[\jot]
      \Theta\left(n^{c}\right)
    \end{array}\right.} && a=b^{c} \\
  & && a<b^{c}
\end{align*}
​\end{document}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

Some minor alignment adjustments were made (like using additional & alignment specifiers), as well as \smashing the "cases environment" and adding the [\jot] line skip. \smash removed any vertical height from it's argument, while \jot is a specific 3pt skip provided by LaTeX.

From a typesetting point of view, note the use of \text{...} in the subscripts. This macro is offered by amsmath and allows text to be typeset in the regular way, while still adjusting for the relative size of the font depending on the placement.


With careful use of the \phantom family of commands, you can get proper alignment inside and outside of the cases (i.e., the second portion of your equation) as well:

enter image description here

This is a general solution that I often use and will work across different environment as well. We fix a size for portions of the equations, and use \makebox to set that text in the specified fixed width. You can specify this fixed width as in:

\newcommand{\FixedSize}[1]{\makebox[1.5in][l]{\ensuremath{#1}}}%

This allows you to easily adjust this width to get the display that you want for the appropriate portions of the equation.

A better solution is to automatically compute the required width using the calc package's \widthof command. For this we select what is the widest portion that we need to be able to accomodate and then compute the width of that. You can do this all in one line, but for readability I have defined \WidestPart separately, and used it to compute the width.

One slight complication in this specific situation is the left brace from the cases. To adjust for this I defined \PhantomBrace which produces a horizontal space equivalent to the width of the brace used for a three line cases, and include that in the adjustment of the first equation.

I added a \quad to separate these two portions but any value can be used here.

\documentclass{article}
\usepackage{calc}
\usepackage{amsmath}

\newcommand{\WidestPart}{\ensuremath{aT\left(\frac{n}{b}\right) + n^{c},}}%
\newcommand{\FixedSize}[1]{\makebox[\widthof{\WidestPart}][l]{\ensuremath{#1}}}%
\newcommand{\PhantomBrace}{\hphantom{\left\{\vphantom{\begin{cases}\\\\\end{cases}}\right.}}%

\begin{document}
\begin{align*}
T_{in\ general}\left(n\right)&=\FixedSize{aT\left(\frac{n}{b}\right) + n^{c},}\PhantomBrace\qquad a\geq1, b\geq1, c>0\\
T_{cases}\left(n\right) &= 
   \begin{cases}
   \FixedSize{\Theta\left(n^{\log_{b}a}\right)}  \qquad a>b^{c}\\
   \FixedSize{\Theta\left(n^{c}\log_{b}n\right)} \qquad a=b^{c}\\
   \FixedSize{\Theta\left(n^{c}\right)}          \qquad a<b^{c}
   \end{cases}
 \end{align*}
\end{document}

You can combine the two equations into one single align environment, i.e. nest the cases inside the align environment:

\begin{align*}
T_{in\ general}\left(n\right)&=aT\left(\frac{n}{b}\right) + n^{c},\ &a\geq1, b\geq1, c>0\\
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}
\end{align*}

and the result will be:

enter image description here

EDIT: If you remove the & in the first equation before a\geq1, b\geq1, c>0\\ and replace it with \hspace{0.4cm} you should get the desired result of having the conditions also lined up properly. If you have different quations, obviously you will have to modify the amount of horizontal space.

I guess the explanation why you need this workaround is that the ampersads inside the case environment go out of scope when you return to the align environment proper and will not interact with those contained in the latter.