Graphics, Figures & Tablesdisplaymath inside tabular environment

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
maja z
Posts: 18
Joined: Mon May 18, 2009 8:53 pm

displaymath inside tabular environment

Post by maja z »

Hi!

I must have missed something somewhere about nesting environments, but I seem to be unable to create a displaymath environment inside a table:
I am trying to create a table where one of the columns has equations. But I don't want them inline, I want proper sized equations, and because of the quantity of text in the other columns, these equations have to be in a multirow {2} cell.

Here's my example, which should produce 3 equations:
(i) normal displaymath style
(ii) displaymath inside tabular, produces errors (Missing $ inserted) and prints as inline, not display
(iii) displaymath inside minipage inside tabular (!): I thought I had cracked it, but unforutnately not, the size is ok, but it is completely misaligned in the table cell.

I would really appreciate if someone could have a look and tell me where I'm missing the point?

Thanks!

Maja

Code: Select all

(i)
\begin{displaymath} 
\lambda=\frac{1}{y} ln \frac{x_{a} \cdot x_{b}}{x_{c} \cdot x_{d}} 
\end{displaymath}

(ii)
\begin{center}
\begin{tabular}{|c|c|}
\hline
split 		& 
	\multirow{2}{*}{
				\begin{displaymath} 
				\lambda=\frac{1}{y} ln \frac{x_{a} \cdot x_{b}}{x_{c} \cdot x_{d}}
				\end{displaymath}}					\\
row				&													\\
\hline
\end{tabular}
\end{center}

(iii)
\begin{center}
\begin{tabular}{|c|c|}
\hline
split & \multirow{2}{*}{
\begin{minipage}{30mm}\begin{displaymath} \lambda=\frac{1}{y} ln \frac{x_{a} \cdot x_{b}}{x_{c} \cdot x_{d}} \end{displaymath}\end{minipage}}\\
row&	\\
\hline
\end{tabular}
\end{center}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

displaymath inside tabular environment

Post by localghost »

The solution is much easier than you might think. You don't need a displayed math environment in this case. The entry over multiple rows can be modified as follows.

Code: Select all

\multirow{2}{*}{$\displaystyle\lambda=\frac{1}{y} ln \frac{x_a \cdot x_b}{x_c \cdot x_d}$}
As you can see, you can switch to display style in in-line math mode.
maja z
Posts: 18
Joined: Mon May 18, 2009 8:53 pm

Re: displaymath inside tabular environment

Post by maja z »

Wow, thank you so much!
(Although I have absolutely no idea how I could have figured it out on my own!)
So thank you again for a quick reply and an elegant solution!!
Maja
Post Reply