I'd like to censor or hide some text while replacing it with the appropriate amount of white-space. The replacement text cannot be searchable. The text to be hidden usually exists in the LR mode. The censor
and invisible
packages do not seem to work well with text spanning multiple lines.
One solution, I believe, would be to turn each word into an appropriately sized box, \makebox[\wordwidth]{}
, and let TeX (or LaTeX) handle the rest since \makebox
is treated like a word.
I am very \sloppy
, so the problem is hopefully simplified because you don't need to worry about whether a dash will be placed in the middle of a word. (Although, the soul
package is capable of handling such situations.)
Best Answer
Here's a quick solution using the customization possibilities of the
soul
package. More information on how this works can be found in the package documentation, p. 22-25.This solution allows to censor multiple lines and also treats hyphenated words correctly (see "armour-like"). As the characters are completely replaced by whitespace using
\phantom
, the censored text isn't written to the resulting PDF at all and therefore can't be extracted.