25

I wonder if there is any LaTeX library that allows me to obtain a sanitization "black marker" effect in order to conceal omissis information, like for example a secret code in an URL or a password in a code listing.

Please have a look at this to get the idea of what I wish to obtain: document with omissis information and here

Any ideas?

3
  • Do you want to specify the 'black marker' effect by hand in your code or use some 'keywords'? I would use a wrapper command for a colorbox and a boolean flag which is set before compilation whether portions should be 'blackened' or not. I do not know such a package, but there might be such one anyway.
    – user31729
    Commented Mar 12, 2014 at 16:34
  • @ChristianH. anything that can be useful, any command that may help me. Now that I think about it, a highlighter command set as black may help me achieve this.
    – fstab
    Commented Mar 12, 2014 at 16:45
  • 6
    There is still one caveat: Do you want to use that document to be printed or just as a .pdf file -- I am not sure, whether 'secret parts' can be nevertheless identified in the pdf code.
    – user31729
    Commented Mar 12, 2014 at 16:54

2 Answers 2

40

There also is the Steven B. Se­gletes's censor package (documentation).

You can use \censor{blurg} to censor short pieces of text.

Long paragraphs can be blacked out with \blackout{foo\par bar}.

Censoring can be turned off via \StopCensoring.

\documentclass{article}
\usepackage{censor}

\begin{document}
When shall we \censor{three meet again}, in thunder, lightning or in rain?

Hi \blackout{Hello

Goodbye} Bye

\StopCensoring
When shall we \censor{three meet again}, in thunder, lightning or in rain?
\end{document}

enter image description here

9
  • 16
    I have but one thing to say about your solution: ▓▓▓▓▓▓▓! Commented Mar 12, 2014 at 17:07
  • @StevenB.Segletes :-)
    – moewe
    Commented Mar 12, 2014 at 17:08
  • 1
    @PeterGerdes As to the latter point, while an \ifcensor may be more elegant than the current state, I'm not sure how typing \StopCensor in the preamble is any more onerous than typing \censorfalse. As to the question about citations, I know that citations come in many different flavors and I fear each one would require its own logic, if it were even possible. Can you be more specific about what you had in mind (including desired syntax), since my own citation experience is limited to BibTeX? Commented Jun 5, 2023 at 0:48
  • 1
    @PeterGerdes I see. Perhaps the package could define \newif\ifcensor with the default being \censortrue while \StopCensoring could set \censorfalseand \RestartCensoring could set \censortrue. Would that seem to provide what you need? Commented Jun 5, 2023 at 21:25
  • 1
    @PeterGerdes I have submitted censor v4.3 to CTAN with these changes. Should propagate in the coming days. Commented Jun 5, 2023 at 23:42
6

Depending on whether you want to mark only short strings of text you could do something like this:

\documentclass{article}
\usepackage{calc}
\newif\ifmarksecrets % declare new switch
\marksecretstrue %comment or use \marksecretsfalse to display normal text
\newcommand{\secret}[1]{
   \ifmarksecrets % Show black rule
      \rule{\widthof{#1}}{\heightof{#1}}
   \else % Just display text
      #1
   \fi   
   }

\begin{document}
Foo foo foo \secret{VERY SECRET BAR} foo foo foo.
\end{document}

For larger boxes, TikZ can be used to draw anything anywhere on the page, but I'm in a bit of a hurry so I can't provide an example now.

1
  • 5
    One should point out that this solution cannot line break in the middle of the censor. Commented Mar 12, 2014 at 17:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .