Sign up ×
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.

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?

share|improve this question

migrated from Dec 28 '11 at 17:24

This question came from our site for professional and enthusiast programmers.

Quite apart from the appearance, I'm not sure I follow your dimensional analysis here! – Joseph Wright Dec 28 '11 at 17:35

1 Answer 1

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


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.

share|improve this answer
Seems like you hit 80 mathmode answers. ;-) – lockstep Dec 28 '11 at 17:28
Keeping track, are we? :) – Werner Dec 28 '11 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 '11 at 17:30
See also… and… for an alternative to cancel. – N.N. Dec 28 '11 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 '11 at 17:35

Your Answer


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.