# Multiply cited reference in footnotes

I have the following problem when using \footcite: it frequently happens that the same citation (same author, same title, same page) appear in the footnotes of the same page – something like :

1. H. Melville. Moby Dick, p. 78.
2. H. Melville. Moby Dick, p. 90.
3. H. Melville. Moby Dick, p. 78.

Is there a way to obtain only :

1. H. Melville. Moby Dick, p. 78.
2. H. Melville. Moby Dick, p. 90.

i.e. the second reference to p.78 of Moby Dick is again ¹ instead of ³ ?

-
MWE?........... – Harish Kumar Nov 14 '12 at 1:22
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It is considered a lot better to put in some code that will compile, as it makes it a lot easier for us to copy it into our text editor and work with it, and see exactly what it is you are trying to do. – hpesoj626 Nov 14 '12 at 1:39
There are two questions where this was already addressed: this older one and this newer one and also the references therein. – Andy Nov 14 '12 at 6:01
possible duplicate of Repeat the same reference in footnote on different pages – lockstep Nov 14 '12 at 7:08
@lockstep I don't think this is a duplicate. The linked solutions don't permit postnotes. – Audrey Nov 14 '12 at 14:45

You can define a variant of \footcite that tracks the last instance and footnote counter values for each given combination of postnotes and entrykeys. If the same combination appears on the page, just the corresponding footnote mark is printed. Otherwise the citation arguments are passed to \footcite.

\documentclass{article}
\usepackage[style=authortitle,citetracker,pagetracker=page]{biblatex}

\makeatletter

\DeclareCiteCommand{\superfootcite}[\cbx@wrap]
{\gdef\cbx@keys{}}
{\xappto\cbx@keys{\thefield{entrykey},}}
{}
{\ifcsundef{cbx@lastin@\cbx@keys @\strfield{postnote}}
{\csnumgdef{cbx@lastin@\cbx@keys @\strfield{postnote}}{-1}}{}%
\ifsamepage{\value{instcount}}{\csuse{cbx@lastin@\cbx@keys @\strfield{postnote}}}
{\footnotemark[\csuse{cbx@lastfn@\cbx@keys @\strfield{postnote}}]}
{\xappto\cbx@cite{\noexpand\footcite%
[\thefield{prenote}][\thefield{postnote}]{\cbx@keys}%
\csnumgdef{cbx@lastfn@\cbx@keys @\strfield{postnote}}{\value{\@mpfn}}%
\csnumgdef{cbx@lastin@\cbx@keys @\strfield{postnote}}{\value{instcount}}}}}

\newrobustcmd{\cbx@wrap}[1]{#1\cbx@cite\gdef\cbx@cite{}}
\def\cbx@cite{}

\makeatother

\begin{document}
\null\vfill\noindent
New citation.\superfootcite[10--15]{companion}
New citation.\superfootcite[10--15]{companion,bertram}
Recurrent citation.\superfootcite[10--15]{companion}
New citation.\superfootcite[10]{companion}
\clearpage\null\vfill\noindent
New citation.\superfootcite[10--15]{companion}
Vanilla footnote.\footnote{Footnote text.}
New citation.\superfootcite[10--15]{bertram}
Recurrent citation.\superfootcite[10--15]{companion}
\end{document}


Here is the output from the first page:

And the second:

-
It works perfectly§ Thank you so much! But shouldn't \footcite behave that way automatically ? – Bernard Alfonsi Nov 15 '12 at 0:21
@BernardAlfonsi It doesn't and I'm not convinced it should. \footcites and \textcite in the verbose styles are defined from \footcite. So changing the default behaviour would complicate things. The multi-cite case would also be prone to ambiguous citation labels. – Audrey Nov 15 '12 at 0:30
@Audrey I'm using a template that I was given at school, and I shouldn't make major changes in there. They use natbib package: \usepackage[sort]{natbib}. I can't figure out whether I can use your solution for natbib. I am sorry, I am very new to it and never used this packages yet. Would you be so kind to advise me how to change proposed solution to make it work in my case? – Foont Nov 15 at 20:30