[Tex/LaTex] Op.cit. for a single author with more than one source

bibliographiescitingnatbib

I’m using opcit package to generate footnote style citation. Sometimes I have two bibliography entries with the same author, and if I cite them both in a text, the subsequent \cite command will reproduce just an “op.cit” reference, without any discrimination between the two sources. Is there a way around this? Also, is there any more elegant way to automatically generate footnote-style citations?

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{hyperref}
\usepackage{mathtools}
\usepackage[american]{babel}
\usepackage{natbib}
\usepackage[hyperref]{opcit}

\begin{document}

Blah Blah.\footnote{\cite{test}, and \cite{random}} Blah Blah.\cite{test}
\nobibliography{testbib}{}

\end{document}

The bibliography has the following entries:

 @article{random,
     Author = {Test Test},
     Date-Added = {2015-07-26 11:01:54 +0000},
     Date-Modified = {2015-07-26 11:13:15 +0000},
     Journal = {Random Year},
     Title = {Random Paper},
     Year = {2004}}

@article{test,
    Author = {Test Test},
    Date-Added = {2015-07-26 11:00:45 +0000},
    Date-Modified = {2015-07-26 11:02:25 +0000},
    Journal = {Test Journal},
    Title = {TestTitle},
    Year = {2002}}

The output "Test, op.cit." does not distinguish between Test (2002) and Test (2004).

Best Answer

Here is a solution with biblatex (and fnpct to add a comma between consecutive footcite commands). I had to redefine a citation macro in order to obtain loc. cit. rather than the default ibid:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{mathtools}
\usepackage[american]{babel}
\usepackage{filecontents}
\begin{filecontents}{mytestbib.bib}
@article{random,
Author = {Test Test},
Date-Added = {2015-07-26 11:01:54 +0000},
Date-Modified = {2015-07-26 11:13:15 +0000},
Journal = {Random Year},
Title = {Random Paper},
Year = {2004}}
%
@article{test,
Author = {Test Test},
Date-Added = {2015-07-26 11:00:45 +0000},
Date-Modified = {2015-07-26 11:02:25 +0000},
Journal = {Test Journal},
Title = {TestTitle},
Year = {2002}}
\end{filecontents}

\usepackage[bibstyle=authoryear, citestyle=authoryear-icomp, natbib, backend=biber]{biblatex}
\addbibresource{mytestbib.bib}
\usepackage{fnpct}
\AdaptNoteOpt\footcite\multfootcite
\usepackage[colorlinks, citecolor=blue]{hyperref}

\renewbibmacro*{cite:ibid}{%
\printtext[bibhyperref]{\bibstring[\mkibid]{opcit}}%
\ifloccit
{\global\booltrue{cbx:loccit}}
{}}

\addbibresource{mytestbib.bib}

\begin{document}

\vspace*{0.55\textheight}
Citations in a first order:
Blah Blah.\footcite{random}\footcite{test}
Blah Blah.\footcite{test}\bigskip

Citations in the reverse order:
Blah Blah.\footcite{test}\footcite{ random}
Blah Blah.\footcite{test}\bigskip

Grouped citations:
Blah Blah.\footcites{random, test}
Blah Blah.\footcite{test}\bigskip

\printbibliography

\end{document}

enter image description here

Related Question