当作者与书籍作者相同时修改书中引用

当作者与书籍作者相同时修改书中引用

我有inbook条目,其中author与相同bookauthor。在这种情况下,默认情况下,bookauthor引用中会省略 a。可以通过以下方式更改

\renewbibmacro*{bybookauthor}{%
\printnames{bookauthor}
}

但现在我们打印了两次相同的名称。我该如何启用条目idemtracker内部功能inbook?MWE:

\documentclass{article}

\usepackage[style=verbose-trad1]{biblatex}
\addbibresource{\jobname.bib}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}

@inbook{mybook,
  author={Done, John},
  bookauthor={Done, John},
  title={Chapter title},    
  booktitle={Main book title},
crossref={mainbook},
}
\end{filecontents}

\renewbibmacro*{bybookauthor}{%
 \printnames{bookauthor}
}

\begin{document}
\cite{mybook}
\end{document}

结果: 结果

预期结果: 期待

更新:

我找到了部分解决方案:

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

} 甚至

\renewbibmacro*{bybookauthor}{%
  \ifnamesequal{author}{bookauthor}
    {\usebibmacro{cite:idem}}
    {\printnames{bookauthor}}}

结果: 结果2 但现在的问题是同上booktitle。应使用逗号。

答案1

正确使用分隔符有点棘手,因为标点符号跟踪器通常会打印它获得的最后一个标点符号,驱动程序会\newunitpunct在执行bookauthorbibmacro 后添加。我们可以使用\printunit而不是常规方法\setunit来解决此问题。

\documentclass{article}

\usepackage[style=verbose-trad1]{biblatex}

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


\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@inbook{mybook,
  author     = {Done, John},
  bookauthor = {Done, John},
  title      = {Chapter title},
  booktitle  = {Main book title},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{mybook}
\end{document}

John Done。“章节标题”。在:同上,主要书名

相关内容