plk / biblatex

biblatex is a sophisticated bibliography system for LaTeX users. It has considerably more features than traditional bibtex and supports UTF-8
520 stars 118 forks source link

`autolang=hyphen` plus `related` not working #1350

Open pcdi opened 8 months ago

pcdi commented 8 months ago

I cannot use autolang=hyphen together with related under biber version: 2.20.

M(n)WE:

\documentclass{article}

\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{german}

\usepackage[autolang=hyphen]{biblatex}

\begin{filecontents}{\jobname.bib}
 @Book{GermanOriginal,
  title            = {German Original},
  langid           = {german},
  related          = {EnglishTranslation},
}

@Book{EnglishTranslation,
  title            = {English Translation}
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

Errors:

debug.tex:26: LaTeX Error: \begin{document} ended by \end{hyphenrules}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.26 \end
         {document}
debug.tex:26: Undefined control sequence.
\blx@break #1&->\blx@done 
                          \undef \blx@do \undef \blx@done 
l.26 \end
         {document}
moewew commented 7 months ago

Thank you very much for reporting this.

I haven't quite figured out what exactly is wrong here, but the problematic commit is quite definitely https://github.com/plk/biblatex/commit/134da03fd355bf342cb919940fbc16267fe7651f.

moewew commented 7 months ago

This actually revealed a bug that's been with us quite a bit longer than https://github.com/plk/biblatex/commit/134da03fd355bf342cb919940fbc16267fe7651f. The definition of \blx@endlang was not always correct when no language switching needed to be done. That should be fixed in https://github.com/plk/biblatex/commit/533b1ee6ab1d7b1b61d830125ebad6375204cf81.

@plk We probably need a biblatex-only release of 3.20a soon, because I'm guessing this issue will pop up in other contexts as well.

The language code uses a lot of \lets and I'm wondering if we can simplify stuff a bit if we just use \defs. I'll investigate...

plk commented 7 months ago

That's fine @moewew - just tell me when ...

moewew commented 7 months ago

Will do. I'm currently hoping we might include the fixes/whatever we need for https://github.com/plk/biblatex/issues/1348 as well, if I can figure out what to do about it soon-ish.