1

I looking to create a chapter in a book I'm writing using the "Novel" documentclass, with blocks of text redacted.

I tried using alt-code 219 to replace the specific redacted characters, but I only get crossed boxes.

Are there any packages that might help me with this problem?

Thank you.

Martin
  • 11
  • You will need a font that contains that character. – Cicada Sep 11 '22 at 07:20
  • Alt-219 produces the U+2588 FULL BLOCK character. You can emulate that with a short fat rule in a macro (here, called \redact): \documentclass{novel}\newcommand{\redact}{\rule{1.1em}{2ex}}\begin{document}x x x █ █ █ \redact \redact \redact \end{document}. Adjust the height and width as appropriate. If you need multi-lines, add \- discretionary hyphen to the definition of the macro: \newcommand{\redact}{\rule{1.1em}{2ex}\-}. – Cicada Sep 11 '22 at 07:38
  • 1
    If you didn't want to pick a special font, I might go about it a different way. Try something like \newcommand{\redact}[1]{\rule[-0.5ex]{\widthof{#1}}{2.5ex}}, which when used with \redact{words to redact} would produce a solid black bar the exact width of "words to redact". (Requires calc package.) – frabjous Sep 11 '22 at 11:35
  • 1
    See the censor package. – Cicada Sep 11 '22 at 14:44

3 Answers3

2

I am the author of the novel document class. If you are using redaction, be careful. The redaction may or may not cause the PDF to fail PDF/X conformance, even though it bears the internal label. If you submit the PDF to a print service, and it is accepted, no problem. If you postprocess with Adobe Acrobat Pro, no problem. But if the PDF is rejected due to PDF/X non-conformance, then novel has no solution. In that case, you would have to actually delete the text, and substitute black boxes (rules) manually.

Remember that novel is for popular fiction, which is not a place where one find redaction.

Further info, not specific to novel: If you simply draw a black rule over existing text, it does not remove the text from the PDF. All it does is hide it. Anyone who can inspect the PDF will be able to read the concealed text. True redaction involves measuring how much space the typeset text occupies, removing the text, and substituting the black rule. Then the original text cannot be revealed by PDF inspection, although the length of the black rule might make it easy to guess whether you redacted Joe or Anastasia.

rallg
  • 2,379
1

Roll your own?

Experiment indicates that it's probably best not to try to get too complicated.

redact

The "c" version would tantalize most, I would expect.

MWE

\documentclass{novel}
\usepackage{xparse}

\ExplSyntaxOn

\tl_new:N 
        \l_xym_rtext_tl

%------------------ \cs_set:Npn \xym_funcredacta:n #1 {

    \regex_replace_all:nnN 
                    { ([A-Za-z]){1} } 
                    { 
                            \c{redact}
                    } 
                    \l_xym_rtext_tl

}

%------------------ \cs_set:Npn \xym_funcredactb:n #1 {

    \regex_replace_all:nnN 
                    { (\w){1} } 
                    { 
                            \c{redact}
                    } 
                    \l_xym_rtext_tl

}

%------------------ \cs_set:Npn \xym_funcredactc:n #1 {

    \regex_replace_all:nnN 
                    { (\S){1} } 
                    { 
                            \c{redact}
                    } 
                    \l_xym_rtext_tl

}

%------------------ \cs_set:Npn \xym_funcredactd:n #1 {

    \regex_replace_all:nnN 
                    { ([\S\s]){1} } 
                    { 
                            \c{redact}
                    } 
                    \l_xym_rtext_tl

}

\NewDocumentCommand { \redact } { } { \rule{1.1em}{2ex} {\hyphenchar\font=32 -} }

\NewDocumentCommand { \redacttexta } { m } { \tl_set:Nx \l_xym_rtext_tl { #1 }

        \tl_map_function:NN 
                    \l_xym_rtext_tl
                    \xym_funcredacta:n

\tl_use:N
        \l_xym_rtext_tl

}

\NewDocumentCommand { \redacttextb } { m } { \tl_set:Nx \l_xym_rtext_tl { #1 }

        \tl_map_function:NN 
                    \l_xym_rtext_tl
                    \xym_funcredactb:n

\tl_use:N
        \l_xym_rtext_tl

}

\NewDocumentCommand { \redacttextc } { m } { \tl_set:Nx \l_xym_rtext_tl { #1 }

        \tl_map_function:NN 
                    \l_xym_rtext_tl
                    \xym_funcredactc:n

\tl_use:N
        \l_xym_rtext_tl

}

\NewDocumentCommand { \redacttextd } { m } { \tl_set:Nx \l_xym_rtext_tl { #1 }

        \tl_map_function:NN 
                    \l_xym_rtext_tl
                    \xym_funcredactd:n

\tl_use:N
        \l_xym_rtext_tl

}

\ExplSyntaxOff

\newcommand\sampletext{[``qwerty'' uiop; asdf: ghjkl, zxcv? bnm. $1,234.56 <>/ = 42 àáâãäåæ]}

\begin{document}

Sample text = \sampletext

There are degrees of redaction.

--- \texttt{\textbackslash redacttexta} hides (unaccented) letters: text text text \redacttexta{\sampletext} text text text

--- \texttt{\textbackslash redacttextb} hides (unaccented) letters and digits: text text text \redacttextb{\sampletext} text text text

--- \texttt{\textbackslash redacttextc} hides anything that is not a space: text text text \redacttextc{\sampletext} text text text

--- \texttt{\textbackslash redacttextd} hides everything: text text text \redacttextd{\sampletext} text text text

\end{document}

Cicada
  • 10,129
0

Using \usepackage{censor} you should be able to include censor. In cases you can actually use package (as I did, when i stumbled with the same issue about this page), it works like this:

This is \blackout{secret text}.
darthn
  • 9
  • 2
  • The novel document class prohibits user-added packages. – rallg Sep 06 '23 at 17:23
  • Using a customised Open Type font feature (defined via Lua) seems to work well as electronic redaction under novel class: see https://tex.stackexchange.com/questions/691279/hiding-informations/696769#696769. The aesthetics of the class are compromised if large chunks (=pages) of text are blocked, though. – Cicada Sep 24 '23 at 10:27