%
% referee.sty
%
% Style file for reports on Latex-submitted documents.
%
% Allows inserting cross-referenced note marks with margin pointers for
% each note. 
%
% Usage: 
%   with \usepackage{referee} added in the top matter of the file
%   submitted for reviewing, the following commands are available to
%   the reviewer:
%
% \referee
%   placed near the beginning of the submitted file, but after the
%   \maketitle command if exists in the original, this adds a new page
%   at the end of the file with the title ``Notes'', and restarts the
%   page numbers with roman page numbering.
%
% \note{referee's remark}
%   placed in the body of the text, but not in titles, abstracts and
%   other floats, or mathmode, marks the original text with a numbered
%   end-note mark, puts an arrow with the same number in the
%   margin, and adds a numbered end-note at the end of the document
%   with the referee's remark. 
%
%   In order to keep numbering in the original intact, notes inserted
%   in sections, theorems etc. must appear after the \label command.
%   
% counters used: endnotecounter, endendnotecounter.
%
%
%-------------------------
%
% problems: 
% 1. the limitations listed above clearly need addressing by a real
%    expert.
% 2. I have not investigated any legal or copyrighting issues.
% 3. If Latex errors occur in the notes, the only way to locate them
%    is to remove the \AtEndDocuent lines temporarily. There should be
%    a \RefereeDebug mode allowing this automatically, but this is not
%    written yet. Maybe the \note command could be made to leave a trace in
%    the log file allowing one to trace errors.
%
\newcommand{\changeto}{$\Rightarrow$}
\newcounter{endnotecounter}
\newcounter{endendnotecounter}
\newcommand{\note}[1]%
{\refstepcounter{endnotecounter}%
\label{Referee:\theendnotecounter}%
\makebox[0pt]{\raisebox{1ex}[0in][0in]{\tiny\bf{*}\theendnotecounter{*}}}%
\marginpar%
   [\rm\theendnotecounter$\rightarrow$]{$\leftarrow$\rm\theendnotecounter}%
\AtEndDocument{\stepcounter{endendnotecounter}{%
%\noindent\theendendnotecounter. #1\\%
 \begin{trivlist} \item[\theendendnotecounter\  (page 
 \pageref{Referee:\theendendnotecounter}).] #1
\end{trivlist}% 
}}}
\newcommand{\referee}{\AtEndDocument{\newpage\setcounter{page}{0}\pagenumbering{roman}
\begin{center} \bf NOTES
\end{center} }}




