summaryrefslogtreecommitdiff
path: root/obsolete/macros/latex/contrib/revtex4-1/tex/latex/revtex/reftest4-1.tex
blob: d1418950c2493017ee5f84e857606ac912d51331 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
% ****** Start of file reftest.tex ******
%
%   This file is part of the APS files in the REVTeX 4.1 distribution.
%   Version 4.1 of REVTeX, July 1, 2008.
%
%   Copyright (c) 2009 The American Physical Society.
%
%   See the REVTeX 4.1 README file for restrictions and more information.
%
\documentclass{revtex4}%
\begin{document}%

\typeout{Filename: reftest4-1.tex for revtex 4.1i 2009/10/19 (AO)}
% This document, when typeset, prompts for the name of a LaTeX auxiliary (.aux) file 
% and then processes that file, paying attention to 
% keys that have been cited (via \citation)
% or defined (via \bibcite).
% It then prints out diagnostics indicating 
% * any keys that were cited but never defined,
% * any keys that were defined but never cited, and
% * keys that were cited and defined, but not in the same order.
%
% BibTeX takes care of such things automatically,
% so there is little use for such a test when using BibTeX.
%
% A separate question: will this file run under revtex4.cls?
% I can see two lines in my .aux with the potential for problems: 
% \global \mathchardef \firstnote@num\z@ \relax 
% \global\NAT@numberstrue

\makeatletter

\def\g@bbletw@#1#2{}%
\def\g@bble@ne#1{}%

\let\bibdata\g@bble@ne
\let\newlabel\g@bbletw@
\let\@writefile\g@bbletw@
\let\bibstyle\g@bble@ne

\@tempcnta\z@
\@tempcntb\z@

\def\bibcite#1#2{%
 \advance\@tempcnta\@ne
 \expandafter\bib@one\csname bib#1\expandafter\endcsname\expandafter{\the\@tempcnta}{#1}%
}

\def\bib@one#1#2#3{%
 \@ifnotrelax#1{%
  \typeout{*** Tag "#3" used in more than one \string\bibitem.}%
  \typeout{\space\space\space\space You must correct this problem before continuing (Bailing out).}%
  \@@end
 }{%
  \def#1{#2}%
  \expandafter\def\csname bib@num#2\endcsname{#3}%
 }%
}%

\def\citation#1{%
 \@for\@tempa:={#1}\do{%
  \expandafter\cite@one\csname cite\@tempa\expandafter\endcsname\expandafter{\@tempa}%
 }%
}

\def\cite@one#1#2{%
 \expandafter\@ifx\expandafter{\csname cite*\endcsname#1}{%
  \@booleantrue\@cite@star@sw
 }{%
  \@ifnotrelax#1{%
  }{%
   \advance\@tempcntb\@ne
   \expandafter\cite@one@\expandafter#1\expandafter{\the\@tempcntb}{#2}%
  }%
 }%
}%
\expandafter\def\csname cite*\endcsname{*}%
\@booleanfalse\@cite@star@sw

\def\cite@one@#1#2#3{%
 \def#1{#2}%
 \expandafter\def\csname cite@num#2\endcsname{#3}%
}%

\def\strut{\vrule height12pt depth4pt width0pt}%

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

\expandafter\def\expandafter\bibtotal\expandafter{\the\@tempcnta}%
\expandafter\def\expandafter\citetotal\expandafter{\the\@tempcntb}%

\def\app@undefined#1#2#3{%
 \expandafter\@ifnotrelax\csname#2#1\endcsname{}{%
   \appdef#3{#1, }%
  }
}%

\let\uncitedbibs\@empty
\@tempcnta\z@
\@ifnum{\bibtotal>\@tempcnta}{%
 \loopwhile{%
  \advance\@tempcnta\@ne
  \expandafter\app@undefined\csname bib@num\the\@tempcnta\endcsname{cite}\uncitedbibs
  \@ifnum{\bibtotal>\@tempcnta}%
 }%
}%

\let\undefinedcites\@empty
\@tempcnta\z@
\@ifnum{\citetotal>\@tempcnta}{%
 \loopwhile{%
  \advance\@tempcnta\@ne
  \expandafter\app@undefined\csname cite@num\the\@tempcnta\endcsname{bib}\undefinedcites
  \@ifnum{\citetotal>\@tempcnta}%
 }%
}%

\def\addit@bad#1#2{%
 \expandafter\@ifnotrelax\csname bib#1\endcsname{%
  \@ifx{#1#2}{%
   \addit{#1}{OK}%
  }{%
   \advance\@tempcntb\@ne
   \addit{#1}{\bf Out of order}%
  }%
 }{%
  \addit{#1}{\bf Undefined}%
 }%
}%
\def\ordertable{}%
\def\table@line#1#2{%
  \hbox to\hsize{%
   \vrule
   \hbox to.5\hsize{\ #1\hss}%
   \hss\vrule\hss\strut
   \hbox to.5\hsize{\ #2\hss}%
   \vrule
  }%
  \hrule
  \vskip\z@skip
}%
\def\addit#1#2{%
 \appdef\ordertable{\table@line{#1}{#2}}%
}%

\@tempcnta\z@
\@tempcntb\z@
\@ifnum{\citetotal>\@tempcnta}{%
 \loopwhile{%
  \advance\@tempcnta\@ne
  \expandafter\addit@bad\csname cite@num\the\@tempcnta\expandafter\endcsname\csname bib@num\the\@tempcnta\endcsname
  \@ifnum{\citetotal>\@tempcnta}%
 }%
}{}%
\expandafter\def\expandafter\citesdisordered\expandafter{\the\@tempcntb}%

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

\def\@tempa{\textbf{Bibitems that were not explicitly cited:} }%
\@ifx@empty\uncitedbibs{%
 \appdef\@tempa{none.}%
}{%
 \appdef\@tempa{\uncitedbibs\ \@cite@star@sw{were implicitly cited.}{please cite or remove bibitem(s).}}%
}%
\@tempa\expandafter\typeout\expandafter{\@tempa}\par

\def\@tempa{\textbf{Citations not defined in bibliography:} }%
\@ifx@empty\undefinedcites{%
 \appdef\@tempa{none.}%
}{%
 \appdef\@tempa{\undefinedcites\space please add bibitem(s) or remove cite(s).}%
}%
\@tempa\expandafter\typeout\expandafter{\@tempa}\par

\@ifnum{\citesdisordered=\z@}{%
 \def\@tempa{\textbf{The order of the bibitems is OK.}}%
 \@tempa\expandafter\typeout\expandafter{\@tempa}\par
}{%
 \def\@tempa{%
  \textbf{There 
  \@ifnum{\citesdisordered<\tw@}{was an error}{were \citesdisordered\ errors}
  in the order of your bibitems.}%
 }%
 \@tempa\expandafter\typeout\expandafter{\@tempa}
 \@ifx@empty\uncitedbibs{\@ifx@empty\undefinedcites{\true@sw}{\false@sw}}{\false@sw}%
 {(This is in addition to the problems noted above.) }{}%
 Please check the following table to see what the problems were.
 Status in boldface signifies that a correction is needed. \par
}%
 \emph{NOTE:
  This table is a complete listing of all your citations, in order of their first occurrence: 
  your bibitems should be in the order shown in the first column of this table.
 }\par
 \small
 \smallskip
 \hrule
 \table@line{\textbf{Citation key}}{\textbf{Status}}%
 \smallskip
 \hrule
 \ordertable
\end{document}
% ****** End of file reftest.tex ******