Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I already read questions about recommended packages, and they often have the advice for

\RequirePackage[l2tabu, orthodox]{nag}

and

\usepackage[all, warning]{onlyamsmath}

I use nag for quite some time now and am unsure if I still need onlyamsmath. My question: as far as I understand, nag already does everything and more that onlyamsmath is doing when it comes to math environments (warn about "bad" math environments), is this correct?

So, does onlyamsmath bring any further advantage if I already use nag? I don't need the error functionality of onlyamsmath, only the warnings.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

OK, I found some time to test this out. I tested everything that onlyamsmath mentioned in its documentation, assuming the documentation is complete. The following code:

\RequirePackage[l2tabu, orthodox]{nag}
\documentclass[fleqn]{scrreprt}

%\usepackage[all, warning]{onlyamsmath}

\begin{document}

$$a = b$$

\begin{eqnarray}
  a = b
\label{eq:foo1}
\end{eqnarray}

\begin{eqnarray*}
  a = b
\label{eq:foo2}
\end{eqnarray*}

\begin{displaymath}
  a = b
\end{displaymath}

\end{document}

Generates these warnings:

Package nag Warning: $$...$$ is obsolete.
(nag)                Use \[...\] et al. instead on input line 8.

Package nag Warning: Environment eqnarray is obsolete. 
(nag)                Use amsmath's align instead on input line 10.

Package nag Warning: Environment eqnarray is obsolete. 
(nag)                Use amsmath's align instead on input line 15.

And now commenting out nag and commenting in onlyamsmath produces these warnings:

Package onlyamsmath Warning: Environment $$ $$ used, please use 
(onlyamsmath)                only the environments provided by the amsmath 
(onlyamsmath)                package on input line 8.

Package onlyamsmath Warning: Environment eqnarray or eqnarray* used, please use 
(onlyamsmath)                only the environments provided by the amsmath 
(onlyamsmath)                package on input line 10.

Package onlyamsmath Warning: Environment eqnarray or eqnarray* used, please use 
(onlyamsmath)                only the environments provided by the amsmath 
(onlyamsmath)                package on input line 15.

Package onlyamsmath Warning: Environment displaymath used, please use 
(onlyamsmath)                only the environments provided by the amsmath 
(onlyamsmath)                package on input line 20.

If you use both at the same time, only onlyamsmath will complain about $$...$$, but nag will not. eqnarray will be warned about by both packages at the same time. displaymath is only complained about by onlyamsmath in all cases.

Conclusion: Yes, onlyamsmath does detect something that nag won't detect (displaymath).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.