Please see the snippet below and tell me how can I achieve the same strike-out effect as in the main text. I am using the version of LaTeX from the latest Ubuntu repositories.

\documentclass{article}\usepackage{ulem}\begin{document}The sout tag works perfect in the \sout{main text area} but not inside the equations.$$list = [1, \sout{2}, 3, \sout{4}, 5, \sout{6}, 7, \sout{8}, 9, \sout{10}]$$Any clue?\end{document}

Here is LaTeX output

4

Best Answer


It looks like the \sout doesn't work inside a math env.You can try doing something like this, which works:

\documentclass{article}\usepackage{ulem}\begin{document}The sout tag works perfect in the \sout{main text area} but not inside the equations.$list = $[1, \sout{2}, 3, \sout{4}, 5, \sout{6}, 7, \sout{8}, 9, \sout{10}$]$Any clue?\end{document}

If anyone's still interested, I just found out about the cancel package, which allows you to strike your text in math mode in a few different ways. It's not horizontal, though -- only diagonal, which in my case is much better.

If you need to keep the strikeout in Math mode (e.g., to keep Math fonts) try:

\newcommand{\msout}[1]{\text{\sout{\ensuremath{#1}}}}

then

$\msout{\mathsf{stuckout}}$

you need amsmath and ulem.

(Solution from here.)

Pretty much any non-math-mode command can be used inside mathmode by putting it within a \text{} environment, e.g.:

\documentclass{article}\usepackage{ulem}\begin{document}The sout tag works perfect in the \sout{main text area} but not inside the equations.\[ list = [1, \text{\sout{2}}, 3, \text{\sout{4}}, 5, \text{\sout{6}}, 7, \text{\sout{8}}, 9, \text{\sout{10}}] \]Any clue?\end{document}

And if you'd like to be able to use strike-out without having ulem redefine how \emph{} works, use \usepackage[normalem]{ulem}.