14

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 ³ ?

12

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

\addbibresource{biblatex-examples.bib}
\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:

enter image description here

And the second:

enter image description here

| improve this answer | |
  • 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 '15 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.