Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Likely bug tied to autolang #1406

Open
ienissei opened this issue Dec 28, 2024 · 2 comments
Open

Likely bug tied to autolang #1406

ienissei opened this issue Dec 28, 2024 · 2 comments
Labels
bug duplicate fixedindev Fixed in current DEV version

Comments

@ienissei
Copy link

ienissei commented Dec 28, 2024

My bibliographies sometimes require having a bib entry citing a different entry (good olf \cite{…}), essentially for abbreviated journal names that need to appear within longer strings (inside a field) and to be added to the list of shortjournals.

My previous distribution was MacTeX 2022, on which the following MWE worked flawlessly (I just confirmed it again). Since updating to MacTeX 2024, it no longer works and issues a not-so-helpful error.

After a lot of tracking down, I managed to isolate the issue, make sure it was not tied to any of my styles or classes, and pin it down to the language=auto or language=autocite options when used in conjunction with autolang (any value other than none), and with a .bib entry that make use of a langid field (which makes sense). Printing of this field is not processed correctly and the error is returned at the line where the entry is (this is not dependent on the specific field used).

It is entirely possible that the bug comes from a change in babel that isn't playing very well with Biblatex in this specific instance, but I thought it might be relevant to start by asking the team. In addition, I ran a diff on the Biblatex code and saw that there was a fair bit of rewriting on those two options and associated macros in ways which might explain the error message (but they were a bit too arcane for me). So I thought I'd run it past you!

\documentclass{book}

% Load Babel
\usepackage[british]{babel}
% Have tried other languages as well

% Load Biblatex with relevant options
\usepackage[style=authortitle]{biblatex}
% Numeric styles also affected, but at the printbibliography stage, i.e. when printing <title>

% Bug appears when both options are present together
\ExecuteBibliographyOptions{%
	language=auto,autolang=hyphen}
% Note: language=autocite also causes the problem, but not language=autobib

% Minimal .bib file
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{A,
	title = {Aaah}}

@book{Test,
	title = {The Story of \cite{A}},% Tried other fields too
	hyphenation = {british},% Tried other languages too
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}

% This one does not cause any bugs.
% Just here to avoid having to do two runs.
\cite{A}

% This one is buggy:
\cite{Test}

\printbibliography

\end{document}

The error message is as follows:

! Extra }, or forgotten \endgroup.
<recently read> \egroup 
                        
l.35 \cite{Test}

Thank you kindly for looking into it and helping me figure out whether the bug is tied to Biblatex or Biber.

PS: By the way, would you suggest a different approach instead of having a \cite{} command inside an entry and still being able to use it in the journal abbreviation list (I promise, it is nicely wrapped in a macro with a proper name)?

@moewew
Copy link
Collaborator

moewew commented Dec 28, 2024

This is either #1350 or #1377, both of which were resolved in bcaa45f.

With the current dev version the file compiles as expected without error again.

\cites in the bibliography are always a bit risky. Not only because of this issue here, but also because the punctuation buffer sometimes gets thrown (see #988 and linked issues and TeX.SX discussions). So if you can avoid them, avoiding them is probably the best idea. Unfortunately, I don't understand enough about what you want to do to be able to say anything useful at this point. But you can always head over to TeX.SX (https://tex.stackexchange.com/) to ask a question and see if anybody has any idea (I'll also have a look).

@moewew moewew added duplicate bug fixedindev Fixed in current DEV version labels Dec 28, 2024
@ienissei
Copy link
Author

Thank you very much and sorry for the duplicate (I thought these AI things that are everywhere pointed them to you these days!).

My use of \cite within entries is strictly limited to abbreviations which are predefined in the class and contain the relevant punctuation macros, so I haven't ran into issues with them (and they are all very similar in format). This is for referencing the books case law is reported in, and for which creating separate related entires would impractical, cryptic and would make the .bib file unusable unless compiled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug duplicate fixedindev Fixed in current DEV version
Projects
None yet
Development

No branches or pull requests

2 participants