I am trying to use an align
environment inside a tabular
environment. Whenever I use an &
character inside the align
environment, there seems to be a conflict, i.e., the following works
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\begin{document}
\begin{table}
\begin{tabular}{|m{0.3\textwidth}|m{0.7\textwidth}|}
\hline
\textbf{Compact form} & \textbf{Expanded form} \\
\hline
\begin{equation*}y=\left(x+a\right)^6\end{equation*}
& \begin{align} y =x^6+6x^5a+15x^4a^2+20x^3a^3+15x^2a^4 \nonumber\\ +6xa^5+a^6 \end{align} \\
\hline
\end{tabular}
\end{table}
\end{document}
but the following does not work (note the &
characters inside align
)
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\begin{document}
\begin{table}
\begin{tabular}{|m{0.3\textwidth}|m{0.7\textwidth}|}
\hline
\textbf{Compact form} & \textbf{Expanded form} \\
\hline
\begin{equation*}y=\left(x+a\right)^6\end{equation*}
& \begin{align} y & =x^6+6x^5a+15x^4a^2+20x^3a^3+15x^2a^4 \nonumber\\ & +6xa^5+a^6 \end{align} \\
\hline
\end{tabular}
\end{table}
\end{document}
TeXStudio gives me the following error: ! Forbidden control sequence found while scanning use of \align.
My goal is to obtain something like this
Is there any way to fix this, e.g. by setting an ampersand replacement for align
to avoid the conflict?
Best Answer
Group the
align
with braces{...}
.