20

I would like to have a bibliography with both Cyrillic and Latin and the main document language being English. How can I make biblatex to automatically switch between languages? (without using XeTeX as suggested by some) The minimal example returns an error if the main language is English. However, with the main language being Russian the document works.

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[russian,english]{babel}

\usepackage[backend = biber,babel=other]{biblatex}
\usepackage{csquotes}
\addbibresource{library.bib}

\begin{document}
%\selectlanguage{russian} %if the main document language is Russian the bibliography is compiled without any problem.
This is a test. \parencite{Bara2006,Baranov2001}

\printbibliography

\end{document}

The .bib entries are

@book{Bara2006,
address = {New York},
author = {Bara, Judith},
publisher = {Routledge},
title = {{English Citation entry}},
year = {2006}
}

@book{Baranov2001,
address = {Санкт-Петербугр},
author = {Баранов, Николай А},
title = {{Эволюция взглядов}},
year = {2001}
}
  • You could add a language key in each of your bibentries (ex: language=russian or language=english). – Paul Gaborit Feb 2 '13 at 14:56
  • 1
    I was thinking about that but unfortunately results in the same error. – shkelda Feb 2 '13 at 15:06
16

You must add hyphenation and language keys to each of your bibentries:

\documentclass{article}
\usepackage{filecontents}
\usepackage[utf8]{inputenc}
\usepackage[russian,english]{babel}

\begin{filecontents*}{library.bib}
@book{Bara2006,
  address = {New York},
  author = {Bara, Judith},
  publisher = {Routledge},
  title = {{English Citation entry}},
  year = {2006},
  language={english},
  hyphenation={english}
}
@book{Baranov2001,
  address = {Санкт-Петербугр},
  author = {Баранов, Николай А},
  title = {{Эволюция взглядов}},
  year = {2001},
  language={russian},
  hyphenation={russian}
}
\end{filecontents*}

\usepackage[bibencoding=auto,backend=biber,babel=other]{biblatex}
\usepackage{csquotes}
\addbibresource{library.bib}

\begin{document}
This is a test. \parencite{Bara2006,Baranov2001}
\newpage
\printbibliography
\end{document}
  • 1
    This is already great and works on my other file. However, the problem is that I am using a reference manager (Mendeley) that doesn't provide for a hypenation field for .bib-export. I would need to add it manually to all my entries and would loose all the changes when I build a new .bib file. – shkelda Feb 2 '13 at 15:47
  • 5
    @shkelda Biber can copy the contents of language to hyphenation for you. Just add \DeclareSourcemap{\maps[datatype=bibtex]{\map{\step[fieldsource=language]\step[fieldset=hyphenation,origfieldval]}}} to your preamble. – Audrey Feb 2 '13 at 16:04
  • 3
    @shkelda BTW: It is actually just the hyphenation field you need to get localized bibliography entries. This field only accepts babel language identifiers. The language field specifies the language of the work for printing. It can be a literal string or a babel identifier. – Audrey Feb 2 '13 at 16:21
  • 1
    @shkelda Because with Russian as the main language babel loads the proper font encodings for you. With English, you need to load them yourself with, say, \usepackage[T1,T2A]{fontenc}. Either way babel=other requires hyphenation to work properly. – Audrey Feb 3 '13 at 22:28
  • 1
    @hdl The order of keys in the .bbl file is irrelevant. Did you choose the correct language id (in .bib and with babel)? – Paul Gaborit Mar 7 '18 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.