# Get rid of undesired vertical spacing within single footnotes (and footcites that are displayed at the bottom of the page) due to setspace settings

I am writing a thesis and added some old code to achieve a citation style, in which a short citation is placed at the bottom of the page together with additional footnotes. This requires the manyfoot package and the code given below is based on the following questions:

I am using the newpxtext package and want a slighlty increased line spacing for the whole document (including captions, footnotes, etc.) and a more pronounced line spacing for the text. If I understood it correctly, this should be achieved by

\linespread{1.05}
\usepackage{setspace}
\setstretch{1.3}


Unfortunately, the setstretch setting leads to an undesired spacing within the footnotes, but only between lines of a single footnote (!) and not between two different footnotes (see pictures). This is in contrast to what I read in several questions (for instance Double line spacing and Set 1,5 line spacing in footnotes). If I exclude the setstretch command, the vertical spacing within the footnotes looks uniform and correct.

How do I get rid of this additional spacing within longer footnotes (for both FootnoteA and FootnoteB) and achieve the desired spacing?

MWE (for the first picture without \setstretch{1.3}; second picture with \setstretch{1.3}):

\documentclass[fontsize=11pt,DIV=11]{scrbook}
\usepackage[USenglish]{babel}
\frenchspacing
\usepackage{newpxtext}
\usepackage{newpxmath}
\usepackage{setspace}
%\setstretch{1.3}

\usepackage{xcolor}
\usepackage{manyfoot}
\usepackage[babel]{csquotes}
\usepackage[backend=biber,style=chem-angew,mcite,subentry]{biblatex}
\usepackage{hyperref}
\hypersetup{%
citecolor={blue!0!black},
urlcolor={blue!80!black}
}

\ExecuteBibliographyOptions{citetracker=true,sorting=none,maxcitenames=10,doi=false,url=false,isbn=false,hyperref=true,backref=false}

\DefineBibliographyStrings{ngerman}{
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The following code defines two different types of footnotes and the citation command for the described citation style

% 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}}

