latex research
Written by Daniel Herber on April 3, 2018.
The code for [ResponseTemplate](blogs/latex/post_7/ResponseTemplate.tex) and [ResponseLetter](blogs/latex/post_7/ResponseLetter.tex) are available. A working example is available on Overleaf at [[link]](https://www.overleaf.com/read/vyvyzmfxvxnp).
---
### Description
To include the response template environments and style options, simply include [ResponseTemplate.tex](blogs/latex/post_7/ResponseTemplate.tex) in your preamble (or copy the source code):
```tex
\input{ResponseTemplate}
```
Below is a summary of what is available:
- A reviewer environment that is intended to mark comments made by the reviewers.
```tex
\begin{reviewer}
This is where you can put the reviewer comments.
\end{reviewer}
```
- A response environment that is intended to mark your response to the reviewer.
```tex
\begin{response}
This is where you can put your response.
\end{response}
```
- A change environment that is intended to mark your changes in the manuscript.
```tex
\begin{change}
This is where you can put your change.
\end{change}
```
- Custom commands to highlight changes in the text (```\xrev{}``` and ```\xrevmath{}```) and to mark places the need to be addressed (```\xneed{}```).
- Loading of a number of standard packages including amsmath, amsthm, amssymb, amsfonts, babel, bm, enumitem, fontenc, graphicx, lmodern, ulem, parskip, geometry, xcolor, tcolorbox, and blindtext.
- Customizable header and footers using the fancyhdr package.
- Customized equation spacing
To include the response letter, simply modify [ResponseLetter.tex](blogs/latex/post_7/ResponseLetter.tex) to your liking and then include the file in your document at the proper location:
```tex
\input{ResponseLetter}
```
---
### Example
The code in this section demonstrates the available environments and how I typically utilize them.
A working example is available on Overleaf at [[link]](https://www.overleaf.com/read/vyvyzmfxvxnp).
Note that the PDF includes some additional content to demonstrate the breakable nature of the boxes and the letter.
PDF: [example](blogs/latex/post_7/ResponseTemplate_example.pdf)
PNG:
[](blogs/latex/post_7/ResponseTemplate_example.png){data-lightbox="blog_imgs" data-title="Response template example."}
Code for the example:
```tex
\documentclass[12pt,letterpaper]{article}
\input{ResponseTemplate}
\begin{document}
\newgeometry{top=1.25in, bottom=1.25in, left=1.5in, right=1.5in}
\pagestyle{fancy} % activates fancyhdr
\subsection*{Reviewer 1}
\begin{reviewer}
This is where you can put the reviewer comments.
\end{reviewer}
\begin{response}
This is where you can put your response.
\end{response}
\begin{change}
This is where you can put your change where the command \texttt{\textbackslash xrev} can be used to highlight the \xrev{specific changes}.%
\begin{align}
\xrevmath{e^{i \pi}} + 1 = 0 \tag{5}
\end{align}
\end{change}
\end{document}
```
---
### Source Code
Below is the source code for [ResponseTemplate](blogs/latex/post_7/ResponseTemplate.tex). Some of the code is based on the answers at [[link]](https://tex.stackexchange.com/questions/300837).
```tex
% Response template
% Written by Daniel R. Herber
% Please see http://www.danielherber.com/latex.php?option=post_7
% necessary packages
\usepackage{geometry} % customize page layout
\usepackage{xcolor} % defines colors
\usepackage[most]{tcolorbox} % colored and framed text boxes
\usepackage{blindtext} % produces text for testing
% colors
\definecolor{block-gray}{gray}{0.95}
% spacing
\AtBeginDocument{%
\abovedisplayskip=4pt plus 1pt minus 1pt
\abovedisplayshortskip=0pt plus 3pt
\belowdisplayskip=4pt plus 1pt minus 1pt
\belowdisplayshortskip=0pt plus 3pt
}
% custom commands
\newcommand{\xrev}[1]{\textcolor{red}{\textbf{#1}}} % changes in text mode
\newcommand{\xrevmath}[1]{\textcolor{red}{#1}} % changes in math mode
\newcommand{\xneed}{\textcolor{blue}{\textbf{NEED}}} % marking places to address
% environments
\newtcolorbox{xreviewer}{%
empty,
borderline west = {4pt}{0pt}{gray},
boxrule = 0pt,
boxsep = 0pt,
breakable,
colback = block-gray,
enhanced,
frame hidden,
left skip = 0pt,
notitle,
parbox = false,
sharp corners,
}
\newtcolorbox{xresponse}{%
empty,
boxsep = 0pt,
breakable,
frame hidden,
notitle,
parbox = false,
}
\newtcolorbox{xchange}{%
boxrule = 1pt,
boxsep = 0pt,
breakable,
colframe = black,
enhanced jigsaw,
interior hidden,
notitle,
parbox = false,
}
\newenvironment{reviewer}{\begin{xreviewer}}{\end{xreviewer}}
\newenvironment{response}{\begin{xresponse}\textbf{Authors' response:}}{\end{xresponse}}
\newenvironment{change}{\begin{xchange}}{\end{xchange}}
% common packages
\usepackage{amsmath, amsthm, amssymb, amsfonts} % math stuff
\usepackage[american]{babel} % culturally determined typographical rules
\usepackage{bm} % advanced bold symbols
\usepackage{enumitem} % controls enumerate, itemize, and description
\usepackage[T1]{fontenc} % select font encodings
\usepackage{graphicx} % improves \includegraphics
\usepackage{lmodern} % enhanced Computer Modern fonts
\usepackage[normalem]{ulem} % various types of underlining and strikeout
\usepackage{parskip} % layout with zero \parindent, non-zero \parskip
% --- fancyhdr ---------------------------------
\usepackage{fancyhdr} % construct headers and footers
\usepackage{lastpage} % reference to the last page
\lhead{\footnotesize Paper \#} % left header
\chead{\footnotesize Reviewer Comments and Response} % center header
\rhead{\footnotesize \thepage~of~\pageref{LastPage}} % right header
\lfoot{} % left footer
\cfoot{} % center footer
\rfoot{} % right footer
\renewcommand{\headrulewidth}{0pt} % remove the header line
```