1

I have a document in English using biblatex to which I need to add an abstract in another language that is supported by babel, but not by biblatex. I thought that this would not be an issue because the abstract does not contain any citations, but I am still getting a warning when I change the language. How can I resolve this?

PS: This happens also when I pass the language=english to biblatex, but I don't want to do that anyway because I do have some non-English bibliography entries whose language is supported by biblatex.

A working example

\documentclass{article}

\usepackage[english]{babel}
% Not including 'csquotes' fires an unrelated warning.
\usepackage{csquotes}
\usepackage{biblatex}

\begin{filecontents}{bibliography.bib}
@misc{SampleEntry,
  author = {Author, Sample},
  title = {Sample Title}
}
\end{filecontents}
\addbibresource{bibliography.bib}

\begin{document}

\selectlanguage{esperanto}
Saluton!
\selectlanguage{english}

Let us cite \cite{SampleEntry}.

\printbibliography
\end{document}

The warnings

Package biblatex Warning: Language 'esperanto' not supported.

LaTeX Warning: There were undefined references.

Package biblatex Warning: Please rerun LaTeX.

7
  • Mmh, also worth mentioning that adding esperanto to the mix in the document appears to lead to an infinite "Package biblatex Warning: Please rerun LaTeX." (it does for me).
    – gusbrs
    May 29, 2022 at 11:22
  • 2
    I don't have a good answer here, but a few comments. First, this is really just a "warning" rather than an error so, unless you have bibliography entries in the rest of the document which require Esperanto, I don't think you need to worry about it. You can get rid of the infinite "Package biblatex Warning: Please rerun LaTeX." by adding esperanto to the list of babel languages in the preamble. Though, it seems wrong to me that biblatex does what it does when the language is not preloaded, which is legit, as far as babel is concerned. ...
    – gusbrs
    May 29, 2022 at 11:53
  • 1
    ... Finally, if really want to get rid of the warning, perhaps take a look at tex.stackexchange.com/a/201280/105447, and add a very simple .lbx file to appease biblatex. Though there might be better ways to do it.
    – gusbrs
    May 29, 2022 at 11:54
  • The line number refers likely to internals of one imported package. So, this isn't the actual line number, where the error occurs. May 29, 2022 at 11:56
  • 1
    A possible workaround: load both languages in the preamble with \usepackage[esperanto,english]{babel}, an then map Esperanto to English (meaning "just use English defaults since there's no support for it") with \DeclareLanguageMapping{esperanto}{english}.
    – gusbrs
    May 29, 2022 at 15:35

1 Answer 1

1

biblatex's language support is implemented in way that

  • requires all used languages to be "known" beforehand (for babel this means, all languages you are going to use need to be announced as options to babel),
  • tries to load biblatex localisations for all announced languages even if there are no citations/bibliographies in the portion of your document typeset in that language.

That means that your document compiles with fewer warnings as soon as you make it read

\documentclass{article}
\usepackage[esperanto, english]{babel}
\usepackage{csquotes}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}

\selectlanguage{esperanto}
Saluton!
\selectlanguage{english}
Let us cite \cite{sigfridsson}.

\printbibliography
\end{document}

You still get a warning that esperanto is unsupported in biblatex, because biblatex does not have an esperanto.lbx.

You may choose to ignore this warning or you may want to look into writing a suitable esperanto.lbx (cf. What is the most appropriate way to configure biblatex for use with an unsupported language?).

There are ways to "silence" this warning, but I would not recommend that, since silencing the warning could come back to bite you if you really want Esperanto citations/bibliography entries at some point.

gusbrs suggested a simple way to make biblatex shut up in the comments: Map Esperanto to English

\DeclareLanguageMapping{esperanto}{english}

Or you can issue

\makeatletter
\protected\def\blx@langsetup#1{%
  \blx@lbxinput{#1}
    {\edef\blx@languagename{#1}}
    {}}
\makeatother

in the preamble to remove the code that generates the relevant warning.


While babel does not error if you don't pass esperanto as option and later use \selectlanguage{esperanto}, the result might be a bit off.

\documentclass{article}
\usepackage[english]{babel}

\begin{document}
\selectlanguage{esperanto}
\tableofcontents
\section{Foo}
Saluton!
\selectlanguage{english}
\tableofcontents
\section{Bar}
Lorem
\end{document}

gives

? contentsname ?

and the warning

Package babel Warning: \contentsname not set for 'esperanto'. Please,
(babel)                define it after the language has been loaded
(babel)                (typically in the preamble) with:
(babel)                \setlocalecaption{esperanto}{contents}{..}
(babel)                Reported on input line 6.

With

\documentclass{article}
\usepackage[esperanto, english]{babel}

\begin{document}
\selectlanguage{esperanto}
\tableofcontents
\section{Foo}
Saluton!
\selectlanguage{english}
\tableofcontents
\section{Bar}
Lorem
\end{document}

I get

Enhavo

I can't tell you if other more important features like hyphenation work in both settings, but this behaviour seems to suggest to me that at least at the moment, you should still announce all languages to babel as package/class options.

3
  • moewe, Not explicitly declaring "secondary" languages in the preamble, and letting them be loaded on the fly as needed in the document, is a documented feature of babel. See, for example, the "Mostly monolingual documents" section of the manual. So, I'd say it is at least "unfortunate" that biblatex reacts with an infinite rerun warning. The OP's case is particularly clear, the intended use of the secondary language is just for an Abstract, where biblatex has no role to play.
    – gusbrs
    May 30, 2022 at 16:29
  • (Though I'm not sure the previous statement applies to \selectlanguage or only to \foreignlanguage. And, with \foreignlanguage the infinite rerun does not occur.)
    – gusbrs
    May 30, 2022 at 16:42
  • 1
    Indeed, just using \foreignlanguage here (and not loading esperanto) is an alternative, and arguably simpler, solution. (Or the otherlanguage* environment).
    – gusbrs
    May 30, 2022 at 16:48

You must log in to answer this question.

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