# alphalabel in multilanguage bibliography in biblatex with biber and babel

I search and found no similar question. I know XeLatex is a one of the solution, but it seems is doable in Babel also

My setup: Miktex 2.9 with Babel 2015/08/03 3.9m and Biber 2.1 This is MWE

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[russian,greek,english]{babel}
\usepackage[natbib=true,
style=alphabetic,
isbn=true,
url=true,
citestyle=alphabetic,
defernumbers=false,
sorting=nyt,
bibencoding=utf8,
backend=biber,
language=auto,
autolang=other,]{biblatex}

\begin{document}
Example one in Greek \textgreek{\cite{AlKarapan}},
example two in Russian
{ \otherlanguage{russian}текст на русском \cite{CypinIstorijaRPC}     текст     на русском}   and example  in English again.
\printbibliography
\end{document}


and test.bib is following:

@Book{AlKarapan,
author = {Καραπαναγοπούλου, Αλέξανδρος Κ.},
title = {Η Μεγάλη Σύνοδος της Ορθοδόξου Ανατολικής Εκκλησίας},
publisher = {auto-édition},
year = {\hbox{1990--1998}},
volumes = {6},
hyphenation={greek},
langid={greek},
}
@Inbook{CypinIstorijaRPC,
author = {Владислав Цыпин},
title = {История Русской Церкви 1917--1997},
chapter = {VIII},
publisher = {Издательство Спасо-Преображенского Валаамского монастыря},
date = {1997},
urldate = {2010-10-25},
url = {http://old.pravoslavie.by/podpod.asp?id=135&Session=10},
langid={russian},
hyphenation={russian},
}


Now if you run pdflatex--biber-pdflatex you see

error is:

Command \textKappa unavailable in encoding OT1. \endentry


and so on...

If you make main language Russian, you will see letters in key for Russian bibentry but not in Greek bibentry.

Solution is following: Open generated bbl file and find labelalpha field entry

  \field{labelalpha}{Καρ98}


and

  \field{labelalpha}{Цып97}


and add there appropriate \otherlanguage command entries as

  \field{labelalpha}{\otherlanguage{greek}Καρ98}


and

  \field{labelalpha}{\otherlanguage{russian}Цып97}


save it and just run pdflatex..Errors are gone and everything is OK..

So question is How can i addd otherlanguage call to labelalpha entries without editing bbl file? can biblatex do this? I thin it is natural since keys are generated by langid so \otherlanguage or in general labelalpha's language needs to be same as langid

p.s. I encountered this problem with, English, Russian,Greek,Georgian setup. No matter which language is set as main language for document...adding 'otherlanguage' call solves the problem..Example was shortened for demo.

edited: just added image how bibliography looks after editing .bbl file adding 'otherlanguage' calls

I think language=auto or similar option needs to applied for keys in bibliography list

The only thing we are missing from language=auto and autolang=other is that they neglect to wrap the label in the bibliography into foreignlanguage or otherlanguage. That is easily fixed with the following definition

\DeclareFieldFormat{labelalpha}{%
\iffieldundef{langid}
{#1}
{\foreignlanguage{\thefield{langid}}{#1}}%
}


This does exactly what you did with your .bbl file, but automatically. Of course, we can only really do that if the langid field is present, so we check that first.

MWE

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{AlKarapan,
author = {Καραπαναγοπούλου, Αλέξανδρος Κ.},
title = {Η Μεγάλη Σύνοδος της Ορθοδόξου Ανατολικής Εκκλησίας},
publisher = {auto-édition},
date = {1990/1998},
volumes = {6},
langid={greek},
}
@Inbook{CypinIstorijaRPC,
author = {Владислав Цыпин},
title = {История Русской Церкви 1917--1997},
chapter = {VIII},
publisher = {Издательство Спасо-Преображенского Валаамского монастыря},
date = {1997},
urldate = {2010-10-25},
url = {http://old.pravoslavie.by/podpod.asp?id=135&Session=10},
langid={russian},
}
\end{filecontents*}

\usepackage[russian,greek,english]{babel}
\usepackage[natbib=true,
style=alphabetic,
isbn=true,
url=true,
defernumbers=false,
sorting=nyt,
backend=biber,
language=auto,
autolang=other]{biblatex}

\DeclareFieldFormat{labelalpha}{%
\iffieldundef{langid}
{#1}
{\foreignlanguage{\thefield{langid}}{#1}}%
}

\begin{document}
\cite{AlKarapan,CypinIstorijaRPC,aksin}
\printbibliography
\end{document}


gives

• You mentioned it in your question, but I would still like to repeat that for documents such as this XeLaTeX and LuaLaTeX are the real solutions. The document (minus fontenc and inputenc, plus fontspec using Linux Libertine) compiled fine and showed the labels as expected out of the box without resorting to any hackery. Aug 10, 2015 at 7:49
• Yes, you are right. And this is becouse langid sets, beside language , fontenc, when seelcting language and in 8bit TeX language=hyphen does not make too much sense, becouse if it switches fontenc, then bibentry is not readable. Let imagine case: User needs to diplay bibentry information in language it is present(so he sets langid), he also adds hypenation language entry different than langid(as long as hyphenation language „stays“ in same encoding as langid language), but he wants lbx translations in main document language, which can be different from langid. Aug 10, 2015 at 16:07
• He will get errors with 8bit TeX. To solve this this biblatex needs one more lang key to work with 8bit TeX and coding changies..IF aothor of biblatex will implement it this will be great..I think classic TeX will live :) Aug 10, 2015 at 16:08
• I guess I can wrap other fields as well? i mean fields mentioned in lbx files. To have result i have mentioned in comment: biblentry in langid and tranlateble things from lbx file in main language>. i know this is different question but can you give example for that? :) Aug 10, 2015 at 16:14
• and why indents in bibliography are different in your answer result, than in images i have posted? Aug 10, 2015 at 16:17