对其他字段使用虚线选项

对其他字段使用虚线选项

一些 biblatex 样式有一个dashed选项,可以用破折号替换重复的作者姓名。我想对作者以外的其他字段执行此操作。

这是一个(不那么)最小的工作示例:

\begin{filecontents}{\jobname.bib}
@book{salaman9999,
 author  ={Redcliffe N. Salaman},
 year    =1985,
 title   ={The author here is shown only once.}}
@book{salaman1985,
 author  ={Redcliffe N. Salaman},
 year    =1985,
 title   ={The History and Social Influence of the Potato}}
@manual{ISO214:1976,
    Org-Short = {ISO},
    Organization = {International Standards Organization},
    Subtitle = {The organization here is shown multiple times},
    Title = {{ISO} 214:1976},
    Year = 1976}
@manual{ISO4:1997,
    Org-Short = {ISO},
    Organization = {International Standards Organization},
    Subtitle = {Information and documentation --- Rules for the abbreviation of title words and titles of publications},
    Title = {{ISO} 4:1997},
    Year = 1997}
@manual{ISO215:1986,
    Org-Short = {ISO},
    Organization = {International Standards Organization},
    Subtitle = {Documentation --- Presentation of contributions to periodicals and other serials},
    Title = {{ISO} 215:1986},
    Year = 1986}
\end{filecontents}

\documentclass{article}

\usepackage[backend=biber, style=authoryear]{biblatex}
\addbibresource{\jobname.bib}

\DeclareBibliographyDriver{manual}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/organization}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \usebibmacro{finentry}}

\newbibmacro*{author/editor+others/organization}{%
    \ifboolexpr{%
        test {\ifnameundef{author}}
        and
        test {\ifnameundef{editor}}
    }
    {\usebibmacro{organization}}
    {\usebibmacro{author/editor+others}}}

\newbibmacro*{organization}{%
    \iflistundef{organization}
        {\global\undef\bbx@lasthash}
        {\usebibmacro{bbx:dashcheck}
           {\bibnamedash}
           {\usebibmacro{bbx:savehash}%
            \printlist[uppercase]{organization}}}%
}

\begin{document}
  \nocite{*}
  \printbibliography
\end{document}

正如您所看到的,我重新定义了@manual驱动程序以在没有作者时打印组织。

然后我尝试定义一个organization基于authoryear'sauthoreditor宏的宏。我希望组织不会重复,而是用破折号代替,就像作者那样,但它没有奏效:

例子

那么我有办法做到这一点吗?

提前致谢,

丹尼尔

答案1

问题在于bibmacrosbbx:dashcheck和字段bbx:savehash的使用fullhash。但是,fullhash如果没有名称,则不存在。因此,必须用fullhash不同的值替换 的使用。为此,我们检查组织的名称(列表)是否与前一个相同。

bbx:dashchek我们可以将宏的定义改为

\renewbibmacro*{bbx:dashcheck}[2]{%
  \ifboolexpr{
    (test {\iflistequals{organization}{\bbx@lasthash}}
    or
    test {\iffieldequals{fullhash}{\bbx@lasthash}}
    )
    and
    not test \iffirstonpage
    and
    (
       not bool {bbx@inset}
       or
       test {\iffieldequalstr{entrysetcount}{1}}
    )
  }
    {#1}
    {#2}}

然后将organisation宏定义为

\newbibmacro*{organization}{%
    \iflistundef{organization}
        {\global\undef\bbx@lasthash}
        {\usebibmacro{bbx:dashcheck}
           {\bibnamedash}
           {\savelist{organization}{\bbx@lasthash}%
            \printlist[uppercase]{organization}}}%
}

鉴于我们使用内部,\bbx@lasthash定义应该被\makeatletter和包裹\makeatother

通过以上两点修改,我们得到:

在此处输入图片描述

相关内容