# How do I put align elements into fixed columns?

I want an "align" equation in one column and a text table in the other column. In LaTeX, it seems that "tables" and "columns" are separate but overlapping mechanisms.

In LaTeX, "columns" seem to be things that auto-flow. I want columns where I manually specify what goes in each column. I guess this is done with "tables" and table columns? However, inside of a table I can't use many constructs such as  or align elements. Is there any solution to this?

\begin{longtable}{|c|c|}
\hline
\begin{align*}
y = b + \sum\limits_i x_i w_i
\end{align*}
&
\begin{tabular}{ll}
a & b \\
a & b \\
\end{tabular} \\
\hline
\end{longtable}

• You need p{<length>} column and also an extra pair of braces around the align* to hide the alignment &s – Gonzalo Medina Jul 17 '15 at 17:04
• Something like this \documentclass{article} \usepackage{longtable} \usepackage{amsmath} \usepackage{array} \begin{document} \begin{longtable}{|m{.4\linewidth}|c|} \hline {\begin{align*} y &= b + \sum_i x_i w_i \\ &=c \end{align*}} & \begin{tabular}[c]{ll} a & b \\ a & b \\ \end{tabular} \\ \hline \end{longtable} \end{document} – Gonzalo Medina Jul 17 '15 at 17:06

## 1 Answer

to typsete an align or a displayed equation using $...$ inside a column, you need a paragraph type column; either p{<length>} or m{<length>} (the latter provided by array package).

However, in your example case, I'd suggest you to use aligned instead of align* and to suppress the vertical rules and use the features provided by the booktabs package.

Three versions of your table: the first one, without major modifications (except for the use of aligned); the second one, introducing some more "air" bettern horizontal rules and content through \arraystretch, and the third one, using booktabs and no vertical rules.

The code:

\documentclass[12pt]{report}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{array}
\usepackage{booktabs}

\begin{document}

\begin{longtable}{|>{$}c<{$}|c|}
\hline
\begin{aligned}
y &= b + \sum\limits_i x_i w_i \\
&= c.
\end{aligned}
&
\begin{tabular}{ll}
a & b \\
a & b \\
\end{tabular} \\
\hline
\end{longtable}

{
\renewcommand\arraystretch{1.7}
\begin{longtable}{|>{$}c<{$}|c|}
\hline
\begin{aligned}
y &= b + \sum\limits_i x_i w_i \\
&= c.
\end{aligned}
&
\begin{tabular}{ll}
a & b \\
a & b \\
\end{tabular} \\
\hline
\end{longtable}
}

\begin{longtable}{>{$}c<{$} c}
\toprule
\begin{aligned}
y &= b + \sum\limits_i x_i w_i \\
&= c.
\end{aligned}
&
\begin{tabular}{ll}
a & b \\
a & b \\
\end{tabular} \\
\bottomrule
\end{longtable}

\end{document}


Perhaps, depending on your actual intent, it would also be a good idea to suppress the padding at the beginning and ending of the inner tabular:

\begin{tabular}{@{}ll@{}}
a & b \\
a & b \\
\end{tabular}