The nag package warns you for incorrect LaTeX usage

Although (La)TeX is already more than 30 years old, it is still optimized and updated. LaTeX commands, classes and packages may therefore become obsolete or outdated. It’s no fun to keep track of all changes in LaTeX and check what package are still good to use, so the nag package does that for you. For example, the \bf, \it, etc. commands for text formatting are obsolete and the nag package produces a warning when they are used. Nag also warns about other things mentioned in the l2tabu documentation (Obsolete packages and commands).

The nag package

Let’s implement the nag package. This goes a little different than normal packages. In your preamble, the first line should be like this:

\RequirePackage[l2tabu, orthodox]{nag}

Again, this should be the first line. So the package is called before the documentclass command.

The l2tabu and orthodox options

About the two specified options l2tabu and orthodox. The first (l2tabu) tells nag to check for obsolete syntax mentioned in the l2tabu documentation. It will also give hints on what to use instead. The second option (orthodox) checks the LaTeX code for syntax that is technically correct, but most likely produces an unwanted result. This is handy for novice users. Experienced LaTeX users might want to omit this option.

2 Comments

  1. […] package deserved a post on howtoTeX.com already. Actually, this package doesn’t do anything as long as your syntax is right. Load the package in […]

  2. Stuart Presnell says:

    The warnings from the nag package show up in your .log file. Just search for “nag” in that file and you might find lines like:

    Package nag Info: Command \topcaption not defined, skipping amendment on input line 109.

    Package nag Warning: `center' environment in figure.

    (nag) Maybe you want \centering instead on input line 141.

Leave a Reply




XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>