biblatex
's\citeauthor{<cite>}
从引文中提取作者(姓氏)姓名<cite>
,如果需要则缩短。我想有选择地从引文中提取作者的姓氏。
如何使用以下格式从引文中按编号提取单个作者(例如):
\authorname{1}% For the first author
\authorname{2}% For the second author
%...
用例包括:
- 作者 FirstAuthor 做了一些研究。然后与 SecondAuthor 发表了一些文章。可以写“
... together with \authorname{2}~\cite{<cite>}, ...
” - 有时定理是根据作者来命名的,例如 FirstAuthor-SecondAuthor 定理。我想使用 来提取这些
\authorname{1}-\authorname{2}~Theorem
。
这是一个可以作为构建基础的最小示例\authorname
。
\documentclass{article}
\usepackage{biblatex}
\begin{filecontents*}[overwrite]{references.bib}
@article{ref,
author = {A. FirstAuthor and B. SecondAuthor and C. ThirdAuthor},
title = {Some title},
journal = {An amazing journal},
year = {2999},
pages = {1-100}
}
\end{filecontents*}
\addbibresource{references.bib}
\begin{document}
\citeauthor{ref}
% \authorname{1}% FirstAuthor
% \authorname{2}% SecondAuthor
% \authorname{3}% ThirdAuthor
\end{document}
我已经研究过如何\blx@citei@citeauthor
循环遍历作者,但无法定义\authorname{<num>}
。
答案1
如图所示如何获取.bib 文件条目中的第 n 位作者?可能会滥用定义的命令postnote
的参数来指定所需的名称。\...cite...
\DeclareCiteCommand
关键在于永远不会出现“et al.”的名称格式,以及\printnames
将内容作为可选<start>-<stop>
参数的调用postnote
。
\documentclass{article}
\usepackage{biblatex}
\DeclareNameFormat{family:noetal}{%
\usebibmacro{name:family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}
\DeclareCiteCommand{\citeauthorgeneral}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\printnames[family:noetal][\thefield{postnote}-\thefield{postnote}]{author}}
{\multicitedelim}
{}
\begin{filecontents*}{\jobname.bib}
@article{ref,
author = {A. FirstAuthor and B. SecondAuthor and C. ThirdAuthor},
title = {Some title},
journal = {An amazing journal},
year = {2999},
pages = {1-100}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\citeauthor{ref}
\citeauthorgeneral[1]{ref}
\citeauthorgeneral[2]{ref}
\citeauthorgeneral[3]{ref}
\end{document}