Cancel in LaTeX (\cancel{x})

x\cancel{x}
LaTeX command
\cancel{x}
Package
Add to your preamble:\usepackage{cancel}
Mode
Text and math mode

Where it is used

Strikes through an expression with a diagonal line to show terms cancelling in a derivation.

Teachers and lecture notes use \cancel to show simplification, for example a factor cancelling in a fraction or opposite terms vanishing in a sum. The same package offers \bcancel (back-slash direction), \xcancel (an X through the term) and \cancelto{0}{x}, which draws an arrow to the value the term goes to. The stroke color can be changed separately from the text color, which helps in slides. \cancel works in text mode too, but it is mostly used in math. Formal papers rarely show cancellation this way; it is a teaching device.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

(x−1)(x+1)(x−1)=x+1\frac{\cancel{(x-1)}(x+1)}{\cancel{(x-1)}} = x + 1
\documentclass{article}
\usepackage{cancel}
\begin{document}
Cancel: $\cancel{x}$

\[ \frac{\cancel{(x-1)}(x+1)}{\cancel{(x-1)}} = x + 1 \]
\end{document}

Related symbols

All 악센트 및 수정자 →

Frequently asked questions

How do I write Cancel in LaTeX?
Type \cancel{x} in math mode, for example $\frac{\cancel{(x-1)}(x+1)}{\cancel{(x-1)}} = x + 1$. Load cancel first with \usepackage{cancel}.
Which package do I need for \cancel{x}?
\cancel{x} needs cancel: add \usepackage{cancel} to your preamble before the document starts.
Can I use \cancel{x} in text mode, or only in math mode?
Both. \cancel{x} compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
Math poweredAI로 LaTeX 작성

최고의 AI LaTeX 편집기, Overleaf 대안

Octree는 15개 이상의 대학의 연구자들이 AI를 사용하여 논문을 더 빠르게 작성하도록 도움

  • AI로 아름다운 TikZ 다이어그램 생성
  • 이미지를 업로드하고 LaTeX로 원활하게 변환
  • 논문 작성 및 서식에 대한 즉각적인 지원 받기