引用键中的 Utf8 字符

引用键中的 Utf8 字符

这是我在 tex.stackexchange 上的第一篇帖子,向大家问好。

我正在使用 biblatex 和 biber 来生成参考书目,但 utf8 字符有问题。像往常一样,我可以在字段中使用 utf8 字符,但它们在引用键中使用时似乎不起作用。mwe 如下:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french,english]{babel}
\usepackage{filecontents}

\begin{filecontents*}{bibliography.bib}
@article{rené,
    author = {Descartes, René},
    title = {Discourse on the method},
}
\end{filecontents*}

\usepackage[backend=biber]{biblatex}
\addbibresource{bibliography.bib}

\begin{document}
This citation fails\cite{rené}.
\printbibliography
\end{document}

我已经指定了 utf8 编码,但是当我运行 biber 时(在使用 pdflatex 进行两次编译后)出现以下错误:

INFO - This is Biber 2.7 (beta)
INFO - Logfile is 'mwe.blg'
INFO - Reading 'mwe.bcf'
INFO - Found 1 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'
WARN - I didn't find a database entry for 'ren\IeC {\'e}' (section 0)
INFO - Overriding locale 'en-US' defaults 'variable = shifted' with 'variable = non-ignorable'
INFO - Overriding locale 'en-US' defaults 'normalization = NFD' with 'normalization = prenormalized'
INFO - Sorting list 'nty/global/' of type 'entry' with scheme 'nty' and locale 'en-US'
INFO - No sort tailoring available for locale 'en-US'
INFO - Writing 'mwe.bbl' with encoding 'UTF-8'
INFO - Output to mwe.bbl
INFO - WARNINGS: 1

如您所见,命令中的字符“é”\cite{rené}已被扩展(由谁扩展?),因此 biber 找不到相应的引用键。

有办法解决这个问题吗?我的密钥是定期自动生成的,因此我希望避免手动编辑每个非 ASCII 字符。

答案1

使用 pdfLaTeX 时,您无法在 entrykey 中使用大多数 UTF-8。如果您使用 LuaLaTeX 或 XeLaTeX,它们都完全兼容 UTF-8,则可以使用大多数 UTF-8 字符(其中包括é在 entrykey 中使用大多数 UTF-8 字符(其中包括)(有一些限制,但这些限制大多在 ASCII 范围内:biblatex 文字和字符串之间有什么区别?使用包含括号的 BibTeX 键和 Biber什么是有效的 BibLaTeX 条目键?)。

Biber 文档明确指出

处理 UTF-8 引用键和文件名(给定一个合适的完全符合 UTF-8 标准的 TeX 引擎)

但 pdfLaTeX 不是 Unicode 引擎。这与 LaTeX 内部处理引用键和字符的方式有关。

如果您自动创建密钥,则应该可以修改流程,以便只获得 ASCII。但我发现自己想出 citekeys 更好,这样更容易记住,因为您已经对它们进行了一些思考。

相关内容