Tags:
create new tag
view all tags

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:

comments.png

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

Topic attachments
I Attachment History Action Size Date Who Comment
PDFpdf MakingVectorizedFiguresinLatexusingMSOffice2007.pdf r1 manage 621.0 K 2009-06-07 - 02:45 UnknownUser Describes how to make a vectorized figure.
PNGpng comments.png r1 manage 3.7 K 2009-06-07 - 02:03 UnknownUser  
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r2 - 2011-10-06 - aakuhn
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback