3

I would like to add vertical material at the bottom of footnotes. I expect this will involve checking if \footins is non-empty just before a pagebreak (\ifvoid\footins\else …) and conditionally inserting the vertical material (… \insert\footins{\vspace{1cm}}\fi). However, I can't seem to find the right command to patch; I tried modifying \@makecol, and \@opcol from LaTeX's \output routine (\let\old@makecol=\@makecol\renewcommand\@makecol{\ifvoid\footins … \fi\old@makecol}) with no success.

The following picture illustrates my motivation. There is a footer, above the footer there are the footnotes and above the footnotes there is the body text. When footnotes exist, I would like to raise them by a small amount as indicated by the red arrow.

An image showing the footer, and the footnotes

The following MWE based on GuM's answer typesets the document in the above picture.

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{fancyhdr}
\usepackage{lipsum}

% The fancy page style:
\fancyhf{}
\fancyfoot[C]{\thepage}
\renewcommand*{\footrulewidth}{.4pt}
\pagestyle{fancy}



\begin{document}

This should be a page without footnotes.

\lipsum[1-4]

Here we place a footnote.\footnote{This one.}  Then we add more text.

\lipsum[5-15]

A long footnote occurs here.\footnote{\lipsum*[16]}.

\lipsum[17-20]

\end{document}
6
  • 4
    A picture is worth 1000 words, and an MWE, twice that, to show what you are attempting. Commented May 29, 2018 at 18:06
  • The footer material comes after the footnotes. Commented May 29, 2018 at 18:17
  • @StevenB.Segletes I added a picture as a quick fix. I will try to construct a good MWE.
    – Witiko
    Commented May 29, 2018 at 18:40
  • Does every footnoted page have this requirement, or does it only occur in one particular page? Commented May 29, 2018 at 18:58
  • 2
    @StevenB.Segletes … and now the MWE is also in there.
    – Witiko
    Commented May 30, 2018 at 19:33

1 Answer 1

1

If I interpret correctly your question, you simply want to add some space below the footnote (and obove the footer). Try the following (explanations are in the comments):

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{fancyhdr}
\usepackage{lipsum}

\newlength\WitikoAdditionalspace
\setlength\WitikoAdditionalspace{1cm} % you said so

\makeatletter

% Add our additional space to the space to subtract from the page goal on pages 
% where at least one footnote occur:
\addtolength{\skip\footins}{\WitikoAdditionalspace}

% Patch the output routine (without "etoolbox"):
\gdef \@makecol {%
   \ifvoid\footins
     \setbox\@outputbox \box\@cclv
   \else
     \setbox\@outputbox \vbox {%
       \boxmaxdepth \@maxdepth
       \unvbox \@cclv
       % Only the amount of space originally devised by LaTeX should go above 
       % the footnotes:
       \skip@ \skip\footins
       \advance \skip@ -\WitikoAdditionalspace
       \vskip \skip@
       % (We could also say
       % \vskip \dimexpr \skip\footins -\WitikoAdditionalspace \relax
       % but let's keep the LaTeX kernel independent of eTeX extensions...)
       \color@begingroup
         \normalcolor
         \footnoterule
         \unvbox \footins
         % Add our space below the footnotes:
         \vskip \WitikoAdditionalspace
       \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
}

\makeatother

% The fancy page style:
\fancyhf{}
\fancyfoot[C]{\thepage}
\renewcommand*{\footrulewidth}{.4pt}
\pagestyle{fancy}



\begin{document}

This should be a page without footnotes.

\lipsum[1-4]

Here we place a footnote.\footnote{This one.}  Then we add more text.

\lipsum[5-15]

A long footnote occurs here.\footnote{\lipsum*[16]}.

\lipsum[17-20]

\end{document}

Addition: Answering @Witiko’s comment, no, there is no particular reason to avoid eTeX extensions or the etoolbox package. However, since the patch doesn’t come down to a simple substitution of one token or two, it could be safer to write down explicitly how the patched macro should look like.

Here’s an example that uses \patchcmd and \glueexpr (not \dimexpr!):

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{etoolbox}
\usepackage{fancyhdr}
\usepackage{lipsum}

\newlength\WitikoAdditionalSpace
\setlength\WitikoAdditionalSpace{1cm} % you said so

\makeatletter

% Add our additional space to the space to subtract from the page goal on pages 
% where at least one footnote occur:
\addtolength{\skip\footins}{\WitikoAdditionalSpace}

% Patch the output routine with "etoolbox":
\patchcmd{\@makecol}
    {\vskip \skip\footins}
    {\vskip \glueexpr \skip\footins -\WitikoAdditionalSpace \relax}
    {\typeout{1st patch succeeded.}}
    {\typeout{1st patch FAILED!}}
\patchcmd{\@makecol}
    {\unvbox \footins}
    {\unvbox \footins \vskip \WitikoAdditionalSpace}
    {\typeout{2nd patch succeeded.}}
    {\typeout{2nd patch FAILED!}}

\makeatother

% The fancy page style:
\fancyhf{}
\fancyfoot[C]{\thepage}
\renewcommand*{\footrulewidth}{.4pt}
\pagestyle{fancy}



\begin{document}

This should be a page without footnotes.

\lipsum[1-8]

Here we place a footnote.\footnote{This one.}  Then we add more text.

\lipsum[9-15]

A long footnote occurs here.\footnote{\lipsum*[16]}.

\lipsum[17-24]

\end{document}
2
  • Thank you for the solution. Is there a greater cosmic reason for doing things without etoolbox / eTeX? I feel the answer would be easier to understand if it just patched the two lines instead of containing the entire \@makecol without clear separation of new code versus source2e.
    – Witiko
    Commented May 30, 2018 at 15:57
  • 1
    I took the liberty to incorporate your MWE into the original question, so that there is a greater correspondence between the question, and your (accepted) answer.
    – Witiko
    Commented May 30, 2018 at 19:29

You must log in to answer this question.

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