plk / biblatex-apa

APA style for BibLaTeX
88 stars 48 forks source link

Missing `\endcsname` error with example entry `10.13:91a` #225

Open zepinglee opened 9 months ago

zepinglee commented 9 months ago

The following MRE results in an error with up-to-date TeX Live.

I remember all the example entries worked several days ago. This error is probably because of LaTeX3 2023-10-10.

\documentclass{article}
\usepackage[style=apa]{biblatex}
\addbibresource{bibtex/bib/biblatex-apa-test-references.bib}
\begin{document}
% \nocite{*}
% \parencite{10.1:1}  % works
\parencite{10.13:91a}  % breaks
\printbibliography
\end{document}
./test.bbl:54: Missing \endcsname inserted.
<to be read again> 
                   \protect 
l.54     \endentry
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-10-10>
Package: biblatex 2023/03/05 v3.19 programmable bibliographies (PK/MW)
File: apa.dbx 2023/03/20 v9.17 APA biblatex style data model
INFO - This is Biber 2.19
moewew commented 9 months ago

Are you sure this exact MWE used to work at all? I get errors from older versions of TeX live on Overleaf when I tested this. (https://www.overleaf.com/read/ffypfgcnmjpc)

AFAICS the problem here is that entrysubtype contains typesettable text whereas biblatex assumes it only contains content that is safe in within an \csname ...\endcsname context, because it does

https://github.com/plk/biblatex/blob/e6bbdc95567f41d140dcf5bb363d3b94c52dd774/tex/latex/biblatex/biblatex.sty#L8562-L8564

The ~ in

https://github.com/plk/biblatex-apa/blob/0cffc8636dd2ffd8955c1e90e76fb70c237be584/bibtex/bib/biblatex-apa-test-references.bib#L2074

breaks this.

I think entrysubtype is probably not the best choice of field here given that core biblatex essentially assumes it behaves more like the actual entry type, i.e. is a single string that is basically safe within \csname ...\endcsname.

zepinglee commented 9 months ago

Thanks for your analysis.

Are you sure this exact MWE used to work at all? I get errors from older versions of TeX live on Overleaf when I tested this. (https://www.overleaf.com/read/ffypfgcnmjpc)

I doubt my memory now.

plk commented 9 months ago

I can't reproduce this with DEV versions. The test doc for the APA style compiles without warnings for me. You are using Lualatex? That's what I use to generate the reference test PDFs for the style.

moewew commented 9 months ago

The TeX engine did not make a difference for me here (I tested with both pdfLaTeX and LuaLaTeX). The problem did not occur in my tests when I loaded babel (I haven't looked at the definitions to find out why). I'm assuming your tests load babel and thus avoid the issue.