When using package ulem's strikeout facilities (macro \sout) and also color in my text, the strikethrough appears behind the letter string:

\documentclass{article} % I also often work with the memoir package (in case this matters for the range of possible fixes)
\usepackage[normalem]{ulem} % option normalem not needed for example but often loaded by me (mentioned for the unlikely case it matters for the fix)

Hello \textcolor{red}{\sout{\textcolor{black}{Welt }}}World!

(If I specify a different color combination, like green or magenta for the text, the effect persists - I just didn't want the compiled example to look ugly or unrealistic.)

How can I have strikethrough in a color different from the text appear on top of the text?

  • Using ulem it seems like you're not concerned about line-breaking. Is this the case?
    – Werner
    Sep 11, 2012 at 5:37
  • I was using ulem mainly because I like its underlining facilities (because its \uline doesn't increase the line spacing, which is what I usually want). Of course if anyone has other pointers to things that work and are compatible with many packages, I'll be glad to know. (That is, I never really thought about line-breaking. I am always glad about further insights.) Sep 11, 2012 at 7:39
  • 1
    @werner why do you say that? -- ulem was the first underline package (iirc) that offered breakable underlines (etc.). it's listed in the uk faq as a solution in a question "underlined text won't break"; there has never been a complaint about that answer, to the faq maintainers... Sep 11, 2012 at 9:36
  • @wasteofspace: You're right. The construction in the MWE led me to believe otherwise. The nested use of \textcolor and \sout removes the line-breaking capability.
    – Werner
    Sep 11, 2012 at 14:01

1 Answer 1


Here is a solution using the SOUL package. Linebreaks etc. are respected although spacing may change very slightly if prior experience holds true. I tried with ulem but likely because of my unfamiliarity of the package, I couldn't get a solution that would work for more than a single word. I'm not sure if the SOUL package is any less compatible than ulem when it comes to conflicts etc.

I believe that both packages first draw the line, and the place the text which is why the line is in the background. There may be other ways around that problem, but my "soul"ution was to typeset zero-width text (using \rlap), and then strikeout a phantom version of the text on top of it. The command takes two optional arguments: the first sets the color of the strike (default red) and the second sets the color of the text. enter image description here


Hello \sotwo{Welt} World!

\sotwo[green]{Here is a long sentence that will span across a number of lines to force a linebreak}

\sotwo[green][blue]{Here is a long sentence that will span across a number of lines to force a linebreak}

Here is a long sentence that will span across a number of lines to force a linebreak

  • Thank you. Does the example work with equally well with color instead of xcolor, or is the latter package strictly speaking necessary in some non-obvious way? Sep 12, 2012 at 7:52
  • Oh, do you think you could add code so that I can also vary the color of the text? Sep 12, 2012 at 8:19
  • It should work equally well with either color or xcolor. I added a second optional argument for the color of the text.
    – Scott H.
    Sep 12, 2012 at 14:56
  • 2
    The following works with ulem but not across line breaks because of the phantom: \newcommand\reduline{\bgroup\markoverwith {\textcolor{red}{\rule[0.5ex]{2pt}{0.4pt}}}\ULon} \newcommand\topline[1]{\rlap{#1}\reduline{\phantom{#1}}}
    – Scott H.
    Sep 12, 2012 at 19:19
  • 2
    Buried in the ulem scanner (\ULon) is a matching \egroup that is inserted after the argument is read and dealt with. Something like \newcommand\mystuff[1]{do stuff\egroup} which could then be used like {\bgroup\mystuff{argument stuff}}
    – Scott H.
    Sep 12, 2012 at 20:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .