# How do I produce an equation of mostly text that is not too long for the page?

So what I want is an equation something like the following:

Volume of diluted cell suspension
or number of Petri dishes =      volume of undiluted    X  density of undiluted
cell suspension             cells
(all over/divided by)

1.7X10^6 cells/ml


How would I do this in LaTeX? I've tried \equation if \textsl, as well as \align and many other things but I can't get the line breaks in the right place or the line breaks will not appear at all.

-
You could use the tabular environment. –  dustin Jul 17 '13 at 18:11
So how would I use the tabular environment to do that? (sorry I haven't been using LaTeX for very long) –  Vicky Nicholls Jul 17 '13 at 18:17
Example of how to do has been added –  dustin Jul 17 '13 at 18:55

## With delimiters

Another variation with parentheses, using pmatrix of package amsmath.

\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\DeclareSIUnit{\cells}{cells}
\sisetup{per-mode = symbol}

\begin{document}

$\begin{pmatrix} \text{volume of diluted cell suspension}\\ \text{or number of Petri dishes} \end{pmatrix} = \frac{ \begin{pmatrix} \text{volume of diluted}\\ \text{cell suspension} \end{pmatrix} \times \begin{pmatrix} \text{density of}\\ \text{undiluted cells} \end{pmatrix} }{ \SI[mode=text]{1.7e6}{\cells\per\ml} }$

\end{document}


## Without delimiters

The text blocks can be set with environment matrix of package amsmath. Without visual delimiters I have increased the spacing around the relational operator = (\thickmuskip) and the binary operator + (\medmuskip):

\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\DeclareSIUnit{\cells}{cells}
\sisetup{per-mode = symbol}

\begin{document}

$\setlength{\thickmuskip}{2\thickmuskip} \setlength{\medmuskip}{2\medmuskip} \begin{matrix} \text{volume of diluted cell suspension}\\ \text{or number of Petri dishes} \end{matrix} = \frac{ \begin{matrix} \text{volume of diluted}\\ \text{cell suspension} \end{matrix} \times \begin{matrix} \text{density of}\\ \text{undiluted cells} \end{matrix} }{ \SI[mode=text]{1.7e6}{\cells\per\ml} }$

\end{document}


## Variant with tabular

The following uses tabular instead of matrix with decreased space between the lines:

\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\DeclareSIUnit{\cells}{cells}
\sisetup{per-mode = symbol}

\newcommand*{\textstack}[1]{%
\text{%
\renewcommand*{\arraystretch}{.9}%
\begin{tabular}{@{}c@{}}%
#1%
\end{tabular}%
}%
}

\begin{document}

$\setlength{\thickmuskip}{2\thickmuskip} \setlength{\medmuskip}{2\medmuskip} \textstack{ volume of diluted cell suspension\\ or number of Petri dishes } = \frac{ \textstack{ volume of diluted\\ cell suspension } \times \textstack{ density of\\ undiluted cells } }{ \SI[mode=text]{1.7e6}{\cells\per\ml} }$

\end{document}


-
In chemistry, square brackets mean concentration. –  egreg Jul 17 '13 at 19:09
@egreg: I have changed the delimiters to parentheses, but then I think, it looks better without delimiters. –  Heiko Oberdiek Jul 17 '13 at 19:24
@egreg most of the time but not exclusively. Sometimes square brackets are just square brackets. This is why many texts explicitly mention that they use the square bracket notation for amount concentration. (It is officially allowed by the IUPAC, though.) –  clemens Jul 17 '13 at 19:42

I'd use the smallmatrix-environment and would add brackets around the text to increase readability.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{displaymath}
\Bigl(\begin{smallmatrix}
\text{Volume of diluted cell suspension}\\
\text{ or number of Petri dishes}
\end{smallmatrix}\Bigr)
= \frac{%
\Bigl(\begin{smallmatrix}
\text{Volume of diluted cell suspension}\\
\text{or number of Petri dishes}
\end{smallmatrix}\Bigr)
\times
\Bigl(\begin{smallmatrix}
\text{density of}\\
\text{undiluted cells}
\end{smallmatrix}\Bigr)
}
{1.7\times10^6\,\text{cells}/\text{ml}}
\end{displaymath}
\end{document}


-

In the first solution, I tried to preserve the layout that you presented:

\documentclass{article}
\usepackage{stackengine}
\begin{document}
\small
\stackon{or number of Petri dishes}{Volume of diluted cell suspension}
= \stackunder{%
\stackunder{volume of undiluted}{cell suspension} $\times$%
\stackunder{density of undiluted}{cells}%
}{\stackunder{--------------------------------------------------------}%
{$1.7\times10^6$ cells/ml}%
}
\end{document}


Upon reflection, you may desire a slightly different layout. This would probably be better:

\documentclass{article}
\usepackage{stackengine}
\begin{document}
\small
\stackanchor{Volume of diluted cell suspension}{or number of Petri dishes}
=
\savestack{\num}{%
\stackanchor{volume of undiluted}{cell suspension} ~$\times$~%
\stackanchor{density of}{undiluted cells}%
}%
\stackunder{%
\stackon{-----------------------------------------------------}{\num}%
}{$1.7\times10^6$ cells/ml}%
\end{document}


-
put a space after $\times$ so the space around it is symmetrical. but some suggestions: how about aligning the = with the division rule, and centering the first part vertically on the =? that would make it look more like an ordioary "equation". –  barbara beeton Jul 17 '13 at 18:30
@barbarabeeton See revision. –  Steven B. Segletes Jul 17 '13 at 18:35

I'd place it in a math environment and use \frac and a mixture of \parboxs set to widths that give the appearance you'd like.

\documentclass{article}
\usepackage{siunitx}
\pagestyle{empty}
\begin{document}

$\parbox{2in}{\centering Volume of diluted cell suspension or number of Petri dishes} = \frac{ \parbox{1.25in}{\centering volume of diluted cell suspension} \times \parbox{1.25in}{\centering density of undiluted cells} } { \SI{1.7e6}{cell\per\ml} }$

\end{document}


The denominator is set using siunitx macros.

But, I'd not be happy about second-guessing the width of the \parboxs. So you could create a new command that measures the width of the widest of the first two lines and sets the width of the \parbox accordingly (actually, I've added a bit more space because things seemed a bit too squeezed):

