Nomenclature+amsart:如果 PDF 输出很长,则会出现编译错误,但如果很短,则不会出现编译错误

Nomenclature+amsart:如果 PDF 输出很长,则会出现编译错误,但如果很短,则不会出现编译错误

使用带有 amsart 的 nomenclature 包,如果 PDF 输出很长,我会收到编译错误,但如果很短,则不会。这是我能做的最简短的问题示例。

\immediate\write18{makeindex "\jobname.nlo" -s nomencl.ist -o "\jobname.nls"}
\documentclass{amsart}
\usepackage{nomencl}
\usepackage{lipsum}

\makenomenclature                                                           

\begin{document}
\title{Nomenclature error} 
\maketitle
\tableofcontents


\nomenclature[Lx]{L}{The distribution of random variable $X$.}
We write $\mathcal{L}_X$ for the distribution of $X$. 

\lipsum 
\lipsum
\printnomenclature
\end{document}

使用 TeXShop 4.42 中的“Typset”命令,并安装全新 MacTeX(来自 mactex-20190508.pkg,今天早上刚刚下载)。第二次运行“Typset”时,控制台显示以下内容。

LaTeX2e <2018-12-01>
(/usr/local/texlive/2019/texmf-dist/tex/latex/amscls/amsart.cls
Document Class: amsart 2017/10/31 v2.20.4
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/nomencl/nomencl.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/koma-script/tocbasic.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/koma-script/scrbase.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/koma-script/scrlfile.sty))))
(/usr/local/texlive/2019/texmf-dist/tex/latex/lipsum/lipsum.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/l3pdfmode.def))
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/lipsum/lipsum.ltd.tex))
(./mwe.aux) (/usr/local/texlive/2019/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsfonts/umsb.fd) (./mwe.toc)
[1{/usr/local/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
Underfull \vbox (badness 10000) has occurred while \output is active [2]
(./mwe.nls)
./mwe.tex:21: Undefined control sequence.
<argument> \list@fname 

l.21 \end{document}

? 

如果我按回车键忽略错误,编译就会完成并输出正确的输出。

如果我将 \printnomenclature 替换为文件 mwe.nls 的内容,也会出现同样的错误,如下所示:

\begin{thenomenclature} 
\nomgroup{L}
  \item [{L}]\begingroup The distribution of random variable $X$.\nomeqref {0}\nompageref{1}

\end{thenomenclature}

但是,如果我在主 TeX 文件中包括 \lipsum 命令,则一次而不是两次,则不会发生错误。

如果我使用 article 而不是 amsart,也不会发生错误。

答案1

短版和长版的区别在于,在第 3 页,代码尝试在标题中写入命名法的名称。而当 amsart 做了一些不寻常的事情时,就会发生冲突。

可能的解决方法:

\usepackage[notocbasic]{nomencl}

或者

\makeatletter\let\list@fname\nomname \makeatother

相关内容