How to write crossed-out math in LaTeX? [duplicate]

As you might know from my other questions, I am still a newbie at LaTeX, so please don't expect me to know anything.

How would I write crossed-out math in LaTeX, which is similar to this, but the line is oblique.

Is that possible?

• Have a look at the cancel package.
– Mico
Oct 6 '12 at 11:12
• @Mico Could you provide further details? Oct 6 '12 at 11:45
• Oct 6 '12 at 12:29

The comments above should have solved the problem. But I thought a minimal example will go a long way:

\documentclass{article}
\usepackage{amsmath}
\usepackage[makeroom]{cancel}

\begin{document}
\noindent
\verb|\cancel{5y}|:
$x+\cancel{5y}=0$
\verb|\bcancel{5y}|:
$x+\bcancel{5y}=0$
\verb|\xcancel{5y}|:
$x+\xcancel{5y}=0$
\verb|\cancelto{\infty}{5y}|:
$x+\cancelto{\infty}{5y}=0$

The first three commands work in text mode also i.e., \cancel{5y}, \bcancel{5y} and
\xcancel{5y} works but \verb|\cancelto{\infty}{5y}| is not.
\end{document}


• For some reason, in some cases \cancel and variants have to be inside curly brackets, for example this works: $x^{\cancel{5y}}$ while this fails $x^\cancel{5y}$. The error is Missing { inserted. ... \mathchoice`.
– alfC
Jul 1 '14 at 21:15
• @alfC When you write super/subscript, it is always better to use braces.
– user11232
Jul 1 '14 at 23:06