3

I want to include a lot of bibliography entries in various languages. The great majority are in english and only a handful is in another language. I have no language, langid or hyphenation fields, to use different language per entry. I can manualy add the langid filed to the non-english entries. Is there a way to set langid={english} by default for every entry that it is not set?

2
  • I would have thought entries without a langid fall back to the document language. Wouldn't that be enough for your purposes?
    – moewe
    Commented Nov 21, 2015 at 7:51
  • @moewe, that's exaclty the problem, the document language is greek, I thus see anything without langid field in greek!
    – Theo
    Commented Nov 22, 2015 at 19:03

1 Answer 1

6

The description of the autolang option on p. 48 of the biblatex documentation says

[The autolang] option controls which babel language environment is used if the babel/polyglossia package is loaded and a bibliography entry includes a langid field (see § 2.2.3). Note that Biblatex automatically adjusts to the main document language if babel/polyglossia is loaded. In multilingual documents, it will also continually adjust to the current language as far as citations and the default language of the bibliography is concerned. This option is for switching languages on a per-entry basis within the bibliography.

So if no langid field is provided biblatex falls back to the current language. Consider the following MWE where british is the document language and uthor does not come with a langid field, while torin has ngerman.

\documentclass[ngerman,british]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear-icomp,autolang=other]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{uthor,
  author    = {Anne Uthor},
  year      = {2001},
  title     = {An English Title},
  booktitle = {Collection},
  editor    = {Eddie Tor},
}
@incollection{torin,
  author     = {Anne U. Torin},
  year       = {2002},
  title      = {Ein deutscher Titel},
  booktitle  = {Sammelband},
  editor     = {Heinz E. Rausgeber},
  langid     = {ngerman},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\nocite{*}

\begin{document}
\printbibliography
\end{document}

torin is set in German, while uthor remains in (British) English.

example output


If you insist on setting the langid field for entries that do not yet have it, use

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldset=langid, fieldvalue={english}]
    }
  }
}

since this mapping does not overwrite fields, only those entries without a langid get english now.

2
  • Thank you! As I commented to the main question, the document's language is not english... I tried your last solution, which works in many cases, but not all of them! I still try to figure out the common point of the non-working entries/files.
    – Theo
    Commented Nov 22, 2015 at 19:08
  • After deleting all auxilliary files, it worked perfectly!
    – Theo
    Commented Nov 22, 2015 at 20:29

You must log in to answer this question.

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