Knowledge base dedicated to Linux and applied mathematics.
Home > Latex > FAQ > Latex - FAQ > Strikethrough - strike out text or formula in LaTeX
All the versions of this article: <English> <français>
How to cross out / strikethrough text or equations in Latex?
There are two main ways to do this with the cancel and ulem packages. It also depends on your needs: is it in mathematical mode or in text mode?
I personally prefer this package because it works equally well on Latex text or on Latex equations
You must use cancel packages as follows:
\cancel draws a diagonal line (slash) through its argument.
\bcancel uses the negative slope (a backslash).
\xcancel draws an X (actually \cancel plus \bcancel).
\cancelto〈value〉〈expression〉 draws a diagonal arrow through the 〈expression〉,
pointing to the 〈value〉
Here is an example I built to illustrate this package
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{cancel}
\usepackage{amsmath}
\begin{document}
I want to strike out symbols in math mode $\cancel{\alpha + 2}=8$
I want to strikethrough this \cancel{text} in text mode.
I want to strikethrough an equation
\begin{equation*}
\cancel{f(x)=(x+a)(x+b)}
\end{equation*}
\begin{equation}
\begin{aligned}
B'&=-\nabla \times E,\\
E'&=\cancel{\nabla \times B - 2\pi j},\\
E'&=\nabla \times B - 4\pi j
\end{aligned}
\end{equation}
I prefer backslash ! Please bcancel
\begin{equation}
\begin{aligned}
B'&=-\nabla \times E,\\
E'&=\bcancel{\nabla \times B - 2\pi j},\\
E'&=\nabla \times B - 4\pi j
\end{aligned}
\end{equation}
What about a cross ?
\begin{equation}
\begin{aligned}
B'&=-\nabla \times E,\\
E'&=\xcancel{\nabla \times B - 2\pi j},\\
E'&=\nabla \times B - 4\pi j
\end{aligned}
\end{equation}
What about cross and replace ?
\begin{equation}
\begin{aligned}
B'&=-\nabla \times E,\\
E'&=\cancelto{\nabla \times B - 2\pi j}{\nabla \times B - 4\pi j}
\end{aligned}
\end{equation}
\end{document}
Documentation in https://ctan.org/pkg/cancel
ulem is only for text. You can use sout or xout functions as follows.
\sout line struck through word
\xout marked over
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\begin{document}
I want to strike out symbols in math mode $\sout{\alpha + 2}=8$
Hum hum not possible ...
I want to strikethrough this \sout{text} in text mode.
Yes we can !
I want to strikethrough this \xout{text} in text mode.
Yes we can and it is very cool xout !!!
I want to strikethrough an equation
\begin{equation*}
\sout{f(x)=(x+a)(x+b)}
\end{equation*}
Hum hum not possible ...
\end{document}