Custom cite command using logic and DeclareCiteCommand with biblatex

biblatexbibliographiescitingmacros

I am using overleaf with biblatex and need a custom cite style to comply with my university's guideline on citation.

Baseline is that every reference needs to be a footnote.
Beside, it's a "3 case thing"; meaning:

  • if this is the first time this reference is cited, show full reference in footnote (author, title, year, pages)
  • if this reference was cited somewhere prior in the document, only print authors last name and title
  • if a reference is cited 2 times in a row, show the second footnote as "repeated, see footnote above"

I tried using the biblatex documentation (which I barely understood) and was looking through solutions here.
I came up with roughly this:

\DeclareCiteCommand{\myfootercitation}[\mkbibfootnote]
  {
    \usebibmacro{prenote}
  }
  {\ifciteibid{REPEATED.}{
  \ifciteindex{\indexfield{indextitle}}{}%
   \textit{\usebibmacro{author}: }
   \printfield[citetitle]{labeltitle},
   \usebibmacro{year},
   \usebibmacro{pages},
   \printfield[cite]{}
   \setunit{\adddot\space}
   }}
  {\multicitedelim}
  {\usebibmacro{postnote}}

I also believe I need \ifciteseen to check if the citation was used before and \ifciteibid to catch the repeated reference case.
But I just fail to get everything together or discovering good educational material on DeclareCiteCommand.

Best Answer

This is more or less what the verbose-ibid style does. It says "ibid." instead of "Repeated, see footnote above" (which I have never seen before and find quite peculiar), but that can be changed.

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

\usepackage[backend=biber, style=verbose-ibid]{biblatex}

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{sigfridsson}
ipsum \autocite{nussbaum}
dolor \autocite{sigfridsson}
sit \autocite{sigfridsson}

\printbibliography
\end{document}

1 Emma Sigfridsson and Ulf Ryde. ‘Comparison of methods for deriving atomic charges from the electrostatic potential and moments’. In: Journal of Computational Chemistry 19.4 (1998), pp. 377–395. doi: 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P.
2 Martha Nussbaum. Aristotle’s ‘De Motu Animalium’. Princeton: Princeton University
Press, 1978.
3 Sigfridsson and Ryde, ‘Comparison of methods for deriving atomic charges from the electrostatic potential and moments’.
4 Ibid.

If you need the "repeated, see footnote above" you can apply the following redefinitions. The relevant macros can be found in verbose-ibid.cbx. There isn't a lot of documentation on \DeclareCiteCommand in the biblatex manual, but you can learn a lot from looking at the code.

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

\usepackage[backend=biber, style=verbose-ibid]{biblatex}

\NewBibliographyString{fnabove}
\DefineBibliographyStrings{english}{
  ibidem  = {repeated},
  fnabove = {see footnote above},
}

\makeatletter
\renewbibmacro*{cite:ibid}{%
  \printtext[bibhyperlink]{\bibstring[\mkibid]{ibidem}}%
  \iffootnote
    {\setunit{\addcomma\space}%
     \bibstring{fnabove}}
    {}%
  \ifloccit
    {\global\toggletrue{cbx:loccit}}
    {}}
\makeatother

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{sigfridsson}
ipsum \autocite{nussbaum}
dolor \autocite{sigfridsson}
sit \autocite{sigfridsson}

\printbibliography
\end{document}

Same output as above, except that footnote 4 now is
"4 Repeated, see footnote above."

Related Question