![当作者与编辑相同时,如何缩短编辑器?](https://linux22.com/image/289129/%E5%BD%93%E4%BD%9C%E8%80%85%E4%B8%8E%E7%BC%96%E8%BE%91%E7%9B%B8%E5%90%8C%E6%97%B6%EF%BC%8C%E5%A6%82%E4%BD%95%E7%BC%A9%E7%9F%AD%E7%BC%96%E8%BE%91%E5%99%A8%EF%BC%9F.png)
在我的参考书目中,有一个案例,其中条目的作者@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}}
任何时候editor
和author
相同
\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}