我尝试使用这里的解决方案https://tex.stackexchange.com/a/373581/100078使用 XeLaTeX。它总是给出错误未定义的控制序列“\DeclareSortingNamekeyScheme”。
这是我正在尝试编译的代码:
\documentclass{article}
\usepackage[backend=biber, style=authoryear]{biblatex}
\DeclareSortingNamekeyScheme{
\keypart{
\namepart{given}
}
\keypart{
\namepart{prefix}
}
\keypart{
\namepart{family}
}
\keypart{
\namepart{suffix}
}
}
\DeclareNameAlias{sortname}{default}
\begin{document}
\cite{sigfridsson,worman,geer,cicero,nussbaum,knuth:ct:a}
\printbibliography
\end{document}
这似乎是直接从文档但它仍然不起作用。
我已经放弃寻找解决方案了。有什么可以帮到我的吗?
PS 我想先按名字对作者进行排序,然后再按姓氏排序。我尝试了另一种方法(代替default
),但即使这样也不起作用。
\DeclareNameAlias{sortname}{first-last}
PS 参考文献是什么并不重要。Biber 可以编译(如果 XeLaTeX 生成其.bcf
文件)。
该错误对应的错误日志:
(/usr/share/texlive/texmf-dist/tex/latex/biblatex/biblatex.cfg
File: biblatex.cfg
)))
! Undefined control sequence.
l.5 \DeclareSortingNamekeyScheme
{
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
l.6 \keypart
{
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
l.7 \namepart
{given}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
答案1
\DeclareSortingNamekeyScheme
在版本 3.3 中引入,并在 3.8 中重命名为\DeclareSortingNamekeyTemplate
。您正在运行的旧版本biblatex
未定义这两个命令。要使用此命令,您必须更新biblatex
和 Biber 版本。
但由于您的目的始终是将姓名视为不可分割的单位,而不想分成名字和姓氏,所以最好的办法是将所有姓名包裹在一组花括号中,这样它们就会被视为原子的。
author = {{Anne Elk} and {Elizabeth Ditor}},
即使采用标准设置也总是会出现相同的结果,您甚至不需要更改格式sortname
或\DeclareSortingNamekeyScheme
。
由于名称解析和拆分是由后端完成的,因此如果名称不是作为原子输入的,则没有biblatex
解决方案将其视为原子。我们只能尝试操纵一切,使名称看起来从未被拆分,但这比将名称放在花括号中要费力得多。