How can I strikeout words in math mode (similar to \sout with \usepackage{ulem} in text mode)? I've tried \usepackage{cancel} and \(\cancel{1+1=2}\) but that draws a diagonal line.


4 Answers 4


Use something like




And you can of course define a command for convenience.

  • 5
    This does not work inside math mode, e.g. if I want to strikeout a portion of a phrase in math mode.
    – N.N.
    Jun 13, 2011 at 12:20
  • @N.N.: It's easy to generalize the solution. See update.
    – Leo Liu
    Jun 13, 2011 at 12:28
  • 1
    This method does not really work well. The ulem package is necessary, and it changes \emph{} to underlining.
    – Jeff
    Aug 29, 2013 at 19:35
  • 1
    @Jeff: Use \normalem.
    – Leo Liu
    Aug 30, 2013 at 2:20
  • @Jeff: or \usepackage[normalem]{ulem}.
    – sigvaldm
    Jan 17, 2020 at 10:54

version 2 (fine remark from Martin)




  x+\hcancel[red]{ \sum_a \mathcal{D}^a\mathcal{D}_a}=2x+ \sum_a \mathcal{D}^a\mathcal{D}_a+3 


enter image description here

  • 1
    \hbox{#2} will typeset #2 in textmode, which is fine with y (except maybe a slightly wrong width), but will break horrible with real math expressions. Jun 13, 2011 at 12:44
  • @Martin yes you are right, I forgot $...$ Jun 13, 2011 at 12:56
  • Does this solution rely on \documentclass{scrartcl}?
    – N.N.
    Jun 13, 2011 at 17:16
  • @N.N. no I think the package `cancel is independent Jun 13, 2011 at 17:47
  • I removed the $$ from the \hbox and included them in the parameter (e.g., \hcancel{$2+2=4$} and it worked fine. Thanks!
    – cxw
    Dec 30, 2016 at 21:26

Works in math and text mode




enter image description here

  • Indeed, but you need to restart the mathmode, don't you? E.g. `$x+\hcancel{$y$}+z$. Jun 13, 2011 at 12:43

I'm using this hack with the ulem package in the preamble.


In the document, I use the command thus defined, \stkout

Lorem \stkout{ipsum}. $x + \stkout{y + z} = 1$.
    A + \stkout{B + C + D} = E.

Screen capture of the example document

Reference: Opposite of \ensuremath: ensure that I'm *not* in math mode?

  • 3
    If find the cancel package much more practical, but your method is anyway interesting :) Jul 7, 2016 at 13:20
  • 1
    I quite like this approach, but feel that it would work better by just patching this to \sout - you can do this with \let\isout\sout \renewcommand{\sout}[1]{\ifmmode\text{\isout{\ensuremath{#1}}}\else\isout{#1}\fi} in the premable of your document. Requires amsmath and ulem Apr 29, 2020 at 20:31

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.