revtex 无法编译“缺少 \begin{document}”

revtex 无法编译“缺少 \begin{document}”

我正在使用 revtex 提供的 documentclass(https://ctan.org/tex-archive/macros/latex/contrib/revtex)。它曾经可以工作,但最近我开始收到以下错误。该文档仍然大部分编译正常,开头有一个奇怪的 \begin{document}。我尝试重新安装所有内容,但无济于事。我将不胜感激任何提示,我正在复制下面的终端输出。我正在使用最新的 Ubuntu,revtex,并且所有软件包都已完全升级。

LaTeX 文件:

\documentclass{revtex4-2}
\begin{document}
\end{document}

日志档案:

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/Debian) (preloaded format=pdflatex 2021.8.20)  20 AUG 2021 23:22
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**test.tex
(./test.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-01-09> xparse <2020-03-03>
(/home/daniel/texmf/tex/latex/revtex/revtex4-2.cls
Document Class: revtex4-2 2019/01/18/14:29:48 4.2c (https://journals.aps.org/re
vtex/ for documentation)
 Copyright (c) 2019 American Physical Society.
 mailto:[email protected]
 Licensed under the LPPL:
http://www.ctan.org/tex-archive/macros/latex/base/lppl.txt
 Arthur Ogawa <arthur_ogawa at sbcglobal dot net>
 Based on work by David Carlisle <david at dcarlisle.demon.co.uk>Version (4.2c)
: Modified by Mark Doyle
 .
ltxutil[2019/01/18/14:29:48 4.2c utilities package (portions licensed from W. E
. Baxter web at superscript.com)]
LaTeX Info: Redefining \@centercr on input line 315.
Class revtex4-2 Info: Repairing broken LaTeX eqnarray on input line 365.
\eqncolsep=\skip47
Class revtex4-2 Info: Repairing hyperref-unfriendly LaTeX definition of \mpfoot
note on input line 440.
Class revtex4-2 Info: Repairing broken LateX \@sect on input line 762.
\intertabularlinepenalty=\count177
\@tbpen=\count178
\@arstrutbox@hline=\box47
Class revtex4-2 Info: Repairing broken LaTeX \@xbitor on input line 1793.
ltxfront[2019/01/18/14:29:48 4.2c frontmatter package (AO,DPC,MD)]
\c@affil=\count179
\c@collab=\count180
\absbox=\box48
ltxgrid[2019/01/18/14:29:48 4.2c page grid package (portions licensed from W. E
. Baxter web at superscript.com)]
\c@linecount=\count181
\output@latex=\toks15
\box@size@1=\box49
\box@size@2=\box50
\@protection@box=\box51
\@topmark@saved=\toks16
\footins@saved=\box52
\footins@recovered=\box53
\column@recovered=\box54
\pagesofar=\box55
\footsofar=\box56
\pagegrid@col=\count182

Class revtex4-2 Warning: Failed to recognize \@vspace, \@vspacer, \@no@pgbk, \@
newline, and \\; no patches applied. Please get a more up-to-date class, .

\c@part=\count183
\c@section=\count184
\c@subsection=\count185
\c@subsubsection=\count186
\c@paragraph=\count187
\c@subparagraph=\count188
\abovecaptionskip=\skip48
\belowcaptionskip=\skip49
\c@figure=\count189
\fbox@1=\box57
\c@table=\count190
\fbox@2=\box58
\c@video=\count191
\fbox@4=\box59
\@bibdataout=\write3
\widetext@top=\box60
\widetext@bot=\box61

Class revtex4-2 Warning: No Society specified, using default society aps.

(/home/daniel/texmf/tex/latex/revtex/aps4-2.rtx
File: aps4-2 2019/01/18/14:29:48 4.2c (https://journals.aps.org/revtex/ for doc
umentation)
Class revtex4-2 Info: RevTeX society APS selected on input line 37.
)

Class revtex4-2 Warning: No journal specified, using default pra.

Class revtex4-2 Info: APS journal PRA selected on input line 7584.

Class revtex4-2 Warning: No type size specified, using default 10.

(/home/daniel/texmf/tex/latex/revtex/aps10pt4-2.rtx
File: aps10pt4-2 2019/01/18/14:29:48 4.2c (https://journals.aps.org/revtex/ for
 documentation)
Class revtex4-2 Info: RevTeX pointsize 10pt selected on input line 36.
)
(/usr/share/texlive/texmf-dist/tex/latex/textcase/textcase.sty
Package: textcase 2019/09/14 v1.00 Text only upper/lower case changing (DPC)
)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty
\Urlmuskip=\muskip16
Package: url 2013/09/16  ver 3.4  Verb mode for urls, etc.
)
(/usr/share/texlive/texmf-dist/tex/latex/natbib/natbib.sty
Package: natbib 2010/09/13 8.31b (PWD, AO)
\bibhang=\skip50
\bibsep=\skip51
LaTeX Info: Redefining \cite on input line 694.
\c@NAT@ctr=\count192
)
Class revtex4-2 Info: Repairing natbib's \BibitemShut on input line 7588.

(/home/daniel/texmf/tex/latex/revtex/revsymb4-2.sty
Package: revsymb4-2 2019/01/18/14:29:48 4.2c (https://journals.aps.org/revtex/ 
for documentation)
LaTeX Info: Redefining \REV@mathfrak on input line 125.
))
! Extra \endgroup.
\document ->\endgroup 
                      \document@inithook \true@sw {}\UseOneTimeHook {begindo...
l.2 \begin{document}
                    
? 
Class revtex4-2 Info: Unrecognized LaTeX tabular. Please update this document c
lass! (Proceeding with fingers crossed.) on input line 2.
Class revtex4-2 Info: cite was not loaded (OK!) on input line 2.
Class revtex4-2 Info: mcite was not loaded (OK!) on input line 2.
Class revtex4-2 Info: multicol was not loaded (OK!) on input line 2.

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.2 \begin{document}
                    
? 
! Interruption.
\GenericError  ...                                
                                                  \endgroup 
l.2 \begin{document}
                    
? 
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def
File: l3backend-pdftex.def 2020-01-29 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count193
\l__pdf_internal_box=\box62
)
No file test.aux.
\openout1 = `test.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
\openout3 = `testNotes.bib'.

[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)

LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right .


 ) 
Here is how much of TeX's memory you used:
 2412 strings out of 481252
 33436 string characters out of 5915888
 310120 words of memory out of 5000000
 19413 multiletter control sequences out of 15000+600000
 403430 words of font info for 27 fonts, out of 8000000 for 9000
 14 hyphenation exceptions out of 8191
 54i,4n,60p,203b,110s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on test.pdf (1 page, 13120 bytes).
PDF statistics:
 12 PDF objects out of 1000 (max. 8388607)
 7 compressed objects within 1 object stream
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

答案1

正如 @David Carlisle 在评论中指出的那样,这个错误是由于使用旧版本而导致的revtex

出现此问题的原因是 APS 页面提供的直接下载(https://journals.aps.org/revtex/revtex-faq#download) 给出的是版本 4.2c,而不是 4.2e。这可以通过\listfiles在序言中加入以下内容来检查,例如

\documentclass{revtex4-2}
\listfiles
\begin{document}
\end{document}

可以通过从 CTAN 下载当前版本来修复该错误:https://ctan.org/tex-archive/macros/latex/contrib/revtex

相关内容