3

The text being cancelled is italicized when the following code is printed. How do I prevent this? Here is a minimum working example:

\documentclass[11pt, oneside]{article}       
\usepackage[version=3]{mhchem} % insert chem equations
\usepackage{cancel} %strike out text

\begin{document}
\begin{align*}
\cee{
\cancel{Mg_{(s)}} + 1/2O_{(g)} + &-> MgO_{(s)} \\
MgO_{(s)} + 2HCl_{(aq)} &-> MgCl2_{(aq)} + H2O_{(l)} \\
}
\end{align*}
\end{document}  

Any help is appreciated.

  • 2
    Should be useful: tex.stackexchange.com/a/30140/21344 The main problem is that \cancel detects math mode in use because you're inside \cee. This breaks mhchems automatic formatting of the species. – Paul Gessler Mar 2 '14 at 4:18
3

You can define a new command that uses \ce inside \cancel to prevent turning the argument into math mode:

\documentclass[11pt, oneside]{article}       
\usepackage[version=3]{mhchem} % insert chem equations
\usepackage{cancel} %strike out text

\newcommand\Cancel[1]{\cancel{\ce{#1}}}

\begin{document}
\begin{align*}
\cee{
\Cancel{Mg_{(s)}} + 1/2O_{(g)} + &-> MgO_{(s)} \\
MgO_{(s)} + 2HCl_{(aq)} &-> MgCl2_{(aq)} + H2O_{(l)} \\
}
\end{align*}
\end{document}  

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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