Emacs的latexmk函数将我带到了一个空缓冲区

10
这是对如何在Emacs中将latexmk绑定到一个按键并在出错时显示错误信息的跟进。
我正在使用Emacs中的一个函数来使用latexmk编译LaTeX文档,但它的行为不完全符合我的要求。我使用的函数是Jouni K. Seppänen提出的:
(defun run-latexmk ()
  (interactive)
  (let ((TeX-save-query nil)
        (TeX-process-asynchronous nil)
        (master-file (TeX-master-file)))
    (TeX-save-document "")
    (TeX-run-TeX "latexmk" "latexmk" master-file)
    (if (plist-get TeX-error-report-switches (intern master-file))
        (TeX-next-error t)
      (minibuffer-message "latexmk done"))))

(add-hook 'LaTeX-mode-hook
          (lambda () (local-set-key (kbd "C-0") #'run-latexmk)))

主要问题是当我使用函数(通过按下C-0)时,有时会将我扔进一个名为TeX Live 2011的空缓冲区。
重现此问题的一种方法是尝试编译以下内容(vc.tex不存在并不重要):
\immediate\write18{sh ./vc}
\input{vc}
\documentclass{article}
\begin{document}
\end{document}

另一种复现它的方法是尝试编译以下内容:

\documentclass{article}
\newcommand{foo}{
\begin{document}
\end{document}

一个小问题是 minibuffer 的高度有时会从一行扩展到两行,当运行run-latexmk并且在运行后它会弹回到一行高度。我遇到了找不到简单示例来复现此行为的问题(我只复制了非常大的文档)。

我希望能解决这两个问题。我也对我与Emacs中的latexmk交互的其他方式感兴趣。


以下是上一个示例(缺少\newcommand闭合花括号的示例)中的*...输出*缓冲区:

Running `latexmk' on `test' with ``latexmk''
Latexmk: This is Latexmk, John Collins, 10 October 2011, version: 4.27a.
**** Report bugs etc to John Collins <collins at phys.psu.edu>. ****
Rule 'pdflatex': File changes, etc:
   Changed files, or newly in use since previous run(s):
      'test.tex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex -recorder -halt-on-error -interaction=nonstopmode -shell-escape -synctex=1  -recorder  "test.tex"'
------------
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
 \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2011-07-01, ngerman-x-2011-07-01, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, galician, german, ngerman, swissgerman, monogreek, greek, hungarian,
 icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, marathi, or
iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, kurmanji,
 lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, pol
ish, portuguese, romanian, russian, sanskrit, serbian, serbianc, slovak, sloven
ian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian, welsh, loaded
.
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/size10.clo)))
Runaway argument?
{ \begin {document} \end {document} 
! File ended while scanning use of \@argdef.
<inserted text> 
                \par 
<*> test.tex

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on test.log.
Collected error summary (may duplicate other messages):
  pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Use the -f option to force complete processing.
Latexmk: Errors, so I did not complete making targets

latexmk exited at Thu Oct 27 08:11:07

以下是生成 *TeX 帮助* 出现 紧急停止。 的 TeX 文件的输出:
Running `latexmk' on `laskurs_logik.hemtenta' with ``latexmk''
Latexmk: This is Latexmk, John Collins, 10 October 2011, version: 4.27a.
**** Report bugs etc to John Collins <collins at phys.psu.edu>. ****
Rule 'pdflatex': File changes, etc:
   Changed files, or newly in use since previous run(s):
      'laskurs_logik.hemtenta.tex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex -recorder -halt-on-error -interaction=nonstopmode -shell-escape -synctex=1  -recorder  "laskurs_logik.hemtenta.tex"'
------------
Latexmk: All targets (laskurs_logik.anteckningar.pdf) are up-to-date
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
 \write18 enabled.
entering extended mode
(./laskurs_logik.hemtenta.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2011-07-01, ngerman-x-2011-07-01, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, galician, german, ngerman, swissgerman, monogreek, greek, hungarian,
 icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, marathi, or
iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, kurmanji,
 lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, pol
ish, portuguese, romanian, russian, sanskrit, serbian, serbianc, slovak, sloven
ian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian, welsh, loaded
.
(/usr/local/texlive/2011/texmf-dist/tex/latex/nag/nag.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/nag/nag-l2tabu.cfg)
(/usr/local/texlive/2011/texmf-dist/tex/latex/nag/nag-orthodox.cfg))fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
 (./vc.tex)
 (/usr/local/texlive/2011/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/leqno.clo)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/fleqn.clo)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/size12.clo))
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/inputenc.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/utf8.def
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/t1enc.dfu)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ot1enc.dfu)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/omsenc.dfu)))
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/t1enc.def))
(/usr/local/texlive/2011/texmf-dist/tex/latex/lm/lmodern.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/fixltx2e.sty) (./strict.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/tools/verbatim.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/enumitem/enumitem.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
(/usr/local/texlive/2011/texmf-dist/tex/latex/ms/everyshi.sty))
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex))
(/usr/local/texlive/2011/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/local/texlive/2011/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(/usr/local/texlive/2011/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.d
ef
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-p
df.def)))
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.
code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.
code.tex)) (/usr/local/texlive/2011/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/color.cfg))
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)))
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.co
de.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconst
ruct.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage
.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.co
de.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicst
ate.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransform
ations.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.cod
e.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.c
ode.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathproce
ssing.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.co
de.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.cod
e.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.cod
e.tex
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.
code.tex))
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.co
de.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretranspare
ncy.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.
code.tex)))
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.cod
e.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.
tex)
(/usr/local/texlive/2011/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
-0-65.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
-1-18.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex)
) (/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
))
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.cod
e.tex
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothan
dlers.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.cod
e.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/frontendlayer/tikz/librarie
s/tikzlibrarytopaths.code.tex)))
(/usr/local/texlive/2011/texmf-dist/tex/latex/isomath/isomath.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/was/fixmath.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/ifluatex.sty)))))
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/mh/mathtools.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/tools/calc.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/mh/mhsetup.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsmath/amsopn.sty)))
(/usr/local/texlive/2011/texmf-dist/tex/latex/onlyamsmath/onlyamsmath.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/tools/bm.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/turnstile/turnstile.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ifthen.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/jknapltx/mathrsfs.sty)
(/usr/local/texlive/2011/texmf-dist/tex/generic/babel/babel.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/babel/english.ldf
(/usr/local/texlive/2011/texmf-dist/tex/generic/babel/babel.def))
(/usr/local/texlive/2011/texmf-dist/tex/generic/babel/swedish.ldf))
(/usr/local/texlive/2011/texmf-dist/tex/latex/microtype/microtype.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/microtype/microtype.cfg))
(/usr/local/texlive/2011/texmf-dist/tex/latex/csquotes/csquotes.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/etoolbox/etoolbox.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/etex-pkg/etex.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/csquotes/csquotes.def)
(/usr/local/texlive/2011/texmf-dist/tex/latex/csquotes/csquotes.cfg))
(/usr/local/texlive/2011/texmf-dist/tex/latex/biblatex/biblatex.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/logreq/logreq.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/logreq/logreq.def))
(/usr/local/texlive/2011/texmf-dist/tex/latex/url/url.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/biblatex/blx-compat.def)
(/usr/local/texlive/2011/texmf-dist/tex/latex/biblatex/biblatex.def)
(/usr/local/texlive/2011/texmf-dist/tex/latex/biblatex/bbx/authoryear-comp.bbx
(/usr/local/texlive/2011/texmf-dist/tex/latex/biblatex/bbx/authoryear.bbx
(/usr/local/texlive/2011/texmf-dist/tex/latex/biblatex/bbx/standard.bbx)))
(/usr/local/texlive/2011/texmf-dist/tex/latex/biblatex/cbx/authoryear-comp.cbx)
(/usr/local/texlive/2011/texmf-dist/tex/latex/biblatex/biblatex.cfg))
(/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/local/texlive/2011/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/hyperref.cfg))

