Efficient ways to anonymize a document
Instead of writing special macros I would use the soul's package \hl
highlighting feature. On final version you can then cancel its effects out.
\documentclass{article}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{soul}
\sethlcolor{black}
\makeatletter
\newif\if@blind
\@blindtrue %use \@blindfalse on final version
\if@blind \sethlcolor{black}\else
\let\hl\relax
\fi
\title{This is my title}
\author{\hl{Y Lazarides}}
\begin{document}
\maketitle
\hl{In our paper (Jones 22)} \lipsum*[1]
\end{document}
On final version one sets the boolean \if@blind
to \@blindfalse
(in line 7).
If you just want to gobble the text rather than blank it out change the code to:
\if@blind \def\hl#1{}\else
\let\hl\relax
\fi
To summarize some of the comments, it does not appear as there is any safe and efficient way of automatically "blinding" a document. If it is important for you to make sure that you are not discriminated by someone else's prejudices, perhaps the safest bet is to hit save as
button and re-write some portions of the paper.
In general, there is more to preparing for double blind reviewing than just syntactically replacing names. It is for instance very easy to reveal one's identity by referring to "my" or "our" previous work, by citing (yet-)unpublished articles, or by otherwise discussing information that is not publicly available. Even if such obvious giveaways are avoided, there are other clues: saying that you build upon work that has been published very recently, discussing the fine points of very recent published research, citing many articles from yourself, even in the third person.
In short, you can't avoid paying attention to these issues in proofreading.
I modified Antal S-Z's answer to this question to allow text to be completely blinded - i.e. the text to hide will be removed entirely from the document such as to prevent it from showing when marking it with the mouse cursor or using some other tool to analyse the document. However, the layout and appearance of the surrounding text will remain intact (although some slight differences may appear due to changes in hyphenation).
Here is the entire code:
\documentclass{minimal}
\usepackage{soul}
\usepackage{tikz}
\usetikzlibrary{calc}
\makeatletter
\newif\if@anonymize
\@anonymizetrue % Uncomment to hide text
%\@anonymizefalse % Uncomment to show text
\if@anonymize
\newcommand{\highlight@DoHighlight}{
\fill [outer sep = -15pt, inner sep = 0pt, color=black]
($(begin highlight)+(0,8pt)$) rectangle ($(end highlight)+(0,-3pt)$) ;
}
\newcommand{\highlight@BeginHighlight}{
\coordinate (begin highlight) at (0,0) ;
}
\newcommand{\highlight@EndHighlight}{
\coordinate (end highlight) at (0,0) ;
}
\newdimen\highlight@previous
\newdimen\highlight@current
\newlength{\item@width}
\DeclareRobustCommand*\anonymize{%
\SOUL@setup
\def\SOUL@preamble{%
\begin{tikzpicture}[overlay, remember picture]
\highlight@BeginHighlight
\highlight@EndHighlight
\end{tikzpicture}%
}%
%
\def\SOUL@postamble{%
\begin{tikzpicture}[overlay, remember picture]
\highlight@EndHighlight
\highlight@DoHighlight
\end{tikzpicture}%
}%
%
\def\SOUL@everyhyphen{%
\discretionary{%
\SOUL@setkern\SOUL@hyphkern
\SOUL@sethyphenchar
\tikz[overlay, remember picture] \highlight@EndHighlight ;%
}{%
}{%
\SOUL@setkern\SOUL@charkern
}%
}%
%
\def\SOUL@everyexhyphen##1{%
\SOUL@setkern\SOUL@hyphkern
\settowidth{\item@width}{##1}%
\makebox[\item@width]{}%
\discretionary{%
\tikz[overlay, remember picture] \highlight@EndHighlight ;%
}{%
}{%
\SOUL@setkern\SOUL@charkern
}%
}%
%
\def\SOUL@everysyllable{%
\begin{tikzpicture}[overlay, remember picture]
\path let \p0 = (begin highlight), \p1 = (0,0) in \pgfextra
\global\highlight@previous=\y0
\global\highlight@current =\y1
\endpgfextra (0,0) ;
\ifdim\highlight@current < \highlight@previous
\highlight@DoHighlight
\highlight@BeginHighlight
\fi
\end{tikzpicture}%
\settowidth{\item@width}{\the\SOUL@syllable}%
\makebox[\item@width]{}%
\tikz[overlay, remember picture] \highlight@EndHighlight ;%
}%
\SOUL@
}
\else
\newcommand{\anonymize}[1]{#1}
\fi
\makeatother
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet urna
nulla. Nam placerat risus quis elit placerat consectetur a in magna. Ut vitae
urna vitae urna sagittis mollis sed a velit. \anonymize{Phasellus enim tellus,
dictum nec sagittis sit amet, viverra at leo.} Pellentesque faucibus orci non
urna facilisis sed venenatis lacus ultricies. In in diam ut massa sodales
consequat at ut mi. Mauris pharetra tortor et nunc iaculis aliquet sodales
turpis convallis. Pellentesque habitant morbi tristique senectus et netus et
malesuada fames ac turpis egestas. \anonymize{Morbi vulputate}, risus non
accumsan vulputate, justo mauris pretium lorem, nec rhoncus mi nisl sit amet
lacus. Aenean metus nunc, sagittis in dictum sed, facilisis sit amet ante. Fusce
enim lorem, pharetra non congue a, vehicula id metus. Nam facilisis, velit
condimentum volutpat tristique, elit elit tristique est, a varius nulla purus
non mi. Nam elementum viverra ligula sit amet hendrerit. Aenean sit amet tempus
turpis. Suspendisse at risus quis eros semper cursus.
\anonymize{Nunc eleifend, augue non lacinia sagittis, lorem elit ullamcorper
libero, non placerat massa lectus vel nisi. Phasellus nunc elit, porttitor
tempor placerat et, semper sed leo. Integer commodo molestie pretium. Ut eu
dolor velit. Phasellus sed dui nunc. Donec iaculis est eu felis accumsan
sodales. Vivamus hendrerit dignissim faucibus.}
In congue condimentum metus in ornare. Etiam at diam vitae mi laoreet
consectetur. \anonymize{Curabitur at turpis commodo nisi tempus tincidunt. Nam
vestibulum lacinia mi, vitae auctor erat consequat ac.} Phasellus semper
blandit orci ac varius. Praesent et magna a mi faucibus porta a non libero. Cum
sociis natoque penatibus et magnis dis parturient montes, \anonymize{nascetur}
ridiculus mus. Nulla facilisi. Nullam commodo volutpat ante ac ornare. Donec
convallis diam accumsan ipsum porta eu elementum leo lacinia. Cras tincidunt
semper mauris, ut mollis lectus consectetur quis. \anonymize{Pellentesque sem
urna}, fringilla eget faucibus quis, condimentum nec mi. Quisque odio felis,
fermentum quis feugiat placerat, dapibus vitae massa. \anonymize{Ut semper elit
eget dolor imperdiet posuere.}
\end{document}
And here is an example showing a text with and without anonymization. The setting can be controlled by simple commenting and uncommenting two lines of code.
With anonymity:
Without anonymity: