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.

I want to symbolically cancel out units using the siunitx package. To do so I tried the cancel package as in the following minimal example:

\documentclass{article}

\usepackage{amsmath}
\usepackage[per=frac]{siunitx}
\usepackage{cancel}

\begin{document}
\begin{align*}
   \frac{\SI{7}{\m}}{\SI{3}{\m}} =  \frac{\SI{7}{\cancel \m}}{\SI{3}{\cancel \m}}
\end{align*}
\end{document}

But this gives me the following output, i.e. when using \cancel the font of the unit changes which is not desired. Any idea how to fix this?

output

Edit: I tried @percusse's solution which works very well. But if I also add the option expproduct=cdot to the package options, the problem reappears.

share|improve this question
    
On your edit, you are using v1 option names which forces compatibility mode. Version 1 did not 'know' \cancel, so unsurprisingly it treats things a bit oddly. –  Joseph Wright Oct 21 '12 at 8:28
    
Ok, thanks. Switching to exponent-product=\cdot worked. –  student Oct 21 '12 at 8:41
    
Finally the problem was that the documentation of siunitx on my box was not up to date. So I didn't find the option exponent-product as well as per-mode... –  student Oct 21 '12 at 8:42
add comment

1 Answer

up vote 9 down vote accepted

You are using an old type of option to siunitx. If I fix the option everything is shown as expected. It also warns you to use the version 2 type inputs.

\documentclass{article}

\usepackage{amsmath}
\usepackage[per-mode=fraction]{siunitx}
\usepackage{cancel}

\begin{document}
\begin{align*}
   \frac{\SI{7}{\m}}{\SI{3}{\m}} =  \frac{\SI{7}{\cancel\m}}{\SI{3}{\cancel\m}}
\end{align*}
\end{document}

enter image description here

share|improve this answer
    
If I add the option: expproduct=cdot to the package option list, the problem reappears. Any idea? –  student Oct 21 '12 at 8:25
    
@student Have a look at the list on page 75, you'll see the newer version for that option. (I have the version released on 2012/7/22) –  percusse Oct 21 '12 at 9:51
add comment

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.