I am trying to move my footnotes upwards, so that they are placed directly underneath the text, and not at the bottom of the page (see image).
The context is that I am experimenting on typesetting some non-trivial document as a single large page. This works fine, but there is a considerable distance between the last line of text and the beginning of footnotes, which I would like to avoid.
Edit: This is specifically about the placement of footnotes w.r.t. the main text, not about how the individual footnotes are organised.
Also, I tried \raggedbottom
, but it did not change anything:
\documentclass[a4paper]{scrartcl}
\usepackage{lipsum}
\raggedbottom
\begin{document}
\lipsum[1]Footnote.\footnote{Footnote}
\lipsum[2]
\end{document}
Use TeX solution for footnote placement within LaTeX does not address my problem. Executing that code with a normal page height (without the \textheight=120pt
) still leaves space between the main text and the footnotes, i.e. the positioning of the footnotes is unchanged:
\documentclass{article}
\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:
\textheight=120pt
\raggedbottom
\begin{document}
Lorem ipsum dolor sit amet, consectetuer%
\footnote{First text.}
adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu%
\footnote{Second text.}
libero, nonummy eget, consectetuer id, vulputate a, magna. Donec
vehicula augue eu neque. Pellentesque habitant morbi tristique
senectus et netus et malesuada fames ac turpis egestas. Mauris ut
leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna%
\footnote{Third text.}
fringilla ultrices. Phasellus eu tellus sit amet tortor gravida
placerat. Integer sapien est, iaculis in, pretium quis, viverra ac,
nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus.
Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
Curabitur auctor semper nulla. Donec varius orci eget risus. Duis%
\footnote{Next text.}
nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis
eget orci sit amet orci dignissim rutrum.
Morbi auctor lorem non justo. Nam lacus%
\footnote{Nulla malesuada porttitor diam. Donec felis
erat, congue non, volutpat at, lobortis vitae, tincidunt tristique, libero.}
libero, pretium at, lobortis vitae, ultricies et, tellus. Donec
aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna,%
\footnote{Short text.}
vitae ornare odio metus a mi. Morbi ac orci et nisl hendrerit%
\footnote{Next short text.}
mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a nulla.%
\footnote{Intersting short text.}
Cum sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper
vestibulum turpis. Pellentesque cursus luctus mauris.%
\footnote{The last footnote.}
\end{document}
\raggedbottom
directive in the preamble.