% Taken from https://github.com/mschroen/review_response_letter
% GNU General Public License v3.0

\documentclass[$if(class)$$class$$endif$]{article}

\usepackage[includeheadfoot,top=20mm, bottom=20mm, footskip=2.5cm]{geometry}

% Typography
\usepackage[T1]{fontenc}
\usepackage{times}
%\usepackage{mathptmx} % math also in times font
\usepackage{amssymb,amsmath}
\usepackage{microtype}
\usepackage[utf8]{inputenc}

% Misc
\usepackage{graphicx}
\usepackage[hidelinks]{hyperref} %textopdfstring from pandoc
\usepackage{soul} % Highlight using \hl{}

% Table

\usepackage{adjustbox} % center large tables across textwidth by surrounding tabular with \begin{adjustbox}{center}
\renewcommand{\arraystretch}{1.5} % enlarge spacing between rows
\usepackage{caption}
\captionsetup[table]{skip=10pt} % enlarge spacing between caption and table

% Section styles

\usepackage{titlesec}
\titleformat{\section}{\normalfont\large}{\makebox[0pt][r]{\bf \thesection.\hspace{4mm}}}{0em}{\bfseries}
\titleformat{\subsection}{\normalfont}{\makebox[0pt][r]{\bf [RC \thesubsection.]\hspace{4mm}}}{0em}{\bfseries}
\titlespacing{\subsection}{0em}{1em}{-0.3em} % left before after

% Paragraph styles

\setlength{\parskip}{0.6\baselineskip}%
\setlength{\parindent}{0pt}%

% Quotation styles
\usepackage[usenames,dvipsnames]{xcolor}

