23

When to use which package for strikeout?

I see answers :

\usepackage{ulem}
\sout{Hello World}

or

\usepackage{soul}
\st{Hello world}

or

\usepackage{cancel}
\cancel{Hello world}

In what situations is it best to use which one?

Maybe there are other packages I am not aware of?

Shouldn't be there one standard way to strikeout?

  • To me the largest difference is that ulem feels like a tool for underlining etc. whereas the SOUL package feels more like a general toolkit for creating text decoration macros that comes with a few pre-defined commands that show you how to use it. – Scott H. Oct 1 '12 at 16:42
  • Maybe someone that knows could comment on this: mail-archive.com/lyx-devel@lists.lyx.org/msg147217.html – Scott H. Oct 1 '12 at 16:46
  • You should also consider soulpos that combines soul with the savepos mechanism so that you can arbitrary underlining and decorations, including rules, leaders and even pictures. Unlike soul underlines, which are built by repeating small elements, here each chunk of text to be underlined is a single element. – skan Nov 8 '17 at 19:50
24

cancel is intended for indicating mathematic cancellation, and consequently only works in math mode; it also strikes out diagnoally.

soul and ulem seem pretty similar. One basic semantic difference between them is that ulem per default changes the definition of \emph{...} to underline its argument instead of putting it in italics. This seems to aim at the reproduction of typewriter typesetting, when underlining often was the only means of indicating emphasis. Since using underlining for emphasis is mostly deprecated nowadays, I've always used soul when I did need to underline something.

The one big reason in favor of soul, however, is that it's able to deal with line breaks and hyphenation:

\documentclass{article}

\textwidth=1cm % just to force hyphenation to happen

\usepackage[T1]{fontenc}

\usepackage{cancel,soul,ulem}

\begin{document}
\[
\frac{\cancel{5}*17}{\cancel{5}*23}
\]

X \sout{supercalifragilisticexpialidocious}

X \st{supercalifragilisticexpialidocious}

X \emph{supercalifragilisticexpialidocious}

X \ul{supercalifragilisticexpialidocious}
\end{document}

(The X are necessary because LaTeX won't hyphenate the first word in a paragraph.)

output

  • 3
    It should probably also be mentioned that ulem has the package option normalem, which does not make \emph underline its argument. This way you can get the \sout command without changing the behavior of \emph. – phfaist Feb 15 '16 at 16:34
  • Just an addition: It is possible to set explicit hyphenation points in ulem using \-. Those work. – Skillmon Jan 25 '18 at 10:50

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.