79

I had to cross out a sentence and I did it the following way, which is kinda sloppy.

$ \rlap{\textbf{-------------------------------------------------------------------------------------------------}}%
{\mbox{Its derivative should be}}$ $2z + 2\bar{z} =4Re[z]$ So are its critical points all over the real axis? 

is there a better way to do this and get the same result?

N.N.
  • 36,163

2 Answers2

96

Use the either the ulem package or the soul package.

\documentclass{article}
\usepackage[normalem]{ulem} % either use this (simple) or
\usepackage{soul} % use this (many fancier options)
\begin{document}

% ulem command
\sout{Its derivative should be $2z + 2\bar{z} =4Re[z]$ So are its critical points all over the real axis?} 

% soul command
\st{Its derivative should be $2z + 2\bar{z} =4Re[z]$ So are its critical points all over the real axis?} 
\end{document}

output of code

Alan Munn
  • 218,180
  • +1 for ulem. It also provides \xout to put XXX over the text (see this answer for an image.) and allows you to design your own pattern. (soul might be able to to the same and more, but I don't know it) – Martin Scharrer Mar 17 '11 at 10:09
  • 3
    Note that ulem changes the behavior of emph. In order to avoid it, add \normalem to the preamble after the package insertion. – Dror Mar 17 '11 at 13:31
  • 6
    That's why I added [normalem] as a package option in the example document. That has the same effect as adding \normalem into the preamble. – Alan Munn Mar 17 '11 at 13:36
  • 3
    I tried both solutions, and my preference goes to ulem because its \sout command can handle "special" characters (such as é, è, à, ...) commonly used in some languages, whereas \st fails. – Anthony Labarre Oct 16 '12 at 08:05
  • @AnthonyLabarre Interesting observation, I'd never noticed that. soul will work with accented characters if you are using LuaTeX or XeTeX, though. – Alan Munn Oct 16 '12 at 15:07
  • I'm having troubles with ulem and soul when there are references being marked. Does anyone else also experiences this? – Jorge Leitao Feb 14 '13 at 11:24
  • @J.C.Leitão I'm not quite clear what you mean. If the problem is that things you want in italics are showing up underlined instead, make sure you load ulem with the [normalem] option. If that's not the problem, maybe you should post a minimal example as a new question. – Alan Munn Feb 14 '13 at 13:02
  • For me, with the ulem package, the \sout command does not wordwrap, which is very annoying. The soul package works fully. – Vincent Fourmond Feb 27 '15 at 08:06
  • @AlanMunn, \sout, \xout and \uwavenot work very well with the environment \begin{equation}...\end{equation} and \begin{align}...\end{align}. Can you please know how to fix it? – Achaire Jun 12 '18 at 13:07
  • 1
    @Achaire soul is not really designed for math mode. Depending on what you are trying to do, there are different solutions. See Color underline a formula and Overstriking into equation with Soul. – Alan Munn Jun 12 '18 at 14:59
30

You can also use PDF annotations with the pdfcomment package. Then you can also add a comment/note.

\documentclass{article}
\usepackage{xcolor}
\usepackage{pdfcomment}
\begin{document}
\pdfmarkupcomment[markup=StrikeOut,color=red,author=Approximist]{Its derivative should be $2z + 2\bar{z} =4Re[z]$ So are its critical points all over the real axis?}{comment}
\end{document}

\pdfmarkupcomment example

Josef
  • 7,432
  • 1
    Looks nice, but it only works under Adobe Reader, right? And thus not under any Linux distribution. Or is there some way to make the comment show up in a pdf reader in Linux? – Adriaan Dec 17 '14 at 14:38
  • 2
    It works with every viewer that implements PDF! OTOH, there are viewers, which promise to be PDF viewers, ... Sorry, but i've lost passion and interest to be up to date with this mess – Josef Dec 18 '14 at 14:29
  • I understand that can be quite a hassle. I can tell you that Evince does not seem not show the 'comment box', but Okular does, under Ubuntu 14.10 at least ;). – Adriaan Dec 18 '14 at 17:36