How to fix reviewresponse.cls for custom reviewer numbering

Recently, I have found anice Latex class that can be used to write answers to reviewers for the rebuttal of journal papers. This latex class is called reviewresponse.cls, which can be found on GitHub. It allows to write an answer to reviewers with comments such as:

....

\reviewer

\begin{revcomment}
Figure 4 - please include legend to the right or below the main figure as in panel b legend overlaps with line of plot making confusion i interpretation. gentle grey grid in backround will also be valuable for plot investigation.
\end{revcomment}
\begin{revresponse}
    [your answer]
\end{revresponse}
\begin{changes}
    some changes you made
\end{changes}

\begin{revcomment}
    No avaliable implementation.
\end{revcomment}
\begin{revresponse}
     [your answer]
\end{revresponse}
\begin{changes}
    some changes you made
\end{changes}

which will then generate something beautiful like:

However, I have found a problem with this class, which is that the reviewers are automatically numbered as Reviewer 1, 2, 3, 4, 5…. But, in several cases, the reviewers are not numbered sequentially and some numbers may be skipped.

To fix this issue, the solution is to redefine the /reviewer command in reviewresponse.cls as follows:

\newcommand*{\reviewer}[1][]{%
  \clearpage
  % If no optional argument, step the counter as before.
  \if\relax\detokenize{#1}\relax
    \refstepcounter{reviewer}%
  \else
    % If an argument was given, set reviewer to N-1 then refstep to N.
    % Using \numexpr avoids the off-by-one problem while keeping refstepcounter
    % (so labels/anchors behave correctly).
    \setcounter{reviewer}{\numexpr#1-1\relax}%
    \refstepcounter{reviewer}%
  \fi
  \@ifundefined{pdfbookmark}{}{%
    \pdfbookmark[1]{Reviewer \arabic{reviewer}}{hyperref@reviewer\arabic{reviewer}}%
  }%
  \section*{Authors' Response to Reviewer~\arabic{reviewer}}
}

After making this modification, the \reviewer command can now be used in your latex document with a parameter to specify the reviewer number that you want, like this: \reviewer[5]. The result then looks like this:


And now the problem is fixed.

That is all for today, I just wanted to share this solution in case someone has the same problem with reviewresponse.cls.

This entry was posted in Latex. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *