acro
因此,我在使用带有的包时遇到了一个奇怪的编译错误(xelatex)bibunits
。这是一个最小工作示例:
\documentclass{report}
\usepackage{lipsum}
\usepackage{acro}
\usepackage{natbib}
\usepackage{bibunits}
\usepackage{hyperref}
\defaultbibliographystyle{apalike}
\defaultbibliography{refs}
\DeclareAcronym{ITCZ}{
short = ITCZ,
long = Intertropical Convergence Zone
}
\begin{document}
\begin{bibunit}
There has never been more \acl{ITCZ} \citep[\acs{ITCZ};][]{Smith_Lorem_1980}.
\lipsum
\putbib
\end{bibunit}
\end{document}
文件内容refs
:
@BOOK{Smith_Lorem_1980,
AUTHOR = {John Smith},
TITLE = {Sit Amet},
YEAR = {1980},
PUBLISHER = {Knopf},
}
问题是,There has never been more \acl{ITCZ} \citep[\acs{ITCZ};][]{Smith_Lorem_1980}.
我想使用首字母缩略词的长名称,然后在引文中使用短版本;因此输出应该类似于Intertropical Convergence Zone (ITCZ; Smith 1980)
。我遇到的问题是,当此行后有一定数量的文本时,编译时会抛出错误。一两行文本似乎不会引起问题,但会\lipsum
触发错误。可以通过使用和不使用进行编译来测试\lipsum
。
发生的错误是
(./bu1.aux
! Undefined control sequence.
l.3 \acro
@used@twice {ITCZ}{1}{1}{0}
bu1.aux
文件中还有一行
\acro@used@twice {ITCZ}{1}{1}{0}
有人知道发生了什么事吗?
bu1.aux
编译后文件的内容
\bibstyle{apalike}
\citation{Smith_Lorem_1980}
\acro@used@twice {ITCZ}{1}{1}{0}
\bibdata{refs}
完整日志
This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019) (preloaded format=xelatex 2020.3.20) 16 JUN 2020 18:54
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**main.tex
(./main.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-02-25>
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/report.cls
Document Class: report 2019/12/20 v1.4l Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2019/12/20 v1.4l Standard LaTeX file (size option)
)
\c@part=\count163
\c@chapter=\count164
\c@section=\count165
\c@subsection=\count166
\c@subsubsection=\count167
\c@paragraph=\count168
\c@subparagraph=\count169
\c@figure=\count170
\c@table=\count171
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen134
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/lipsum/lipsum.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3.sty
Package: expl3 2020-02-25 L3 programming layer (loader)
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3backend/l3backend-xdvipdfmx.def
File: l3backend-xdvipdfmx.def 2020-02-23 L3 backend support: xdvipdfmx
\g__graphics_track_int=\count172
\l__pdf_internal_box=\box45
\g__pdf_backend_object_int=\count173
\g__pdf_backend_annotation_int=\count174
)) (/usr/local/texlive/2019/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
Package: xparse 2020-02-25 L3 Experimental document command parser
\l__xparse_current_arg_int=\count175
\g__xparse_grabber_int=\count176
\l__xparse_m_args_int=\count177
\l__xparse_v_nesting_int=\count178
)
Package: lipsum 2019/01/02 v2.2 150 paragraphs of Lorem Ipsum dummy text
(/usr/local/texlive/2019/texmf-dist/tex/latex/lipsum/lipsum.ltd.tex
File: lipsum.ltd.tex 2019/01/02 v2.2 The Lorem ipsum dummy text
))
(/usr/local/texlive/2019/texmf-dist/tex/latex/acro/acro.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.st
y
Package: xtemplate 2020-02-25 L3 Experimental prototype document functions
\l__xtemplate_tmp_dim=\dimen135
\l__xtemplate_tmp_int=\count179
\l__xtemplate_tmp_muskip=\muskip16
\l__xtemplate_tmp_skip=\skip49
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
Package: l3keys2e 2020-02-25 LaTeX2e option processing using LaTeX3 keys
) (/usr/local/texlive/2019/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2019/09/21 v2.5h e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count180
)
Package: acro 2020/02/03 v2.11c Typeset Acronyms
\l__acro_tmpa_int=\count181
\l__acro_tmpb_int=\count182
\l__acro_tmpc_int=\count183
\l__acro_tmpd_int=\count184
\l__acro_page_space_skip=\skip50
\l__acro_short_width_dim=\dimen136
\g__acro_barrier_int=\count185
Package xtemplate Info: Declaring object type 'acro-first' taking 2
(xtemplate) argument(s) on line 912.
Package xtemplate Info: Declaring object type 'acro-extra' taking 1
(xtemplate) argument(s) on line 1041.
(/usr/local/texlive/2019/texmf-dist/tex/latex/zref/zref-abspage.sty
Package: zref-abspage 2019/11/29 v2.28 Module abspage for zref (HO)
(/usr/local/texlive/2019/texmf-dist/tex/latex/zref/zref-base.sty
Package: zref-base 2019/11/29 v2.28 Module base for zref (HO)
(/usr/local/texlive/2019/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty
Package: ltxcmds 2019/12/15 v1.24 LaTeX kernel commands for general use (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/infwarerr/infwarerr.sty
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty
Package: kvsetkeys 2019/12/15 v1.18 Key value parser (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty
Package: kvdefinekeys 2019-12-19 v1.6 Define keys (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/pdftexcmds/pdftexcmds.sty
Package: pdftexcmds 2019/11/24 v0.31 Utility functions of pdfTeX for LuaTeX (HO
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/iftex/iftex.sty
Package: iftex 2019/11/07 v1.0c TeX engine tests
)
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode not found.
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/etexcmds/etexcmds.sty
Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/auxhook/auxhook.sty
Package: auxhook 2019-12-17 v1.6 Hooks for auxiliary files (HO)
)
Package zref Info: New property list: main on input line 763.
Package zref Info: New property: default on input line 764.
Package zref Info: New property: page on input line 765.
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/atbegshi/atbegshi.sty
Package: atbegshi 2019/12/05 v1.19 At begin shipout hook (HO)
)
\c@abspage=\count186
Package zref Info: New property: abspage on input line 66.
)
Package xtemplate Info: Declaring object type 'acro-page-number' taking 1
(xtemplate) argument(s) on line 1271.
Package xtemplate Info: Declaring object type 'acro-title' taking 1
(xtemplate) argument(s) on line 1340.
Package xtemplate Info: Declaring object type 'acro-list' taking 2 argument(s)
(xtemplate) on line 1378.
(/usr/local/texlive/2019/texmf-dist/tex/latex/translations/translations.sty
Package: translations 2018/02/28 v1.8 internationalization of LaTeX2e packages
(CN)
(/usr/local/texlive/2019/texmf-dist/tex/latex/koma-script/scrlfile.sty
Package: scrlfile 2020/01/24 v3.29 KOMA-Script package (loading files)
))
(/usr/local/texlive/2019/texmf-dist/tex/latex/acro/acro.definitions.tex))
(/usr/local/texlive/2019/texmf-dist/tex/latex/natbib/natbib.sty
Package: natbib 2010/09/13 8.31b (PWD, AO)
\bibhang=\skip51
\bibsep=\skip52
LaTeX Info: Redefining \cite on input line 694.
\c@NAT@ctr=\count187
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/bibunits/bibunits.sty
Package: bibunits 2004/05/12 v2.4 Multiple bibliographies in one document.
\@bibunitaux=\write3
\@bibunitauxcnt=\count188
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/hyperref.sty
Package: hyperref 2020/01/14 v7.00d Hypertext links for LaTeX
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks15
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/pdfescape/pdfescape.sty
Package: pdfescape 2019/12/09 v1.15 Implements pdfTeX's escape features (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/hycolor/hycolor.sty
Package: hycolor 2020-01-27 v1.10 Color options for hyperref/bookmark (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty
Package: letltxmacro 2019/12/03 v1.6 Let assignment for LaTeX macros (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/kvoptions/kvoptions.sty
Package: kvoptions 2019/11/29 v3.13 Key value format for package options (HO)
)
\@linkdim=\dimen137
\Hy@linkcounter=\count189
\Hy@pagecounter=\count190
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/pd1enc.def
File: pd1enc.def 2020/01/14 v7.00d Hyperref: PDFDocEncoding definition (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/intcalc/intcalc.sty
Package: intcalc 2019/12/15 v1.3 Expandable calculations with integers (HO)
)
\Hy@SavedSpaceFactor=\count191
Package hyperref Info: Hyper figures OFF on input line 4547.
Package hyperref Info: Link nesting OFF on input line 4552.
Package hyperref Info: Hyper index ON on input line 4555.
Package hyperref Info: Plain pages OFF on input line 4562.
Package hyperref Info: Backreferencing OFF on input line 4567.
Package hyperref Info: Implicit mode ON; LaTeX internals redefined.
Package hyperref Info: Bookmarks ON on input line 4800.
\c@Hy@tempcnt=\count192
(/usr/local/texlive/2019/texmf-dist/tex/latex/url/url.sty
\Urlmuskip=\muskip17
Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc.
)
LaTeX Info: Redefining \url on input line 5159.
\XeTeXLinkMargin=\dimen138
(/usr/local/texlive/2019/texmf-dist/tex/generic/bitset/bitset.sty
Package: bitset 2019/12/09 v1.3 Handle bit-vector datatype (HO)
(/usr/local/texlive/2019/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty
Package: bigintcalc 2019/12/15 v1.5 Expandable calculations on big integers (HO
)
))
\Fld@menulength=\count193
\Field@Width=\dimen139
\Fld@charsize=\dimen140
Package hyperref Info: Hyper figures OFF on input line 6430.
Package hyperref Info: Link nesting OFF on input line 6435.
Package hyperref Info: Hyper index ON on input line 6438.
Package hyperref Info: backreferencing OFF on input line 6445.
Package hyperref Info: Link coloring OFF on input line 6450.
Package hyperref Info: Link coloring with OCG OFF on input line 6455.
Package hyperref Info: PDF/A mode OFF on input line 6460.
LaTeX Info: Redefining \ref on input line 6500.
LaTeX Info: Redefining \pageref on input line 6504.
\Hy@abspage=\count194
\c@Item=\count195
\c@Hfootnote=\count196
)
Package hyperref Info: Driver (autodetected): hxetex.
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/hxetex.def
File: hxetex.def 2020/01/14 v7.00d Hyperref driver for XeTeX
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/puenc.def
File: puenc.def 2020/01/14 v7.00d Hyperref: PDF Unicode definition (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/stringenc/stringenc.sty
Package: stringenc 2019/11/29 v1.12 Convert strings between diff. encodings (HO
)
)
\pdfm@box=\box46
\c@Hy@AnnotLevel=\count197
\HyField@AnnotCount=\count198
\Fld@listcount=\count199
\c@bookmark@seq@number=\count266
(/usr/local/texlive/2019/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty
Package: rerunfilecheck 2019/12/05 v1.9 Rerun checks for auxiliary files (HO)
(/usr/local/texlive/2019/texmf-dist/tex/latex/atveryend/atveryend.sty
Package: atveryend 2019-12-11 v1.11 Hooks at the very end of document (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty
Package: uniquecounter 2019/12/15 v1.4 Provide unlimited unique counter (HO)
)
Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2
86.
)
\Hy@SectionHShift=\skip53
)
\gdef\bu@bibstyle{apalike}
\gdef\bu@bibdata{refs}
Package translations Info: No language package found. I am going to use `englis
h' as default language. on input line 17.
(./main.aux)
\openout1 = `main.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 17.
LaTeX Font Info: Trying to load font information for TS1+cmr on input line 1
7.
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ts1cmr.fd
File: ts1cmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions
)
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for TU/lmr/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 17.
LaTeX Font Info: ... okay on input line 17.
\AtBeginShipoutBox=\box47
(/usr/local/texlive/2019/texmf-dist/tex/latex/translations/translations-basic-d
ictionary-english.trsl
File: translations-basic-dictionary-english.trsl (english translation file `tra
nslations-basic-dictionary')
)
Package translations Info: loading dictionary `translations-basic-dictionary' f
or `english'. on input line 17.
Package hyperref Info: Link coloring OFF on input line 17.
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/nameref.sty
Package: nameref 2019/09/16 v2.46 Cross-referencing by name of section
(/usr/local/texlive/2019/texmf-dist/tex/latex/refcount/refcount.sty
Package: refcount 2019/12/15 v3.6 Data extraction from label references (HO)
)
(/usr/local/texlive/2019/texmf-dist/tex/generic/gettitlestring/gettitlestring.s
ty
Package: gettitlestring 2019/12/15 v1.6 Cleanup title references (HO)
)
\c@section@level=\count267
)
LaTeX Info: Redefining \ref on input line 17.
LaTeX Info: Redefining \pageref on input line 17.
LaTeX Info: Redefining \nameref on input line 17.
(./main.out) (./main.out)
\@outlinefile=\write4
\openout4 = `main.out'.
(./bu1.aux)
\openout3 = `bu1.aux'.
Package natbib Warning: Citation `Smith_Lorem_1980' on page 1 undefined on inpu
t line 29.
(/usr/local/texlive/2019/texmf-dist/tex/generic/stringenc/se-ascii-print.def
File: se-ascii-print.def 2019/11/29 v1.12 stringenc: Printable ASCII characters
)
[1
]
No file bu1.bbl.
(./bu1.aux
! Undefined control sequence.
l.3 \acro
@used@twice {ITCZ}{1}{1}{0}
? x
Here is how much of TeX's memory you used:
12210 strings out of 479805
222229 string characters out of 5893180
738150 words of memory out of 5000000
29240 multiletter control sequences out of 15000+600000
532714 words of font info for 27 fonts, out of 8000000 for 9000
1348 hyphenation exceptions out of 8191
43i,4n,48p,789b,436s stack positions out of 5000i,500n,10000p,200000b,80000s
Output written on main.pdf (1 page).
答案1
正如评论中提到的,此问题仅发生在较旧的代码库中acro
。使用当前版本acro
(v3.2,2020-05-10)和\usepackage{acro}
或(更明确地说),\usepackage[version=3]{acro}
此问题不会出现。但可以使用重现该错误\usepackage[version=2]{acro}
。
潜在的问题似乎是在正常类别代码制度中bibunits
读取单元文件,其中是“其他”字符,但代码需要是字母。可以通过添加对读取文件的宏的调用来解决这个问题。.aux
@
acro
\acro@used@twice
@
\makeatletter
.aux
\documentclass{report}
\usepackage{lipsum}
\usepackage[version=2]{acro}
\usepackage{natbib}
\usepackage{bibunits}
\usepackage{hyperref}
\makeatletter
\def\@startbibunit{%
\global\let\@startbibunitorrelax\relax
\global\let\@finishbibunit\@finishstartedbibunit
\global\advance\@bibunitauxcnt 1
\if@filesw
{\endlinechar-1
\makeatletter
\@input{\@bibunitname.aux}}%
\immediate\openout\@bibunitaux\@bibunitname.aux
\immediate\write\@bibunitaux{\string\bibstyle{\@localbibstyle}}%
\fi
}
\def\@finishstartedbibunit{%
\if@filesw
\immediate\closeout\@bibunitaux
\fi
\ifx\bibunits@rerun@warning\@empty
\if@filesw
{\endlinechar-1
\makeatletter
\let\@namedef\@xtestdef
\@input{\@bibunitname.aux}}%
\fi
\fi
}
\makeatother
\defaultbibliographystyle{apalike}
\defaultbibliography{\jobname}
\DeclareAcronym{ITCZ}{
short = ITCZ,
long = Intertropical Convergence Zone
}
\begin{filecontents}{\jobname.bib}
@BOOK{Smith_Lorem_1980,
AUTHOR = {John Smith},
TITLE = {Sit Amet},
YEAR = {1980},
PUBLISHER = {Knopf},
}
\end{filecontents}
\begin{document}
\begin{bibunit}
\acuse{ITCZ}
There has never been more \acl{ITCZ} \citep[\acs{ITCZ};][]{Smith_Lorem_1980}.
\lipsum
\putbib
\end{bibunit}
\end{document}