我有这个文件这是由 Lyx 生成的,无法编译,在 LyX 和 pdflatex 中都无法编译。错误消息为:
$ pdflatex QFT2_Summary.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./QFT2_Summary.tex
LaTeX2e <2014/05/01>
Babel <3.9k> and hyphenation patterns for 78 languages loaded.
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2014/texmf-dist/tex/latex/jknapltx/mathrsfs.sty)
(/usr/local/texlive/2014/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2014/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2014/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2014/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2014/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2014/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/usr/local/texlive/2014/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/local/texlive/2014/texmf-dist/tex/latex/cancel/cancel.sty)
(/usr/local/texlive/2014/texmf-dist/tex/latex/esint/esint.sty)
(/usr/local/texlive/2014/texmf-dist/tex/latex/feyn/feyn.sty
Package: `feyn' 0.3.3 <2009/10/08 >
(/usr/local/texlive/2014/texmf-dist/tex/latex/jknapltx/ursfs.fd)
(/usr/local/texlive/2014/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2014/texmf-dist/tex/latex/amsfonts/umsb.fd)
(/usr/local/texlive/2014/texmf-dist/tex/latex/esint/uesint.fd))
(/usr/local/texlive/2014/texmf-dist/tex/latex/braket/braket.sty)
(/usr/local/texlive/2014/texmf-dist/tex/latex/doublestroke/dsfont.sty)
(/usr/local/texlive/2014/texmf-dist/tex/latex/carlisle/slashed.sty)
(/usr/local/texlive/2014/texmf-dist/tex/latex/mh/breqn.sty
(/usr/local/texlive/2014/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2014/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/local/texlive/2014/texmf-dist/tex/latex/l3kernel/expl3-code.tex
(/usr/local/texlive/2014/texmf-dist/tex/latex/etex-pkg/etex.sty)
! Missing \endcsname inserted.
<to be read again>
\char
l.3842 \cs_new:cpn { __int_compare_!=:NNw }
#1#2#3 !=
?
问题是该文件有 3842 行,而错误消息指向末尾。我根本不知道该如何开始追踪这件事。有人有什么建议吗?
答案1
一般来说,为了调试一个大文档,而我不知道错误的来源,我会在 \begin{document} 之后放置一个 \end{document},看看它是否编译成功。如果不能,问题就出在序言中。如果它编译成功,那么我开始在文档中以连续的方式向下移动 \end{document},确保不要将其插入到组的中间。每次我都会重新编译。当它最终破坏编译时,我就知道问题出在哪个代码块中。
– 史蒂文·B·塞格莱特斯