Are you teaching chemistry and have ever had the need to show the addition of equations and the cancelling of compounds? Well, that’s not too complicated.
For this we use the cancel package. First we will redefine the [cce inline=”true” lang=”latex”]\cancel[/cce] command so we can use an optional argument to specify the color of the cancelling line. The rest it pretty straight forward:
[cce lang=”latex”]\documentclass{article}
\usepackage{chemmacros,cancel}
\let\oldcancel\cancel
\renewcommand\cancel[1][black]{%
\def\CancelColor{\color{#1}}%
\oldcancel}
\begin{document}
\begin{align*}
\ch{\cancel[blue]{HCOOH\aq} + H2O\lqd{} &<=> H3O^+\aq{} + \cancel[red]{HCOO^-\aq}} \\
\ch{\cancel[red]{HCOO^-\aq} + H2O\lqd{} &<=> \cancel[blue]{HCOOH\aq} + OH^-\aq}\\[-1ex]
\cline{1-2}
\ch{H2O\lqd{} + H2O\lqd{} &<=> H3O^+\aq{} + OH^-\aq}
\end{align*}
\end{document}[/cce]
FYI: you may also have a look here to see how it’s done with mhchem.