Blacked-out text in LaTeX
Alec Jacobson
November 28, 2010
Here's a small command you can add to your LaTeX document's header that will let you "blackout" text like a censored Watergate era document.
\newlength{\blackoutwidth}
\newcommand{\blackout}[1]
{%necessary comment
\settowidth{\blackoutwidth}{#1}%necessary comment
\rule[-0.3em]{\blackoutwidth}{1.125em}%necessary comment
}
The command is easy to use and automatically adjusts to the word or phrase that should be blacked out, as long as it's not longer than a line. Here's an example of \blackout in use:
The above can be compiled from the following LaTeX document:
\documentclass[letterpaper,11pt]{article}
\newlength{\blackoutwidth}
\newcommand{\blackout}[1]
{%necessary comment
\settowidth{\blackoutwidth}{#1}%necessary comment
\rule[-0.3em]{\blackoutwidth}{1.125em}%necessary comment
}
\begin{document}
\noindent
{\tiny Deep Throat's true identity is \blackout{Mark Felt}. \\
Deep Throat's true identity is Mark Felt.}\\
{\small Deep Throat's true identity is \blackout{Mark Felt}. \\
Deep Throat's true identity is Mark Felt.}\\
Deep Throat's true identity is \blackout{Mark Felt}. \\
Deep Throat's true identity is Mark Felt. \\
{\bf Deep Throat's true identity is \blackout{Mark Felt}. \\
Deep Throat's true identity is Mark Felt.}\\
\emph{ Deep Throat's true identity is \blackout{Mark Felt}. \\
Deep Throat's true identity is Mark Felt.}\\
{\Large Deep Throat's true identity is \blackout{Mark Felt}. \\
Deep Throat's true identity is Mark Felt.}\\
{\huge Deep Throat's true identity is \blackout{Mark Felt}. \\
Deep Throat's true identity is Mark Felt.}\\
\end{document}