In the following TeX stackexchange answer, the author provides an excellent \blackout
macro that produces very aesthetically pleasing underline effect.
However, this macro does not work well with any bold or italic text. In particular, instead of
\blackout{This should be \textbf{bold} and \textit{italic}}
which fails with
! Argument of \textbf has an extra }.
one has to use
\blackout{This should be} \textbf{\blackout{bold}} \blackout{and} \textit{\blackout{italic}}}
which is more verbose. Is there a way to adjust the definition of \blackout
to handle this, or perhaps a way how to automatically apply \blackout
to every word in the sentence, thereby automatically producing the more verbose version?
EDIT: I've figured out that using \bfseries ... \mdseries
instead of \textbf{...}
and \itshape ... \upshape
instead of \textit{...}
fixes the problem. I'd still like to understand why though, and if the original \blackout
macro could be modified to work with \textbf{} / \textit{}
..
Best Answer
I have been working on a revamped version of
censor
which uses token cycles to process the argument to\blackout
and\xblackout
. It can, at least, digest macros. There are still issues, as explained in the new manual, but in a case like the OP describes, it works just fine.This will also allow alternate syntax of
\blackoutenv ... \endblackoutenv
. Likewise for\xblackoutenv
.Here's another example that highlights usage with expandable macros:
I am hoping to release it soon, but in the meantime, I will post a provisional version.
Here is
censor-PROVISIONAL.sty
SUPPLEMENT
The OP was disappointed that the
censor
hack that worked in List of Underlining Packages - Pros and Cons no longer seems to work with this provisional package. An investigation reveals that what doesn't work isn't mycensor
hack, but mylipsum
hack (to get expanded lipsum text) in that answer. The essentialcensor
hack still works in this context: