![重新定义 AASTeX 6.1 的 `\mag` 会破坏 arXiv 上的 LaTeX,并且使用它也会破坏整个 LaTeX](https://linux22.com/image/349963/%E9%87%8D%E6%96%B0%E5%AE%9A%E4%B9%89%20AASTeX%206.1%20%E7%9A%84%20%60%5Cmag%60%20%E4%BC%9A%E7%A0%B4%E5%9D%8F%20arXiv%20%E4%B8%8A%E7%9A%84%20LaTeX%EF%BC%8C%E5%B9%B6%E4%B8%94%E4%BD%BF%E7%94%A8%E5%AE%83%E4%B9%9F%E4%BC%9A%E7%A0%B4%E5%9D%8F%E6%95%B4%E4%B8%AA%20LaTeX.png)
我正在尝试提交一系列文章给论文集使用AASTeX 6.1模板。我遇到了一个错误,arXiv 支持人员说相关部分是:
(/texlive/2016/texmf-dist/tex/latex/amscls/amsthm.sty) 没有文件 blah.aux。!缺少数字,视为零。$ l.140 \begin{document}
?!紧急停止。
我编写的测试文件很短,可以放在这里:
\documentclass[twocolumn]{aastex61}
\usepackage{amsmath,amsthm,amssymb}
\protected\def\micron{\ifmmode \,\operatorname{\mu m}\else $\operatorname{\mu m}$\fi}
\protected\def\mag{\ifmmode \,\operatorname{mag}\else $\operatorname{mag}$\fi}
\shorttitle{Scam Yourself}
\shortauthors{Dobbs}
\begin{document}
\title{Pull the Wool Over Your Own Eyes}
\author{J.~R.~Dobbs}
\affiliation{Church of the SubGenius}
\correspondingauthor{J.~R.~Dobbs}
\email{[email protected]}
\begin{abstract}
Slack shall set you free!
\end{abstract}
\keywords{religion,slack}
\section{Introduction}
Praise Bob, and pass the slack!
5 \micron, $5\micron$
6 \mag, $6\mag$
\end{document}
令人烦恼的问题是,这个 LaTeX 文件在我的计算机上编译得很好,使用与 arXiv (2016) 相同的 TeXLive 版本,但在 arXiv 上却产生了那个神秘的错误。用 替换\def
不起作用\renewcommand
。arXiv 支持人员甚至告诉我,删除\usepackage
和 自定义\def
行也会导致问题。
如何修复?我肯定想覆盖AASTeX 提供的\micron
和\mag
命令。对于我不需要覆盖的命令,我使用\DeclareMathOperator
,这不会造成问题。
我在这里提出这个问题是为了让 arXiv 和 AAS 的人们有一个共同探讨这个问题的论坛,或者让一些已经知道巧妙解决方案的外部 TeX 专家有机会参与进来。
编辑:这是 arXiv 日志的完整相关部分:
[verbose]: This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
(./blah.tex
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(./aastex61.cls
Document Class: aastex61 2016/04/16 Version 6.1/AAS markup document class
(/texlive/2016/texmf-arxiv/tex/latex/revtex/revtex4-1.cls
Document Class: revtex4-1 2010/07/25/20:33:00 4.1r (http://publish.aps.org/revt
ex4/ for documentation)
ltxutil[2010/07/25/20:33:00 4.1r utilities package (portions licensed from W. E
. Baxter web at superscript.com)]
ltxfront[2010/07/25/20:33:00 4.1r frontmatter package (AO,DPC)]
ltxgrid[2010/07/25/20:33:00 4.1r page grid package (portions licensed from W. E
. Baxter web at superscript.com)]
(/texlive/2016/texmf-arxiv/tex/latex/revtex/aps4-1.rtx)
(/texlive/2016/texmf-arxiv/tex/latex/revtex/aps10pt4-1.rtx)
(/texlive/2016/texmf-dist/tex/latex/textcase/textcase.sty)
(/texlive/2016/texmf-dist/tex/latex/url/url.sty)
(/texlive/2016/texmf-local/tex/latex/natbib/natbib.sty
This is natbib version 8.31
!!WARNING!! !!WARNING!! !!WARNING!! !!WARNING!!
This version (v8.31) of natbib is stricter in its formatting
requirements for bibitem entries than the previous version
used at arXiv (v7.1).
If your submission encounters a problem see
http://arXiv.org/help/faq/texlive
and the natbib documentation at
http://www.ctan.org/tex-archive/macros/latex/contrib/natbib/
for explanation and adjust your submission accordingly.
The arXiv team.
) (/texlive/2016/texmf-arxiv/tex/latex/revtex/revsymb4-1.sty))
(/texlive/2016/texmf-dist/tex/latex/base/latexsym.sty)
(/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty
(/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty)
(/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty
(/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty)
(/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/texlive/2016/texmf-dist/tex/latex/graphics-def/dvips.def)))
(/texlive/2016/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/texlive/2016/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/texlive/2016/texmf-dist/tex/generic/epsf/epsf.sty
This is `epsf.tex' v2.7.4 <14 February 2011>
) (/texlive/2016/texmf-dist/tex/latex/tools/longtable.sty)
(/texlive/2016/texmf-dist/tex/latex/xcolor/xcolor.sty
(/texlive/2016/texmf-dist/tex/latex/graphics-cfg/color.cfg))
(/texlive/2016/texmf-dist/tex/latex/hyperref/hyperref.sty
(/texlive/2016/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/texlive/2016/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/texlive/2016/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/texlive/2016/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/texlive/2016/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/texlive/2016/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/texlive/2016/texmf-config/tex/latex/latexconfig/hyperref.cfg))
Package hyperref Message: Driver (default): hdvips.
(/texlive/2016/texmf-dist/tex/latex/hyperref/hdvips.def
(/texlive/2016/texmf-dist/tex/latex/hyperref/pdfmark.def
(/texlive/2016/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty)))
(/texlive/2016/texmf-dist/tex/latex/tools/array.sty)
(/texlive/2016/texmf-dist/tex/generic/ulem/ulem.sty))
(/texlive/2016/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/texlive/2016/texmf-dist/tex/latex/amsmath/amstext.sty
(/texlive/2016/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/texlive/2016/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/texlive/2016/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/texlive/2016/texmf-dist/tex/latex/amscls/amsthm.sty)
No file blah.aux.
! Missing number, treated as zero.
$
l.140 \begin{document}
?
! Emergency stop.
$
l.140 \begin{document}
No pages of output.
Transcript written on blah.log.
以及来自我的计算机的同一级别编译的整个日志:
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./blah.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(./aastex61.cls
Document Class: aastex61 2016/04/16 Version 6.1/AAS markup document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/revtex/revtex4-1.cls
Document Class: revtex4-1 2010/07/25/20:33:00 4.1r (http://publish.aps.org/revt
ex4/ for documentation)
ltxutil[2010/07/25/20:33:00 4.1r utilities package (portions licensed from W. E
. Baxter web at superscript.com)]
ltxfront[2010/07/25/20:33:00 4.1r frontmatter package (AO,DPC)]
ltxgrid[2010/07/25/20:33:00 4.1r page grid package (portions licensed from W. E
. Baxter web at superscript.com)]
(/usr/local/texlive/2016/texmf-dist/tex/latex/revtex/aps4-1.rtx)
(/usr/local/texlive/2016/texmf-dist/tex/latex/revtex/aps10pt4-1.rtx)
(/usr/local/texlive/2016/texmf-dist/tex/latex/textcase/textcase.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/url/url.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/natbib/natbib.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/revtex/revsymb4-1.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/latexsym.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2016/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/local/texlive/2016/texmf-dist/tex/generic/epsf/epsf.sty
This is `epsf.tex' v2.7.4 <14 February 2011>
) (/usr/local/texlive/2016/texmf-dist/tex/latex/tools/longtable.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/color.cfg))
(/usr/local/texlive/2016/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/local/texlive/2016/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2016/texmf-dist/tex/latex/latexconfig/hyperref.cfg))
Package hyperref Message: Driver (autodetected): hpdftex.
(/usr/local/texlive/2016/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/tools/array.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/ulem/ulem.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/amscls/amsthm.sty)
No file blah.aux.
(/usr/local/texlive/2016/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(/usr/local/texlive/2016/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/ulasy.fd)
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsfonts/umsb.fd) [1{/usr/local/t
exlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] [2] (./blah.aux)
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right .
)
<
/usr/local/texlive/2016/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on blah.pdf (2 pages, 97265 bytes).
SyncTeX written on blah.synctex.gz.
Transcript written on blah.log.
编辑2017-02-22:当我注释掉这些行时
\usepackage{amsmath,amsthm,amssymb}
\protected\def\micron{\ifmmode \,\operatorname{\mu m}\else $\operatorname{\mu m}$\fi}
\protected\def\mag{\ifmmode \,\operatorname{mag}\else $\operatorname{mag}$\fi}
我的机器上也出现了类似的错误:
./blah.tex:160: Missing number, treated as zero.
,
l.160 6 \mag,
$6\mag$
?
./blah.tex:160: Missing number, treated as zero.
$
l.160 6 \mag, $6\mag$
?
[2
./blah.tex:162: Incompatible magnification (0);
the previous value will be retained (1000).
\AtBegShi@Output ...ipout \box \AtBeginShipoutBox
\fi \fi
l.162 \end{document}
尽管在这种情况下,文档已完成编译,但只是缺少幅度单位。
答案1
2017 年 2 月 22 日对问题进行的编辑添加了信息,使得无需猜测即可回答问题。信息包括来自日志文件的以下几行:
./blah.tex:160: Missing number, treated as zero.
,
l.160 6 \mag,
$6\mag$
?
\mag
是 tex 基元(在索引中标识为教科书它表示要应用到物体的放大倍数(用星号标记),并期望输入一个数字。
有问题的文件包含以下定义:
\protected\def\mag{\ifmmode \,\operatorname{mag}\else $\operatorname{mag}$\fi}
我不会试图解释为什么 arxiv 会触发这个错误前
\begin{document}
,但一旦日志文件提供了完整的错误消息,就会发现曾是失败的原因。
这是绝不重新定义一个原始命令是个好主意。这就是为什么 latex 提供 -- 并强烈建议使用 -- 的原因之一\newcommand
,这样就可以立即看出特定的命令名已经被使用。当这种情况发生时,是时候进行一些研究了……是您无意中尝试重新定义的命令的目的。 \def
轻率地抹去之前存在的所有内容,有时会导致像这样的谜团。