# op. cit. in authoryear-ibid

I use biblatex with the authoryear-ibid style, that is citations look like this: (Author 2019), and like this: (ibid.) when the same reference is cited several times in a row.

What I want is the following: when I cite a reference that has already been cited before, but not just before, I would like the citation to be: (Author, op. cit.). I can't find out how to do it, does anybody have a solution?

The style authoryear-ibid does not stand to gain a lot from using op. cit.: a year is hardly longer than 'op. cit.' and it has the huge advantage of being a unique and somewhat informative label.

But it is of course possible to modify authoryear-ibid a bit to include op. cit.. Compare the redefinition below with the original in authoryear-ibid.cbx. The relevant change consists in replacing

   \usebibmacro{cite:labeldate+extradate}


with

    \ifopcit
{\usebibmacro{cite:opcit}}


The definition of cite:opcit is a straightforward copy from verbose-trad1.cbx. Furthermore, biblatex must be loaded with the option opcittracker=context,.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear-ibid, opcittracker=context, backend=biber]{biblatex}

\newbibmacro*{cite:opcit}{%

\renewbibmacro*{cite}{%
\global\boolfalse{cbx:loccit}%
\iffieldundef{shorthand}
{\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{cite:ibid}}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\printdelim{nonameyeardelim}}}
{\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}}%
\ifopcit
{\usebibmacro{cite:opcit}}
{\usebibmacro{cite:shorthand}}}

\begin{document}
\cite{sigfridsson}

\cite{knuth:ct:a}

\cite{sigfridsson}

\cite{knuth:ct:a}

\cite{worman}

\cite{knuth:ct:b}

\cite{worman}

\cite{knuth:ct:b}

\cite{sigfridsson}

\cite{sigfridsson}

\printbibliography
\end{document}


gives

I have severe doubts that this is clearer than the normal output from authoryear-ibid.

Especially the fact that 'Knuth op. cit.' might refer to knuth:ct:a or knuth:ct:b requires the reader to pay much closer attention to previous citations than probably necessary.

If you want to restrict op. cit. to authors with only a single work to avoid confusion, you should load biblatex with the option singletitle and replace \ifopcit in the above with

        \ifthenelse{\ifopcit\AND\ifsingletitle}


Then the MWE produces

Ambiguities are avoided here, but you get a weird mixture of 'op. cit.' and non-'op. cit.' citations.