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

2 Answers 2


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".

\WarningFilter{hyperref}{Token not allowed}     


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


  • If you care about the document, use variant II (with \textorpdfstring)
    – yo'
    May 4, 2012 at 8:47
  • THanks for both suggestions, I'll use the proper \texorpdfstring solution. However, I couldn't get the silence working, its not filtering the relevant warning. If I use \WarningsOff it does filter out all warning though, so maybe I am doing something wrong. I'll anyway accept your answer, as the silence package seems the way to go (with respect to the original question). May 4, 2012 at 10:19
  • @Rabarberski It is hard to determine why you cannot filter the warning message without an MWE. Maybe it is due to loading the silence package after the hyperref package.
    – maetra
    May 4, 2012 at 11:06
  • @maetra: yes, I agree. The point I wanted to make is that there is probably something I am doing wrong, but I don't care at this point, because I use the better solution to my problem (i.e. \using texorpdfstring). However, if I run the example in the post, the messages are filtered out (regardless of the string I put in there), but the messages end up in my PDF file! May 4, 2012 at 12:41

You can also cheat TeXnicCenter by removing the duplicate warnings from the LaTeX output. The latter can be done with a simple Perl script for example:

@lines = <STDIN>;
foreach (@lines) {
   if (/^(.*Warning:.*)$/) {
      next if ($warning{$1} == 1);
      $warning{$1} = 1;
   print $_;

In order to apply the script, create the following batch file:

latex %1 %2 %3 %4 %5 %6 %7 %8 %9 | perl remove-warnings.pl

and tell TeXnicCenter to use this as the LaTeX executable (in the profile settings).

Without the filter script the message window looks like this:

enter image description here

Applying the script leads to this:

enter image description here

  • Nice general suggestion, but I don't have perl installed (and don't want to go through the trouble just for this) May 4, 2012 at 10:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .