我有两个 bibLaTex 条目
@article{madeUp1,
title = {MadeUPTitle},
author = {MadeUp Author1 and MadeUp Author2 and MadeUp Author3 and MadeUp Author4},
journal = {MadeUpJournal},
volume = {0},
issue = {0},
pages = {000--001},
numpages = {0},
year = {2021},
month = {April},
publisher = {MadeUpPublisher},
doi = {www.madeup.com/21321},
}
和
@article{madeUp2,
title = {MadeUPTitle},
author = {Author1, Madeup and Author2, Madeup and Author3, Madeup and Author4, Madeup},
journal = {MadeUpJournal},
volume = {0},
issue = {0},
pages = {000--001},
numpages = {0},
year = {2021},
month = {April},
publisher = {MadeUpPublisher},
doi = {www.madeup.com/21321},
}.
我用这种风格的 biber
\usepackage[backend=biber,style=alphabetic,sorting=nyt]{biblatex}。
因此,当我使用 \citeauthor{madeUp1} 时,我得到的结果为“MadeUp Author1 and MadeUp Author2 and MadeUp Author3 and MadeUp Author4”,这正是我想要的。但是,我想要一个命令\citeauthor连字符只显示作者的姓氏,并用适当的破折号隔开,例如
“作者 1--作者 2--作者 3--作者 4”
当我打字时\citeauthorhyphenated{madeup1}。它还应该使用 \citeauthorhyphenated{madeUp2} 呈现相同的内容。在线搜索没有呈现任何结果,因此我陷入困境……
答案1
有趣的是,不久前有一个相关的问题(Biblatex - 使用 citet 时作者姓名之间的连字符),我们可以使用那里解释的方法。一个简单的解决方案是将\AtNextCite
合适的\DeclareDelimFormat
定义与打包\citeauthor
成一个新命令。
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=alphabetic, sorting=nyt, maxcitenames=999]{biblatex}
\makeatletter
\newcommand*{\citeauthorattr}{%
\AtNextCite{%
\DeclareDelimFormat{multinamedelim}{\textendash\penalty\hyphenpenalty}%
\DeclareDelimAlias{finalnamedelim}{multinamedelim}%
}%
\citeauthor}
\makeatother
\begin{filecontents}{\jobname.bib}
@article{madeUp1,
title = {MadeUPTitle},
author = {MadeUp Author1 and MadeUp Author2
and MadeUp Author3 and MadeUp Author4},
journal = {MadeUpJournal},
volume = {0},
issue = {0},
pages = {000--001},
year = {2021},
month = apr,
doi = {www.madeup.com/21321},
}
@article{madeUp2,
title = {MadeUPTitle},
author = {Author1, Madeup and Author2, Madeup
and Author3, Madeup and Author4, Madeup},
journal = {MadeUpJournal},
volume = {0},
issue = {0},
pages = {000--001},
year = {2021},
month = apr,
doi = {www.madeup.com/21321},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
Lorem \autocite{madeUp1} ipsum \autocite{madeUp2}
Lorem \citeauthor{madeUp1} ipsum \citeauthor{madeUp2}
Lorem \citeauthorattr{madeUp1} ipsum \citeauthorattr{madeUp2}
\printbibliography
\end{document}