3

I recently updated l3kernel and other packages and installed biblatex-chem and libertinust1math. I am now getting an error with the acro package.

Specifically, I am trying to use \emph{\Iac{NFA}} and am getting "ERROR: Missing number, treated as zero" for \l__acro_article_Indefinite_bool in the following minimal example. (See below for the complete error message.) Before updating and installing the above packages, everything had been working correctly with the document from which I derived this example.

I'm not sure what's going on, although it seems related to biblatex for some reason. Does anyone know what is causing this?

\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}

Here is a section of the .log file surrounding the error. The complete .log file can be found at .log of error

\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.
5
  • There wasn't any recent (that I recall) breaking change to l3kernel, so I find it rather weird. Could you please try to make a compilable example that reproduces the issue? Also, run your dissertation with \listfiles and show the .log output of that, please. Commented Aug 29, 2020 at 21:17
  • @PhelypeOleinik The .log is over 5000 lines long and the file list is nearly 200 lines long. Should I paste here, or...? I will work on a compilable example that reproduces the error, but I have a custom document class and many packages, so I'm not sure how minimal that example will end up being... Commented Aug 29, 2020 at 21:28
  • You can use pastebin.com to send the log (it might help pinpoint the problem). A compilable example will really help (even if not that minimal): the amount of combinations in a failing LaTeX document are endless, so a starting point is essential, so take your time. Commented Aug 29, 2020 at 22:08
  • show the complete error message.Copy it from the log, including the lines around it. Commented Aug 29, 2020 at 22:38
  • @PhelypeOleinik @UlrikeFischer I was able to narrow it down to some interaction between biblatex (or its dependencies) with acro. The log file is linked in the above edits. Also, I remembered that I installed libertinust1math and biblatex-chem just prior to these errors, if that is a clue. Commented Aug 31, 2020 at 20:21

1 Answer 1

4

Ouch! This is a sneaky one.

First, the issue is unrelated (kind of) to biblatex. The issue only appears there because biblatex adds \NoCaseChange to expl3's \text_expand:n. If you do that manually with

\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

you can remove biblatex from the equation.

The problem is that \NoCaseChange is equal to \use:n, and \use:n is an extremely ubiquitous macro, so that will make anything look like \NoCaseChange, which is not good. In the specific case of acro, it uses \tl_map_tokens:nn to iterate on a list that contains {indefinite}, and eventually reaches a code that looks like:

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

which should pass the {indefinite} token list to \__acro_article:nnn {NFA}{long-acc}, which works great... unless \use:n means to skip the argument while case-changing, which is exactly what happens here: the \__acro_article:nnn thing is skipped, and indefinite is title-case changed to Indefinite, and everything goes off the tracks.

I think the correct way to fix this would be to make \NoCaseChange different from \use:n and \@firstofone so that it isn't that easily mistaken:

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

Add that to your document after loading biblatex and it should work fine:

\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}
4
  • 1
    I've updated the code such that we use a string-based test, so the name of the cs has to match, not just the definition: that really should sort things at the cost of a little speed.
    – Joseph Wright
    Commented Sep 1, 2020 at 9:11
  • @PhelypeOleinik Thank you so much for your help with this!! I would have never been able to figure that out! Out of curiosity, do you know which update/install was the trigger for this bug? Thanks again!! Commented Sep 1, 2020 at 17:57
  • @JosephWright Thanks for updating the code! Where can I get the update, or would you recommend I wait until it is picked up by CTAN / TeXLive? Commented Sep 1, 2020 at 17:59
  • @HenryDeYoung Out of the three I only follow the updates of l3kernel, so I'm not 100% sure, but on April 3rd expl3's case-changing was added to acro, and on June 6, \NoChangeCase was added to biblatex, so a bit later than that (until the CTAN upload). Joseph sent the expl3 update to CTAN today, so tomorrow or the day after it should reach the mirrors (depending which you use). Until then the fix in my answer is enough (safer than a manual update). Commented Sep 1, 2020 at 22:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .