1

I'm facing a rather weird problem (at least for me). I'm trying to get the reference in my PhD thesis right, and what I would like is the following:

  • citations are displayed as footnotes, and they also appear at the end in a general bibliography;
  • the footnote apex is the corresponding number of the reference;
  • the reference in the footnote is a shorter version of the one in the general bibliography: name, journal, volume, date (essentially it just lacks the title entry).

I was able to get it right by means of the answer given in https://tex.stackexchange.com/a/20819, reported here:

\documentclass{report}

\usepackage{filecontents}
\begin{filecontents}{biblio.bib}
% biblio.bib
@Article{paper1,
  author =       {John Smith},
  title =        {A title},
  journal =      {A Journal},
  year =         {2010}
}
@Article{paper2,
  author =       {John Doe},
  title =        {A paper},
  journal =      {Another journal},
  year =         {2009}
}
@Article{paper3,
  author =       {Yuppie Networking},
  title =        {My paper},
  journal =      {The best journal},
  year =         {2000}
}
\end{filecontents}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[style=numeric-comp]{biblatex}
\usepackage[colorlinks=false]{hyperref}
\usepackage{manyfoot}

\ExecuteBibliographyOptions{citetracker=true,sorting=none}

% Citation footnotes: use \footnoteA
\DeclareNewFootnote{A}

% Vanilla footnotes: use \footnoteB
\DeclareNewFootnote{B}

% Number of each bibliography entry in brackets
\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}

\makeatletter

\newtoggle{cbx@togcite}

% Citation number superscript in brackets
\renewcommand\@makefntext[1]{%
  \iftoggle{cbx@togcite}
    {\@textsuperscript{\normalfont[\@thefnmark]}\enspace #1}
    {\@textsuperscript{\normalfont\@thefnmark}\enspace #1}%
  \global\togglefalse{cbx@togcite}}

%---------------------------------------------------------------
% Mostly verbatim from Joseph Wright
% http://www.texdev.net/2010/03/08/biblatex-numbered-citations-as-footnotes/

\DeclareCiteCommand{\sfcite}[\cbx@superscript]%
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \usebibmacro{sfcite}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}

\newbibmacro*{sfcite}{%
  \ifciteseen
  {}
  {\xappto\cbx@citehook{%
   \global\toggletrue{cbx@togcite}%
   \noexpand\footnotetextA[\thefield{labelnumber}]{%
     \fullcite{\thefield{entrykey}}\addperiod}}}}

\newrobustcmd{\cbx@superscript}[1]{%
  \mkbibsuperscript{\mkbibbrackets{#1}}%
  \cbx@citehook%
  \global\let\cbx@citehook=\empty}

\let\cbx@citehook=\empty

%---------------------------------------------------------------

\makeatother

\addbibresource{biblio.bib}

\begin{document}
\chapter{Title}
\null\vfill\noindent
Vanilla footnote.\footnoteB{Vanilla footnote text.}
First citation.\sfcite{paper1}
Second citation.\sfcite{paper2}
Vanilla footnote.\footnoteB{Vanilla footnote text.}
First ``multi'' citation.\sfcite{paper1,paper3}

\printbibliography
\end{document}

which gives output of the code above and bibliography bibliography

I slightly modified it in order to remove the title from the footnote, by adding:

%avoid displaying the title in the footnote reference.
\AtEveryCitekey{%
\ifentrytype{article}{
    \clearfield{title}%
}{}
}

and what I get is indeed what I want, but in the apex of the footnote there is now an extra space before the reference number:

weird spaces

that apparently I am not able to get rid of. Maybe it's just something stupid I'm not seeing, could anyone give me any suggestion?

Thanks,

Fabrizio

  • 5
    Possibly add a % at the end of \ifentrytype{article}{ and maybe also after }{} – Steven B. Segletes Nov 6 '17 at 12:41
  • Thanks, Steven, this totally solves it. It was indeed a stupid thing. – Brizio Nov 6 '17 at 12:43
2

Steven solved it in the comments.

The problem were two missing %. The following code works as expected:

%avoid displaying the title in the footnote reference.
\AtEveryCitekey{%
\ifentrytype{article}{%
    \clearfield{title}%
}{}%
}
| improve this answer | |
  • This does not answer the question. Please note: answers shouldn't be comments to questions, answers or other comments. So please delete it. – Schweinebacke Nov 6 '17 at 12:52

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