# how to insert multi line equation in the tabular environment?

How can insert multi line equation in the tabular environment?

For example see the following code that can show my request.

\begin{tabular}{rrr}
&a &b\\
&u=\begin{cases}  0;& i=0\\ 1;& i \neq 0  \end{cases} $e\\ &c &d \end{tabular}  Should I use another environment instead of the tabular? @Grundlingh: In fact, I'm trying to use the following code: \begin{tabular}{lll} &(A)$\ds u=\sqrt{x^2+y^2}$~~~~~~~~~~~~~~~~&(B)$\ds u=\sqrt{x^4+y^4}$\\ &(C)$\ds u=\sqrt[3]{xy}$&(D)$\ds u=\sqrt[3]{x^2+y^2}$\\ &(E)$\ds u=\sqrt[3]{x^4+y^4}$&(F) u=\begin{cases}e^{\frac{-1}{x^2+y^2}}; &x^2+y^2\neq 0\\ 0; &x^2+y^2=0\end{cases}\\ &(G)$\ds u=\sqrt[3]{x}\sin y$&(H)$\ds u=\sqrt[3]{y}\tan x$\\ \end{tabular}  - Instead of using tabular, you could use array. Regardless, it is not 100% clear from your example code what you're aiming for. – Werner Jul 25 '11 at 20:03 I don't understand the first empty column; delete all starting & characters and use \begin{tabular}{l@\hspace{5em}l} which spares you from inserting all those ~'s. You are also missing two $ characters in the cell containing the cases environment. – egreg Jul 25 '11 at 22:20

\documentclass{article}
\usepackage{amsmath,varwidth,array,ragged2e}
\newcolumntype{L}{>{\varwidth[c]{\linewidth}}l<{\endvarwidth}}
\newcolumntype{M}{>{$}l<{$}}
\def\ds{\mathrm{d}s}%  don't know what your \ds should be ....
\begin{document}

\def\arraystretch{1.7}
\begin{tabular}{rMrL}
(A) & \ds u=\sqrt{x^2+y^2} &(B) & $\ds u=\sqrt{x^4+y^4}$\tabularnewline
(C) & \ds u=\sqrt[3]{xy}   &(D) & $\ds u=\sqrt[3]{x^2+y^2}$\tabularnewline
(E) & \ds u=\sqrt[3]{x^4+y^4} & (F) &
$u=\begin{cases}e^{\frac{-1}{x^2+y^2}}; &x^2+y^2\neq 0\\ 0; &x^2+y^2=0\end{cases}$ \tabularnewline
(G) & \ds u=\sqrt[3]{x}\sin y & (H) & $\ds u=\sqrt[3]{y}\tan x$
\end{tabular}

\end{document}


-

I found a solution for this some time back using saveboxes. Use a savebox to hold the aligned content, then use the saveboxes in the tabular.

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

-

Not sure what you are trying to achieve, but does this work for you:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
a &=b\\
u &=\begin{cases}  0;& i=0\\ 1;& i \neq 0  \end{cases} &e\\
c &=d
\end{align*}
\end{document}

-