# geometry - Footnotes immediately after text

The package geometry makes it very easy to define how much space should separe the text from the footnotes:

\usepackage{geometry}
\geometry{footnotesep=2em}


However the setting is effective only when the page's body is filled with text, while I'd like it to work as well when the page is mainly blank (see page 4 in the MWE), something that often occurs in the end of book chapters.

I could not find any help in the geometry documentation, but I guess it is my fault as I am just at the beginning in my exploration of LaTeX's possibilities from a more 'code-conscious' point of view.

Edit. One comment suggests using the solution presented in a related question (see link at the bottom). When setting the spacing to 2em inside the renewed footnote (\renewcommand\footnoterule{\vfilneg\vspace{2em}\svfootnoterule}) the job is done indeed, but the text leaks out of the page body:

If, instead, I set geometry's footnotesep to 2em, and ask for no space in the renewed command (\renewcommand\footnoterule{\vfilneg\svfootnoterule}), again the spacing is the wanted one on mainly blank ending pages, but it then becomes random throughout the document (highlighted in pink in the picture below):

I've addes a second MWE with more text, so that the problem with this solution become a tad more clear, though I could not make them as bold as in the book I'm working on, from wich I took the pictures.

MWE (original)

\documentclass[11pt, twoside, openany]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{lipsum}
\geometry{showframe,footnotesep=2em}
\renewcommand\footnoterule{\rule{\linewidth}{0pt}}
\begin{document}
\lipsum[1]\section*{Section}\lipsum[2-5] Text\footnote{Foot text note.}\section*{Another}\lipsum[1]
\newpage
%this is how I'd like it:
\lipsum[1]\section*{Section}\lipsum[2-5] Text\textsuperscript{1}\section*{Another}\lipsum[1]\vspace{2em}

\end{document}


\begin{document}
1.  \lipsum[1] Text\footnote{\, 7. \lipsum[1-2]}  % full page

\section*{Section 1}

2.  \lipsum[2-5] Text\footnote{\, 8. \lipsum[1-2]}% unfilled page
\section*{Another 1}
3.  \lipsum[1]
\raggedbottom\clearpage
%   \newpage
%this is how I'd like it:
4.  \lipsum[1]
\section*{Section 2}

5.  \lipsum[2-5]Text\footnote{\, 9. \lipsum[7]} % unfilled page

\section*{Another 2}
6.  \lipsum[1]

7. \lipsum[1]\footnote{\lipsum[1]}\lipsum[2]\footnote{\lipsum[2]}\lipsum[3-6]\footnote{\lipsum[1]}

• The solution of tex.stackexchange.com/questions/593010/… works fine if you use \raggedbottom\clearpage instead of \newpage. And also at the end of the document replacing Text\textsuperscript{1} for Text\footnote{Foot text note.} Jun 9 at 14:59
• Thank you for your feedback. Keep me posted. Jun 12 at 19:29

UPDATE Using the new MWE.

I added some "numbers" to help identify sections and paragraphs, and a 1em spaced grid.

The length that determines the distance between text body and footnotes is \skip\footins, set here as \setlength{\skip\footins}{2em}

(\footnotesep determines the height of the struts separating the footnotes)

LaTeX does not print on a grid. However, as you can see in the figures below, the space between the text and the first footnote is (very) close to 2em, for both full pages and partially filled pages.

#1 full page

#2 page not filled

#3 page filled

#5 last page, not filled

\documentclass[11pt, twoside, openany]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{showframe}

\usepackage{lipsum}

\newcommand{\gridpaper}{% draw a grid spaced 1em
\begin{tikzpicture}
\draw[line width=.4pt,draw=black!30] (0,0) grid[step=1em] (\paperwidth,\paperheight);
\end{tikzpicture}%
}
\usepackage{tikz}
\usepackage{background}
\backgroundsetup{%
angle=0,
contents=\gridpaper,
scale=1,
}

\setlength{\skip\footins}{2em} % <<<<<<<<<<<<<<<
\renewcommand\footnoterule{\vfilneg} % <<<<<<<<<<<<<<<<<

\begin{document}
1.  \lipsum[1] FULL PAGE\footnote{\, 12. \lipsum[1-2]}  % full page

\section*{Section 1}

3.  \lipsum[2-3] TEXT\footnote{\, 4. \lipsum[1-2]}% unfilled page
\section*{Another 1}
5.  \lipsum[1]  (PAGE NOT FILLED)

\raggedbottom\clearpage
%   \newpage
%this is how I'd like it:
6.  \lipsum[1]
\section*{Section 2}

7.  \lipsum[2-5] FULL PAGE\footnote{\, 8. \lipsum[7]}

\section*{Another 2}

9.  \lipsum[1]
10. \lipsum[1]\footnote{11. \, \lipsum[3]}% \rule{1pt}{2em}\vspace*{-\baselineskip}
12. \lipsum[2]\footnote{13. \, \lipsum[2]}
14. \lipsum[4-5]\footnote{15. \, \lipsum[1]}  (LAST PAGE, NOT FILLED)

\end{document

• Try adding \lipsum[1]\footnote{\lipsum[1]}\lipsum[2]\footnote{\lipsum[2]}\lipsum[3-6]\footnote{\lipsum[1]} with footnotesep=2em (I need a 2em spacing!) and \renewcommand\footnoterule{\vfilneg\svfootnoterule}, and see how the last three footnotes are differently spaced from the text. I'm adding a picture to the question where this is even more evident. Thank you. Jun 10 at 11:26
• @Mattia I updated the answer using your new MWE. Please try the new code. Jun 10 at 19:33
• Strangely this does work when compiled on its own, but fails (i.e. text is left at the bottom) when I implement it in the main document. I'll try to solve and let you know. Thank you. Jun 11 at 18:24
• I managed to make it work, but there still are some issues with the spacing. In the meantime I'll upvote your answer. I will update the question in some days; thank you for your help! Jun 12 at 19:27