# Suppress natbib warnings

The output of pdflatex is filled with lines like this:

Package natbib Warning: Citation lee2004calder' on page 15 undefined on input
line 207.


I'm aware that the citation is undefined, and at some future point I'll find the warning helpful, but it's currently cluttering pdflatex output. I'd like a no-warn option that I can enable while I'm not interested in natbib issues, and disable at a later point. The natbib documentation doesn't appear to have anything similar.

How can I suppress these warnings?

A similar question has no useful answers.

Here's one possibility; the xpatch package was used to patch the internal commands \NAT@citexnum, \NAT@citex and \nocite and suppress the warnings they generate for undefined citations. Use \NoWarnNat to suppress the warnings; comment-out the command to activate the warnings:

\documentclass{article}
\usepackage{natbib}
\usepackage{xpatch}

\makeatletter
\newcommand\NoWarnNat{
\xpatchcmd{\NAT@citexnum}{\PackageWarning}{\let\PackageWarning\@gobbletwo\PackageWarning}{}{}
\xpatchcmd{\NAT@citex}{\PackageWarning}{\let\PackageWarning\@gobbletwo\PackageWarning}{}{}
\xpatchcmd{\nocite}{\PackageWarning}{\let\PackageWarning\@gobbletwo\PackageWarning}{}{}
}
\makeatother

\NoWarnNat% comment-out this line to activate the warnings

\begin{document}

\nocite{bbbb}
\cite{aaaa}

\bibliographystyle{plainnat}
\bibliography{biblio}
\end{document}
`