Package hyperref Message: Driver (autodetected): hpdftex.

(/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/ellipsis/ellipsis.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/tools/xspace.sty))
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/frontendlayer/tikz/librarie
s/tikzlibrarycalc.code.tex)
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/frontendlayer/tikz/librarie
s/tikzlibraryshapes.misc.code.tex
(/usr/local/texlive/2011/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibrary
shapes.misc.code.tex))
(/usr/local/texlive/2011/texmf-dist/tex/latex/biblatex/lbx/swedish.lbx)
(./laskurs_logik.hemtenta.aux)
(/usr/local/texlive/2011/texmf-dist/tex/latex/lm/t1lmr.fd)
ABD: EveryShipout initializing macros
(/usr/local/texlive/2011/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(/usr/local/texlive/2011/texmf-dist/tex/latex/microtype/mt-cmr.cfg)
(./laskurs_logik.hemtenta.bbl)
(/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./laskurs_logik.hemtenta.out) (./laskurs_logik.hemtenta.out)
(/usr/local/texlive/2011/texmf-dist/tex/latex/lm/ot1lmr.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/lm/omllmm.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/lm/omslmsy.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/lm/omxlmex.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/microtype/mt-msa.cfg)
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsfonts/umsb.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/microtype/mt-msb.cfg)
(/usr/local/texlive/2011/texmf-dist/tex/latex/jknapltx/ursfs.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/pxfonts/upxsyc.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/lm/omslmr.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/lm/t1lmtt.fd)

Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\citeauthor' on input line 127.


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\citetitle' on input line 127.


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\citeauthor' on input line 143.


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\citetitle' on input line 143.

