我想使用documentclass
revtex4
并且在其中我想使用包glossaries-extra
。
不幸的是,当我将两者放在一起时,我收到以下消息:Error: Missing \glsxtr@resource in aux file. (Have you used \glsxtrresourcefile or \GlsXtrLoadResources?) system returned with code 768
。
看起来,该glossaries-extra
包无法找到我的条目,但我不明白为什么它不起作用,我对许多文档(例如\documentclass{article}
)使用了相同类型的代码,没有任何麻烦。
这是我的最小的非工作示例aipsamp-test.tex
:
% arara: pdflatex: { synctex: yes, shell: yes, interaction: batchmode }
% arara: pdflatex: { synctex: yes, shell: yes, interaction: batchmode }
%\documentclass[twocolumn]{article}
\documentclass[%
aip,
amsmath, amssymb,
reprint,% Neither reprint nor twocolumn options work.
% twocolumn,
]{revtex4-2} % or revtex4-1.
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{filecontents}{SymbolsAcronymsTest.bib}
@acronym{fem,short= {FEM}, long= {Finite Element Method}}
@symbol{dens,
name={\ensuremath{ \rho }},
description={mass density},
}
\end{filecontents}
\newcommand{\PathSymbolsEntries}{./SymbolsAcronymsTest}%.bib
\usepackage[record, automake]{glossaries-extra}
\newglossary*{acronym}{Abbreviations}
\newglossary*{symbol}{Nomenclature}
\GlsXtrLoadResources[
src={\PathSymbolsEntries},
type={acronym},
match={entrytype=acronym},
]
\GlsXtrLoadResources[
src={\PathSymbolsEntries},
type=symbol,
match={entrytype=symbol},
]
\begin{document}
\title{Sample Title}
\author{A. Author}
\date{\today}
\begin{abstract}
An article usually includes an abstract.
\end{abstract}
\maketitle
\section{First-level heading}
This sample document demonstrates proper use of REV.
$\gls{dens}$, \gls{fem}
\printunsrtglossary[type=acronym]
\printunsrtglossary[type=symbol]
\end{document}
是否存在已知的不兼容性?或者您有什么想法?提前致谢。
编辑
通过shell命令可以清楚地看到这个问题:
pdflatex --shell-escape ./aipsamp-test.tex 1>log.txt
pdflatex --shell-escape ./aipsamp-test.tex 1>log.txt
Error: Missing \glsxtr@resource in aux file. (Have you used \glsxtrresourcefile or \GlsXtrLoadResources?)
system returned with code 768
而且正如前面的命令所示,错误不会停止编译,而只是在终端中发出警告。所以问题没有出现在日志文件中。因此,我认为问题来自选项的glossaries-extra
内部。runsystem(bib2gls aipsamp-test)
automake
否则,在生成的文档中,“首字母缩略词和术语”部分为空,并且在应该出现 rho 和 FEM 的位置有一个问号,如下面的屏幕截图中以红色显示。
这是生成的日志文件aipsamp-test.log
:
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex 2020.9.17) 17 SEP 2020 16:58
entering extended mode
\write18 enabled.
%&-line parsing enabled.
**./aipsamp-test.tex
(./aipsamp-test.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06>
(/Applis/TexLive/texlive2020/texmf-dist/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=\count167
\@tbpen=\count168
\@arstrutbox@hline=\box45
Class revtex4-2 Info: Repairing broken LaTeX \@xbitor on input line 1793.
Class revtex4-2 Info: Making \typeout \long on input line 2053.
ltxfront[2019/01/18/14:29:48 4.2c frontmatter package (AO,DPC,MD)]
\c@affil=\count169
\c@collab=\count170
\absbox=\box46
ltxgrid[2019/01/18/14:29:48 4.2c page grid package (portions licensed from W. E
. Baxter web at superscript.com)]
\c@linecount=\count171
\output@latex=\toks15
\box@size@1=\box47
\box@size@2=\box48
\@protection@box=\box49
\@topmark@saved=\toks16
\footins@saved=\box50
\footins@recovered=\box51
\column@recovered=\box52
\pagesofar=\box53
\footsofar=\box54
\pagegrid@col=\count172
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=\count173
\c@section=\count174
\c@subsection=\count175
\c@subsubsection=\count176
\c@paragraph=\count177
\c@subparagraph=\count178
\abovecaptionskip=\skip48
\belowcaptionskip=\skip49
\c@figure=\count179
\fbox@1=\box55
\c@table=\count180
\fbox@2=\box56
\c@video=\count181
\fbox@4=\box57
\@bibdataout=\write3
\widetext@top=\box58
\widetext@bot=\box59
Class revtex4-2 Info: Selecting society aip on input line 7581.
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/revtex/aip4-2.rtx
File: aip4-2.rtx 2019/01/18/14:29:48 4.2c AIP substyle for REVTeX
Class revtex4-2 Info: RevTeX society AIP selected on input line 87.
)
Class revtex4-2 Warning: No journal specified, using default cha.
Using journal substyle cha.
Class revtex4-2 Info: Reading file aps10pt4-2.rtx on input line 7586.
(/Applis/TexLive/texlive2020/texmf-dist/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.
)
Class revtex4-2 Info: Overriding 10pt on input line 7586.
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/textcase/textcase.sty
Package: textcase 2019/09/14 v1.00 Text only upper/lower case changing (DPC)
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/amsfonts/amssymb.sty
Package: amssymb 2013/01/14 v3.01 AMS font symbols
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/amsfonts/amsfonts.sty
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
\@emptytoks=\toks17
\symAMSa=\mathgroup4
\symAMSb=\mathgroup5
LaTeX Font Info: Redeclaring math symbol \hbar on input line 98.
LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold'
(Font) U/euf/m/n --> U/euf/b/n on input line 106.
))
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/amsmath/amsmath.sty
Package: amsmath 2020/01/20 v2.17e AMS math features
\@mathmargin=\skip50
For additional information on amsmath, use the `?' option.
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/amsmath/amstext.sty
Package: amstext 2000/06/29 v2.01 AMS text
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/amsmath/amsgen.sty
File: amsgen.sty 1999/11/30 v2.0 generic functions
\@emptytoks=\toks18
\ex@=\dimen134
)
LaTeX Info: Redefining \text on input line 28.
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/amsmath/amsbsy.sty
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
\pmbraise@=\dimen135
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/amsmath/amsopn.sty
Package: amsopn 2016/03/08 v2.02 operator names
)
\inf@bad=\count182
LaTeX Info: Redefining \frac on input line 227.
\uproot@=\count183
\leftroot@=\count184
LaTeX Info: Redefining \overline on input line 389.
\classnum@=\count185
\DOTSCASE@=\count186
LaTeX Info: Redefining \ldots on input line 486.
LaTeX Info: Redefining \dots on input line 489.
LaTeX Info: Redefining \cdots on input line 610.
\Mathstrutbox@=\box60
\strutbox@=\box61
\big@size=\dimen136
LaTeX Font Info: Redeclaring font encoding OML on input line 733.
LaTeX Font Info: Redeclaring font encoding OMS on input line 734.
\macc@depth=\count187
\c@MaxMatrixCols=\count188
\dotsspace@=\muskip16
\c@parentequation=\count189
\dspbrk@lvl=\count190
\tag@help=\toks19
\row@=\count191
\column@=\count192
\maxfields@=\count193
\andhelp@=\toks20
\eqnshift@=\dimen137
\alignsep@=\dimen138
\tagshift@=\dimen139
\tagwidth@=\dimen140
\totwidth@=\dimen141
\lineht@=\dimen142
\@envbody=\toks21
\multlinegap=\skip51
\multlinetaggap=\skip52
\mathdisplay@stack=\toks22
LaTeX Info: Redefining \[ on input line 2859.
LaTeX Info: Redefining \] on input line 2860.
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/url/url.sty
\Urlmuskip=\muskip17
Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc.
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/natbib/natbib.sty
Package: natbib 2010/09/13 8.31b (PWD, AO)
\bibhang=\skip53
\bibsep=\skip54
LaTeX Info: Redefining \cite on input line 694.
\c@NAT@ctr=\count194
)
Class revtex4-2 Info: Repairing natbib's \BibitemShut on input line 7588.
(/Applis/TexLive/texlive2020/texmf-dist/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 \frak on input line 101.
LaTeX Info: Redefining \Bbb on input line 117.
LaTeX Info: Redefining \REV@mathfrak on input line 125.
))
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/base/inputenc.sty
Package: inputenc 2018/08/11 v1.3c Input encoding file
\inpenc@prehook=\toks23
\inpenc@posthook=\toks24
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/base/fontenc.sty
Package: fontenc 2020/02/11 v2.0o Standard LaTeX package
)
LaTeX Warning: File `SymbolsAcronymsTest.bib' already exists on the system.
Not generating it from this source.
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/glossaries-extra/glossaries-e
xtra.sty
Package: glossaries-extra 2020/03/23 v1.44 (NLCT)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/xkeyval/xkeyval.sty
Package: xkeyval 2014/12/03 v2.7a package option processing (HA)
(/Applis/TexLive/texlive2020/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/Applis/TexLive/texlive2020/texmf-dist/tex/generic/xkeyval/xkvutils.tex
\XKV@toks=\toks25
\XKV@tempa@toks=\toks26
(/Applis/TexLive/texlive2020/texmf-dist/tex/generic/xkeyval/keyval.tex))
\XKV@depth=\count195
File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
))
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2019/09/21 v2.5h e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count196
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/glossaries/base/glossaries.st
y
Package: glossaries 2020/03/19 v4.46 (NLCT)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/base/ifthen.sty
Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty
Package: mfirstuc 2017/11/14 v2.06 (NLCT)
\@glsmfirst=\toks27
\@glsmrest=\toks28
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/xfor/xfor.sty
Package: xfor 2009/02/05 v1.05 (NLCT)
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/datatool/datatool-base.sty
Package: datatool-base 2019/09/27 v2.32 (NLCT)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/substr/substr.sty
Package: substr 2009/10/20 v1.2 Handle substrings
\c@su@anzahl=\count197
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/datatool/datatool-fp.sty
Package: datatool-fp 2019/09/27 v2.32 (NLCT)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/fp/fp.sty
Package: fp 1995/04/02
`Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/fp/defpattern.sty
Package: defpattern 1994/10/12
\actioncount=\count198
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/fp/fp-basic.sty
Package: fp-basic 1996/05/13
\FP@xs=\count199
\FP@xia=\count266
\FP@xib=\count267
\FP@xfa=\count268
\FP@xfb=\count269
\FP@rega=\count270
\FP@regb=\count271
\FP@regs=\count272
\FP@times=\count273
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/fp/fp-addons.sty
Package: fp-addons 1995/03/15
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/fp/fp-snap.sty
Package: fp-snap 1995/04/05
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/fp/fp-exp.sty
Package: fp-exp 1995/04/03
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/fp/fp-trigo.sty
Package: fp-trigo 1995/04/14
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/fp/fp-pas.sty
Package: fp-pas 1994/08/29
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/fp/fp-random.sty
Package: fp-random 1995/02/23
\FPseed=\count274
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/fp/fp-eqn.sty
Package: fp-eqn 1995/04/03
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/fp/fp-upn.sty
Package: fp-upn 1996/10/21
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/fp/fp-eval.sty
Package: fp-eval 1995/04/03
)))
\@dtl@toks=\toks29
\@dtl@tmpcount=\count275
\dtl@tmplength=\skip55
\dtl@sortresult=\count276
\@dtl@numgrpsepcount=\count277
\@dtl@datatype=\count278
\dtl@codeA=\count279
\dtl@codeB=\count280
\@dtl@foreach@level=\count281
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/glossaries/base/glossaries-co
mpatible-307.sty
Package: glossaries-compatible-307 2020/03/19 v4.46 (NLCT)
)
\gls@level=\count282
\@gls@tmpb=\toks30
\gls@tmplen=\skip56
\glskeylisttok=\toks31
\glslabeltok=\toks32
\glsshorttok=\toks33
\glslongtok=\toks34
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/glossaries/styles/glossary-hy
pernav.sty
Package: glossary-hypernav 2020/03/19 v4.46 (NLCT)
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/glossaries/styles/glossary-li
st.sty
Package: glossary-list 2020/03/19 v4.46 (NLCT)
\glslistdottedwidth=\skip57
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/glossaries/styles/glossary-lo
ng.sty
Package: glossary-long 2020/03/19 v4.46 (NLCT)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/tools/longtable.sty
Package: longtable 2020/01/07 v4.13 Multi-page Table package (DPC)
\LTleft=\skip58
\LTright=\skip59
\LTpre=\skip60
\LTpost=\skip61
\LTchunksize=\count283
\LTcapwidth=\dimen143
\LT@head=\box62
\LT@firsthead=\box63
\LT@foot=\box64
\LT@lastfoot=\box65
\LT@cols=\count284
\LT@rows=\count285
\c@LT@tables=\count286
\c@LT@chunks=\count287
\LT@p@ftn=\toks35
)
\glsdescwidth=\skip62
\glspagelistwidth=\skip63
)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/glossaries/styles/glossary-su
per.sty
Package: glossary-super 2020/03/19 v4.46 (NLCT)
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/supertabular/supertabular.sty
Package: supertabular 2020/02/02 v4.1g the supertabular environment
\c@tracingst=\count288
\ST@wd=\dimen144
\ST@rightskip=\skip64
\ST@leftskip=\skip65
\ST@parfillskip=\skip66
\ST@pageleft=\dimen145
\ST@headht=\dimen146
\ST@tailht=\dimen147
\ST@pagesofar=\dimen148
\ST@pboxht=\dimen149
\ST@lineht=\dimen150
\ST@prevht=\dimen151
\ST@toadd=\dimen152
\ST@dimen=\dimen153
\ST@pbox=\box66
))
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/glossaries/styles/glossary-tr
ee.sty
Package: glossary-tree 2020/03/19 v4.46 (NLCT)
\glstreeindent=\skip67
))
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/glossaries-extra/glossaries-e
xtra-bib2gls.sty
Package: glossaries-extra-bib2gls 2020/03/23 v1.44 (NLCT)
)
\@glsxtr@leveloffset=\count289
\glsxtrresourcecount=\count290
\@glsxtrnewgls@inner=\count291
\glsshortpltok=\toks36
\glslongpltok=\toks37
)
runsystem(bib2gls aipsamp-test)...executed.
Package glossaries-extra Warning: No file `aipsamp-test.glstex' on input line 3
3.
Package glossaries-extra Warning: No file `aipsamp-test-1.glstex' on input line
39.
Class revtex4-2 Info: Unrecognized LaTeX tabular. Please update this document c
lass! (Proceeding with fingers crossed.) on input line 41.
Class revtex4-2 Info: Patching unrecognized longtable package. (Proceeding with
fingers crossed) on input line 41.
Class revtex4-2 Info: cite was not loaded (OK!) on input line 41.
Class revtex4-2 Info: mcite was not loaded (OK!) on input line 41.
Class revtex4-2 Info: multicol was not loaded (OK!) on input line 41.
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.d
ef
File: l3backend-pdfmode.def 2020-03-12 L3 backend support: PDF mode
\l__kernel_color_stack_int=\count292
\l__pdf_internal_box=\box67
) (./aipsamp-test.aux)
\openout1 = `aipsamp-test.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 41.
LaTeX Font Info: ... okay on input line 41.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 41.
LaTeX Font Info: ... okay on input line 41.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 41.
LaTeX Font Info: ... okay on input line 41.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 41.
LaTeX Font Info: ... okay on input line 41.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 41.
LaTeX Font Info: ... okay on input line 41.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 41.
LaTeX Font Info: ... okay on input line 41.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 41.
LaTeX Font Info: ... okay on input line 41.
\openout3 = `aipsamp-testNotes.bib'.
Class revtex4-2 Warning: Assuming \noaffiliation for authors.
LaTeX Font Info: Trying to load font information for T1+cmss on input line 4
8.
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/base/t1cmss.fd
File: t1cmss.fd 2019/12/16 v2.5j Standard LaTeX font definitions
)
LaTeX Font Info: Trying to load font information for U+msa on input line 52.
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/amsfonts/umsa.fd
File: umsa.fd 2013/01/14 v3.01 AMS symbols A
)
LaTeX Font Info: Trying to load font information for U+msb on input line 52.
(/Applis/TexLive/texlive2020/texmf-dist/tex/latex/amsfonts/umsb.fd
File: umsb.fd 2013/01/14 v3.01 AMS symbols B
)
Package glossaries-extra Warning: Glossary entry `dens' has not been defined on
input line 52.
Package glossaries-extra Warning: Glossary entry `fem' has not been defined on
input line 52.
Package glossaries-extra Warning: No entries defined in glossary `acronym' on i
nput line 54.
Package glossaries-extra Warning: No entries defined in glossary `symbol' on in
put line 55.
No file aipsamp-test.bbl.
No file aipsamp-test.bbl.
[1{/Applis/TexLive/texlive2020/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./aipsamp-test.aux) )
Here is how much of TeX's memory you used:
9602 strings out of 480608
149647 string characters out of 5901651
505453 words of memory out of 5000000
25383 multiletter control sequences out of 15000+600000
540170 words of font info for 40 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
59i,4n,41p,1053b,329s stack positions out of 5000i,500n,10000p,200000b,80000s
{/Applis/TexLive/texlive2020/texmf-dist/fonts/enc/dvips/c
m-super/cm-super-t1.enc}</Applis/TexLive/texlive2020/texmf-dist/fonts/type1/pub
lic/amsfonts/cm/cmr10.pfb></Applis/TexLive/texlive2020/texmf-dist/fonts/type1/p
ublic/cm-super/sfrm0900.pfb></Applis/TexLive/texlive2020/texmf-dist/fonts/type1
/public/cm-super/sfrm1000.pfb></Applis/TexLive/texlive2020/texmf-dist/fonts/typ
e1/public/cm-super/sfss1000.pfb></Applis/TexLive/texlive2020/texmf-dist/fonts/t
ype1/public/cm-super/sfsx0900.pfb></Applis/TexLive/texlive2020/texmf-dist/fonts
/type1/public/cm-super/sfsx1440.pfb>
Output written on aipsamp-test.pdf (1 page, 75208 bytes).
PDF statistics:
33 PDF objects out of 1000 (max. 8388607)
23 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)
我继续调查,似乎问题出reprint
在 中的选项上\documentclass
:通过注释此选项,编译不会返回任何错误,文档看起来符合预期。但是,如果没有此选项,布局将完全不同。我还注意到 选项存在同样的问题twocolumn
。但为什么这些选项会产生麻烦的问题仍然存在?
答案1
问题本质上是
\documentclass[twocolumn]{revtex4-2}
\makeatletter
\protected@write\@auxout{}{\gdef\string\foo{bar}}
\makeatother
\begin{document}
\maketitle
A
\end{document}
不会写入\gdef \foo{bar}
辅助文件。我不知道为什么,当twocolumn
不活动时它可以工作,如果\maketitle
省略 它也工作,如果在 之前排版了一些文本它可以工作\maketitle
,但如果是某些调用\maketitle
中排版的第一件事,则不会显示。twocolumn
\@auxout
我以为这可能与新的乳胶钩现在 revtex 与足够新的 latex 版本一起使用,但在 Overleaf 上测试时,我似乎能够使用和将其复制回 TL 2014(就 Overleaf 而言revtex4
)revtex4-1
。
虽然大多数辅助文件都正确输出,但应该写入\glsxtr@resource
的\GlsXtrLoadResources
却没有,这是它用来生成它的底层机制\protected@write\@auxout
。使用几个补丁\GlsXtrLoadResources
,\glsxtrresourcefile
我们可以延迟写入辅助文件,直到\end{document}
它们成功写入。
% arara: pdflatex: { synctex: yes, shell: yes, interaction: batchmode }
% arara: pdflatex: { synctex: yes, shell: yes, interaction: batchmode }
\begin{filecontents}{SymbolsAcronymsTest.bib}
@acronym{fem,short= {FEM}, long= {Finite Element Method}}
@symbol{dens,
name={\ensuremath{ \rho }},
description={mass density},
}
\end{filecontents}
\documentclass[twocolumn]{revtex4-2}
\usepackage[record,automake]{glossaries-extra}
\newglossary*{acronym}{Abbreviations}
\newglossary*{symbol}{Nomenclature}
\makeatletter
% patch some recent changes to the \GlsXtrLoadResources and
% \glsxtrresourcefile macros so the redefinitions below should
% also work with earlier versions of glossaries-extra
\providecommand{\glsindexingsetting}{}
\providecommand{\glsxtr@save@mfu}{}
\renewcommand*{\GlsXtrLoadResources}[1][]{%
\ifnum\glsxtrresourcecount=0\relax
\glsxtrresourcefile[#1]{\jobname}%
\else
\edef\glsxtrresourcefilename{\jobname-\the\glsxtrresourcecount}% <--- ADDED
\glsxtrresourcefile[#1]{\glsxtrresourcefilename}% <--- MODIFIED
\fi
\advance\glsxtrresourcecount by 1\relax
}
\renewcommand*{\glsxtrresourcefile}[2][]{%
\@glsxtr@if@record@only
{\renewcommand{\glsindexingsetting}{bib2gls}}%
{\edef\glsindexingsetting{bib2gls-\ifglsxindy xindy\else makeindex\fi}}%
\disable@keys{glossaries-extra.sty}{record}%
\glsxtr@writefields
\glsxtr@save@mfu
\ifdefempty\GlsXtrDefaultResourceOptions
{%
\AtEndDocument{% <--- ADDED
\protected@write\@auxout{\glsxtrresourceinit}%
{\string\glsxtr@resource{#1}{#2}}%
}% <--- ADDED
}%
{%
\AtEndDocument{% <--- ADDED
\protected@write\@auxout{\glsxtrresourceinit}%
{\string\glsxtr@resource{\GlsXtrDefaultResourceOptions,#1}{#2}}%
}% <--- ADDED
}%
\let\@glsxtr@org@see@noindex\@gls@see@noindex
\let\@gls@see@noindex\relax
\IfFileExists{#2.glstex}%
{%
\edef\@bibgls@restoreat{\noexpand\catcode\noexpand`\noexpand\@=\number\catcode`\@}%
\makeatletter
\@input{#2.glstex}%
\@bibgls@restoreat
\@glsxtr@check@bibgls@nameref
}%
{%
\GlossariesExtraWarning{No file `#2.glstex'}%
}%
\let\@gls@see@noindex\@glsxtr@org@see@noindex
}
\makeatother
\GlsXtrLoadResources[
src={./SymbolsAcronymsTest},
type={acronym},
match={entrytype=acronym},
]
\GlsXtrLoadResources[
src={./SymbolsAcronymsTest},
type={symbol},
match={entrytype=symbol},
]
\begin{document}
\maketitle
\gls{dens}, \gls{fem}
\printunsrtglossary[type=acronym]
\printunsrtglossary[type=symbol]
\end{document}
除了弄乱 的内部结构外glossaries-extra
,在 之前排版任何内容\maketitle
也可以避免此问题,因此
\documentclass[twocolumn]{revtex4-2}
\makeatletter
\protected@write\@auxout{}{\gdef\string\foo{bar}}
\makeatother
\begin{document}
\rule{0pt}{0pt}
\maketitle
A
\end{document}
提供了一个准确的辅助文件,但这确实明显地推低了任何标题内容,尽管规则本身的大小为零。
这个不可靠的辅助文件似乎只影响外部调用(makeglossaries
/ bib2gls
),因此(如这个答案) 在进行这些外部调用之前切换到onecolumn
并编译一次,然后再恢复到,可能就足够了twocolumn
。每当您想要更新词汇表时,都需要重复此操作。