我创建了一个小示例,希望获取小写字母的作者姓名。预期结果是Knuth(1984)但它正在生产KNUTH(1984)。
\documentclass{article}
\usepackage[style=abnt,ittitles]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{donaldknuth1984,
author = {Donald E. Knuth},
title = {The TeXbook},
publisher = {Addison-Wesley Professional},
year = {1984},
isbn = {0201134489}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\newcommand\posscite[1]{\citeauthor*{#1}'s \citeyear{#1}}
\begin{document}
\posscite{donaldknuth1984}
\end{document}
可能需要重新\citeauthor
定义abnt.cbx,但我没能做到。我也尝试过强制\posscite
使用小写:\newcommand\posscite[1]{\lowercase\expandafter{\citeauthor*{#1}}'s \citeyear{#1}}
,但也没用。
答案1
我建议你使用\posscite
在我的答案到\textcite 的作者姓名为所有格
\documentclass{article}
\usepackage[style=abnt,ittitles]{biblatex}
\DeclareNameWrapperFormat{textlabelname:poss}{#1's}
\DeclareFieldFormat{shorthand:poss}{%
\ifnameundef{labelname}{#1's}{#1}}
\DeclareFieldFormat{citetitle:poss}{\mkbibemph{#1}'s}
\DeclareFieldFormat{label:poss}{#1's}
\newrobustcmd*{\posscitealias}{%
\AtNextCite{%
\DeclareNameWrapperAlias{labelname}{textlabelname:poss}%
\DeclareFieldAlias{shorthand}{shorthand:poss}%
\DeclareFieldAlias{citetitle}{citetitle:poss}%
\DeclareFieldAlias{label}{label:poss}}}
\newrobustcmd*{\posscite}{%
\posscitealias%
\textcite}
\newrobustcmd*{\Posscite}{\bibsentence\posscite}
\newrobustcmd*{\posscites}{%
\posscitealias%
\textcites}
\addbibresource{biblatex-examples.bib}
\begin{document}
\posscite{worman}
\end{document}
这种方法的优点是您不必\posscite
通过将多个\...cite...
命令合并为一个来定义\newcommand
(这通常会对引用跟踪产生负面影响,而且如果您想正确获得前后注释,则更难处理)。
答案2
我添加了另一个作者(一个假的作者)并使用命令\textcite{}
和版本正确处理多个\textcites{}
。
\usepackage[style=abnt,ittitles]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{donaldknuth1984,
author = {Donald E. Knuth},
title = {The TeXbook},
publisher = {Addison-Wesley Professional},
year = {1984},
isbn = {0201134489}
}
@book{other2021,
author = {Other Author},
title = {Title},
publisher = {Addison-Wesley Professional},
year = {2021},
isbn = {0201134489}
}
\end
\end{filecontents*}
\addbibresource{\jobname.bib}
\newcommand\posscite[1]{\citeauthor*{#1}'s \citeyear{#1}}
\begin{document}
%\posscite{donaldknuth1984}
\textcite{donaldknuth1984}
\textcites{donaldknuth1984}{other2021}
\end{document}
结果如下。请注意,只有复数版本\textcites{A}{B}...{N-1}{N}
在引用 {N-1} 和 {N} 之间添加了字母“e”。