LaTeX revision hacks

The text of this pdf (below) provides an overview of how to use automated line referencing and updatable block quotes within a revised manuscript and in writing a letter of response to an editor. The .tex used to generate this pdf follows below. I have structured this to include a mock “first draft” and mock “revised draft” — make sure to look at the revised version for a more complete description of the methods (my mock reviewers suggested adding additional details!).

For an even more detailed look at the use of these methods, check out the .tex below that includes the commands I used to generate the pdf (complete with line references and quote blocks).

Disclaimer: I just started learning LaTeX – please excuse any unintentional breaks with tradition or coding format!

PDF: Original draft, revised draft, and response to reviewer comments
responseletter_hacks

 

.tex code

% text quoting solution from https://github.com/krlmlr/lm-template/tree/quotedtext (Kirill Müller)

% line referencing solution from http://seananderson.ca/2013/04/28/cross-referencing-reviewer-replies-in-latex.html (Sean Anderson)

% easy double-quotes method from http://tex.stackexchange.com/questions/36812/isnt-there-any-other-way-of-doing-double-quotes-in-latex-besides

\documentclass[12pt]{article}
\usepackage{framed} % to add frames around comments
\usepackage{parskip} % to skip paragraph indentation
\usepackage[affil-it]{authblk} % for title page
\usepackage{lineno}\linenumbers % add line numbers to whole document
\usepackage{hyperref} % to enable hyperlinks
\usepackage{fullpage} % less white margin space

