align inside of tabular

Today I failed using an align-environment inside of a tabular-environment.

Consider the following example:

\documentclass[12pt]{scrbook}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}

\begin{document}

\begin{tabular}{ll}
A & B \\%
& %
\begin{align}
A &= B \\
C &= D
\end{align}%
\\%
\end{tabular}%

\end{document}


When I try this I'll get an error claiming: "Argument of \align has an extra }." and "Paragraph ended before \align was complete." and much more.

When I enclose everything in paraphrases (like {\begin{align}.....\end{align}}) I'll get some other errors: "Missing \endgroup inserted." and multiple "Missing } inserted."

How can I use the align-environment properly inside of a table?

• It should look like: A | B \\ (blank) | (equation) \\ – MrD Jun 27 '13 at 16:30
• You should use the aligned environment here. – Qrrbrbirlbel Jun 27 '13 at 16:32

When I enclose everything in paraphrases (like {\begin{align}.....\end{align}}) I'll get some other errors: "Missing \endgroup inserted." and multiple "Missing } inserted."

It works alright in the following examples.

Code

\documentclass[12pt,parskip=full]{scrbook}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage[pass,showframe]{geometry}
\begin{document}
\begin{tabular}{l|l|}
A & B \\
& {\!\begin{aligned} % http://tex.stackexchange.com/q/98482/16595 A &= B \\ % http://tex.stackexchange.com/q/78788/16595 C &= D \end{aligned}}
\end{tabular}

\hrulefill

\begin{tabular}{l|p{5cm}|}
A & B \\
& {\begin{align}
A &= B \\
C &= D \end{align}}
\end{tabular}

\hrulefill

\begin{tabularx}{\linewidth}{l|X|}
A & B \\
& {\begin{align}
A &= B \\
C &= D \end{align}}
\end{tabularx}
\end{document}


Output

• This is working, but I get no tags (the equations are not numbered). – MrD Jun 27 '13 at 17:36
• @DL6ER The align environment does need a line width (it stretches). So you’ll want to use a p column or something with the X column of tabularx. – Qrrbrbirlbel Jun 27 '13 at 17:58
• So what was the solution here? Just to use tabularx instead of tabular? – David Doria Jun 30 '14 at 11:46
• @H.R. Someone ate my backslashes. It should work now. – Qrrbrbirlbel Mar 7 '17 at 23:55

An alternative to tabular is cals tables:

\documentclass[12pt]{scrbook}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{cals}
\begin{document}

\begin{calstable}
\colwidths{{10mm}{40mm}}
\brow
\cell{A}
\cell{B}
\erow
\brow
\cell{}
\cell{
\begin{align}
A &= B \\
C &= D
\end{align}%
}
\erow
\end{calstable}
\end{document}