1

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}

table with misaligned equation

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 table with aligned equation

Is there any way to fix this, e.g. by setting an ampersand replacement for align to avoid the conflict?

5

Group the align with braces {...}.

\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.