当作者与编辑相同时,如何缩短编辑器?

当作者与编辑相同时,如何缩短编辑器?

在我的参考书目中,有一个案例,其中条目的作者@Inbook与书的编辑是相同的:

@Book{ducktales, Booktitle={Ducktales}, Editor = {Donald Duck}, Year = {2001}}

@Inbook{intro, Title={Introduction}, Crossref = {ducktales}, Author = {Donald Duck}, Pages = {1-10}}

参考书目条目如下所示:

唐老鸭:简介。出自:唐老鸭历险记(2001),唐老鸭出版。

但是,如果作者与编辑相同,我希望将编辑替换为作者。因此条目应如下所示:

唐老鸭:简介。出自:唐老鸭历险记(2001),作者出版。

我怎样才能做到这一点?

答案1

我们可以重新定义byeditor宏来打印\bibstring[\mkibid]{idem\thefield{gender}}任何时候editorauthor相同

\renewbibmacro*{byeditor}{%
  \ifnameundef{editor}
    {}
    {\usebibmacro{bytypestrg}{editor}{editor}%
     \setunit{\addspace}%
     \ifnamesequal{author}{editor}
       {\bibstring[\mkibid]{idem\thefield{gender}}}
       {\printnames[byeditor]{editor}}%
     \newunit}%
  \usebibmacro{byeditorx}}

\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {\usebibmacro{byeditor+othersstrg}%
     \setunit{\addspace}%
     \ifnamesequal{author}{editor}
       {\bibstring[\mkibid]{idem\thefield{gender}}}
       {\printnames[byeditor]{editor}}%
     \clearname{editor}%
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}

当然,您可以\bibstring[\mkibid]{idem\thefield{gender}}选择上面任何您喜欢的东西(例如author:)。

你也可以对byauthor

\renewbibmacro*{bybookauthor}{%
  \ifnamesequal{author}{bookauthor}
    {\bibstring[\mkibid]{idem\thefield{gender}}}
    {\printnames{bookauthor}}}

如果您更喜欢输出“author”而不是“idem”。

\NewBibliographyString{author}
\DefineBibliographyStrings{english}{author = {author}}
\DefineBibliographyStrings{german}{author = {Autor}}

并替换每一行

{\bibstring[\mkibid]{idem\thefield{gender}}}

以上

{\bibstring{author}}

平均能量损失

\documentclass{article}
\usepackage[style=authoryear-ibid]{biblatex}
\addbibresource{biblatex-examples.bib}

\providecommand*{\mkibid}[1]{#1}
\renewbibmacro*{bybookauthor}{%
  \ifnamesequal{author}{bookauthor}
    {\bibstring[\mkibid]{idem\thefield{gender}}}
    {\printnames{bookauthor}}}

\renewbibmacro*{byeditor}{%
  \ifnameundef{editor}
    {}
    {\usebibmacro{bytypestrg}{editor}{editor}%
     \setunit{\addspace}%
     \ifnamesequal{author}{editor}
       {\bibstring[\mkibid]{idem\thefield{gender}}}
       {\printnames[byeditor]{editor}}%
     \newunit}%
  \usebibmacro{byeditorx}}

\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {\usebibmacro{byeditor+othersstrg}%
     \setunit{\addspace}%
     \ifnamesequal{author}{editor}
       {\bibstring[\mkibid]{idem\thefield{gender}}}
       {\printnames[byeditor]{editor}}%
     \clearname{editor}%
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}

\begin{document}
  \nocite{kant:kpv,westfahl:space}
  \printbibliography
\end{document}

在此处输入图片描述

相关内容