6

This question already has an answer here:

I'm new to LaTeX. I'm trying to create a table where one of the cells contains aligned equations.

The naive approach of nesting an align environment inside the table environment does not work:

\begin{tabular}{l r}
A & B\\
\begin{align}
x &= y+1\\
x &= (y+1) (y-1)
\end{align}
\end{tabular}

This gives the error 'Argument of \align has an extra }.'

I must admit I have no idea what that error message means... Why is it not possible to nest align and table environments? How do I put aligned equations in a table?

Thanks!

marked as duplicate by Werner, Christoph, Peter Jansson, Guido, barbara beeton Mar 3 '14 at 21:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from stackoverflow.com Mar 3 '14 at 20:13

This question came from our site for professional and enthusiast programmers.

11

As you've discovered, you can't use an align (or align*) environment inside a tabular environment, unless you go to some lengths to "hide" the align environment.

A simple remedy is available: Use an aligned environment. Optionally, use a [t] or [b] placement specifier to specify if you want top- or bottom-alignment. If you don't provide a placement indicator, any adjacent material will be centered vertically relative to the material in the aligned environment.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{tabular}{lr}
A & B\\
\hline
$\begin{aligned}[t] % placement: default is "center", options are "top" and "bottom"
x &= y+1\\
x &= (y+1) (y-1)
\end{aligned}$ & abc xyz\\
\end{tabular}
\end{document}
  • +1 for option [t]. – IgotiT Jul 12 '17 at 6:40

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