![引用的(半)自动复数化](https://linux22.com/image/283872/%E5%BC%95%E7%94%A8%E7%9A%84%EF%BC%88%E5%8D%8A%EF%BC%89%E8%87%AA%E5%8A%A8%E5%A4%8D%E6%95%B0%E5%8C%96.png)
在我的文档中,我会写类似这样的内容(使用natbib
,但这不应该有太大关系):
\citet{reference} show that .....
这将呈现为
Jones 等人(1990)表明……
(\citet
创建\natbib
“作者列表(年份)”引用样式)
当然,如果{reference}
我是一个人,我应该写
\cite{reference} shows that ....
渲染为
琼斯(1990)表明……
由于我很懒,无法花额外的 5 秒钟来搜索参考资料以查看它是否是单个作者,那么是否有可能有一种自动化的方法来实现复数化?或者一些相对简单的宏,看起来像
\IfRefIsPlural{reference}{show}{shows}
答案1
可以biblatex
执行以下操作:
\documentclass{article}
\usepackage[style=authoryear,natbib=true]{biblatex}
\addbibresource{biblatex-examples.bib}
% Used in some citations
\newcounter{totalnames}
\DeclareNameFormat{labelname}{%
\setcounter{totalnames}{\value{author}}%
\ifcase\value{uniquename}%
\usebibmacro{name:family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}%
\or
\ifuseprefix
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffixi}}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefixi}
{\namepartsuffixi}}%
\or
\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}%
\fi
\usebibmacro{name:andothers}}
\newcommand{\IfRefIsPlural}[2]{%
\ifnum\thetotalnames=1
#1%
\else%
#2
\fi%
}
\begin{document}
\citet{bertram} \IfRefIsPlural{shows}{show}
\citet{angenendt} \IfRefIsPlural{shows}{show}
\printbibliography
\end{document}
(小警告:这不适用于\citet{bertram,angenendt}
)