0

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}

Example

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}

Example 2

1
  • 1
    Try the \raggedbottom directive in the preamble.
    – Bernard
    Mar 17, 2018 at 23:38

1 Answer 1

1

LaTeXs output routine has to be patched to move any skip at the end of the page below the footnotes:

\documentclass{article}

\makeatletter

\newskip\prefootskip
\gdef \@makecol {%
   \ifvoid\footins
     \setbox\@outputbox \box\@cclv
   \else
     \setbox\@outputbox \vbox {%
       \boxmaxdepth \@maxdepth
       \unvbox \@cclv
       \prefootskip \lastskip
       \unskip
       \vskip \skip\footins
       \color@begingroup
         \normalcolor
         \footnoterule
         \unvbox\footins
       \color@endgroup
       \vskip \prefootskip
       }%
   \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
}
\makeatother

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

\end{document}

enter image description here

If you use this with KOMA-Script classes, you have to add a negative space to cancel some space introduced by the footnoterule:

\documentclass{scrartcl}

\makeatletter

\newskip\prefootskip
\gdef \@makecol {%
   \ifvoid\footins
     \setbox\@outputbox \box\@cclv
   \else
     \setbox\@outputbox \vbox {%
       \boxmaxdepth \@maxdepth
       \unvbox \@cclv
       \prefootskip \lastskip
       \unskip
       \vskip \skip\footins
       \ifx\@textbottom\relax\else\vskip \z@ \@plus-.05fil\fi
       \color@begingroup
         \normalcolor
         \footnoterule
         \unvbox\footins
       \color@endgroup
       \ifx\@textbottom\relax\else\vskip \z@ \@plus.05fil\fi
       \vskip \prefootskip
       }%
   \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
}
\makeatother

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

\end{document}
4
  • Thank you, this works great! Do you know how to adapt this for KOMA-script classes (in particular scrartcl)? I've spent the last few hours digging through source, but I can't figure out why there would be a difference.
    – Philipp
    Mar 18, 2018 at 15:48
  • 1
    There was a \skip too much. This only caused problems with KOMA-Script, but it is fixed now. Also the KOMA-Script \footnoterule added some space... Mar 18, 2018 at 16:32
  • I had thought from various books/manuals with a raggedbottom declaration that footnotes were typeset immediately below the text. As the question (and my tests) exhibit this appears not to be the case. Should the various documentation/manuals be changed to reflect the actuality, or have I got it all wrong? Mar 20, 2018 at 20:39
  • They are immediately below the text if there is an automated pagebreak. So this only affects affects explicit pagebreaks, for example new chapters, \clearpage, \newpage, ... or the end of the document like in the example of this question. If you think this is unclear in some manuals, their authors would probably appreciate some feedback. For KOMA-Script this is different: \raggedbottom will always set the footnotes flushed to the bottom there.(This is the space introduced by the footnoterule) This change is documented in the KOMA-Script manual. Mar 20, 2018 at 21:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .