我使用的是authoryear-icomp
biblatex 样式。对于一些名称较长的机构的出版物,我想使用shortauthor
。但是,该样式authoryear-icomp
只是shortauthor
从第一个引用开始使用,如下所示:
我希望它能够像在 中一样工作style=apa
,它使用完整的作者姓名作为第一次引用,并在方括号中引入简称,然后将其用于所有进一步的引用(即使是同一作者的其他出版物)。
有没有什么办法可以实现这种行为authoryear-icomp
?
这是 MWE:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[style=authoryear-icomp, % alternatively: style=apa
bibstyle=authoryear,
autocite=inline,
backend=biber
]
{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{testbib.bib}
@online{test1,
author = {{Institution Long Name}},
shortauthor = {ILN},
title = {Test title},
year = {2020}
}
@online{test2,
author = {{Institution Long Name}},
shortauthor = {ILN},
title = {Another test title},
year = {2020}
}
\end{filecontents*}
\addbibresource{testbib.bib}
\begin{document}
Citation number one \autocite{test1}.
Citation number two \autocite{test1}.
Third citation with a different publication by the same author \autocite{test2}.
\end{document}
答案1
您可以这样做 - 我从 APA 样式中获取了一些代码。您可能需要使其更符合cite
样式authoryear-icomp
才能更广泛地使用,但这可以让您获得所需的开始:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[style=authoryear-icomp, % alternatively: style=apa
bibstyle=authoryear,
autocite=inline,
backend=biber
]
{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{testbib.bib}
@online{test1,
author = {{Institution Long Name}},
shortauthor = {ILN},
title = {Test title},
year = {2020}
}
@online{test2,
author = {{Institution Long Name}},
shortauthor = {ILN},
title = {Another test title},
year = {2020}
}
\end{filecontents*}
\addbibresource{testbib.bib}
\makeatletter
\DeclareCiteCommand{\parencite}[\mkbibparens]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{metacite}%
\usebibmacro{cite:post}}
{}
{\usebibmacro{cite:postnote}}
\newbibmacro*{cite:post}{%
\xifinlist{\thefield{fullhash}}{\cbx@names}
{}
{\listxadd{\cbx@names}{\thefield{fullhash}}}}
\global\let\cbx@names\@empty
\def\cbx@ifnamesaved{%
\xifinlist{\thefield{fullhash}}{\cbx@names}
{\@firstoftwo}
{\@secondoftwo}}
\newbibmacro*{metacite}{%
\ifnameundef{shortauthor}
{\usebibmacro{cite}}
{\usebibmacro{sacite}}}
\newbibmacro*{sacite}{%
\cbx@ifnamesaved
{\printnames{shortauthor}}
{\printnames{author}%
\addspace\mkbibbrackets{\printnames[sabrackets]{shortauthor}}}%
\setunit{\printdelim{nameyeardelim}}%
\usebibmacro{cite:labeldate+extradate}%
\savefield{namehash}{\cbx@lasthash}%
\savefield{labelyear}{\cbx@lastyear}%
\setunit{\multicitedelim}}
\makeatother
\begin{document}
Citation number one \autocite{test1}.
Citation number two \autocite{test1}.
Third citation with a different publication by the same author \autocite{test2}.
\end{document}