% Citation number superscript in brackets (for babel french)
\ifdef{\@makefntextFB}{%
\renewcommand\@makefntextFB[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}]{%

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

\let\cbx@citehook=\empty

\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newbibmacro{string+doiurlisbn}[1]{%
\iffieldundef{doi}{%
\iffieldundef{url}{%
\iffieldundef{isbn}{%
\iffieldundef{issn}{%
#1%
}{%
}%
}{%
}%
}{%
\href{\thefield{url}}{#1}%
}%
}{%
\href{https://doi.org/\thefield{doi}}{#1}%
}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\DeclareFieldFormat{journaltitle}{\usebibmacro{string+doiurlisbn}{\mkbibemph{#1}}}

\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[
fieldsource=doi,
match=\regexp{https?://(dx.)?doi.org/(.+)},
replace=\regexp{$2}%$
]
}
}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{filecontents}{\jobname.bib}
@Article{Frank1953,
author  = {Frank, F. C.},
title   = {On spontaneous asymmetric synthesis},
journal = {Biochim. Biophys. Acta},
year    = {1953},
volume  = {11},
pages   = {459-463},
doi     = {http://dx.doi.org/10.1016/0006-3002(53)90082-1},
url     = {http://www.sciencedirect.com/science/article/pii/0006300253900821},
}

@Article{Kagan1986,
author  = {Puchot, C. and Samuel, O. and Dunach, E. and Zhao, S. and Agami, C. and Kagan, H. B.},
title   = {Nonlinear effects in asymmetric synthesis. Examples in asymmetric oxidations and aldolization reactions},
journal = {J. Am. Chem. Soc.},
year    = {1986},
volume  = {108},
number  = {9},
pages   = {2353-2357},
doi     = {10.1021/ja00269a036},
url     = {http://dx.doi.org/10.1021/ja00269a036},
}

@article{Soai1995,
author = {Soai, Kenso and Shibata, Takanori and Morioka, Hiroshi and Choji, Kaori},
title = {Asymmetric autocatalysis and amplification of enantiomeric excess of a chiral molecule},
journal = {Nature},
year = {1995},
volume = {378},
number = {6559},
pages = {767-768},
url = {http://dx.doi.org/10.1038/378767a0}
}

@Article{Brown2001,
author  = {Blackmond, Donna G. and McMillan, Christopher R. and Ramdeehul, Shailesh and Schorm, Andrea and Brown, John M.},
title   = {Origins of Asymmetric Amplification in Autocatalytic Alkylzinc Additions},
journal = {J. Am. Chem. Soc.},
year    = {2001},
volume  = {123},
number  = {41},
pages   = {10103-10104},
doi     = {10.1021/ja0165133},
url     = {http://dx.doi.org/10.1021/ja0165133},
}
\end{filecontents}

\begin{document}
\chapter{Title}
\null\vfill\noindent
Vanilla footnote.\footnoteB{This is a very very very very very very very very very very very very very very very very very very long Vanilla footnote text.}
First citation.\sfcite{Frank1953}
First citation.\sfcite{Brown2001}
Vanilla footnote.\footnoteB{Vanilla footnote text.}
First multi'' citation.\sfcite{Frank1953,Brown2001,Soai1995}
\chapter{Title}
\null\vfill\noindent
Second citation.\sfcite{Frank1953}
Vanilla footnote.\footnoteB{Vanilla footnote text.}
Second citation.\sfcite{Soai1995}
Second citation.\sfcite{Brown2001}\footnoteB{Vanilla footnote text.}
First citation.\sfcite{Kagan1986}
\printbibliography
\end{document}


setspace resets the line spacing in footnotes explicitly by redefining \@footnotetext to include

\def\baselinestretch {\setspace@singlespace}%


In your setup you only make use of footnotes controlled by manyfoot, which don't call \@footnotetext and are not patched by setspace.

We can apply the setspace patch to manyfoot's by redefining the manyfoot equivalent of \@footnotetext

\makeatletter
\long\def\MFL@fnoteplain#1#2#3{\NCC@makefnmark{#2}%
\MFL@insert#1{\def\baselinestretch {\setspace@singlespace}%
\reset@font\footnotesize
\interlinepenalty\interfootnotelinepenalty
\hsize\MFL@columnwidth \@parboxrestore
\protected@edef\@currentlabel{\@thefnmark}%
\color@begingroup
\MFL@applyhook{#1}%
\@makefntext{%
\rule\z@\footnotesep\ignorespaces#3\@finalstrut\strutbox}%
\color@endgroup
}%
}
\makeatother


I changed \setstretch{1.3} to \setstretch{2} to exaggerate the effect in the MWE

\documentclass[fontsize=11pt,DIV=11]{scrbook}
\usepackage[USenglish]{babel}
\frenchspacing
\usepackage{newpxtext}
\usepackage{newpxmath}
\usepackage{setspace}
\setstretch{2}

\usepackage{xcolor}
\usepackage{manyfoot}
\usepackage[babel]{csquotes}
\usepackage[backend=biber,style=chem-angew,mcite,subentry]{biblatex}
\usepackage{hyperref}
\hypersetup{%
citecolor={blue!0!black},
urlcolor={blue!80!black}
}

\makeatletter
\long\def\MFL@fnoteplain#1#2#3{\NCC@makefnmark{#2}%
\MFL@insert#1{\def\baselinestretch {\setspace@singlespace}%
\reset@font\footnotesize
\interlinepenalty\interfootnotelinepenalty
\hsize\MFL@columnwidth \@parboxrestore
\protected@edef\@currentlabel{\@thefnmark}%
\color@begingroup
\MFL@applyhook{#1}%
\@makefntext{%
\rule\z@\footnotesep\ignorespaces#3\@finalstrut\strutbox}%
\color@endgroup
}%
}
\makeatother

\ExecuteBibliographyOptions{citetracker=true,
sorting=none,
maxcitenames=10,
doi=false, url=false, isbn=false,
backref=false,
}

\DefineBibliographyStrings{german}{
}

\DeclareNewFootnote{A}

\DeclareNewFootnote{B}

\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}}

% Citation number superscript in brackets (for babel french)
\ifdef{\@makefntextFB}{%
\renewcommand\@makefntextFB[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}]{%

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

\let\cbx@citehook=\empty

\makeatother

\newbibmacro{string+doiurlisbn}[1]{%
\iffieldundef{doi}{%
\iffieldundef{url}{%
\iffieldundef{isbn}{%
\iffieldundef{issn}{%
#1%
}{%
}%
}{%
}%
}{%
\href{\thefield{url}}{#1}%
}%
}{%
\href{https://doi.org/\thefield{doi}}{#1}%
}%
}

\DeclareFieldFormat{journaltitle}{\usebibmacro{string+doiurlisbn}{\mkbibemph{#1}}}

\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[
fieldsource=doi,
match=\regexp{https?://(dx.)?doi.org/(.+)},
replace=\regexp{$2}%$
]
}
}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\chapter{Title}
\null\vfill\noindent
Vanilla footnote.\footnoteB{This is a very very very very very very very very very very very very very very very very very very long Vanilla footnote text.}
First citation.\sfcite{sigfridsson}
First citation.\sfcite{aksin}
First citation.\sfcite{companion}
Vanilla footnote.\footnoteB{Vanilla footnote text.}
First multi'' citation.\sfcite{sigfridsson,nussbaum,worman}
\chapter{Title}
\null\vfill\noindent
Second citation.\sfcite{sigfridsson}
Vanilla footnote.\footnoteB{Vanilla footnote text.}
Second citation.\sfcite{worman}
Second citation.\sfcite{nussbaum}\footnoteB{Vanilla footnote text.}
First citation.\sfcite{geer}
\printbibliography
\end{document}


• Thanks moewe, worked like a charm! One related question: If one would like to consistently change the vertical spacing (to say 105%) within the footnotes using your code, how could this be achieved (since \linespread apparently does not affect this new footnotes at all)? May 8, 2020 at 8:53
• I also have a follow-up question, maybe you also know the answer to that one? Then you are my citation hero ;-) tex.stackexchange.com/questions/542927/… May 8, 2020 at 8:54
• @Sacharja The spacing within footnotes can be changed by replacing \def\baselinestretch {\setspace@singlespace} in the patched version of \MFL@fnoteplain with something like \def\baselinestretch {2}. If this should apply to all single-spaced text in your document and not just the footnotes, my understanding is that \SetSinglespace{2} would be the proper interface (in which case you keep the \def\baselinestretch {\setspace@singlespace} as it is in the code in the answer). May 8, 2020 at 12:41
• Following your first suggestion (changing to \def\baselinestretch {2}) results in slightly increased line spacing between footnotes (for instance between citation-footnote 1 and citation-footnote 2 from the MWE), and strongly increased line spacing within footnotes that go across multiple lines (for instance within citation-footnote 2 from the MWE). How could one get an evenly increased line spacing between and within footnotes? Should I ask a new question for this? May 8, 2020 at 17:07
• @Sacharja I have no idea. If you want an answer I suggest you ask a new question. May 8, 2020 at 17:23

Did you try specifying the space after the footnote, by using this code:

\footnote{xxx\\[-.2cm]}

• I was looking for a general solution as it is provided by moewe. Further, \footnote{xxx\\[-.2cm]} changes the spacing between two footnotes, not the undesired spacing within single footnotes that range across at least two lines as described in my question. Still, your code works and provides a solution if someone wants to selectively change the spacing between two footnotes. May 8, 2020 at 9:01