[Tex/LaTex] align inside of tabular

aligntables

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?

Best Answer

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

enter image description here