This is a follow-up question to Mixing underline and strike-out. This time, I'm specifically interested in an implementation using soul
(that doesn't require multiple compilations to stabilize).
I would like to use soul
to create an (underline) + (strike-through) command \textulst
that would combine \textul
with \textst
and still allow line-breaks within.
Thus far I'm unable to properly combine the two, as soul
uses the same underlining for both the (regular) underline and the strike-through.
Here's my (unsuccessful) attempt at generating \textulst
:
\documentclass{article}
\usepackage{soul}
\makeatletter
\def\SOUL@ulstunderline#1{{%
\setbox\z@\hbox{#1}%
\dimen@=\wd\z@
\dimen@i=\SOUL@uloverlap
\advance\dimen@2\dimen@i
\rlap{% Draw underline
\null
\kern-\dimen@i
\SOUL@ulcolor{\SOUL@ulleaders\hskip\dimen@}%
}%
\SOUL@stpreamble% Switch to draw over-strike
\rlap{%
\null
\kern-\dimen@i
\SOUL@ulcolor{\SOUL@ulleaders\hskip\dimen@}%
}%
\unhcopy\z@
}}
\def\SOUL@ulsteverysyllable{%
\SOUL@ulstunderline{%
\the\SOUL@syllable
\SOUL@setkern\SOUL@charkern
}%
}
\def\SOUL@ulstsetup{%
\SOUL@ulsetup
\let\SOUL@everysyllable\SOUL@ulsteverysyllable
}
\DeclareRobustCommand*\textulst{\SOUL@ulstsetup\SOUL@}
\makeatletter
\begin{document}
Here is \textul{some text}.
Here is \textst{some text}.
Here is \textulst{some text}.
\end{document}
soul
andcensor
?soul
cannot handle nesting. Also, as mentioned below,censor
does not handle hyphenation properly. The solution proposed in the linked question in awesome (and usestikz
, but requires multiple compiles (even first time around) to settle the references.