[1{/usr/local/texlive/2011/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
[2pdfTeX warning (ext4): destination with the same identifier (name{equation.0.
1}) has been already used, duplicate ignored

\@EveryShipout@Output ...@Org@Shipout \box \@cclv 

l.170 
      ]pdfTeX warning (ext4): destination with the same identifier (name{equati
on.0.1}) has been already used, duplicate ignored
<to be read again> 
                   \relax 
l.171 \begin{equation}
                      pdfTeX warning (ext4): destination with the same identifi
er (name{equation.0.1}) has been already used, duplicate ignored
<to be read again> 
                   \relax 
l.178 \begin{equation}
                      pdfTeX warning (ext4): destination with the same identifi
er (name{equation.0.1}) has been already used, duplicate ignored
<to be read again> 
                   \relax 
l.188 \begin{equation}
                       [3]pdfTeX warning (ext4): destination with the same iden
tifier (name{equation.0.1}) has been already used, duplicate ignored
<to be read again> 
                   \relax 
l.194 \begin{equation}
                      pdfTeX warning (ext4): destination with the same identifi
er (name{equation.0.1}) has been already used, duplicate ignored
<to be read again> 
                   \relax 
l.200 \begin{equation}
                      pdfTeX warning (ext4): destination with the same identifi
er (name{equation.0.1}) has been already used, duplicate ignored
<to be read again> 
                   \relax 
l.207 \begin{equation}


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\citeauthor' on input line 220.


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\citetitle' on input line 220.

[4]
No complaints by nag.
[5] (./laskurs_logik.hemtenta.aux) )
(see the transcript file for additional information){/usr/local/texlive/2011/te
xmf-dist/fonts/enc/dvips/lm/lm-ec.enc}{/usr/local/texlive/2011/texmf-dist/fonts
/enc/dvips/lm/lm-rm.enc}{/usr/local/texlive/2011/texmf-dist/fonts/enc/dvips/lm/
lm-mathit.enc}{/usr/local/texlive/2011/texmf-dist/fonts/enc/dvips/lm/lm-mathsy.
enc}</usr/local/texlive/2011/texmf-dist/fonts/type1/public/lm/lmbx12.pfb></usr/
local/texlive/2011/texmf-dist/fonts/type1/public/lm/lmbxi10.pfb></usr/local/tex
live/2011/texmf-dist/fonts/type1/public/lm/lmcsc10.pfb></usr/local/texlive/2011
/texmf-dist/fonts/type1/public/lm/lmmi12.pfb></usr/local/texlive/2011/texmf-dis
t/fonts/type1/public/lm/lmmi8.pfb></usr/local/texlive/2011/texmf-dist/fonts/typ
e1/public/lm/lmr10.pfb></usr/local/texlive/2011/texmf-dist/fonts/type1/public/l
m/lmr12.pfb></usr/local/texlive/2011/texmf-dist/fonts/type1/public/lm/lmr17.pfb
></usr/local/texlive/2011/texmf-dist/fonts/type1/public/lm/lmr7.pfb></usr/local
/texlive/2011/texmf-dist/fonts/type1/public/lm/lmr8.pfb></usr/local/texlive/201
1/texmf-dist/fonts/type1/public/lm/lmri12.pfb></usr/local/texlive/2011/texmf-di
st/fonts/type1/public/lm/lmsy10.pfb></usr/local/texlive/2011/texmf-dist/fonts/t
ype1/public/lm/lmsy7.pfb></usr/local/texlive/2011/texmf-dist/fonts/type1/public
/lm/lmsy8.pfb></usr/local/texlive/2011/texmf-dist/fonts/type1/public/lm/lmtt10.
pfb>
Output written on laskurs_logik.hemtenta.pdf (5 pages, 251703 bytes).
SyncTeX written on laskurs_logik.hemtenta.synctex.gz.
Transcript written on laskurs_logik.hemtenta.log.
Latexmk: Found input bbl file 'laskurs_logik.hemtenta.bbl'
Latexmk: Log file says output to 'laskurs_logik.hemtenta.pdf'
Latexmk: Found biber source file(s) [/home/repabil/Dokument/skola/refse.bib laskurs_logik.hemtenta.bcf]
Rule 'pdflatex': Rules & subrules not known to be previously run:
   pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
      'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex -recorder -halt-on-error -interaction=nonstopmode -shell-escape -synctex=1  -recorder  "vc.tex"'
------------
laskurs_logik.hemtenta.aux
laskurs_logik.hemtenta.bcf
laskurs_logik.hemtenta.out
laskurs_logik.hemtenta.run.xml
Latexmk: All targets (laskurs_logik.hemtenta.pdf) are up-to-date
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
 \write18 enabled.
entering extended mode
(./vc.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2011-07-01, ngerman-x-2011-07-01, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, galician, german, ngerman, swissgerman, monogreek, greek, hungarian,
 icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, marathi, or
iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, kurmanji,
 lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, pol
ish, portuguese, romanian, russian, sanskrit, serbian, serbianc, slovak, sloven
ian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian, welsh, loaded
.
)
! Emergency stop.
<*> vc.tex

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on vc.log.
Failure to make 'vc.pdf'
Collected error summary (may duplicate other messages):
  pdflatex: Command for 'pdflatex' gave return code 256

------------
Latexmk: Some operations failed, for the following tex file(s)
  'vc.tex'
Latexmk: Use the -f option to force complete processing.
Latexmk: Errors, so I did not complete making targets

latexmk exited at Sat Nov  5 14:28:13

你应该将实际引起问题的文件的*...output*缓冲区的全部内容放入一些公共pastebin中。 - Ivan Andrus
@IvanAndrus 我已经在我的问题中包含了它。 - N.N.
抱歉,我是指那个导致你问题的大文件之一。我编辑了我的答案来解决缺少括号的示例,但不幸的是没有一个好的答案。 - Ivan Andrus
2个回答

10

latexmk被调用的方式存在问题。它是无参数调用的,因此尝试编译目录中的所有tex文件,包括新创建的vc.tex。这当然会导致问题,因为无法编译vc.tex,所以每次都会出现错误。

从您拥有的函数开始,使用TeX-command-expand进行修复相对容易,例如:

(defun run-latexmk ()
  (interactive)
  (let ((TeX-save-query nil)
        (TeX-process-asynchronous nil)
        (master-file (TeX-master-file)))
    (TeX-save-document "")
    (TeX-run-TeX "latexmk"
                 (TeX-command-expand "latexmk %t" 'TeX-master-file)
                 master-file)
    (if (plist-get TeX-error-report-switches (intern master-file))
        (TeX-next-error t)
      (minibuffer-message "latexmk done"))))

编辑:为了解决“TeX Live 2011”缓冲区的问题,您还需要使用其他答案。


感谢您的回答和坚持不懈。这解决了vc.tex存在时的问题,但我在问题中提到的两个小例子仍然会被抛入TeX Live 2011缓冲区。 - N.N.
很抱歉,你需要使用其他答案来解决这个问题。 - Ivan Andrus
它似乎与其他修复一起按照我想要的方式工作。谢谢!您能否在此答案中添加一个注释,说明其他修复是必需的? - N.N.

4
我很久以前就遇到了这个问题,并且进行了调查。这是由于AUCTeX解析输出的方式导致的,它试图确定错误所在的文件。当TeX开始读取文件时,它会输出(/path/to/the/file,当它完成读取文件时,它会打印。AUCTeX有许多误解的方式。它读取的第一个“文件”是TeX Live 2011,然后由于某种原因,它认为关闭的文件比打开的文件更多,你最终回到了TeX Live 2011。
在你提供的简短示例中,问题在于输出包含


(./auctex-bug2.texsh: ./vc: No such file or directory

这个问题可能是由于文件名中包含了冒号:, 导致程序无法识别其为新文件。当然,即使成功识别为新文件,也不会取得正确的结果。您可以通过在*... output*缓冲区适当的位置添加一个空格来解决此问题,然后再运行TeX-next-error(由于C-0自动调用TeX-next-error,所以不能使用它,但是您可以手动运行C-c C-c latexmk RET C-c C-l)。

但是,由于我怀疑这个例子并不是您真正遇到的问题,因此您需要找出实际问题所在。

对我来说,一个常见的问题是AUCTeX错误地粘贴“overfull box”行。您可以阅读我找到问题和解决方案的电子邮件(最新的AUCTeX从CVS中获取时已经修复,但不包括最新版本11.86)。

最近我遇到了同样的问题,并决定再次深入研究。这次是因为一行代码。

Package hyperref Message: Driver (autodetected): hpdftex.

有时候,当它无法识别某个文件时(自动检测),它会认为文件的结尾是由 ) 标记表示。不过,我覆盖了 TeX-parse-error 函数,使其能够在输出缓冲区中着色,这在查找问题时非常有帮助。如何修复它当然取决于问题所在。

以下是用于着色输出的代码。只需评估函数定义,然后像往常一样运行LaTeX即可。

(defun TeX-parse-error (old)
  "Goto next error.  Pop to OLD buffer if no more errors are found."
  (let ((regexp
         (concat
          ;; TeX error
          "^\\(!\\|\\(.*?\\):[0-9]+:\\) \\|"
          ;; New file
          "(\\(\"[^\"]*?\"\\|/*\
\\(?:\\.+[^()\r\n{} \\/]*\\|[^()\r\n{} .\\/]+\
\\(?: [^()\r\n{} .\\/]+\\)*\\(?:\\.[-0-9a-zA-Z_.]*\\)?\\)\
\\(?:[\\/]+\\(?:\\.+[^()\r\n{} \\/]*\\|[^()\r\n{} .\\/]+\
\\(?: [^()\r\n{} .\\/]+\\)*\\(?:\\.[-0-9a-zA-Z_.]*\\)?\\)?\\)*\\)\
)*\\(?: \\|\r?$\\)\\|"
          ;; End of file
          "\\()\\))*\\|"
          ;; Hook to change line numbers
          " !\\(?:offset(\\([---0-9]+\\))\\|"
          ;; Hook to change file name
          "name(\\([^)]+\\))\\)\\|"
          ;; LaTeX bad box
          "^\\(\\(?:Overfull\\|Underfull\\|Tight\\|Loose\\)\
 \\\\.*?[0-9]+--[0-9]+\\)\\|"
          ;; LaTeX warning
          "^\\(LaTeX [A-Za-z]*\\|Package [A-Za-z]+ \\)Warning:.*")))
    (while
        (cond
         ((null
           (re-search-forward regexp nil t))
          ;; No more errors.
          (message "No more errors.")
          (beep)
          (TeX-pop-to-buffer old)
          nil)
         ;; TeX error
         ((match-beginning 1)
          (when (match-beginning 2)
            (unless TeX-error-file
              (push nil TeX-error-file)
              (push nil TeX-error-offset))
            (unless (car TeX-error-offset)
              (rplaca TeX-error-file (TeX-match-buffer 2))))
          (if (looking-at "Preview ")
              t
            (TeX-error)
            nil))
         ;; LaTeX bad box
         ((match-beginning 7)
          (if TeX-debug-bad-boxes
              (progn
                (TeX-warning (TeX-match-buffer 7))
                nil)
            (re-search-forward "\r?\n\
\\(?:.\\{79\\}\r?\n\
\\)*.*\r?$")
            t))
         ;; LaTeX warning
         ((match-beginning 8)
          (if TeX-debug-warnings
              (progn
                (TeX-warning (TeX-match-buffer 8))
                nil)
            t))

         ;; New file -- Push on stack
         ((match-beginning 3)
          (overlay-put
           (make-overlay (match-beginning 3) (match-end 3))
           'face 'font-lock-type-face)
          (let ((file (TeX-match-buffer 3))
                (end (match-end 3)))
            ;; Strip quotation marks and remove newlines if necessary
            (when (or (eq (string-to-char file) ?\")
                      (string-match "\n" file))
              (setq file
                    (mapconcat 'identity (split-string file "[\"\n]+") "")))
            (push file TeX-error-file)
            (push nil TeX-error-offset)
            (goto-char end))
          t)

         ;; End of file -- Pop from stack
         ((match-beginning 4)
          (overlay-put
           (make-overlay (match-beginning 4) (match-end 4))
           'face 'font-lock-warning-face)
          (when (> (length TeX-error-file) 1)
            (pop TeX-error-file)
            (pop TeX-error-offset))
          (goto-char (match-end 4))
          t)

         ;; Hook to change line numbers
         ((match-beginning 5)
          (setq TeX-error-offset
                (list (string-to-number (TeX-match-buffer 5))))
          t)

         ;; Hook to change file name
         ((match-beginning 6)
          (setq TeX-error-file
                (list (TeX-match-buffer 6)))
          t)))))

编辑:

至于您的第二个示例,那很困难,因为就像TeX在发生错误之前会读取文件并关闭它一样。 因此,在出现错误时,从技术上讲,您不在任何文件中,但这只是因为TeX不知道发生真正的错误的位置。

无论如何,以下是一种非常麻烦的解决问题的方法。 它试图根据输出缓冲区*file-name output*的名称重构应该是“默认”的文件。 这只是掩盖了问题,但如果您的文档只包含一个文件,则可能至少有80%的工作时间。 当它不起作用时,它会很令人困惑-甚至比现在更加困惑。 :-)

(defadvice TeX-parse-reset (after make-master-file-default () activate)
  (push (concat (substring (buffer-name) 1 (- (length (buffer-name)) 8)) "." TeX-default-extension) TeX-error-file)
  (push nil TeX-error-offset))

defadvice添加到您的.emacs文件中是否解决了您感兴趣的问题? - Ivan Andrus
更具体地说,当我使用vc-bundle时,问题似乎会发生。 - N.N.
“另一个答案”是什么意思?我读了整个页面(因为我也遇到了TeX Live缓冲区为空的问题),但我无法理解你的意思。你能否(或者N.N.)请发表两个问题的完整解决方案[特别是空缓冲区问题的解决方案]? - Marius Hofert
另一个答案(被接受的那个)是如何修复vc.tex问题。TeX Live缓冲区问题是许多不同问题的症状,其中一些实际上无法修复。如果您想要一个“修复”大多数时间都有效的方法,请尝试添加此答案中的defadvice。如果这不能解决问题,那么可以使用最小示例打开另一个问题。 - Ivan Andrus
太好了。请将其作为答案写出来。我现在要尝试一下,如果它有效,我一定会给你投票支持。 - Ivan Andrus
显示剩余9条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接