One option is to use newcommand
and renewcommand
in conjunction:
\documentclass{article}
\newcommand{\confidential}[1]{#1}
\renewcommand{\condidential}[1]{} %Comment out this whole line to surpress exclusion.
\begin{document}
His name was \confidential{Frank}.
\end{document}
One advantage with this method is that you easily can style the text in different ways, and you can put a standard message to appear whenever something is excluded.
For example:
\newcommand{\confidential}[1]{\textbf{#1}}
makes all the included, confidential information appear in bold.
Further,
\renewcommand{\condidential}[1]{\textbf{CONFIDENTIAL}}
makes all the confidential information, when excluded, replaced with a placeholder which says: CONFIDENTIAL.
You can also easily set up different environments for different needs. For example, if you want to have different levels of confidentiality, you can have a \superConfidential
environment in addition to the \confidential
environment.
\phantom
): Censor text spanning multiple lines. Thesoul
package provided a good solution to tapping into the line breaking.