From 3225c190bb874fa17c648d7e7a4a5f9340b37eff Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 11 Dec 2009 17:26:57 +0000 Subject: new package censor 1.00 (9dec09) git-svn-id: svn://tug.org/texlive/trunk@16365 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/censor/README | 7 + Master/texmf-dist/doc/latex/censor/censor.pdf | Bin 0 -> 73222 bytes Master/texmf-dist/doc/latex/censor/censor.tex | 264 ++++++++++++++++++++++++++ Master/texmf-dist/tex/latex/censor/censor.sty | 69 +++++++ 4 files changed, 340 insertions(+) create mode 100644 Master/texmf-dist/doc/latex/censor/README create mode 100644 Master/texmf-dist/doc/latex/censor/censor.pdf create mode 100644 Master/texmf-dist/doc/latex/censor/censor.tex create mode 100644 Master/texmf-dist/tex/latex/censor/censor.sty (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/censor/README b/Master/texmf-dist/doc/latex/censor/README new file mode 100644 index 00000000000..0fc23ac08a7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/censor/README @@ -0,0 +1,7 @@ +The 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. + +Author: Steven Segletes \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/censor/censor.pdf b/Master/texmf-dist/doc/latex/censor/censor.pdf new file mode 100644 index 00000000000..d223b38ea96 Binary files /dev/null and b/Master/texmf-dist/doc/latex/censor/censor.pdf differ diff --git a/Master/texmf-dist/doc/latex/censor/censor.tex b/Master/texmf-dist/doc/latex/censor/censor.tex new file mode 100644 index 00000000000..1cd93cb0b40 --- /dev/null +++ b/Master/texmf-dist/doc/latex/censor/censor.tex @@ -0,0 +1,264 @@ +\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} diff --git a/Master/texmf-dist/tex/latex/censor/censor.sty b/Master/texmf-dist/tex/latex/censor/censor.sty new file mode 100644 index 00000000000..7afa369ddfd --- /dev/null +++ b/Master/texmf-dist/tex/latex/censor/censor.sty @@ -0,0 +1,69 @@ +% censor.sty +% Copyright Steven B. Segletes +\ProvidesPackage{censor} +[2009/12/07 v1.00 + Provides capability for redaction of sensitive information] + +% CHOOSE MODE OF OPERATION: +% 1) IF .tex FILE IS CREATED IN PRIVATE (SECURE) ENVIRONMENT: +% a) To produce censored document, censor individual words with +% \censor{word} +% b) To produce uncensored document, place \StopCensoring in preamble +% c) To produced a mixed document with some redaction, but elsewhere +% turned off, place \StopCensoring and/or \RestartCensoring in +% various document locations as needed. +% +% DISCLAIMER: Don't \censor whitespace (i.e., phrases), or justifications +% could get fouled up. If space-laden phrase needs repeated censoring, +% I suggest typesetting according to the following example: +% \def\CodeName{\censor{Little} \censor{Bo} \censor{Peep}} +% In the text, refer to {\CodeName} as often as needed. +% +% 2) IF .tex FILE IS INITIALLY CREATED IN PUBLIC (UNSECURE) ENVIRONMENT: +% a) To produce censored document, define (in the document preamble) +% placeholders for all censored phrases, like: +% \def\ProjectName{\censor*{7}} +% In document, refer to {\ProjectName} as needed. The "7" refers +% to the approximate width (in ex's) of the censored word. +% b) Use of \StopCensoring in preamble will merely turn censored +% black rectangles into underlined blank spaces, since uncensored +% word is not known to the public source (.tex) document. +% c) To produce uncensored document, the source code must be moved +% to a private (secure) working environment. At that point, the +% uncensored document may be created merely by editing the document +% preamble and redefining the censored placeholders, so that +% \def\ProjectName{\censor*{7}} becomes \def\ProjectName{Liberty}, +% for example. Note that line justification could be affected, since +% censored placeholders are not exactly the same width as the +% actual word, in Mode 2 operation. +% d) To produced (in the private/secure environment) a mixed document +% with some redaction, but elsewhere turned off, place \StopCensoring +% and/or \RestartCensoring in various document locations as needed. +% +% DISCLAIMER: Don't \censor whitespace (i.e., phrases), or justifications +% could get fouled up. I suggest typesetting multi-word phrases according +% to the following example: +% \def\CodeName{\censor*{6} \censor*{2} \censor*{4}} +% In the text, refer to {\CodeName} as often as needed. +% +% NOTE: For both modes of operation, placeholders are placed in curly +% braces, so that surrounding white space and/or punctuation is properly +% handled. + +\usepackage{pbox} + +\newcommand\censor{\@ifstar{\@cenlen}{\@cenword}} + \newcommand\@cenlen[1]{\protect\rule[-.3ex]{#1 ex}{2.1ex}} + \newcommand\@cenword[1]{% + \protect\rule[-.3ex]{\widthofpbox{#1}}{2.1ex}} + +\newcommand\un@censor{\@ifstar{\un@cenlen}{\un@cenword}} + \newcommand\un@cenlen[1]{\protect\underline{\hspace{#1 ex}}} + \newcommand\un@cenword[1]{#1} + +\newcommand\StopCensoring{\let\censor\un@censor} +\newcommand\RestartCensoring{% + \renewcommand\censor{\@ifstar{\@cenlen}{\@cenword}}} + +\endinput + -- cgit v1.2.3