47 How do I cross something out?
If you’re working with conversion factors, or any other kind of math that involves showing that something has been removed or cancelled out, crossing things out is essential.
Luckily, it’s very easy to cross something out in a LaTeX expression.
The \cancel{}
command
Simply use the \cancel{x}
command, where x is whatever you want to cross out. This looks like:
[latex]\cancel{x}[/latex]
Let’s put this command to use in the conversion of 10 metres to millimetres.
First, determine the conversion factor. Since there are 1000 mm in 1 m, our conversion factor will be [latex]\frac{1000\text{ mm}}{1\text{ m}}[/latex].
Next, multiply the conversion factor by the original measurement of 10 m. Following the rules of cancelling out in fractions, we end up with:
[latex]10\cancel{\text{ m}}\times\dfrac{1000\text{ mm}}{1\cancel{\text{ m}}}=10,000\text{ mm}[/latex]
By crossing out the metres, it is easier to illustrate how we go from metres to millimetres.
While this example was very simple and easy to understand, the \cancel{}
command is especially useful when converting between many different units. To demonstrate, here is an example from chemistry:
[latex]45.3\cancel{\text{ g }\ce{SO2}}\times \dfrac{1\cancel{\text{ mol }\ce{SO2}}}{64.06\cancel{\text{ g }\ce{SO2}}}\times \dfrac{2\cancel{\text{ mol }\ce{SO3}}}{2\cancel{\text{ mol }\ce{SO2}}}\times \dfrac{80.06\text{ g }\ce{SO3}}{1\cancel{\text{ mol }\ce{SO3}}}=56.6\text{ g }\ce{SO3}[/latex]
While the \cancel{}
command is most useful when using numerals, it can also be used to cancel out words:
[latex]9\cancel{\text{ c pancake mix}}\times \dfrac{1\text{ egg}}{2\cancel{\text{ c pancake mix}}}=4.5\text{ eggs}[/latex]
Cancelling out spaces
In a prior example, we had [latex]10\cancel{\text{ m}}[/latex], which is written as 10\cancel{\text{ m}}
. You’ll notice that the command is cancelling out the metre symbol as well as the space before it. But wouldn’t it be better to only cancel out the metre symbol?
Yes, it would be better — but this can be difficult.
Since LaTeX doesn’t recognize spaces written between its commands, the only way to insert a space is to use \text{ }
. If you have a numeral, then a unit of measurement, like in the case of 10 m, you need a space between the two.
The simplest way to write this in LaTeX is 10\text{ m}
, in which the space and the m are created using the same \text{}
command.
If you try to put the \cancel{}
command within the \text{}
command so that only the m is cancelled, this is what happens:[1]
[latex]10\text{ \cancel{m}}[/latex]
The \text{}
command prints out exactly what you write in its curly brackets. Therefore, if you try to insert a \cancel{m}
command within a \text{}
command, you’ll just print out “\cancel{m}”.
If you really want to make sure that the space isn’t cancelled out, you can use two separate \text{}
commands to write the space and the m:
[latex]10\text{ }\cancel{\text{m}}[/latex]
Compare this to the original way we wrote it:
[latex]10\cancel{\text{ m}}[/latex]
You can see that the difference is minute and that using two separate \text{}
commands for the space and the m is cumbersome.
You can use two \text{}
commands if you prefer, but when you’re writing a ton of conversion factors (like in a chapter on conversion factors in a math or chemistry textbook), this extra work will quickly add up.
Generally, we recommend writing 10\cancel{\text{ m}}
, because it’s a little simpler, and it’s doubtful that anyone would be able to tell the difference.
- You can right-click this expression and go to Math Settings > Math Renderer > Plain Source and then back to Common HTML to switch between seeing the original LaTeX markup and the expression in display form. ↵