28

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}
}
2
  • 1
    You could add a language key in each of your bibentries (ex: language=russian or language=english). Commented Feb 2, 2013 at 14:56
  • 1
    I was thinking about that but unfortunately results in the same error.
    – shkelda
    Commented Feb 2, 2013 at 15:06

1 Answer 1

19

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}
9
  • 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
    Commented Feb 2, 2013 at 15:47
  • 6
    @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
    Commented Feb 2, 2013 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
    Commented Feb 2, 2013 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
    Commented Feb 3, 2013 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)? Commented Mar 7, 2018 at 15:47

You must log in to answer this question.

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