4

In a document whose default language is Sanskrit, how does one switch the bibliography to English, and the font to the one defined to be used for English?

\documentclass{article}

\usepackage{polyglossia}
\usepackage{csquotes}
\setdefaultlanguage{sanskrit}
\setotherlanguage{english}

\usepackage{fontspec}
\newfontfamily\englishfont[Mapping=tex-text]{TeX Gyre Schola}
\newfontfamily\devanagarifont[Script=Devanagari]{Chandas}

\usepackage[backend=biber,%
language=english% ignored?
]{biblatex}

\usepackage{filecontents}
\addbibresource{\jobname.bib}
\begin{filecontents*}{\jobname.bib}

@Collection{dp-edP,
  editor =   {Peter Peterson},
  title =    {The Nyāyabinduṭīkā by Dharmottara-āchārya},
  publisher =    {Asiatic Society},
  address =  {Calcutta},
  year =     1889,
  url =      {http://east.uni-hd.de/bib/5186/}, %This one seems to make it worse
  shorthand =    {P},
}

\end{filecontents*}

\begin{document}

\cite{dp-edP}
मंगलं महा श्री ॥
\printshorthands
\printbibliography
\end{document}

produces the following output:

sample output

We can see here that the Chandas font defined for Sanskrit is used for the bibliography, too. It doesn't contain diacritics, so we get holes in these places.

biber apparently is given a Sanskrit locale by biblatex, as these lines in its log suggest:

INFO - Overriding locale 'sa-IN' defaults 'normalization = NFD' with 'normalization = prenormalized'
INFO - Overriding locale 'sa-IN' defaults 'variable = shifted' with 'variable = non-ignorable'
INFO - Sorting list 'shorthand/global' of type 'list' with scheme 'shorthand' and locale 'sa-IN'
INFO - Overriding locale 'sa-IN' defaults 'variable = shifted' with 'variable = non-ignorable'
INFO - Overriding locale 'sa-IN' defaults 'normalization = NFD' with 'normalization = prenormalized'
INFO - Sorting list 'nty/global' of type 'entry' with scheme 'nty' and locale 'sa-IN'

One observation: the url field of the bibliographical entry makes latex stop, requiring one to hit enter. Commented out, the document compiles in one go, and the following odd error (\devanagarifont is defined) disappears:

! Package polyglossia Error: The current roman font does not contain the Devana
gari script!
(polyglossia)                Please define \devanagarifont with \newfontfamily.

Regarding

Package biblatex Warning: Upgrade package 'polyglossia' to >v1.42.0 recommended

polyglossia.sty 1.42.2 from github in my working directory doesn't solve it.

Edit:

Another example using German as the main, English as secondary language:

\documentclass[12pt]{article}

\usepackage{polyglossia}
\usepackage{csquotes}
\setdefaultlanguage{german}
\setotherlanguage{english}

\usepackage{fontspec}
\newfontfamily\englishfont[Mapping=tex-text]{Andale Mono}
\newfontfamily\germanfont[Mapping=tex-text]{Latin Modern Roman}

\usepackage[backend=biber,%
language=english% ignored?
]{biblatex}

\usepackage{filecontents}
\addbibresource{\jobname.bib}
\begin{filecontents*}{\jobname.bib}

@Collection{dp-edP,
  editor =   {Peter Peterson},
  title =    {The Nyāyabinduṭīkā by Dharmottara-āchārya},
  publisher =    {Asiatic Society},
  address =  {Calcutta},
  year =     1889,
  url =      {http://east.uni-hd.de/bib/5186/}, %This one seems to make it worse
  shorthand =    {P},
}

\end{filecontents*}

\begin{document}

\cite{dp-edP}
Etwas auf deutsch. \textenglish{Something in English.}
\printshorthands
\printbibliography
\end{document}

sample output two

What you notice here are the German equivalents for "Abbreviations", "References", and "ed.", and the font for English not being used in bibliography.

Another edit:

One possible workaround might be to specifically \renewcommand*{\bibfont}{\englishfont} in the preamble, but that still leaves us with Sanskrit hyphenation patterns for the bibliography. If we have a primary language with defined terms such as for the "References" heading, this would also not solve the problem of printing these in the desired language. For Sanskrit this is not the case though, these terms are not supported, falling back to English in this case. See the hyphenation of "Calcutta" below:

sample output three

  • 1
    The new version of polyglossia seems to make things better, but still does not work totally smoothly. If you drop the languge` option and go with \begin{otherlanguage}{english} \printbibliography \end{otherlanguage} instead does that work for you? (It worked in a modified version of your MWE, which I cannot test because of font issues.) – moewe Mar 19 '16 at 7:41
  • @moewe No, unfortunately no change, both with polyglossia 1.42.0 and 1.42.2. Maybe I should modify my example to use more common fonts and languages? What did you modify on my MWE? – muk.li Mar 19 '16 at 8:44
  • 1
    The MWE I came up with was quite far away from yours. If you can reproduce the main problem with two languages that use the same script (English and French, say) then that would make life easier, because we don't need special fonts for that. Currently however the language thing with polyglossia, babel and friends is a bit of a mess ... – moewe Mar 19 '16 at 10:17
  • @moewe See my edit above. – muk.li Mar 19 '16 at 12:47
  • See also issue #385 at the biblatex bug tracker – moewe Mar 19 '16 at 16:27
1

This specific issue is fixed in biblatex 3.4 (currently in dev on Sourceforge).

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.