Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
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

6 Answers 6

up vote 13 down vote accepted

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}

Result

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}

Result

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}

Result

share|improve this answer
    
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.) –  cgnieder 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}

Result

share|improve this answer

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}

enter image description here

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}

enter image description here

share|improve this answer
    
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}

enter image description here

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:

enter image description here

share|improve this answer

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}

Result

Hope this is what you were looking for!

share|improve this answer
    
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}

enter image description here

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:

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.