![Biber:UTF8 文件的问题](https://linux22.com/image/277346/Biber%EF%BC%9AUTF8%20%E6%96%87%E4%BB%B6%E7%9A%84%E9%97%AE%E9%A2%98.png)
我在 AMD64 上运行 Biber 1.7(最新版)和配套的 Biblatex(最新版),发行版是 Gentoo,语言环境为 UTF8。使用的编辑器是 Kile,MWE 是用 XeLaTeX 编译的。
MWE,根据 egreg 的建议添加了 fontspect:
\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{cmunrm.otf}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguages{russian}
\usepackage{csquotes}
\PassOptionsToPackage{style=authoryear-comp, natbib=true, backend=biber}{biblatex}
\usepackage{biblatex}
\addbibresource[datatype=bibtex]{bibliography.bib}
\DeclareNameAlias{sortname}{first-last}
\begin{document}
\nocite{*}
a
\printbibliography
\end{document}
书目文件是
@STRING{zhetf = {Журнал Экспериментальной и Теоретической Физики}}
@ARTICLE{Migdal1975r,
AUTHOR = {Александр Аркадьевич Мигдал},
TITLE = {{Фазовые переходы в калибровочных и спиновых решеточных моделях}},
JOURNAL = zhetf,
VOLUME = 69,
NUMBER = 4,
PAGES = {1457--1465},
YEAR = 1975
}
我可以正常运行 XeLaTeX,但是当我调用 Biber 时它会停止,如下所示:
stuff@stuff ~/ $ biber mwe
INFO - This is Biber 1.7
INFO - Logfile is 'mwe.blg'
INFO - Reading 'mwe.bcf'
INFO - Using all citekeys in bib section 0
INFO - Processing section 0
INFO - Looking for bibtex format file 'bibliography.bib' for section 0
INFO - Decoding LaTeX character macros into UTF-8
INFO - Found BibTeX data source 'bibliography.bib'
并返回。输出的 BBL 文件为空。参考书目文件可能存在什么问题?
实际上,这种行为发生在多个平台上,至少包括 Windows 7 和 Gentoo。
编辑:问题不在于参考书目没有显示在 PDF 文件中,这可以通过指定西里尔字体来解决。相反,问题在于 Biber 过早退出,没有生成任何输出或错误消息。
这是生成的日志文件,biber --debug mwe
显示了它在没有任何警告的情况下死亡(我说“死亡”是因为该行末尾没有“...”):
[0] Config.pm:425> INFO - This is Biber 1.7
[0] Config.pm:428> INFO - Logfile is 'mwe.blg'
[75] biber:251> INFO - === piÄ<85> paź 18, 2013, 08:46:45
[75] Biber.pm:333> INFO - Reading 'mwe.bcf'
[143] Biber.pm:607> INFO - Using all citekeys in bib section 0
[143] Biber.pm:675> DEBUG - Adding 'entry' list 'nyt' for section 0
[154] Biber.pm:2997> INFO - Processing section 0
[154] Biber.pm:3118> DEBUG - Looking for directly cited keys:
[165] Biber.pm:3134> INFO - Looking for bibtex format file 'mwe.bib' for section 0
[165] bibtex.pm:179> DEBUG - Caching data for BibTeX format file 'mwe.bib' for section 0
[166] bibtex.pm:901> INFO - Decoding LaTeX character macros into UTF-8
[166] bibtex.pm:776> INFO - Found BibTeX data source 'mwe.bib'
[166] bibtex.pm:860> DEBUG - Cached Text::BibTeX entry for key 'Migdal1975r' from BibTeX file 'mwe.bib'
[167] bibtex.pm:187> DEBUG - All cached citekeys will be used for section '0'
[167] bibtex.pm:355> DEBUG - Source mapping (type=driver, key=Migdal1975r): Entry type is 'article' but map wants 'conference', skipping step ...
[167] bibtex.pm:355> DEBUG - Source mapping (type=driver, key=Migdal1975r): Entry type is 'article' but map wants 'electronic', skipping step ...
[167] bibtex.pm:355> DEBUG - Source mapping (type=driver, key=Migdal1975r): Entry type is 'article' but map wants 'www', skipping step ...
[167] bibtex.pm:350> DEBUG - Source mapping (type=driver, key=Migdal1975r): Entry type is 'article' but map wants 'mastersthesis' and step has 'final' set, skipping rest of map ...
[167] bibtex.pm:350> DEBUG - Source mapping (type=driver, key=Migdal1975r): Entry type is 'article' but map wants 'phdthesis' and step has 'final' set, skipping rest of map ...
[167] bibtex.pm:350> DEBUG - Source mapping (type=driver, key=Migdal1975r): Entry type is 'article' but map wants 'techreport' and step has 'final' set, skipping rest of map ...
[167] bibtex.pm:378> DEBUG - Source mapping (type=driver, key=Migdal1975r): No field 'address', skipping step ...
[167] bibtex.pm:378> DEBUG - Source mapping (type=driver, key=Migdal1975r): No field 'school', skipping step ...
[167] bibtex.pm:378> DEBUG - Source mapping (type=driver, key=Migdal1975r): No field 'annote', skipping step ...
[167] bibtex.pm:378> DEBUG - Source mapping (type=driver, key=Migdal1975r): No field 'archiveprefix', skipping step ...
[168] bibtex.pm:378> DEBUG - Source mapping (type=driver, key=Migdal1975r): No field 'primaryclass', skipping step ...
[168] bibtex.pm:378> DEBUG - Source mapping (type=driver, key=Migdal1975r): No field 'key', skipping step ...
[168] bibtex.pm:378> DEBUG - Source mapping (type=driver, key=Migdal1975r): No field 'pdf', skipping step ...
[168] bibtex.pm:941> DEBUG - Parsing namestring 'Александр Аркадьевич Мигдал'
编辑 2:我尝试了一下 bib 文件,发现问题与期刊名称有关。如果期刊名称使用西里尔字母书写,Biber 无法完成。将其更改为其他名称(“blablabal”)可使 Biber 完成,而任何包含西里尔字母的内容(例如,作者姓名)都会导致 Biber 失败。为什么?
答案1
您必须使用fontspec
具有西里尔字母的字体进行声明。例如
\usepackage{libertine}
可以。这主要取决于文档的性质,如果你有数学,也许
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{CMU Serif}
第二个声明应该是
\setmainfont[Ligatures=TeX]{cmunrm.otf}
如果 CMU Serif 未作为系统字体安装。以下是完整示例(我曾经filecontents*
使它自包含并且不破坏我的文件)。
\begin{filecontents*}{\jobname.bib}
@STRING{zhetf = {Журнал Экспериментальной и Теоретической Физики}}
@ARTICLE{Migdal1975r,
AUTHOR = {Александр Аркадьевич Мигдал},
TITLE = {{Фазовые переходы в калибровочных и спиновых решеточных моделях}},
JOURNAL = zhetf,
VOLUME = 69,
NUMBER = 4,
PAGES = {1457--1465},
YEAR = 1975
}
\end{filecontents*}
\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{CMU Serif}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguages{russian}
\usepackage{csquotes}
\usepackage[style=authoryear-comp, natbib=true, backend=biber]{biblatex}
\addbibresource[datatype=bibtex]{\jobname.bib}
\DeclareNameAlias{sortname}{first-last}
\begin{document}
\nocite{*}
a
\printbibliography
\end{document}
答案2
答案很无趣。虽然 egreg 似乎能够毫不费力地生成文件,但 Gentoo 上可用的最新版本 Biber (biber-1.7-r1) 却让我头疼不已。
最终有效的方法是将书目文件的格式从传统的 BibTeX 格式更改为 BibLaTeX 引入的新格式(看这里)。在这种情况下,唯一的要求是将 JOURNAL 改为 JOURNALTITLE。
因此,以下文件对我有用并解决了该问题:
@STRING{zhetf = {Журнал Экспериментальной и Теоретической Физики}}
@ARTICLE{Migdal1975r,
AUTHOR = {Александр Аркадьевич Мигдал},
TITLE = {{Фазовые переходы в калибровочных и спиновых решеточных моделях}},
JOURNALTITLE = zhetf,
VOLUME = 69,
NUMBER = 4,
PAGES = {1457--1465},
YEAR = 1975
}
这可能是 Biber 或其他地方的错误,因为默认情况下 Biber 应该能够毫无问题地读取旧式 BibTeX 文件。