ABNT 格式使用大写字母表示作者姓氏。引用名为约翰·多伊和年份2021, 它给(美国能源部,2021 年)。我想获取作者的全名,所以我按照@loved-by-Jesus 在引用作者全名。这还不够,因为 ABNT 样式将姓氏格式化为大写,导致约翰·多伊而不是预期的约翰·多伊。我尝试使用\capitalisewords
frommfirstuc
包,但是没有成功。
以下是示例代码:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber,style=abnt,ittitles]{biblatex}
\usepackage{hyperref}
\usepackage{mfirstuc}
\newrobustcmd*{\citefirstlastauthor}{\AtNextCite{\DeclareNameAlias{labelname}{given-family}}\citeauthor}
\newcommand\theauthorname[1]{\capitalisewords{\expandafter\citefirstlastauthor*{#1}}}
\begin{filecontents*}{test.bib}
@article{doe2021,
author = {John Doe and Mary White and Cris Ross},
title = {Author Title Test},
journal = {Test Journal},
year = {2021}
}
\end{filecontents*}
\addbibresource{test.bib}
\usepackage{usebib}
\newbibfield{author}
\newbibfield{address}
\bibinput{test}
\begin{document}
\theauthorname{doe2021}\\
\textcite{doe2021}\\
\usebibentry{doe2021}{author}
\printbibliography
\end{document}
结果:
@nicholas-hamilton 提供的解决方案如何引用完整作者姓名,使用usebib
包,它几乎给你正确的文本(因为它保留了连接词和而不是使用逗号,并且当文档使用其他语言时不进行翻译),并且它也不会创建到参考书目的链接。
如何获取全名John Doe、Mary White 和 Cris Ross并将其链接到参考书目吗?
答案1
由于biblatex-abnt
对名称宏进行了相当大的修改,我们需要一些代码来撤销其中一些更改。\textcite
没有将名称大写,因此我从那里找到了所需的代码。
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber,style=abnt,ittitles]{biblatex}
\usepackage{hyperref}
\DeclareCiteCommand{\citefirstlastauthor}
{\DeclareNameAlias{labelname}{given-family}%
\let\multinamedelim\multinamedelimorig
\let\finalnamedelim\finalnamedelimorig
\let\mkbibnamefamily\origmkbibnamefamily
\let\mkbibnamegiven\origmkbibnamegiven
\let\mkbibnameprefix\origmkbibnameprefix
\let\mkbibnamesuffix\origmkbibnamesuffix
\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}%
{\ifciteindex%
{\indexnames{labelname}}%
{}%
\printtext[bibhyperref]{\printnames{labelname}}}%
{\multicitedelim}%
{\usebibmacro{postnote}}%
\begin{filecontents*}{\jobname.bib}
@article{doe2021,
author = {John Doe and Mary White and Cris Ross},
title = {Author Title Test},
journal = {Test Journal},
year = {2021}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\citefirstlastauthor{doe2021}
\textcite{doe2021}
\printbibliography
\end{document}