使用 nag 时是否只需要 amsmath?

使用 nag 时是否只需要 amsmath?

我已经阅读了关于推荐套餐的问题,他们经常会给出以下建议

\RequirePackage[l2tabu, orthodox]{nag}

\usepackage[all, warning]{onlyamsmath}

nag已经使用了很长时间,但不确定是否还需要onlyamsmath。我的问题是:据我所知,在数学环境方面(警告“糟糕的”数学环境),nag已经做了所有事情,甚至更多onlyamsmath,这是正确的吗?

那么,onlyamsmath如果我已经使用,是否会带来任何进一步的优势nag?我不需要的错误功能onlyamsmath,只需要警告。

答案1

好的,我抽出一些时间来测试一下。我测试了onlyamsmath文档中提到的所有内容(假设文档完整)。以下代码:

\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}

生成以下警告:

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.

现在注释掉nag和添加注释onlyamsmath会产生以下警告:

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.

如果同时使用两者,则只会onlyamsmath抱怨$$...$$,但nag不会。eqnarray会同时被两个包警告。只有在所有情况下displaymath才会抱怨。onlyamsmath

结论:是的,确实检测到了无法检测到的onlyamsmath东西( )。nagdisplaymath

相关内容