colortbl and amsmath conflict

This is groping in the dark a bit, because I couldn't find anything significant by tracing, but then these alignment constructs are so fragile it really goes over my head.

By staring hard at the colortbl code, I cooked up the following patch. Please try the modified MWE:

\documentclass[10pt]{article}
\usepackage{amsmath}
\usepackage{colortbl}

%%%%%%%%%% HERE COMES THE PATCH %%%%%%%%%%
\usepackage{etoolbox}

\makeatletter
\pretocmd\start@align
{%
  \let\everycr\CT@everycr
  \CT@start
}{}{}
\apptocmd{\endalign}{\CT@end}{}{}
\makeatother
%%%%%%%%%% END PATCH %%%%%%%%%%

\begin{document}

  \begin{tabular}[b]{cc}
    Correct & Incorrect\\
    \parbox[b][]{0.4\linewidth}{
    \begin{align*}
      3(2x-5)^2&=3(4x^2-20x+25)\\
               &=12x^2-60x+75
    \end{align*}
    } &
        \parbox[b][]{0.5\linewidth}{
        \begin{align*}
          3(2x-5)^2&=(6x-15)^2\\
                   &=36x^2-180x+225
        \end{align*}
        }\\
\end{tabular}

\end{document}

I don't know whether this has any averse effects on the colortblness of the outer tabular though. Please test.


I am not sure what the actual source of the problem is, but one way to work around this problem is to just use aligned instead:

enter image description here

Notes:

  • As egreg pointed out, using a \parbox is no longer necessary when using the aligned environment.
  • I would not recommend using an = when things are not equal as is the case for the incorrect column. I have not made that change here as then you need to decide what to do with the following equal.

Code:

\documentclass[10pt]{article}
\usepackage{colortbl}
\usepackage{amsmath}

\begin{document}
\begin{center}
\begin{tabular}[b]{cc}
Correct & Incorrect\\
$\begin{aligned}
3(2x-5)^2&=3(4x^2-20x+25)\\
&=12x^2-60x+75
\end{aligned}$
 &
$\begin{aligned}
3(2x-5)^2&=(6x-15)^2\\
&=36x^2-180x+225
\end{aligned}$
\\
\end{tabular}
\end{center}
\end{document}