# 2011-07-29 Enforcing proper usage of LaTeX2e constructs (en)

Today I wanted to write something about automatic extraction of page ranges from a pdf file, but this will wait, since I found something really nice instead!

Some time ago I learned about the onlyamsmath package (by Harald Harders), which yields an error when some deprecated construct like $$...$$ or the eqnarray environment is used. (It also has a mild warning option.) But today I discovered another package, called nag (by Ulrich Michael Schwarz), which does essentially the same (and much more). It gives warnings whenever it encounters something bad, most notably $$...$$ and \bf and friends. Note: by default it does not warn about anything; personally, I recommend using it in the very first line of the document in the following way:

\RequirePackage[l2tabu,orthodox,abort]{nag}


Refer to its documentation for the explanation of the options; a short one is: l2tabu detects things described in the famous document entitled An essential guide to LaTeX2e usage. Obsolete commands and packages, orthodox detects some more things, and abort turns warnings (the default behavior) into errors (this is especially useful when giving your file to a coauthor who will then add his/her stuff—unfortunately, there’s no cutoffusersfingers option…)

And just for the sake of completeness: onlyamsmath warns about displaymath and nag does not; everything else covered by onlyamsmath is covered by nag, too.