Using Editorial Comments in Latex
Ever wonder how you can effectively insert comments into your own
LateX output, and easily turn those comments on or off? Here's a useful trick.
Insert this code into the top of your document:
\usepackage{ifthen}
\usepackage{amssymb}
\newboolean{hidecomments}
\setboolean{hidecomments}{false}
\ifthenelse{\boolean{hidecomments}}
{\newcommand{\nb}[2]{}}
{\newcommand{\nb}[2]{
\fbox{\bfseries\sffamily\scriptsize#1}
{\sf\small$\blacktriangleright$
{#2} $\blacktriangleleft$}}}
Insert this line as well, using your own initials, rather than emh (in both places):
\newcommand\emh[1]{\nb{EMH}{#1}}
Now, anywhere you want to comment, do the following.
Emerson is a handsome devil.
\emh{find a citation for this!}
Here's the result:
One advantage of this scheme is that you can keep track of an arbitrary number of commenters:
\newcommand\gcm[1]{\nb{GCM}{#1}}
\newcommand\gk[1]{\nb{GK}{#1}}
The second big advantage is you can turn comments off and on in the final output by changing the
hidecomments
to true. You would want to turn this off in the submitted version of your document.
Andrew Black showed me this trick. I'm not sure where he got it from.
>
He most likely got it from Oscar Nierstrasz. -- Main.aakuhn - 06 Oct 2011
Full Code:
\documentclass{article}
\usepackage{ifthen}
\usepackage{amssymb}
\newboolean{hidecomments}
\setboolean{hidecomments}{false}
\ifthenelse{\boolean{hidecomments}}
{\newcommand{\nb}[2]{}}
{\newcommand{\nb}[2]{
\fbox{\bfseries\sffamily\scriptsize#1}
{\sf\small$\blacktriangleright$
{#2} $\blacktriangleleft$}}}
\newcommand\emh[1]{\nb{EMH}{#1}}
\newcommand\gcm[1]{\nb{GCM}{#1}}
\begin{document}
Emerson is a handsome devil.
\emh{find a citation for this!}
\gcm{yea!}
\end{document}
-- Main.emhill - 07 Jun 2009