TransWikia.com

supercite and footnote

TeX - LaTeX Asked by Laltock on December 29, 2020

I use a newcommand combining supercite and footfullcite to have a bibliography reference in footnote and the same in the bibliography. I can’t merge the numbers of the citation.

documentclass[a4paper,11pt]{book}
usepackage{geometry} 
usepackage[T1]{fontenc}
usepackage[french]{babel}    
usepackage[autopunct=true,giveninits=true,autocite=superscript,backend=bibtex,sorting=none, sortlocale=auto,notetype=foot+end,style=numeric-comp,maxnames=10,maxbibnames=100,doi=true, isbn=true,url=false,eprint=true]{biblatex}
addbibresource{library.bib} 
usepackage{csquotes}

newcommand{PresCite}[1]{autocite{#1} footfullcite{#1}}

usepackage[colorlinks=true, frenchlinks=true, linkcolor=black,filecolor=magenta,urlcolor=blue, citecolor=gray]{hyperref}
urlstyle{same}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}

bla bla bla PresCite{Toto1900,Toto1901,Toto1902}

printbibliography  
end{document}

The result is:

  1. in text

    enter image description here

  2. in footnote

    enter image description here

  3. in bibliography

    enter image description here

What I would like:

  1. in text

    enter image description here

  2. in footnote

    enter image description here

  3. in Bibliography

    enter image description here

One Answer

Since the footnote marker is already provided by autocite, a possible solution is to avoid footfullcite and instead use a footnote without a marker, and use fullcite inside that footnote. A footnote without a marker can be made following for example Supressing the footnote number, which creates a hyperref warning about an empty anchor, which can be suppressed following avoiding hyperref warning: Ignoring empty anchor.

Normally fullcite does not print the cite label (similar to footfullcite) but you can add the number by redefining the fullcite command as in Adding numbering/label of fullcite entries in text?. In the code below instead of redefining fullcite a new macro myfullcite is created so you can still use the original fullcite in other places.

The redefinition of the macro also allows you to insert newlines after each citation in case of multiple citations, to simulate the appearance of multiple footnotes.

All that is left is some spacing issues in making the bibliography entries align in the footnote (with eachother and with regular footnotes). The first entry can be corrected with a negative -1em at the start of the footnote, while other lines can be corrected with negative space inside of myfullcite.

Putting everything together:

documentclass[a4paper,11pt]{book}
usepackage[height=5cm]{geometry} 
usepackage[T1]{fontenc}
usepackage[french]{babel}    
usepackage[autopunct=true,giveninits=true,autocite=superscript,backend=bibtex,sorting=none, sortlocale=auto,notetype=foot+end,style=numeric-comp,maxnames=10,maxbibnames=100,doi=true, isbn=true,url=false,eprint=true]{biblatex}
usepackage{xcolor}
addbibresource{library.bib} 
usepackage{csquotes}

makeatletter
defblfootnote{xdef@thefnmark{}@footnotetext}
makeatother
DeclareCiteCommand{myfullcite}
  {usebibmacro{prenote}}
   {{printtext[labelnumberwidth]{% New
        printfield{prefixnumber}% New
        printfield{labelnumber}}} % New
  usedriver
     {DeclareNameAlias{sortname}{default}}
     {thefield{entrytype}}}
  {parhspace{-1em}}
  {usebibmacro{postnote}}

newcommand{PresCite}[1]{%
autocite{#1}%
begin{NoHyper}%
blfootnote{hspace{-1em}myfullcite{#1}}%
end{NoHyper}
}

usepackage[colorlinks=true, frenchlinks=true, linkcolor=black,filecolor=magenta,urlcolor=blue, citecolor=gray]{hyperref}
urlstyle{same}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
regular cite cite{Toto1899}

bla bla bla PresCite{Toto1900,Toto1901,Toto1902}
normalfootnote{normal footnote} footnotesfootnote{second footnote}

just one PresCite{Toto1899}

and again PresCite{Toto1899}

printbibliography  
end{document}

Result (page size reduced to 5cm with geometry for the screenshot):

enter image description here

Note that the citations are printed as [1] etc. and not as 1., to differentiate them from normal footnotes. If you don't want this then you can do the redefinition as follows:

DeclareCiteCommand{myfullcite}
  {usebibmacro{prenote}}
   {{   printfield{prefixnumber}% New
        printfield{labelnumber}.} % New
   usedriver
     {DeclareNameAlias{sortname}{default}}
     {thefield{entrytype}}}
  {parhspace{-0.85em}}
  {usebibmacro{postnote}}

Note the slightly reduced negative space of 0.85em instead of 1em.

enter image description here

Note also that repeated PresCite commands for the same reference create repeated footnotes, with the same number, as this number is taken from the reference list and not from the footnote counter as in footfullcite.


Alternatively, if you just want compressed footnotes and it is not a prerequisite that the numbers must correspond to the bibliography numbering, then you can use the footnoterange package (see Compressing consecutive footnote marks) and create the (range of) footnotes inside of DeclareCiteCommand by including the footnoterange environment in the pre- and post-code of the cite command and the footnote commands in the loopcode (see the manual of BibLaTeX on page 180).

documentclass[a4paper,11pt]{book}
usepackage[height=5cm]{geometry} 
usepackage[T1]{fontenc}
usepackage[french]{babel}    
usepackage[autopunct=true,giveninits=true,autocite=superscript,backend=bibtex,sorting=none, sortlocale=auto,notetype=foot+end,style=numeric-comp,maxnames=10,maxbibnames=100,doi=true, isbn=true,url=false,eprint=true]{biblatex}
usepackage{xcolor}
usepackage{footnoterange}
addbibresource{library.bib} 
usepackage{csquotes}

DeclareCiteCommand{PresCite}
  {usebibmacro{prenote}begin{footnoterange}}
   {footnote{usedriver{DeclareNameAlias{sortname}{default}}
     {thefield{entrytype}}}}
  {}
  {usebibmacro{postnote}end{footnoterange}}

usepackage[colorlinks=true, frenchlinks=true, linkcolor=black,filecolor=magenta,urlcolor=blue, citecolor=gray]{hyperref}
urlstyle{same}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
regular cite cite{Toto1899}

bla bla bla PresCite{Toto1900,Toto1901,Toto1902}normalfootnote{normal footnote} footnotesfootnote{second footnote}
printbibliography  
end{document}

enter image description here

Correct answer by Marijn on December 29, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP