| Version 2 (modified by mwr, 5 years ago) |
|---|
How Do I Include Aligned Equations In a Table?
The primary problem with including aligned equations in a tabular environment is that LaTeX uses the same alignment character '&' for indicating columns in the tabular environment and for indicating the alignment location in the aligned equation environment. So the LaTeX parser has trouble telling which & characters go with which environment. One solution to this is to typeset all the aligned equations into a saved box, and then place that box in the tabular environment. This prevents the parser from seeing extraneous & characters.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\newsavebox\unistrain
\begin{lrbox}{\unistrain}
\begin{minipage}{0.3\textwidth}
\begin{align*}
\epsilon_1 &= \frac{\sigma_1}{E} \\
\epsilon_2 &= -\nu \epsilon_1 \\
\epsilon_3 &= -\nu \epsilon_1
\end{align*}
\end{minipage}
\end{lrbox}
\newsavebox\unistress
\begin{lrbox}{\unistress}
\begin{minipage}{0.3\textwidth}
\begin{align*}
\sigma_1 &= E \epsilon_1 \\
\sigma_2 &= 0 \\
\sigma_3 &= 0
\end{align*}
\end{minipage}
\end{lrbox}
\begin{table}
\label{tab:stress_strain_relations}
\caption{Elastic Stress-Strain Relations}
\begin{center}
\begin{tabular}{lcc}
Type of Stress & Principal Strains & Principal Stresses \\ \hline \hline
Uniaxial & \usebox{\unistrain} & \usebox{\unistress} \\
\end{tabular}
\end{center}
\end{table}
\end{document}
Result:
Attachments
-
align-in-tabular.png
(7.7 KB) - added by mwr
5 years ago.
-
table-with-breaks.png
(5.6 KB) - added by mwr
4 years ago.
-
siunitx-booktabs.png
(27.9 KB) - added by mwr
19 months ago.

