Biblatex/Biber 将每个作者的作者姓名替换为破折号

Biblatex/Biber 将每个作者的作者姓名替换为破折号

在作者年份类型的参考书目样式的参考书目中,BibLaTeX 可以用破折号或类似符号替换重复的作者列表(所有作者相同)。是否可以更改此行为,以便按作者进行替换?这在以下期刊中很常见古生物学

作为示例,以下参考:

作者,A.2000。首次参考。期刊A2, 21–22。AUTHOR
, A. & BAUTHOR, B. 2001。第二次参考。期刊B4, 34–46。AUTHOR
, A., BAUTHOR, B. & CAUTHOR, C. 2002。第三次参考。期刊C6,89–99。

将发布为:

作者,A.2000。首次参考。期刊A2, 21–22。————
& BAUTHOR, B. 2001. 第二次参考。期刊B4, 34–46。————
——— & CAUTHOR, C. 2002. 第三次参考。期刊C6,89–99。

用三个破折号代替每个重复的作者。

回复 使用 biblatex,是否可以用 bibnamedash 或 idem 字符串替换作者列表中的一位作者?描述了仅使用 Idem/Eadem/Eidem/Eaedem 替换重复的第一作者的命令,但这可以应用于作者列表中的多个作者吗?

附录: 该图像来自 Porro, LB 等人的“计算机断层扫描...”, 古生物学,2015,第 16 页。

包含多个 3 em 破折号的参考书目示例

答案1

总体思路是受到 Audrey 的回答启发使用 biblatex,是否可以用 bibnamedash 或 idem 字符串替换作者列表中的一位作者?,但最终采取了截然不同的方法。

您可以使用 来控制插入的破折号\bibnamedash,两个破折号之间的分隔符是\multidashdelim,最后一个破折号用 分隔\finaldashdelim

\makeatletter
\renewcommand*{\bibnamedash}{\textemdash\textemdash\textemdash}
\newcommand*{\multidashdelim}{\addspace}
\newcommand*{\finaldashdelim}{\finalnamedelim}

\newtoggle{bbx:goahead}
\InitializeBibliographyStyle{\global\csundef{bbx@lastname@1}}

