[Tex/LaTex] More robust strike-through / cross-out

strikeoutulem

I al using the ulem package to cross-out unwanted text like so

\documentclass{article}
\usepackage{ulem}
\begin{document}    
\xout{Lorum ipsum dola blah blah blah.}
\sout{Lorum ipsum dola blah blah blah.}
\end{document}

This works great, but isn't very robust: even a paragraph break in the affected text causes this method to throw back a compile error.

I am interested in learning about more robust ways that can be used to strike-through or cross-out large swathes of text (entire chapters, for example). At a minimum, this should mean that citations, equations, paragraph breaks, and page breaks do not cause problems. Even better would be if stuff such as section headings and tables also get crossed out. The icing on the cake would be if LaTeX could also use something like TiKz to intelligently put a cross through figures that are within the affected text (maybe that's asking too much, but this community has surprised me before!).

Im fairly open to alternative methods of achieving this (for example, one idea was having TiKz calculate the shape of the affected materials and draw obliquely shaded rectangles of the appropriate size over them, but I don't know how to do that). I am mostly interested in hearing whether people are aware of any ways of tackling this problem.

Best Answer

This just puts a paragraph parsing wrapper around \xout and \sout, given as \xoutpars and \soutpars.

However, this will not address things like math, etc.

\documentclass{article}
\usepackage{ulem,lipsum}
\newcommand\xoutpars[1]{\let\helpcmd\xout\parhelp#1\par\relax\relax}
\newcommand\soutpars[1]{\let\helpcmd\sout\parhelp#1\par\relax\relax}
\long\def\parhelp#1\par#2\relax{%
  \helpcmd{#1}\ifx\relax#2\else\par\parhelp#2\relax\fi%
}
\begin{document}
\xout{Lorum ipsum dola blah blah blah.}
\sout{Lorum ipsum dola blah blah blah.}

Now we start. \xoutpars{This is a test

...of multiple paragraphs.

And now a third.}

Now we start. \soutpars{This is a test

...of multiple paragraphs.

And now a third.}
\end{document}

enter image description here