更新并安装软件包后,acro 出现缺少数字的错误

更新并安装软件包后,acro 出现缺少数字的错误

我最近更新了l3kernel和其他软件包并安装了biblatex-chemlibertinust1math。现在我收到了该软件包的错误acro

具体来说,我尝试使用\emph{\Iac{NFA}}并在下面这个最小示例中得到“错误:缺少数字,视为零” \l__acro_article_Indefinite_bool。(请参阅下文了解完整的错误消息。)在更新和安装上述软件包之前,我从中得出此示例的文档的一切都运行正常。

我不确定发生了什么,尽管这似乎与biblatex某种原因有关。有人知道是什么原因造成的吗?

\documentclass{article}

\usepackage[backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}

\usepackage{acro}
\DeclareAcronym{NFA}{%
  short = NFA,
  short-indefinite = an,
  long = nondeterministic finite automaton,
  long-plural-form = nondeterministic finite automata%
}

\listfiles

\begin{document}
\emph{\Iac{NFA}} is a mathematical machine.
\cite{knuth:ct:a}
\end{document}

.log以下是与错误相关的文件部分。完整.log文件可在以下位置找到:错误日志

\openout3 = `thesis.bcf'.

Package biblatex Info: Trying to load bibliographic data...
Package biblatex Info: ... file 'thesis.bbl' found.

(./thesis.bbl)
Package biblatex Info: Reference section=0 on input line 16.
Package biblatex Info: Reference segment=0 on input line 16.
\l__acro_aux_file_iow=\write4
\openout4 = `thesis.acr'.

\AtBeginShipoutBox=\box46

(/usr/local/texlive/2020basic/texmf-dist/tex/latex/translations/translations-ba
sic-dictionary-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 16.

./thesis.tex:17: Missing number, treated as zero.
<to be read again> 
                   \l__acro_article_Indefinite_bool 
l.17 \emph{\Iac{NFA}}
                      is a mathematical machine.
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

Package atveryend Info: Empty hook `BeforeClearDocument' on input line 19.
[1{/usr/local/texlive/2020basic/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
Package atveryend Info: Executing hook `AfterLastShipout' on input line 19.

(./thesis.aux (./thesis.acr))
Package atveryend Info: Empty hook `AtVeryEndDocument' on input line 19.

答案1

哎哟!这太狡猾了。

首先,这个问题与 无关biblatex。问题只出现在那里,因为biblatex添加\NoCaseChangeexpl3\text_expand:n。如果你手动使用

\ExplSyntaxOn
\tl_put_right:Nn \l_text_expand_exclude_tl { \NoCaseChange }
\tl_put_right:Nn \l_text_case_exclude_arg_tl { \NoCaseChange }
\cs_set_eq:NN \NoCaseChange \use:n
\ExplSyntaxOff

你可以biblatex从等式中删除。

问题是\NoCaseChange等于\use:n,并且\use:n极其无处不在的宏,所以这会让任何事情就像\NoCaseChange,这​​并不好。在 的具体情况下acro,它用于\tl_map_tokens:nn迭代包含 的列表{indefinite},最终得到如下代码:

\use:n{\__acro_article:nnn {NFA}{long-acc}}{indefinite}

它应该将{indefinite}标记列表传递给\__acro_article:nnn {NFA}{long-acc},效果很好...除非\use:n意味着在更改大小写时跳过参数,这正是这里发生的情况:\__acro_article:nnn跳过该内容,并将indefinite标题大小写更改为Indefinite,并且一切都偏离了轨道。

我认为解决这个问题的正确方法是\NoCaseChange 不同的\use:n\@firstofone这样就不会那么容易弄错了:

\ExplSyntaxOn
\cs_gset:Npn \NoCaseChange #1 { \use:n {#1} }
\ExplSyntaxOff

加载后将其添加到您的文档中biblatex,它应该可以正常工作:

\documentclass{article}

\usepackage[backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}

\usepackage{acro}
\DeclareAcronym{NFA}{%
  short = NFA,
  short-indefinite = an,
  long = nondeterministic finite automaton,
  long-plural-form = nondeterministic finite automata%
}

\listfiles

%% Workaround to \NoCaseChange and \tl_map_tokens:nn issue:
\ExplSyntaxOn
\cs_gset:Npn \NoCaseChange #1 { \use:n {#1} }
\ExplSyntaxOff

\begin{document}
\emph{\Iac{NFA}} is a mathematical machine.
\cite{knuth:ct:a}
\end{document}

相关内容