[Tex/LaTex] way to avoid repetitive compiler warning messages

texniccenterwarnings

I use TeXnicCenter, and use the very convenient 'Compilation Results' window (see screenshot below). I have a number of identical warning* messages (not strictly identical of course, as they point to a different position in my LaTeX source).

Is there a way to have the latex compiler ignore or suppress text-identical warning messages, so that they don't fill my buffer, and so that I can easily notice any other warning messages?

TeXniCenter doesn't seem to provide such a feature, so I am resorting to the latex compiler here.

(*) The origin of the message is that I use math mode in my headings, and the hyperref package warns me that it ignores these. For now, I don't want to turn off the hyperref package, and i don't want to take out the math symbol in my headings either.

Compilation Results window screenshot

Best Answer

One solution it to use the silence package. According to its documentation it is able to do the following

This package is designed to filter out unwanted warnings and error messages. Entire packages (including LaTeX) can be censored, but very specific messages can be targeted too. TeX’s messages are left untouched.

In this example you can see how it works and suppresses the warning "Token not allowed in a PDF string".

\documentclass{article}
\usepackage{silence}
\WarningFilter{hyperref}{Token not allowed}     
\usepackage{hyperref}

\begin{document}
\section{$x_2$}
\end{document}

But it would be even better if you use texorpdfstring for mathematical formulas in headings

\documentclass{article}
\usepackage{hyperref}

\begin{document}
\section{\texorpdfstring{$x_2$}{x2}}
\end{document}