A solution to arranging footnotes in a particular manner has three unintended effects. Can these be fixed/undone?
This is the initial problem:
The user wipet gave an excellent solution in TeX here. David Carlisle demonstrated how to use that answer within LaTeX here.
If I use that in a LaTeX, preamble, however, in addition to arranging the footnotes as intended, it also makes three unwanted changes.
- Footnote text is now the same size as body text (rather than smaller).
- Footnote line spacing is now the same as body text (rather than single-space); that is, setspace now changes footnote line spacing as well.
- The typeface of the footnote numbers, both in the body text and in the footnote block, is now Computer Modern regardless of the font specified for the document (by fontspec).
A MWE to illustrate the effects is:
\documentclass[12pt]{article}
\usepackage[onehalfspacing]{setspace}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text,Numbers=OldStyle]{Arial}
\newcount\specfootnum % for global counting the footnotes
\newcount\fnotenum % for footnote marks
\newif\ifrepeat
\tracingpages=1
\def\footnote{\global\advance\fnotenum by1 \fnmark\footnoteA}
\def\footnoteA#1{\global\advance\specfootnum by1
\edef\tmp{\indent\llap{\fnmark\kern2pt}}%
\expandafter\gdef\csname specfoot:\the\specfootnum
\expandafter\endcsname\expandafter{\tmp#1}%
\setbox0=\hbox{\tmp#1}%
\ifdim\wd0<.45\hsize \dimen0=.5\baselineskip
\else \ifdim\wd0>\hsize \setbox0=\vbox{\tmp\strut#1\strut\par\kern0pt}\dimen0=\ht0
\else\dimen0=\baselineskip
\fi\fi
\insert\footins{\floatingpenalty=20000
\vbox to\dimen0{\vss\penalty\specfootnum}\penalty0}%
}
\def\fnmark{$^{\the\fnotenum}$}
\catcode`@=11
\def\pagecontents{\ifvoid\topins\else\unvbox\topins\fi
\dimen@=\dp\@cclv \unvbox\@cclv % open up \box255
\ifvoid\footins\else % footnote info is present
\vskip\skip\footins \footnoterule \printspecfoot \fi
\ifr@ggedbottom \kern-\dimen@ \vfil \fi
}
\gdef \@makecol {%
\ifvoid\footins
\setbox\@outputbox \box\@cclv
\else
\setbox\@outputbox \vbox {%
\boxmaxdepth \@maxdepth
\unvbox \@cclv
\vskip \skip\footins
\color@begingroup
\normalcolor
\footnoterule
\footnoterule \printspecfoot
\ifx\@textbottom\relax\else\kern-\dimen@ \vfil \fi
\color@endgroup
}%
\fi
\let\@elt\relax
\xdef\@freelist{\@freelist\@midlist}%
\global \let \@midlist \@empty
\@combinefloats
\ifvbox\@kludgeins
\@makespecialcolbox
\else
\setbox\@outputbox \vbox to\@colht {%
\@texttop
\dimen@ \dp\@outputbox
\unvbox \@outputbox
\vskip -\dimen@
\@textbottom
}%
\fi
\global \maxdepth \@maxdepth
}
\catcode`@=12
\def\printspecfoot{\bgroup\def\tmp{}%
\setbox0=\vbox{\repeattrue \unvbox\footins
\loop \unpenalty \setbox0=\lastbox
\ifvoid0 \repeatfalse
\else \setbox0=\vbox{\unvbox0 \xdef\tmp{\the\lastpenalty,\tmp}}\fi
\ifrepeat \repeat
}%
\dimen1=\hsize \rm
\expandafter\printspecfootA\tmp,
}
\def\printspecfootA#1,{\ifx,#1,\egroup\else
\ifdim\dimen1<.45\hsize
\setbox0=\hbox{\csname specfoot:#1\endcsname}%
\ifdim\wd0<.5\hsize
\vskip-\baselineskip \vskip-\parskip
\noindent\hskip.5\hsize \hskip-.5\parindent \box0 \par
\dimen1=\hsize
\else
\noindent\unhbox0 \newdimenone
\fi
\else \csname specfoot:#1\endcsname \newdimenone \fi
\global\expandafter\let\csname specfoot:#1\endcsname=\relax
\expandafter \printspecfootA\fi
}
\def\newdimenone{$$\global\dimen1=\predisplaysize
\abovedisplayskip=0pt \belowdisplayskip=0pt
\abovedisplayshortskip=0pt \belowdisplayshortskip=0pt
$$\advance\dimen1 by-2em\vskip-\baselineskip
}
%%% the test:
\raggedbottom
\begin{document}
This is text in Arial to illustrate that the footnote number in the body text is in Computer Modern.\footnote{As it also is down here.} The footnotes do arrange themselves as intended.\footnote{In this way.} But the footnote text is both the same size as the body text and has the same spacing.\footnote{As you can see in this footnote, which is long enough to extend over two lines and illustrate the point. Neither of these effects are intended.}
\end{document}
This renders for me as:
Can you see why this would have these three effects? And how can they be undone (they are unintended and unwanted)?