[Tex/LaTex] How to replace the second footcite “Author. Title. Year.” by “Ibid”

biberbiblatexciting

I would like to present footcites as follow:

Author. Title of the article. Year of the article. [ref]

or

Ibid. [ref] (for the second times of the same cite)

For the first presentation, I use a new Cite command defined from customized \footcite command.

Here's some code for testing purposes:

\begin{filecontents}{mybib.bib}
@article{Aggarwal2004b,
author = {Aggarwal, B. B. and Takada, Y. and Oommen, O. V.},
journal = {Expert Opin Investig Drugs},
month = oct,
number = {10},
pages = {1327--1338},
publisher = {Informa Pharma Science},
title = {{From chemoprevention to chemotherapy: common targets and common goals}},
volume = {13},
year = {2004}
}
\end{filecontents}    
\documentclass{report}
\usepackage[autolang=hyphen,backend=biber,style=numeric]{biblatex}
\usepackage[bookmarks,colorlinks=true]{hyperref}

\DeclareCiteCommand{\footpartcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printnames{labelname}%
   \setunit{\labelnamepunct}
   \printfield[citetitle]{title}%
   \newunit
   \printfield{year}
   {\adddot}
   \mkbibbrackets{\usebibmacro{cite}}}
  {\addsemicolon\space}
  {\usebibmacro{postnote}}

\DeclareMultiCiteCommand{\footpartcites}[\mkbibfootnote]{\footpartcite} {\addsemicolon\space}

\bibliography{mybib} 
\begin{document}

Test~\footpartcite{Aggarwal2004b}. \\
Test~\footpartcite{Aggarwal2004b}. \\
\printbibliography

\end{document}

But, this doesn't replace the footcite by "Ibid. [ref]" if the footcite is already in the document.

The result is:

Result

The result should be like this:

1 Aggarwal, Takada, and Oommen. “From chemoprevention to chemotherapy: common
targets and common goals”. 2004. [ref].

2 Ibid. [ref].

Is there any solution to replace the second footcite by Ibid…?

Best Answer

You are almost there, the only thing we have to do is to tell biblatex we want to be able to track "ibid" by ibidtracker=constrict (or any other option that turns on the ibidtracker, see p. 56 of the biblatex documentation for more on that, constrict is the authoryaer standard setting).

In our new cite command we then only need to check whether the citation was cited before (and whether it is not the first citation on a new page) and if so, print "ibid" instead of the whole stuff

\DeclareCiteCommand{\footpartcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
     {\usebibmacro{cite:ibid}}
     {\usebibmacro{cite:fullpartcite}}%
   \setunit{\addperiod\space}%
   \printtext[brackets]{%
     \usebibmacro{cite}}}
  {\addsemicolon\space}
  {\usebibmacro{postnote}}

where cite:ibid prints "ibid" and is defined as follows

\providecommand*{\mkibid}[1]{#1}
\newbibmacro*{cite:ibid}{%
  \printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}}

and cite:fullpartcite prints the more verbose citation

\newbibmacro*{cite:fullpartcite}{%
  \printnames{labelname}%
  \setunit{\labelnamepunct}%
  \printfield[citetitle]{title}%
  \newunit
  \printfield{year}}

MWE

\documentclass{article}
\usepackage[autolang=hyphen,backend=biber,style=numeric,ibidtracker=constrict]{biblatex}
\usepackage[bookmarks,colorlinks=true]{hyperref}

\providecommand*{\mkibid}[1]{#1}
\newbibmacro*{cite:ibid}{%
  \printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}}
\newbibmacro*{cite:fullpartcite}{%
  \printnames{labelname}%
  \setunit{\labelnamepunct}%
  \printfield[citetitle]{title}%
  \newunit
  \printfield{year}}

\DeclareCiteCommand{\footpartcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
     {\usebibmacro{cite:ibid}}
     {\usebibmacro{cite:fullpartcite}}%
   \setunit{\addperiod\space}%
   \printtext[brackets]{%
     \usebibmacro{cite}}}
  {\addsemicolon\space}
  {\usebibmacro{postnote}}

\DeclareMultiCiteCommand{\footpartcites}[\mkbibfootnote]{\footpartcite}{\addsemicolon\space}

\addbibresource{biblatex-examples.bib} 

\begin{document}

Test\footpartcite{wilde,baez/article}.

Test\footpartcite{cicero} again \footpartcite{cicero}.

\printbibliography
\end{document}

enter image description here