我正在寻找一个使用的示例biblatex
,biber
我发现biblatex biber 非拉丁(西里尔)UTF-8 名称和biblatex:使用 firstinits 选项缩写西里尔文作者姓名,但它们都不是结论性的(并且已经结束)。因此,我想出了一个 MWE(如下),它可以编译pdflatex test.tex; biber test; pdflatex test.tex; pdflatex test.tex
(使用 TexLive 2014),并生成以下内容:
大部分看起来都是这样的 - 我的问题是:
- 这是使用 biblatex/biber 中的西里尔字母名称/标题的正确方法吗?(也就是说,使用
\foreignlanguage
?) - 就像上面的帖子一样,西里尔文名称没有缩写,而拉丁文名称却缩写了。我怎样才能让它们都缩写呢?
编辑:不缩写的原因可以在.bbl
文件中看到:
\name{author}{1}{}{%
{{hash=3bd6100cde97ee45844a484f7fc7612b}{Goethe}{G\bibinitperiod}{Johann\bibnamedelima Wolfgang}{J\bibinitperiod\bibinitdelim W\bibinitperiod}{von}{v\bibinitperiod}{}{}}%
...
\name{author}{1}{}{%
{{hash=c78e01570c60a06ba7419ac38e11ab99}{\foreignlanguage{russian}{Фёдор\bibnamedelimb Михайлович\bibnamedelimb Достоевский}}{\\bibinitperiod}{}{}{}{}{}{}}%
看起来,biblatex
/biber
足够聪明,能够看穿 ,为西里尔文名称\foreignlanguage
插入\bibnamedelimb
,但不知何故,它并没有填充所有字段(特别是那些包含缩写的字段)。如果我尝试手动破解,并类比拉丁名称插入 ,对于labelname
和author
,结果如下:
{{hash=c78e01570c60a06ba7419ac38e11ab99}{\foreignlanguage{russian}{Достоевский}}{\foreignlanguage{russian}{Д\bibinitperiod}}{\foreignlanguage{russian}{Фёдор\bibnamedelima Михайлович}}{\foreignlanguage{russian}{Ф\bibinitperiod\bibinitdelim М\bibinitperiod}}{}{}{}{}}%
...然后缩写有效 - 但显然,我不想为每个西里尔字母条目手动执行此操作,因此可以提出这样的问题:我可以以某种方式诱导biber
自动生成它吗,也许通过在文件中输入一些命令.bib
?
EDIT2:我还尝试在.bib 文件中用外语包装每个作者姓名单词:
author={\foreignlanguage{russian}{Фёдор} \foreignlanguage{russian}{Михайлович} \foreignlanguage{russian}{Достоевский}},
...这根本不起作用(没有缩写,事实上,在最终输出中跳过了一些单词)。
EDIT3:正如@egreg在评论(单个对象)中指出的那样,我尝试删除\foreignlanguage
作者姓名,并直接用UTF-8写入:
author={Фёдор Михайлович Достоевский},
...现在这会在.bbl
文件中正确拆分名称组件:
\name{author}{1}{}{%
{{hash=e3c9a72252d468ac324a38026797e091}{Достоевский}{Д\bibinitperiod}{Фёдор\bibnamedelima Михайлович}{Ф\bibinitperiod\bibinitdelim М\bibinitperiod}{}{}{}{}}%
...但是,当pdflatex
第二次运行时,它崩溃了:
! LaTeX Error: Command \CYRF unavailable in encoding T1.
...所以显然,仍然需要字体编码切换。
以下是代码:
\documentclass{article}
\usepackage{filecontents} % tlmgr install filecontents
\begin{filecontents*}{\jobname.bib}
@BOOK{von1841faust,
title={Faust: Eine Tragödie. Erster Theil},
author={Johann Wolfgang von Goethe},
url={http://books.google.dk/books?id=zF8-AAAAYAAJ},
year={1841},
publisher={Hermann Passarge}
}
% see: https://tex.stackexchange.com/questions/215447/using-cyrillic-with-tex-gyre-pagella-and-pdflatex
% if fonts are properly set-up, there's no need for separate \fontencoding{T2A}\selectfont, as in:
% title={\fontencoding{T2A}\selectfont \foreignlanguage{russian}{Двойник}},
% else - with or without \fontencoding{T2A}\selectfont:
% ! LaTeX Error: Command \CYRD unavailable in encoding T1.
% with \foreignlanguage and \fontencoding{T2A}:
% LaTeX Font Warning: Font shape `T2A/qpl/m/n' undefined
% (Font) using `T2A/cmr/m/n' instead on input line 48.
% kpathsea: Running mktexmf larm1000
% ! I can't find file `larm1000'.
% <*> ...ljfour; mag:=1; nonstopmode; input larm1000
% mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input larm1000' failed to make larm1000.tfm.
% ! Font T2A/cmr/m/n/10=larm1000 at 10.0pt not loadable: Metric (TFM) file not found.
@book{dostoevskij2014dvoinik,
title={\foreignlanguage{russian}{Двойник}},
author={\foreignlanguage{russian}{Фёдор Михайлович Достоевский}},
isbn={9785000640227},
url={http://books.google.dk/books?id=OR7BAQAAQBAJ},
year={2014},
publisher={Aegitas}
}
\end{filecontents*}
\usepackage[utf8]{inputenc}
\usepackage[T2A, T1]{fontenc} % before babel!
\usepackage[russian,greek,english]{babel} % tlmgr install babel-russian
\usepackage[sc]{mathpazo}
\usepackage{paratype} % tlmgr install paratype
\usepackage{tgpagella}
% T2A for cyrillic - paratype
\usepackage{substitutefont}
\substitutefont{T2A}{\rmdefault}{PTSerif-TLF}
\usepackage{siunitx}
\usepackage[%
style=ieee,
isbn=true,
url=true,
defernumbers=true,
sorting=nyt, % "Sort by name, year, title."
%sorting=none, % "Do not sort at all. All entries are processed in citation order." (order of appearance)
bibencoding=utf8,
backend=biber
]{biblatex}
\bibliography{\jobname}
\begin{document}
From \si{\mega\ohm} to \si{\micro\watt} -- consider "Faust" \cite{von1841faust}, which is in (extended) Latin script; or "\foreignlanguage{russian}{Двойник}" \cite{dostoevskij2014dvoinik}, which is in Cyrillic script.
\printbibliography
\end{document}
答案1
您不需要\foreignlanguage
在文件中.bib
。请改用 biblatex 选项autolang=other
。它会自动包装环境中的 bib 条目otherlanguage
。要使其工作,您还需要文件langid
中的字段.bib
。
这是您的 MWE 更正(我删除了字体设置,由于某种原因它在我的计算机上不起作用 --- 但我猜这是一个不同的问题):
\documentclass{article}
\usepackage{filecontents} % tlmgr install filecontents
\begin{filecontents*}{\jobname.bib}
@BOOK{von1841faust,
title={Faust: Eine Tragödie. Erster Theil},
author={Johann Wolfgang von Goethe},
url={http://books.google.dk/books?id=zF8-AAAAYAAJ},
year={1841},
publisher={Hermann Passarge},
langid={german},
}
@book{dostoevskij2014dvoinik,
title={Двойник},
author={Фёдор Михайлович Достоевский},
isbn={9785000640227},
url={http://books.google.dk/books?id=OR7BAQAAQBAJ},
year={2014},
publisher={Aegitas},
langid={russian},
}
\end{filecontents*}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc} % before babel!
\usepackage[russian,greek,german,english]{babel} % tlmgr install babel-russian
\usepackage{siunitx}
\usepackage[%
style=ieee,
isbn=true,
url=true,
defernumbers=true,
sorting=nyt, % "Sort by name, year, title."
%sorting=none, % "Do not sort at all. All entries are processed in citation order." (order of appearance)
bibencoding=utf8,
backend=biber,
language=auto, % get main language from babel
autolang=other,
]{biblatex}
\bibliography{\jobname}
\begin{document}
From \si{\mega\ohm} to \si{\micro\watt} -- consider "Faust" \cite{von1841faust}, which is in (extended) Latin script; or "\foreignlanguage{russian}{Двойник}" \cite{dostoevskij2014dvoinik}, which is in Cyrillic script.
\printbibliography
\end{document}
输出: