% ****** Start of file reftest.tex ******
%
%   This file is part of the APS files in the REVTeX 3.0 distribution.
%   Version 3.0 of REVTeX, November 10, 1992.
%
%   Copyright (c) 1992 The American Physical Society.
%
%   See the REVTeX 3.0 README file for restrictions and more information.
%
%

\documentstyle[aps]{revtex}
\begin{document}

\typeout{Filename: reftest.tex, v0.01 <23 September 1992>}

\makeatletter

\def\newlabel#1#2{}          \let\@writefile\newlabel
\def\bibdata#1{}             \let\bibstyle\newlabel

\newcount\bibcount      \bibcount0
\newcount\citecount     \citecount0

\def\bibcite#1#2{%
\advance\bibcount by1
\xdef\@tempb{bib#1}%
\expandafter\ifx\csname\@tempb\endcsname\relax %
\def\@tempa{\expandafter\xdef\csname \@tempb\endcsname{\the\bibcount}%
\expandafter\xdef\csname bib@num\the\bibcount\endcsname{#1}%
}%
\else %
\def\@tempa{\typeout{*** Tag "#1" used in more than one \string\bibitem.}%
\typeout{\space\space\space\space You must correct this first.}%
\end{document}%
}
\fi
\@tempa
}

\def\citation#1{%
\@for\@tempa:={#1}\do
{\edef\@tempb{cite\@tempa}%
\expandafter\ifx\csname\@tempb\endcsname\relax %
\advance\citecount by1
\expandafter\xdef\csname \@tempb\endcsname{\the\citecount}%
\expandafter\xdef\csname cite@num\the\citecount\endcsname{\@tempa}%
\fi
}%
}

\typeout{}
\typein[\filename]{Type in file name (no extension)}
\expandafter\input\expandafter{\filename.aux}

\xdef\bibtotal{\the\bibcount} \xdef\citetotal{\the\citecount}

\newcount\index

\index0 \def\uncitedbibs{}
\loop\ifnum\index<\bibtotal
\advance\index by1
\xdef\@tempa{\csname bib@num\the\index\endcsname}%
\expandafter\ifx\csname cite\@tempa\endcsname\relax
\xdef\uncitedbibs{\uncitedbibs\csname bib@num\the\index\endcsname, }
\fi
\repeat

\index0 \def\undefinedcites{}
\loop\ifnum\index<\citetotal
\advance\index by1
\xdef\@tempa{\csname cite@num\the\index\endcsname}%
\expandafter\ifx\csname bib\@tempa\endcsname\relax
\xdef\undefinedcites{\undefinedcites\csname cite@num\the\index\endcsname, }
\fi
\repeat

\index0 \newcount\errcount \errcount0

\def\strut{\vrule height12pt depth4pt width0pt}

\def\addit#1#2{%
\bgroup
\let\bf\relax
\xdef\ordertable{\ordertable
\hbox to\hsize
{\vrule\hbox to.5\hsize{\hss#1\hss}\hss\vrule\hss\strut
\hbox to.5\hsize{\hss#2\hss}\vrule}%
\hrule
}%
\egroup
}

\def\ordertable{}%

\loop\ifnum\index<\citetotal
\advance\index by1
\xdef\@tempa{\csname cite@num\the\index\endcsname}%
\xdef\@tempb{\csname  bib@num\the\index\endcsname}%
\expandafter\ifx\csname bib\@tempa\endcsname\relax %
\addit{\@tempa}{{\bf Undefined in bibiography/references.}}%
\else %
\ifx\@tempa\@tempb %
\addit{\@tempa}{{OK in bibiography/references.}}
\else %
\advance \errcount by 1
\addit{\@tempa}{{\bf Out of order in bibiography/references.}}
\fi
\fi
\repeat

\typeout{}
\typeout{%
* Bibitems that were not cited:
\ifx\uncitedbibs\empty none.
\else \uncitedbibs please cite or remove these bibitems.
\fi
}
\typeout{}
\typeout{%
* Undefined citations:
\ifx\undefinedcites\empty none.
\else \undefinedcites please add bibitems or remove these cites.
\fi
}

\typeout{}
\typeout{%
\ifnum\errcount=0
* The order of the bibitems is OK.
\else
* The order of the bibitems is wrong. Preview
reftest.dvi for more details.
\fi
}

\hrule height2pt
\bigskip
Analysis of \filename.aux, according to rules of
{\it Physical Review\/}: All bibitems must occur in the
bibliography/reference section in order of their first citation in the
file, and all bibitems must be cited in the paper.
\bigskip
\hrule height2pt
\bigskip \bigskip

* Bibitems that were not cited:
\ifx\uncitedbibs\empty none.
\else \uncitedbibs please cite or remove bibitem(s).
\fi
\vskip1pc
* Undefined citations:
\ifx\undefinedcites\empty none.
\else \undefinedcites please add bibitem(s) or remove cite(s).
\fi

\vskip1pc
\ifnum\errcount=0
* The order of the bibitems is OK.
\else
* There were \the\errcount\space
errors in the order of your bibitems. This
is in addition to any problems noted above. Please
check the following table to see what the problems were.
Comments
in boldface denote problems that need to be corrected.
{\it NOTE:
This table is a complete listing of all your citations, in order of their
first occurrence. That is, your bibitems should be in the order shown
in the first column of this table.
}
\smallskip \small
\hrule
\hbox to\hsize
{\vrule\hbox to.5\hsize
{\hss Citation tag\hss}%
\hss\vrule\hss\strut depth5pt\hbox to.5\hsize
{\hss Comment\hss}\vrule}%
\hrule
\smallskip
\hrule
\ordertable %
\fi

\typeout{}

\end{document}

%
% ****** End of file reftest.tex ******