\documentclass{article}
\usepackage{siunitx}
\newlength{\categorywidth}
\newlength{\tmpcategorywidth}
\newcommand{\category}[2]{%
\settowidth{\categorywidth}{#1}%
\settowidth{\tmpcategorywidth}{#2}%
\ifdim\categorywidth<\tmpcategorywidth\relax\setlength{\categorywidth}{\tmpcategorywidth}\fi
\parbox{\dimexpr\categorywidth+1em\relax}{\centering #1 #2}%
}
\pagestyle{empty}
\begin{document}

$\category{Volume of diluted cell suspension}{or number of Petri dishes} = \frac{ \category{volume of diluted}{cell suspension} \times \category{density of undiluted}{cells} } { \SI{1.7e6}{cell\per\ml} }$

\end{document}


This gives a more balanced appearance:

-

This is a bit of a hack but, but you can use the \substack command to get LaTeX do something,

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$$\substack{\text{Volume of diluted cell suspension}\\\text{or number of petri dishes}} = \frac{\substack{\text{volume of undiluted}\\ \text{cellsuspension}} \times\substack{\text{density of undiluted}\\ \text{cells}}}{1.7\times 10^6 \text{cells/ml}}$$

\end{document}


Hope this is what you were looking for!

-
Welcome to TeX.SX! –  Papiro Jul 17 '13 at 19:09
@Papiro Thanks! –  Christian Bueno Jul 17 '13 at 19:30

Here it is using tabular

\documentclass{article}
\usepackage{tabu, multirow}

\begin{document}
\begin{tabular}{lcccc}
\centering
\multirow{2}{2in}{Volume of diluted cell suspension or number of Petri dishes}
& $$=$$ & \multirow{2}{1.25in}{volume of undiluted cell suspension}
& $$\times$$ & \multirow{2}{1in}
{density of undiluted cells}\\
\\
\cline{3-5}
& & \multicolumn{3}{c}{$$1.7\times 10^6$$ cells/ml}
\end{tabular}
\end{document}


You can always tweak the \multirow to your liking.

If you want the equal sign centered vertically, you can do

\multirow{2}{.1in}{$$=$$}


which yields:

-