biblatex:仅在某些情况下使用 ibid

biblatex:仅在某些情况下使用 ibid

biblatex可以选择在引文中使用“ibid” authoryear-ibid。激活此选项后,我的 pdf 输出包含以下内容:

(我) (ibid.); 和

(二) John (ibid)

我想保留 (I) 但不保留 (II) -- 即我想biblatex打印John (2000)但不打印John (ibid)。有人知道怎么做吗?

(如果您使用,这里可以用另一种方式来表述我的问题natbib=true:我可以使用 来激活 ibid 的使用,\citep但不能使用 来激活吗\citet?)

答案1

\ifciteibid必须从 bibmacro 中删除测试。textcite为了方便起见,我使用xpatch包来选择性地改变 bibmacro 的定义。

\documentclass{article}

\usepackage[style=authoryear-ibid,natbib=true]{biblatex}

\usepackage{xpatch}

\xpatchbibmacro{textcite}{%
       {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
          {\usebibmacro{cite:ibid}}
      {\iffieldundef{labelyear}
             {\usebibmacro{cite:label}}
             {\usebibmacro{cite:labelyear+extrayear}}}}
}{%
      {\iffieldundef{labelyear}
             {\usebibmacro{cite:label}}
             {\usebibmacro{cite:labelyear+extrayear}}}
}{}{}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

Some text \citep{A01}.

As was shown in \citet{A01}~\dots

Some more text \citep{A01}.

\printbibliography

\end{document}

在此处输入图片描述

编辑:这是样式所需的修改authoryear-icomp(使用不同的实现textcite):

\usepackage{xpatch}

\xpatchbibmacro{textcite}{%
          {\usebibmacro{cite:label}%
       \setunit{%
         \global\booltrue{cbx:parens}%
         \addspace\bibopenparen}%
       \ifnumequal{\value{citecount}}{1}
         {\usebibmacro{prenote}}
         {}%
       \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
         {\usebibmacro{cite:ibid}}
         {\usebibmacro{cite:labelyear+extrayear}}}
}{%
          {\usebibmacro{cite:label}%
       \setunit{%
         \global\booltrue{cbx:parens}%
         \addspace\bibopenparen}%
       \ifnumequal{\value{citecount}}{1}
         {\usebibmacro{prenote}}
         {}%
      \usebibmacro{cite:labelyear+extrayear}}
}{}{}

\xpatchbibmacro{textcite}{%
             {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
        {\usebibmacro{cite:ibid}}
        {\usebibmacro{cite:labelyear+extrayear}}}%
}{%
             {\usebibmacro{cite:labelyear+extrayear}}%
}{}{}

相关内容