I would like to strikeout a paragraph with some different text colorings in it. As I learned here: Strikeout - when which package ? ( ulem vs soul vs ...) the \st
command in soul
strikesout whole paragraphs (respecting line breaks), while \sout
in ulem
just puts everything on one line (highly undesirable). But when I put my color commands inside \st
, it tells me Argument of \textcolor has an extra }.
and Package xcolor Error: Undefined color {gray}.
!
\documentclass{article}
\usepackage[normalem]{ulem}
\usepackage{soul}
\usepackage{xcolor}
\newcommand{\clight}[1]{\textcolor{white!70!black}{#1}}
\definecolor{alert}{RGB}{255, 10, 61} % 1/20/22
\newcommand{\calert}[1]{\textcolor{alert}{#1}}
\begin{document}
\clight{blah blah blah \calert{Warning!} blah blah blah}.
\sout{\clight{blah blah blah}}
\st{blah blah blah}.
%\st{\textcolor{gray}{blah blah}}
%\st{\clight{blah blah}} % gives `Argument of \clight has an extra }.`
\end{document}
There seem to be known issues regarding these packages: Interaction between xcolor, ulem, and no-break spaces, soul: broken highlighting with xcolor when using \selectcolormodel, acro acronym not recognized inside the soul package's strikeout command. very disappointing that no better solutions have been developed.
P.S. using \sout
, it looks like the horizontal line is behind the text, not over it... very strange
pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022)
or withLuaHBTeX, Version 1.15.0 (TeX Live 2022)
. Have you an up-to-date installation?