\newbibmacro*{bbx:printlist}[1]{%
  \toggletrue{bbx:goahead}%
  \printnames[dashed:given-family]{#1}}

\newbibmacro*{dash:delim}{%
  \ifnumgreater{\value{listcount}}{\value{liststart}}
    {\ifboolexpr{
       test {\ifnumless{\value{listcount}}{\value{liststop}}}
       or
       test \ifmorenames
     }
       {\multidashdelim}
       {\finaldashdelim}}
    {}}

\DeclareNameFormat{dashed:given-family}{%
   \ifboolexpr{togl {bbx:goahead} 
               and test {\iffieldequalcs{hash}{bbx@lastname@\the\value{listcount}}}}
     {\usebibmacro{dash:delim}\bibnamedash}
     {\global\togglefalse{bbx:goahead}%
      \ifgiveninits
        {\usebibmacro{name:family-given}
           {\namepartfamily}%
           {\namepartgiveni}%
           {\namepartprefix}%
           {\namepartsuffix}}
        {\usebibmacro{name:family-given}
          {\namepartfamily}%
          {\namepartgiven}%
          {\namepartprefix}%
          {\namepartsuffix}}}%
  \csxdef{bbx@lastname@\the\value{listcount}}{\thefield{hash}}}

\renewbibmacro*{author}{%
  \ifboolexpr{ test {\ifuseauthor}
               and not test {\ifnameundef{author}} }
    {\usebibmacro{bbx:printlist}{author}%
     \setunit{\addcomma\space}%
     \usebibmacro{authorstrg}}
    {\global\csundef{bbx@lastname@1}}}

\renewbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{ test {\ifuseeditor}
               and not test {\ifnameundef{editor}} }
    {\usebibmacro{bbx:printlist}{editor}%
     \setunit{\addcomma\space}%
     \usebibmacro{#1}%
     \clearname{editor}}
    {\global\csundef{bbx@lastname@1}}}

\renewbibmacro*{bbx:translator}[1]{%
  \ifboolexpr{ test {\ifusetranslator}
               and not test {\ifnameundef{translator}} }
    {\usebibmacro{bbx:printlist}{translator}%
     \setunit{\addcomma\space}%
     \usebibmacro{#1}%
     \clearname{translator}}
    {\global\csundef{bbx@lastname@1}}}
\makeatother

如果你希望破折号能够跳过名称,你可以更改行

\ifboolexpr{togl {bbx:goahead} 
            and test {\iffieldequalcs{hash}{bbx@lastname@\the\value{listcount}}}}

\iffieldequalcs{hash}{bbx@lastname@\the\value{listcount}}

然后您还可以删除所有提及的内容bbx:goahead

平均能量损失

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authortitle,
            maxbibnames=999,
            backend=biber,
            sorting=nyt,
            abbreviate=false]{biblatex}

\makeatletter
\renewcommand*{\bibnamedash}{\textemdash\textemdash\textemdash}
\newcommand*{\multidashdelim}{\addspace}
\newcommand*{\finaldashdelim}{\finalnamedelim}

\newtoggle{bbx:goahead}
\InitializeBibliographyStyle{\global\csundef{bbx@lastname@1}}

\newbibmacro*{bbx:printlist}[1]{%
  \toggletrue{bbx:goahead}%
  \printnames[dashed:given-family]{#1}}

\newbibmacro*{dash:delim}{%
  \ifnumgreater{\value{listcount}}{\value{liststart}}
    {\ifboolexpr{
       test {\ifnumless{\value{listcount}}{\value{liststop}}}
       or
       test \ifmorenames
     }
       {\multidashdelim}
       {\finaldashdelim}}
    {}}

\DeclareNameFormat{dashed:given-family}{%
   \ifboolexpr{togl {bbx:goahead} 
               and test {\iffieldequalcs{hash}{bbx@lastname@\the\value{listcount}}}}
     {\usebibmacro{dash:delim}\bibnamedash}
     {\global\togglefalse{bbx:goahead}%
      \ifgiveninits
        {\usebibmacro{name:family-given}
           {\namepartfamily}%
           {\namepartgiveni}%
           {\namepartprefix}%
           {\namepartsuffix}}
        {\usebibmacro{name:family-given}
          {\namepartfamily}%
          {\namepartgiven}%
          {\namepartprefix}%
          {\namepartsuffix}}}%
  \csxdef{bbx@lastname@\the\value{listcount}}{\thefield{hash}}}

\renewbibmacro*{author}{%
  \ifboolexpr{ test {\ifuseauthor}
               and not test {\ifnameundef{author}} }
    {\usebibmacro{bbx:printlist}{author}%
     \setunit{\addcomma\space}%
     \usebibmacro{authorstrg}}
    {\global\csundef{bbx@lastname@1}}}

\renewbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{ test {\ifuseeditor}
               and not test {\ifnameundef{editor}} }
    {\usebibmacro{bbx:printlist}{editor}%
     \setunit{\addcomma\space}%
     \usebibmacro{#1}%
     \clearname{editor}}
    {\global\csundef{bbx@lastname@1}}}

\renewbibmacro*{bbx:translator}[1]{%
  \ifboolexpr{ test {\ifusetranslator}
               and not test {\ifnameundef{translator}} }
    {\usebibmacro{bbx:printlist}{translator}%
     \setunit{\addcomma\space}%
     \usebibmacro{#1}%
     \clearname{translator}}
    {\global\csundef{bbx@lastname@1}}}
\makeatother

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{bookABC,
  author = {Anne Uthor and Enid Blyton and William Riter},
  title = {UBR},
  date = {1990},}
@BOOK{bookADC,
  author = {Anne Uthor and James Joyce and William Riter},
  title = {UJR},
  date = {1991},}
@BOOK{book1,
  author = {Buchautor, Emma-Louise},
  gender = {sf},
  title = {First Title},
  date = {2001}}
@BOOK{book2,
  author = {Buchautor, Emma-Louise},
  title = {Same female author},
  date = {2002}}
@BOOK{book3,
  author = {Buchautor, Emma-Louise and van Helsing, Sarah},
  gender = {pf},
  title = {Same first author whose gender is unspecified},
  date = {2003}}
@BOOK{book4,
  author = {Buchautor, Emma-Louise and van Helsing, Sarah and Knuth, Donald E.},
  gender = {pp},
  title = {Same first and second female authors},
  date = {2004}}
@BOOK{book5,
  editor = {Buchautor, Emma-Louise and van Helsing, Sarah and Knuth, Donald E. and Cicero, Marcus Tullius},
  gender = {pp},
  title = {Same leading names of mixed genders},
  date = {2005}}
@BOOK{book6,
  editor = {van Helsing, Abraham},
  title = {Different name},
  date = {2006}}
@BOOK{book7,
  author = {van Helsing, Abraham},
  gender = {sm},
  translator = {van Helsing, Abraham},
  title = {Same male name},
  date = {2007}}
@BOOK{book8,
  editor = {van Helsing, Abraham and Jackson, Tom},
  gender = {pm},
  translator = {Cicero, Marcus Tullius},
  title = {Same first male author},
  date = {2008}}
@BOOK{book9,
  author = {van Helsing, Abraham and Jackson, Tom},
  title = {Same male names},
  date = {2009}}
@BOOK{book10,
  author = {van Helsing, Abraham and Jackson, Tom},
  gender = {pm},
  title = {Same authors of unspecified gender},
  date = {2010}}
@article {JMOR:JMOR10504,
  author = {Markey, Molly J. and Marshall, Charles R.},
  title = {Linking form and function of the fibrous joints in the skull: A new quantification scheme for cranial sutures using the extant fish Polypterus endlicherii},
  journal = {Journal of Morphology},
  volume = {268},
  number = {1},
  doi = {10.1002/jmor.10504},
  pages = {89--102},
  date = {2007-01},
}
@article {markey:pnas,
  author = {Markey, Molly J. and Marshall, Charles R.},
  title = {Terrestrial-style feeding in a very early aquatic tetrapod is supported by evidence from experimental analysis of suture morphology},
  journal = {Proceedings of the National Academy of Sciences},
  volume = {104},
  number = {17},
  doi = {10.1073/pnas.0701706104},
  pages = {7134-7138},
  date = {2007-04},
}
@article {Markey2085,
  author = {Markey, Molly J. and Main, Russell P. and Marshall, Charles R.},
  title = {\emph{In vivo} cranial suture function and suture morphology in the extant fish \emph{Polypterus}: implications for inferring skull function in living and fossil fish},
  volume = {209},
  number = {11},
  pages = {2085--2102},
  year = {2006},
  doi = {10.1242/jeb.02266},
  journal = {Journal of Experimental Biology},
}
\end{filecontents}
\addbibresource{\jobname.bib}

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

示例输出


如果我们使用

\newcounter{bbx:currnames}
\newcounter{bbx:lastnames}

\newbibmacro*{bbx:printlist}[1]{%
  \setcounter{bbx:currnames}{0}%
  \toggletrue{bbx:goahead}%
  \printnames[dashed:given-family]{#1}%
  \setcounter{bbx:lastnames}{\value{bbx:currnames}}}

可以dash:cleanup实现为

\newbibmacro{dash:cleanup}{\setcounter{bbx:lastnames}{0}}

并用作

\InitializeBibliographyStyle{\usebibmacro{dash:cleanup}}

\renewbibmacro*{author}{%
  \ifboolexpr{ test {\ifuseauthor}
               and not test {\ifnameundef{author}} }
    {\usebibmacro{bbx:printlist}{author}%
     \setunit{\addcomma\space}%
     \usebibmacro{authorstrg}}
    {\usebibmacro{dash:cleanup}}}

\renewbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{ test {\ifuseeditor}
               and not test {\ifnameundef{editor}} }
    {\usebibmacro{bbx:printlist}{editor}%
     \setunit{\addcomma\space}%
     \usebibmacro{#1}%
     \clearname{editor}}
    {\usebibmacro{dash:cleanup}}}

\renewbibmacro*{bbx:translator}[1]{%
  \ifboolexpr{ test {\ifusetranslator}
               and not test {\ifnameundef{translator}} }
    {\usebibmacro{bbx:printlist}{translator}%
     \setunit{\addcomma\space}%
     \usebibmacro{#1}%
     \clearname{translator}}
    {\usebibmacro{dash:cleanup}}}

然后你必须改变

\ifboolexpr{togl {bbx:goahead} 
            and test {\iffieldequalcs{hash}{bbx@lastname@\the\value{listcount}}}}

dashed:given-family稍长一点

\ifboolexpr{togl {bbx:goahead} 
            and not test {\ifnumgreater{\value{listcount}}{\value{bbx:lastnames}}}
            and test {\iffieldequalcs{hash}{bbx@lastname@\the\value{listcount}}}}

另一个清理解决方案是

\makeatletter
\newtoggle{bbx:goahead}
\newcounter{bbx:currnames}
\newcounter{bbx:lastnames}

\renewcommand*{\bibnamedash}{\textemdash\textemdash\textemdash}
\newcommand*{\multidashdelim}{\addspace}
\newcommand*{\finaldashdelim}{\finalnamedelim}

\InitializeBibliographyStyle{\usebibmacro{dash:cleanup}{0}}

\newbibmacro*{bbx:printlist}[1]{%
  \setcounter{bbx:currnames}{0}%
  \toggletrue{bbx:goahead}%
  \printnames[dashed:given-family]{#1}%
  \usebibmacro{dash:cleanup}{\value{bbx:currnames}+1}%
  \setcounter{bbx:lastnames}{\value{bbx:currnames}}}

\newbibmacro*{dash:delim}{%
  \ifnumgreater{\value{listcount}}{\value{liststart}}
    {\ifboolexpr{
       test {\ifnumless{\value{listcount}}{\value{liststop}}}
       or
       test \ifmorenames
     }
       {\multidashdelim}
       {\finaldashdelim}}
    {}}

\DeclareNameFormat{dashed:given-family}{%
   \addtocounter{bbx:currnames}{1}%
   \ifboolexpr{togl {bbx:goahead} and not test \iffirstonpage
               and test {\iffieldequalcs{hash}{bbx@lastname@\the\value{listcount}}}}
     {\usebibmacro{dash:delim}\bibnamedash}
     {\global\togglefalse{bbx:goahead}%
      \ifgiveninits
        {\usebibmacro{name:family-given}
           {\namepartfamily}%
           {\namepartgiveni}%
           {\namepartprefix}%
           {\namepartsuffix}}
        {\usebibmacro{name:family-given}
          {\namepartfamily}%
          {\namepartgiven}%
          {\namepartprefix}%
          {\namepartsuffix}}}%
  \csxdef{bbx@lastname@\the\value{listcount}}{\thefield{hash}}}

\newbibmacro{dash:cleanup}[1]{%
  \ifnumgreater{\value{bbx:lastnames}}{#1}
    {\global\csundef{bbx@lastname@\the\value{bbx:lastnames}}%
     \addtocounter{bbx:lastnames}{-1}%
     \usebibmacro{dash:cleanup}{#1}}
    {}}

\renewbibmacro*{author}{%
  \ifboolexpr{ test {\ifuseauthor}
               and not test {\ifnameundef{author}} }
    {\usebibmacro{bbx:printlist}{author}%
     \setunit{\addcomma\space}%
     \usebibmacro{authorstrg}}
    {\usebibmacro{dash:cleanup}{0}}}

\renewbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{ test {\ifuseeditor}
               and not test {\ifnameundef{editor}} }
    {\usebibmacro{bbx:printlist}{editor}%
     \setunit{\addcomma\space}%
     \usebibmacro{#1}%
     \clearname{editor}}
    {\usebibmacro{dash:cleanup}{0}}}

\renewbibmacro*{bbx:translator}[1]{%
  \ifboolexpr{ test {\ifusetranslator}
               and not test {\ifnameundef{translator}} }
    {\usebibmacro{bbx:printlist}{translator}%
     \setunit{\addcomma\space}%
     \usebibmacro{#1}%
     \clearname{translator}}
    {\usebibmacro{dash:cleanup}{0}}}
\makeatother

无论如何,您可能想要and not test \iffirstonpage在中\ifboolexpr添加dashed:given-family

相关内容