$if(cutout-quotes)$
\usepackage[most]{tcolorbox}
\usetikzlibrary{decorations.pathmorphing}
\newtcolorbox{quotebox}[1][]{enhanced,
fonttitle=\sffamily\bfseries,boxrule=0pt,arc=0pt,colframe=white, boxsep=4mm, colback=white, left=0mm, right = 0mm, enlarge top by=0.25cm, enlarge bottom by=0.25cm,
borderline north={0.25mm}{0mm}{black!25!white, decorate,
decoration={coil,aspect=0}},
borderline east={0.25mm}{0mm}{black!25!white},
borderline south={0.25mm}{0mm}{black!25!white, decorate,
decoration={coil,aspect=0}},
borderline west={0.25mm}{0mm}{black!25!white},
#1}
$else$
% \usepackage{xcolor}
\newenvironment{quotebox}
  {\def\FrameCommand{
	\fboxsep=0.6em % box to text padding
	\fcolorbox{black!25!white}{white}}%
	% the "2" can be changed to make the box smaller
    \MakeFramed {\advance\hsize-2\width \FrameRestore}
    \begin{minipage}{\linewidth}
  }
  {\end{minipage}\endMakeFramed}
$endif$

\usepackage{framed}
\let\oldquote=\quote
\let\endoldquote=\endquote
\renewenvironment{quote}{\begin{quotebox}\advance\leftmargini -2.4em\begin{oldquote}}{\end{oldquote}\end{quotebox}}


% Table styles

\let\oldtabular=\tabular
\let\endoldtabular=\endtabular
\renewenvironment{tabular}[1]{\begin{adjustbox}{center}\begin{oldtabular}{#1}}{\end{oldtabular}\end{adjustbox}}


% Shortcuts

%% Let textbf be both, bold and italic
%\DeclareTextFontCommand{\textbf}{\bfseries\em}

%% Add RC and AR to the left of a paragraph
%\def\RC{\makebox[0pt][r]{\bf RC:\hspace{4mm}}}
%\def\AR{\makebox[0pt][r]{AR:\hspace{4mm}}}

%% Define that \RC and \AR should start and format the whole paragraph
\usepackage{suffix}
\long\def\RC#1\par{\makebox[0pt][r]{\bf RC:\hspace{4mm}}{\bf #1}\par\makebox[0pt][r]{AR:\hspace{10pt}}} %\RC
\WithSuffix\long\def\RC*#1\par{{\bf #1}\par} %\RC*
% \long\def\AR#1\par{\makebox[0pt][r]{AR:\hspace{10pt}}#1\par} %\AR
\WithSuffix\long\def\AR*#1\par{#1\par} %\AR*


\newlength{\emptysubsection}
\setlength{\emptysubsection}{0.9em}
\addtolength{\emptysubsection}{\parskip}

\newenvironment{reviewer}{%
\subsection{}
\vspace{-\emptysubsection}
\bfseries
}{}



%%%
%DIF PREAMBLE EXTENSION ADDED BY LATEXDIFF
%DIF UNDERLINE PREAMBLE %DIF PREAMBLE
\RequirePackage[normalem]{ulem} %DIF PREAMBLE
\RequirePackage{color} %DIF PREAMBLE
\definecolor{offred}{rgb}{0.867, 0.153, 0.153} %DIF PREAMBLE
\definecolor{offblue}{rgb}{0.0705882352941176, 0.168627450980392, 0.717647058823529} %DIF PREAMBLE
\providecommand{\DIFdel}[1]{{\protect\color{offred}\sout{#1}}} %DIF PREAMBLE
\providecommand{\DIFadd}[1]{{\protect\color{offblue}\uwave{#1}}} %DIF PREAMBLE
%DIF SAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFaddbegin}{} %DIF PREAMBLE
\providecommand{\DIFaddend}{} %DIF PREAMBLE
\providecommand{\DIFdelbegin}{} %DIF PREAMBLE
\providecommand{\DIFdelend}{} %DIF PREAMBLE
%DIF FLOATSAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFaddFL}[1]{\DIFadd{#1}} %DIF PREAMBLE
\providecommand{\DIFdelFL}[1]{\DIFdel{#1}} %DIF PREAMBLE
\providecommand{\DIFaddbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFaddendFL}{} %DIF PREAMBLE
\providecommand{\DIFdelbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFdelendFL}{} %DIF PREAMBLE
%DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF

% Fix pandoc related tight-list error
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

% Add task difficulty and assignment commands from https://github.com/cdc08x/letter-2-reviewers-LaTeX-template
% \usepackage[usenames,dvipsnames]{xcolor}
\usepackage{ifdraft}

\newcommand{\TaskEstimationBox}[2]{%
\ifoptiondraft{\parbox{1.0\linewidth}{\hfill \hfill {\colorbox{#2}{\color{White} \textbf{#1}}}}}%
{}%
}
%
\def\WorkInProgress {\TaskEstimationBox{Work in progress}{Cyan}}
\def\AlmostDone {\TaskEstimationBox{Almost there}{NavyBlue}}
\def\Done {\TaskEstimationBox{Done}{Blue}}
%
\def\NotEstimated {\TaskEstimationBox{Effort not estimated}{Gray}}
\def\Easy {\TaskEstimationBox{Feasible}{ForestGreen}}
\def\Medium {\TaskEstimationBox{Medium effort}{Orange}}
\def\TimeConsuming {\TaskEstimationBox{Time-consuming}{Bittersweet}}
\def\Hard {\TaskEstimationBox{Infeasible}{Black}}
%
\newcommand{\Assignment}[1]{
%
\ifoptiondraft{%
\vspace{.25\baselineskip} \parbox{1.0\linewidth}{\hfill \hfill \vspace{.25\baselineskip} \normalfont{Assignment:} \normalfont{\textbf{#1}}}%
}{}%
}

$if(manuscript-tex)$
\usepackage{xr}
\externaldocument{$manuscript-tex$}
$endif$

$for(header-includes)$
  $header-includes$
$endfor$


$if(csl-refs)$
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newlength{\cslentryspacingunit} % times entry-spacing
\setlength{\cslentryspacingunit}{\parskip}
\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
 {% don't indent paragraphs
  \setlength{\parindent}{0pt}
  % turn on hanging indent if param 1 is 1
  \ifodd #1
  \let\oldpar\par
  \def\par{\hangindent=\cslhangindent\oldpar}
  \fi
  % set entry spacing
  \setlength{\parskip}{#2\cslentryspacingunit}
 }%
 {}
\usepackage{calc}
\newcommand{\CSLBlock}[1]{#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$

\begin{document}

{\Large\bf Author response to reviews of}\\[1em]
$if(manuscript-id)$Manuscript $manuscript-id$\\ \\$endif$
$if(title)${\Large $title$}\\[1em]$endif$
$if(authors)${$authors$}\\$endif$
$if(journal)${\\ submitted to \it $journal$ }$endif$\\
\hrule

\hfill {\bfseries [RC]\hspace{0.5em}} \textbf{Reviewer comment}%
%\(\qquad\) AR:\hspace{0.5em} Author response%
\(\qquad \fcolorbox{black!25!white}{white}{\hspace{0.25em}Manuscript text\hspace{0.25em}}\)

\vspace{2em}

$body$

$for(include-after)$
  $include-after$
$endfor$

\end{document}\grid
