summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/censor/censor.tex
blob: 2c0c5650fe33f9a4df4b6a43662bb0e320df126d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
%% Copyright 2009 Steven B. Segletes
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Steven B. Segletes.
%
% This work consists of all files listed in manifest.txt.
%
% This notice added 2010/01/04 by Clea F. Rees with the permission of 
% Steven B. Segletes.
\documentclass{article}
\usepackage{censor}

\parindent 0in
\parskip 1em

\begin{document}

\vspace*{0in}
\begin{center}
\LARGE The \textsf{censor} Package\\
\small \rule{0in}{1em}Tools for Producing Redacted Documents\\
\large \rule{0in}{2em} Steven B. Segletes\\
steven@arl.army.mil\\
\rule{0em}{2em}2009/12/07\\
v1.00
\end{center}

\section{Introduction}

The \textsf{censor} package allows a convenient redaction/censor
capability to be employed, for those who need to protect restricted
information, as well as for those who are forced to work in a more
inefficient environment when dealing with restricted information.

Let us assume you have a document for internal use, containing some
restricted (\textit{i.e.}, private, sensitive, proprietary or
classified) information.  To give a very short (fictitious) example:

{\addtolength{\leftskip}{2.3em}
RESTRICTED SOURCE: \hrulefill

\verb|The Liberty missile, with charge diameter (CD) of 80~mm, |\\
\verb|revealed a penetration capability of 1.30 1.19, and |\\
\verb|1.37~CD in three recent tests into armor steel.|

RESTRICTED OUTPUT: \hrulefill

The Liberty missile, with charge diameter (CD) of 80~mm, revealed a
penetration capability of 1.30 1.19, and 1.37~CD in three recent tests
into armor steel.

\hrulefill

}

Censor/redaction capabilities are desirable to sanitize the information.
This would accomplish two things:  allow for wider distribution of the
output and/or allow a less sensitive output to be stored locally with
fewer storage controls.

There are two modes in which the censor package can be used: (i) when
the source (.tex file) remains restricted/secure; and (ii) when the source
(.tex file) is public/unsecure.

\clearpage
\section{Mode I: Restricted/Secure Source (.tex file)}

In this mode, you create the source in a restricted/secure environment,
but would like to produce output that can be more widely distributed, or
stored in a less restricted location.  With the addition of
\verb|\usepackage{censor}| to your document preamble, the \verb|\censor|
command becomes accessible to block out key identifiers:

{\addtolength{\leftskip}{2.3em}
CENSORED RESTRICTED SOURCE: \hrulefill

\verb|The \censor{Liberty} missile, with charge diameter (CD) of|\\
\verb|\censor{80}~mm, revealed a penetration capability of 1.30|\\
\verb|1.19, and 1.37~CD in three recent tests into armor steel.|

CENSORED NO-LONGER-RESTRICTED OUTPUT: \hrulefill

The \censor{Liberty} missile, with charge diameter (CD) of
\censor{80}~mm, revealed a penetration capability of 1.30 1.19, and
1.37~CD in three recent tests into armor steel.

\hrulefill

}

The censored version of the output is (presumably) less sensitive in its
content, and my be stored in or distributed to a less sensitive
environment (\textit{e.g.}, as a hardcopy).  The censored words are not part
of the output document (hardcopy or electronic), even though the space
allocated for the redaction is identical to the original word being
redacted.

The document may also be printed out in its restricted (uncensored)
form, merely with the addition of the \verb|\StopCensoring| command at
the beginning of the document:

{\addtolength{\leftskip}{2.3em}
UNCENSORED RESTRICTED SOURCE: \hrulefill

\verb|\StopCensoring|\\
\verb| |\\
\verb|The \censor{Liberty} missile, with charge diameter (CD) of|\\
\verb|\censor{80}~mm, revealed a penetration capability of 1.30|\\
\verb|1.19, and 1.37~CD in three recent tests into armor steel.|

UNCENSORED RESTRICTED OUTPUT: \hrulefill

\StopCensoring

The \censor{Liberty} missile, with charge diameter (CD) of
\censor{80}~mm, revealed a penetration capability of 1.30 1.19, and
1.37~CD in three recent tests into armor steel.

\hrulefill

}\RestartCensoring

\clearpage
\section{Mode II: Public/Unsecure Source (.tex file)}

