[Tex/LaTex] biblatex: only use ibid in certain situations

biblatexcitingnatbib

biblatex has the option of using "ibid" in citations with the authoryear-ibid option. With this option activated, my pdf output contains both:

(I) (ibid.); and

(II) John (ibid).

I would like to keep (I) but not (II) — i.e., I would like biblatex to print John (2000) but not John (ibid). Does anyone know how to do that?

(Here is another way of formulating my question if you use natbib=true: can I activate the use of ibid with \citep but not with \citet?)

Best Answer

The \ifciteibid test must be removed from the textcite bibmacro. For convenience, I use the xpatch package to selectively change the bibmacro's definition.

\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}

enter image description here

EDIT: Here are the modifications necessary for the authoryear-icomp style (which uses a different implementation of 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}}%
}{}{}