带有作者注释的条目的特殊设置

带有作者注释的条目的特殊设置

对于所有带有作者注释的条目,我想打印所有作者姓名和标题。对于所有其他条目,我想用 et. al. 缩写太多作者姓名,并省略标题。

经过反复尝试,我找到了以下解决方案:

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents*}{bib.bib}
    @article{A,
        author       = {A Author and B Buthor and C Cuthor and D Duthor},
        author+an    = {=highlight;1=highlight},
        title        = {Title},
        year         = 2013,
    }

    @article{B,
        author       = {B Buthor and C Cuthor and D Duthor and E Euthor},
        title        = {Title},
        year         = 2013,
    }

    @article{C,
        author       = {C Cuthor and D Duthor and E Euthor and A. Author},
        author+an    = {4=highlight},
        title        = {Title},
        year         = 2013,
    }   
\end{filecontents*}

\usepackage[english]{babel}
\usepackage{enumitem}
\usepackage[style=phys,defernumbers,backend=biber, maxnames=3]{biblatex}

% Highlight selected authors
\renewcommand*{\mkbibnamegiven}[1]{%
    %\iffieldannotation{highlight}{highlight}{other}%
    \ifitemannotation{highlight}%
    {\textbf{#1}}%
    {#1}}%
\renewcommand*{\mkbibnamefamily}[1]{%
    \ifitemannotation{highlight}%
    {\textbf{#1}}%
    {#1}}%
\renewcommand*{\mkbibnameprefix}[1]{%
    \ifitemannotation{highlight}%
    {\textbf{#1}}%
    {#1}}%
\renewcommand*{\mkbibnamesuffix}[1]{%
    \ifitemannotation{highlight}%
    {\textbf{#1}}%
    {#1}}%

% Increase maxnames if annotated, otherwise delete title.
\makeatletter
\newbibmacro*{begentry}{%
\blx@resolve@annotation@label{author}%
\ifinlistcs{highlight}{abx@annotation@field@author}{\defcounter{maxnames}{99}}{\clearfield{title}}%
}
\makeatother

\addbibresource{bib.bib}

\parindent=0pt
\begin{document}
    \cite{A, B, C}
    \printbibliography
\end{document} 

输出

这似乎有效,但这是正确的方法吗?

此外,此解决方案要求我将所有 bib 文件中的每个author+an = {...},文件更改为author+an = {=highlight; ...},(使用 这并不难sed)。 可以避免这种情况吗?

我知道我可以maxnames使用该options字段进行设置,但这对标题似乎不起作用。

对于重要的案例,我有一个相当复杂的设置,使用了许多参考部分、参考上下文、类别和关键字。这种特殊处理仅适用于一个参考书目,它有自己的refsection

相关内容