[comp.text.tex] How to get rid of "Citation ... undefined"

verwer@ruuinf.cs.ruu.nl (Nico Verwer) (07/03/90)

When yo LaTeX a file for the first time, or (sometimes) after LaTeX
produced an error, there will be many undefined citations in your text,
one for every \cite{...} which is not defined in the .aux file.
Thus you get loads of "Citation `...' on page ... undefined" warnings
which clobber your screen and .log file.
I made a style file which will cause LaTeX to warn only once for every
undefined citation. It's rather simple, but useful, so I decided to post
it here.
Regards, Nico.

==========CUT HERE============================================================
%%% This is onecw.sty, version of 29 june 1990, by Nico Verwer.
%%% Normally, LaTeX issues a warning every time it encounters an
%%% undefined citation. Thus you will get multiple warnings for the same
%%% citation. When you include this sty file, only one warning will be
%%% issued for every citation.
%%% Almost all of this code is directly taken from latex.tex.
%%% Please email suggestions (I'm still looking for a better name),
%%% comments, etc. to verwer@cs.ruu.nl .
\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{,\penalty\@m\ }\@ifundefined
       {b@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}
       \global\@namedef{b@\@citeb}{{\bf ?}}}%
\hbox{\csname b@\@citeb\endcsname}}}{#1}}