This mode is envisioned for users who must bear a large level of
inconvenience to work in a restricted/secure environment (generally
meaning in a location physically removed from one's desk).  Its use is
envisioned to allow a large percentage of a document to be created in an
public/unsecure environment, with only the restricted details being
completed in a restricted/secure environment.

After including the \verb|\usepackage{censor}| command in the document
preamble, the \verb|\censor*| command becomes accessible.  The way this
author envisions its use is as follows:

{\addtolength{\leftskip}{2.3em}
CENSORED UNRESTRICTED SOURCE: \hrulefill

\verb|% KEYWORD IDENTIFIERS:|\\
\verb|\def\Missile{\censor*{7}}|\\
\verb|\def\Size{\censor*{2}}|\\
\verb| |\\
\verb|The {\Missile} missile, with charge diameter (CD) of|\\
\verb|{\Size}~mm, revealed a penetration capability of 1.30 1.19,|\\
\verb|and 1.37~CD in three recent tests into armor steel.|

CENSORED UNRESTRICTED OUTPUT: \hrulefill

\def\Missile{\censor*{7}}
\def\Size{\censor*{2}}

The {\Missile} missile, with charge diameter (CD) of {\Size}~mm, revealed a
penetration capability of 1.30 1.19, and 1.37~CD in three recent tests
into armor steel.

\hrulefill

}

In this way, the source (.tex file) contains no restricted information,
and may thus be prepared in an unrestricted environment.  The argument
to the \verb|\censor*| command is a number representing the approximate
width of the redaction (in ex's).  Because the redaction width is only
approximate, it is possible that the censored and uncensored originals
might have differing text justification.  In the text, the curly braces
are placed around the keyword identifiers so as to produce the proper
interaction with the surrounding whitespace and punctuation.

Because the source (.tex) file contains no restricted information, the
use of \verb|\StopCensoring| cannot (in and of itself) produce the
restricted document.  Rather it will produce the following:\clearpage

{\addtolength{\leftskip}{2.3em}
UNCENSORED UNRESTRICTED OUTPUT: \hrulefill

\StopCensoring
\def\Missile{\censor*{7}}
\def\Size{\censor*{2}}

The {\Missile} missile, with charge diameter (CD) of {\Size}~mm, revealed a
penetration capability of 1.30 1.19, and 1.37~CD in three recent tests
into armor steel.

\hrulefill

}\RestartCensoring

In order to produce the uncensored, restricted output, the unrestricted
source file must be moved into the restricted/secure environment and be
subject to a small amount of additional editing.  Once in the restricted
environment, the source (.tex file) may be edited such that the censored
keyword identifiers are filled in with their restricted values, changing
the \verb|\censor*| commands to \verb|\censor| commands, in the process.
This and the addition of the \verb|\StopCensoring| command to the file
will produce the uncensored, restricted result:

{\addtolength{\leftskip}{2.3em}
UNCENSORED NO-LONGER-UNRESTRICTED SOURCE: \hrulefill

\verb|\StopCensoring|\\
\verb|% KEYWORD IDENTIFIERS:|\\
\verb|\def\Missile{\censor{Liberty}}}|\\
\verb|\def\Size{\censor{80}}|\\
\verb| |\\
\verb|The {\Missile} missile, with charge diameter (CD) of|\\
\verb|{\Size}~mm, revealed a penetration capability of 1.30 1.19,|\\
\verb|and 1.37~CD in three recent tests into armor steel.|

UNCENSORED RESTRICTED OUTPUT: \hrulefill

\StopCensoring
\def\Missile{\censor{Liberty}}
\def\Size{\censor{80}}

The {\Missile} missile, with charge diameter (CD) of {\Size}~mm, revealed a
penetration capability of 1.30 1.19, and 1.37~CD in three recent tests
into armor steel.

\hrulefill

}

The only changes required of the document were at the very beginning,
among the keyword identifiers.  The primary text of the source document
remained unaltered.  Note also that the censored, unrestricted output
may also be obtained from the no-longer-unrestricted source by removing
the \verb|\StopCensoring| command at the beginning of the file.

\clearpage
\section{Miscellany}

Censoring may be dynamically turned on and off in a document with the
use of the \verb|\StopCensoring| and \verb|\RestartCensoring| commands.
In addition to these two commands, the \verb|\censor| and \verb|\censor*|
commands constitute the totality of commands available in the
\textsf{censor} package.

It is preferable not to apply \verb|\censor| to whitespace, or text
justification could be adversely affected.  If one wished to censor a
multi-word phrase, such as ``Little Bo Peep,'' it is recommended to do
it as follows:\\
\verb|   \censor{Little} \censor{Bo} \censor{Peep}|\\
If such a phrase is to be used repeatedly through a document, 
it is most convenient to place it as a keyword identifier:\\
\verb|   \def\Name{\censor{Little} \censor{Bo} \censor{Peep}}|\\
such that subsequent reference is done indirectly:\\
\verb|   We examine the life of {\Name} in this report|\\

The source code for \textsf{censor} is so short as to be included below:

\verb|\ProvidesPackage{censor}|\\
\verb|[2009/12/07 v1.00|\\
\verb| Provides capability for redaction of sensitive information]|\\
\verb||\\
\verb|\usepackage{pbox}|\\
\verb||\\
\verb|\newcommand\censor{\@ifstar{\@cenlen}{\@cenword}}|\\
\verb|  \newcommand\@cenlen[1]{\protect\rule[-.3ex]{#1 ex}{2.1ex}}|\\
\verb|  \newcommand\@cenword[1]{%|\\
\verb|              \protect\rule[-.3ex]{\widthofpbox{#1}}{2.1ex}}|\\
\verb||\\
\verb|\newcommand\un@censor{\@ifstar{\un@cenlen}{\un@cenword}}|\\
\verb|  \newcommand\un@cenlen[1]{\protect\underline{\hspace{#1 ex}}}|\\
\verb|  \newcommand\un@cenword[1]{#1}|\\
\verb||\\
\verb|\newcommand\StopCensoring{\let\censor\un@censor}|\\
\verb|\newcommand\RestartCensoring{%|\\
\verb|           \renewcommand\censor{\@ifstar{\@cenlen}{\@cenword}}}|\\
\verb||\\
\verb|\endinput|\\

\end{document}