% line referencing
\newcommand{\R}[1]{\label{#1}\linelabel{#1}} % use this to set the placement of the line reference tags
\newcommand{\lr}[1]{page~\pageref{#1}, line~\lineref{#1}} % use this to reference the tags (print line numbers)

% quoting
\newcommand\declquotedtext[2]{\expandafter\def\csname quotedtext@#1 \endcsname{#2}} %use around text you may want to quote later, but don’t want printed in the main text
\newcommand\defquotedtext[2]{\declquotedtext{#1}{#2}#2} %use around text you want to appear in the main text and that you want to quote later
\newcommand\usequotedtext[1]{\csname quotedtext@#1 \endcsname} %use to print the quoted text

\newcommand{\q}[1]{“#1”} % easier way to get double quotes

\begin{document}
\sffamily %sets text to sans
\title{Fancy tricks and hacks for responding to reviewer comments in LaTeX}
\author{Elizabeth A. Hobson}
\affil{{\small{\textnormal{Postdoctoral Fellow} \\ \textnormal{National Institute for Mathematical and Biological Synthesis, Knoxville, TN, USA} \\\textnormal{email: ehobson@nimbios.org} \\\textnormal{\url{website: https://sites.google.com/site/hobsonresearch}}}}}
\maketitle

\section*{Original draft}

Responding carefully and thoroughly to reviewer comments is an essential part of the manuscript revision process. But, it also includes some of the most annoying and tedious aspects. Many editors request a thorough response that addresses each reviewer comment and provides the line number in the revised draft that indicates where the change was made. For me, making sure these line number references are correct is one of the most annoying steps. I had been doing all of my writing in Word and using the built in line numbers to reference in my response letter. However, it’s hard to get these line references completely correct when moving back and forth between documents or within a long document. More importantly, even when I have carefully added all the line number references to each comment and proofed them all, I inevitably find edits I need to make in the text and this also inevitably messes up the line numbering, and I need to readjust all of the line references in my response letter. There had to be a better way!

I recently have been working on writing in LaTeX. While it does have somewhat of a learning curve, there are some really great things about it. One is the ability to define your own commands. I had a suspicion that there was some way of streamlining the revision/response process using LaTeX. A lot of Googling and asking office- and hall-mates later, and I’ve compiled some really nice \q{hacks} that make this process a lot more efficient.

\subsection*{LaTeX hacks}
I had two goals: (1) find a method for automatically inserting line number references that would update the line numbers as I revised, and (2) find a method for quoting a block of text from the revised draft.

I found two nice descriptions of methods for accomplishing these hacks:

(1) automated line referencing, from Sean Anderson: \url{http://seananderson.ca/2013/04/28/cross-referencing-reviewer-replies-in-latex.html}
\\
\\
(2) quoting text, from Kirill M{\”u}ller: \url{https://github.com/krlmlr/lm-template/tree/quotedtext}

\section*{Revised draft}

Responding carefully and thoroughly to reviewer comments is an essential part of the manuscript revision process. \R{R1-01st}\defquotedtext{R1-01q}{Many editors request a thorough response that addresses each reviewer comment and provides the line number in the revised draft that indicates where the change was made. Getting these line references correct can make it easier for editors to find and review changes, while getting them wrong can cause needless confusion and annoyance. For authors, making sure these line number references are correct in the response letter is one of the most tedious steps in the revision process.}\R{R1-01en}

I had been doing all of my writing in Word and using the built in line numbers to reference in my response letter. However, it’s hard to get these line references completely correct when moving back and forth between documents or within a long document. More importantly, even when I have carefully added all the line number references to each comment and proofed them all, I inevitably find edits I need to make in the text and this also inevitably messes up the line numbering, and I need to readjust all of the line references in my response letter. There had to be a better way!

\R{R1-02}\defquotedtext{R1-02q}{I recently transitioned to LaTeX for most of my manuscript drafting.} While it does have somewhat of a learning curve, there are some really great things about it. One is the ability to define your own commands. I had a suspicion that there was some way of streamlining the revision/response process using LaTeX. A lot of Googling and asking office- and hall-mates later, and I’ve compiled some really nice \q{hacks}.

\subsection*{LaTeX hacks explained}
I had two goals: (1) find a method for automatically inserting line number references that would update the line numbers as I revised, and (2) find a method for quoting a block of text from the revised draft that would update in case of further revisions within the block.

I found two nice descriptions of methods for accomplishing these hacks:

\subsubsection*{Automated line referencing}
\R{R2-01st}Sean Anderson has a nice tutorial on using automated line referencing, and it is the method I’ve used here. See \url{http://seananderson.ca/2013/04/28/cross-referencing-reviewer-replies-in-latex.html} for his full tutorial.

To use the automated line referencing, you just need to define two new commands in the preamble:
\begin{framed}\begin{verbatim}\newcommand{\R}[1]{\label{#1}\linelabel{#1}}
\newcommand{\lr}[1]{page~\pageref{#1}, line~\lineref{#1}}\end{verbatim}\end{framed}

The first command is used to set the placement of the line reference tags in the revised text and the second command is used to print the line references.

Then all you need to do is insert \begin{verbatim} \R{yourtag}\end{verbatim} wherever you want to pull a line reference from in the revised text and \begin{verbatim} \lr{yourtag}\end{verbatim} in your response letter wherever you want to print the line reference. These tags need to be unique for each line you want to reference, but you can reference the same line multiple times in the response letter, if for example you want to refer to the same line in different parts of the response.

\subsubsection*{Quoting text}
Kirill M{\”u}ller posted code for quoting text, and it is the method I’ve used here. See \url{https://github.com/krlmlr/lm-template/tree/quotedtext} for the full example code.

To use the automated text quoting, you need to define three new commands in the preamble:
\begin{framed}\begin{verbatim}\newcommand\declquotedtext[2]{\expandafter\def\csname quotedtext@#1 \endcsname{#2}}
\newcommand\defquotedtext[2]{\declquotedtext{#1}{#2}#2}
\newcommand\usequotedtext[1]{\csname quotedtext@#1 \endcsname}\end{verbatim}\end{framed}

The first is to tag text you may want to quote later, but don’t want printed in the main text. The second is used around text you want to appear in the main text and that you want to quote later. The third is used to print these quotes. Again, you’ll need a unique tag for each unique quote.

\subsubsection*{Notes on organizing comments / revisions}
Both methods above require unique tags to refer to specific lines or quotes to be printed later. I usually go through the reviewer comments and use a combination of Reviewer number and comment number to assign unique tags to each comment. Usually I use something like \q{R1-01}, where \q{R1} indicates the reviewer number (i.e. Reviewer 1 or Reviewer 2, etc.) and \q{-01} indicates the tag for that reviewer’s comment. Then \q{R1-01} is Reviewer 1’s first comment and \q{R2-03} is Reviewer 2’s third comment.

Then I can add additional text to the end of these tags to indicate sub-comments or the start/end of a block of changed text. To specify the location of a block of text (start and end line numbers), add \q{st} for the where I want to pull the starting line number from and \q{en} for where the end line number reference should be. So, \q{R1-01st} would be the start position of the line reference corresponding to Reviewer 1’s first comment and \q{R1-01en} would be the ending position of the line reference for that comment. Then I can use the start and end tags to specify the range of lines for a particular comment like:
\begin{verbatim}(see text \lr{R1-01st} to \lr{R1-01en})\end{verbatim}

I also sometimes use \q{q} to specify quoted text — this just ensures I don’t get conflicts with the regular comment key, which only happens in a few instances. So I’d have a tag like: \begin{verbatim}\defquotedtext{R1-01q}\end{verbatim}

I also use these comment tags as subsection titles for each comment. This makes it easier to jump back and forth between sections because the comments than each appear in the document structure. I can also comment out comments that I have finished responding to using \q{\%} before the subsection title, which helps me keep track of the comments that still need my attention vs. the ones I’ve finished.

\subsubsection*{Additional tips}
Tags for line references should be outside of brackets for quoting text.

There are other ways of quoting text (see \url{http://tex.stackexchange.com/questions/57223/automating-quoting-across-latex-documents} for many more ideas). However, many methods I found require separate documents (i.e. quoting a block of text from text1.tex to text2.tex). I wanted to find something that would work within a single document. \R{R2-01en}

\section*{Conclusions}
I hope these methods will save others time and reduce some of the annoying aspects of the revision process.

\newpage
\section*{Response to reviewer comments}
We thank the reviewers for their helpful comments. Below, we provide each comment (framed) followed by our response.

\subsection*{Reviewer 1}
\begin{framed}The goal of this manuscript is to provide ideas for minimizing the tedious or annoying aspects of responding to reviewer comments, while increasing the accuracy of responses and decreasing problems for editors. The author does a nice job of providing these suggestions, and the manuscript, with some small changes, would be very helpful and suitable for distribution. Below, I summarize my specific comments.\end{framed}

\textbf{Reviewer 1 line comments:}

%\subsubsection*{R1-01}
\begin{framed}Line 11: Rephrase for clarity to emphasize the annoying parts of the revision process, not that revising in general is annoying.\end{framed}
Response: Text was changed as recommended and now reads: \q{\usequotedtext{R1-01q}} (\lr{R1-01st} to \lr{R1-01en}).

%\subsubsection*{R1-02}
\begin{framed}Line 21: Rephrase sentence to be less informal\end{framed}
Response: Rephrased sentence to increase formality. Sentence now reads: \q{\usequotedtext{R1-02q}} (\lr{R1-02}).

\subsection*{Reviewer 2}
\begin{framed}The author summarizes several time-saving methods for responding to reviewer comments. These hacks will be useful to researchers who use LaTeX to draft their manuscripts. However, more details are needed to make this user friendly, as specified below.\end{framed}

\textbf{Reviewer 2 line comments:}

%\subsubsection*{R2-01}
\begin{framed}Page 1, Section \q{LaTeX hacks}: Please provide additional details about how to use these commands, especially for people less experienced with LaTeX.\end{framed}
Response: I added a lot more description about how to use the commands (see \lr{R2-01st} to \lr{R2-01en}).

\end{document}