4

I'd like to typeset a problem solution highlighting dimensional analysis in LaTeX. What is the best way to format the following in LaTeX?

  1.345 g | 0.5 L | 1000 cm^3
 ---------|-------|----------- =  0.6725 g
   cm^3   |       |   1 L

I could use a table I guess but that seems wrong. A set of \frac commands would also work but not give exactly the same visual affect. (It would be really nice to cancel the units in the expression as well). Aside from digging into pstricks is there a better way to do this?

2

1 Answer 1

7

You could definitely use \frac to write the LHS components, and the cancel package provides a diagonal strike-through of elements. Here's a minimal example:

enter image description here

\documentclass{article}
\usepackage{cancel}% http://ctan.org/pkg/cancel
\begin{document}
\[
  \frac{1.345\,\textrm{g}}{1\,\cancel{\textrm{cm}^3}}\,
    \frac{0.5\,\cancel{\textrm{L}}}{1}\,
    \frac{1000\,\cancel{\textrm{cm}^3}}{1\,\cancel{\textrm{L}}}=0.6725\,\textrm{g}
\]
​\end{document}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

If the SW-NE diagonal crossing through L is visually unappealing, cancel also provides \bcancel, as well as xcancel (a combination of \cancel and \bcancel). The siunitx package can also be used to write numerals with units in a standard way.

7
  • 2
    Seems like you hit 80 mathmode answers. ;-)
    – lockstep
    Dec 28, 2011 at 17:28
  • Keeping track, are we? :)
    – Werner
    Dec 28, 2011 at 17:29
  • Is \ell a legal symbol for "liter"? It's used, but not endorsed by the BIPM. The correct spacing for units is \,, not \;, but perhaps here it can stand.
    – egreg
    Dec 28, 2011 at 17:30
  • See also tex.stackexchange.com/questions/15916/… and tex.stackexchange.com/questions/20643/… for an alternative to cancel.
    – N.N.
    Dec 28, 2011 at 17:32
  • @egreg: I'll update my answer to reflect the notation choice. Thanks for the note on spacing; looking back at it, I should actually remove the \, from 1000 as well, since it is perhaps more common to not have that for 4-digit numerals, leading to the initial choice of \;.
    – Werner
    Dec 28, 2011 at 17:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .