在默认语言为梵语的文档中,如何将参考书目切换为英语,并将字体切换为定义用于英语的字体?
\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}
产生以下输出:
我们在这里可以看到,为梵语定义的 Chandas 字体也用于参考书目。它不包含变音符号,所以我们在这些地方得到了空洞。
biber 显然被 biblatex 赋予了梵语语言环境,正如其日志中的这些行所暗示的那样:
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'
一个观察:书目条目的 url 字段使 latex 停止,需要按回车键。注释掉后,文档一次性编译,并出现以下奇怪的错误 (\devanagarifont是定义)消失:
! Package polyglossia Error: The current roman font does not contain the Devana
gari script!
(polyglossia) Please define \devanagarifont with \newfontfamily.
关于
Package biblatex Warning: Upgrade package 'polyglossia' to >v1.42.0 recommended
polyglossia.sty
我的工作目录中的 github 1.42.2 无法解决这个问题。
编辑:
另一个例子是使用德语作为主要语言,英语作为次要语言:
\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}
您在这里注意到的是“缩写”、“参考文献”和“ed.”的德语对应词,以及参考书目中未使用的英语字体。
另一项编辑:
一种可能的解决方法可能是\renewcommand*{\bibfont}{\englishfont}
在序言中特别说明,但这仍然给我们留下了参考书目的梵语连字模式。如果我们的主要语言有定义的术语,例如“参考”标题,这也不能解决以所需语言打印这些术语的问题。但对于梵语来说情况并非如此,这些术语不受支持,在这种情况下会恢复为英语。请参见下面的“加尔各答”的连字:
答案1
此特定问题已在 biblatex 3.4(目前在 Sourceforge 上开发)中修复。