每次我尝试使用\textcite
“统一”样式的命令时,Overleaf 都会报出“未定义控制序列”的错误。但当我切换到“authoryear”样式时,错误就消失了。我该如何解决这个问题?以下是我的序言部分:
\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{example-sentences}
\usepackage[backend=biber, style=unified, natbib=true]{biblatex}
\addbibresource{references.bib}
\usepackage [english]{babel}
\usepackage [autostyle, english = american]{csquotes}
\MakeOuterQuote{"}
以下是我从 Overleaf 收到的错误消息:
\blx@biblinkstart [#1]->\blx@sfsave
\hyper@natlinkstart {\the \c@refsection ...
l.23 ...ime today," from \textcite{rior_gen_2021}}
.
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.
\blx@biblinkstart ...x@sfsave \hyper@natlinkstart
{\the \c@refsection @#1}\b...
l.23 ...ime today," from \textcite{rior_gen_2021}}
.
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.
再次,如果我使用 authoryear 样式,则不会发生上述情况(但我想改用统一样式)。请问我该怎么办?
答案1
unified
的命令的实现\textcite
需要您加载hyperref
。它使用的代码灵感来自https://tex.stackexchange.com/a/27615/35864.例如参见https://github.com/semprag/biblatex-sp-unified/issues/48。
文档状态
统一引用样式依赖于文内引用和参考书目之间的超链接。因此,该
hyperref
包是必需的。它会自动加载,sp.cls
但如果您使用不同的文档类并且hyperref
该类未加载它,您\usepackage{hyperref}
也需要将其添加到您的序言中。
添加\usepackage{hyperref}
到文档前言中。(请注意,除了少数记录在案的例外情况外,hyperref
通常应该是您加载的最后一个包)。以下 MWE 编译得很好
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=unified]{biblatex}
\usepackage{hyperref}
\addbibresource{biblatex-examples.bib}
\begin{document}
Lorem \textcite{sigfridsson}
\printbibliography
\end{document}
按原样,但如果省略该行将会引发错误\usepackage{hyperref}
。