1

I'm redefining the footnote layout and want to have them displayed always at the bottom of the page. For pure text it was easy by putting an \vfill at the beginning of the \footseprule definition; like suggested here.

If I have a document with many and long footnotes, bottom floats ([b] option) get placed below the footnote (which is standard in article.cls). I've tried to surpress bottom floats on pages with footnotes, like suggested here. But when every page contains footnotes, the bottom floats are still placed below.

How can I achieve that bottom floats are always placed at the bottom of the textarea but above the footnote(rule); without using any additional package, especially footmisc (which is the solution most often advised to similar questions), or another class.

Here my MWE:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}

\usepackage{blindtext}
\usepackage{graphicx}

\makeatletter
\renewcommand\footnoterule{\vfill%
    \kern-3\p@ \hrule \@width \textwidth \kern 2.6\p@ \kern 2\p@}
\makeatother

\begin{document}

\blindtext\footnote{\blindtext[2]}

\begin{figure}[!b]
    \includegraphics[width=.5\textwidth]{example-image}
\end{figure}

\blindtext\footnote{\blindtext[7]}

\blindtext[3]\footnote{text}

\end{document}

Edit

Reading footmisc.sty again and taking the ideas of @JohnKormylo and @UlrikeFischer into account, I tried modifing \@makecol by rearranging the parts. Since, as far as I understand it, footmisc places the output of the footnote after \@combinefloats:

Part from footmisc.sty:

\def \@makecol {%
  \@kernel@before@cclv
  \setbox\@outputbox \box\@cclv
  \@outputbox@removebskip
  \let\@elt\relax
  \xdef\@freelist{\@freelist\@midlist}%
  \global \let \@midlist \@empty
  \@makecol@appendblocks
% Here the blocks are appended; i.e. a floatblock and a footnoteblock
  \ifvbox\@kludgeins
     \@makespecialcolbox
  \else
     \@makenormalcolbox
  \fi
  \global \maxdepth \@maxdepth
}

I tried it in a quite simple version:

\gdef \@makecol {%
    \setbox\@outputbox \box\@cclv
    \let\@elt\relax
    \xdef\@freelist{\@freelist\@midlist}%
    \global \let \@midlist \@empty
    \@combinefloats
    \ifvoid\footins
    \else
            \boxmaxdepth \@maxdepth
            \unvbox \@cclv
            \vskip \skip\footins
            \color@begingroup
            \normalcolor
            \footnoterule
            \unvbox \footins
            \color@endgroup
    \fi
    \ifvbox\@kludgeins
    \@makespecialcolbox
    \else
    \setbox\@outputbox \vbox to\@colht {%
        \@texttop
        \dimen@ \dp\@outputbox
        \unvbox \@outputbox
        \vskip -\dimen@
        \@textbottom
    }%
    \fi
    \global \maxdepth \@maxdepth
}

Indeed the bottom float now appears right after the textarea. But all footnotes are pushed to the top of the next page. Thus, the approach may be show the right direction, but one has to fix the placement of the footnotes...

I'll keep trying and am thankful for hints or solutions by others!

9
  • You will need to modify \output. The key question is: are there any convenient hooks available? Jul 19, 2023 at 17:10
  • well as \usepackage[bottom]{footmisc} probably is doing what you want, you could study the code and copy the relevant parts. Personally I would use footmisc. Jul 19, 2023 at 17:21
  • @JohnKormylo in the (experimental) latex-lab code the output routine has been changed and there are/will be configuration points that can be used, but they aren't yet in standard latex. Jul 19, 2023 at 17:23
  • From sourc2e.pdf, its seems footnotes are added by \@makecol before running \@combinefloats. Also, it adds the entire \footins to the text then removes the excess back. Jul 19, 2023 at 17:36
  • @UlrikeFischer, that what I did so far. But the code oft footmisc is kind of hard to understand for me in this case. I also guess, like @JohnKormylo suggested, that it has to do with @makecol. But couldn't figure out so far how to get it working
    – lukeflo
    Jul 19, 2023 at 17:47

1 Answer 1

0

Since there appeared some ambiguities when trying to patch the \@makefntext macro with etoolbox while using footmisc package, I came back to my own question.

I just studied the footmisc package a little more detailed and was able to edit the footnote definition, as well as the output routine to meet all my requirements. It contains an adapted variant of \@makefntext, pushes the footnote to the bottom of the page and places floats always above footnotes; even if they contain the [b] option.

I tested the code with the follwoing MWE, as well as with some more complex documents including sections, lists, pictures, citations, very long footnotes etc. So far, I couldn't detect any problem or conflict:

\documentclass[twoside]{article}

\makeatletter
% Editing footnotes to meet my formatting requirements
\newbox{\@fnbox} % New box for FN number
\newcommand*{\indent@fnmark}{2.5em} % indention between FN number and FN text
\renewcommand\@makefntext[1]{% Redfinition of FN
            \bgroup
            \setbox\@fnbox\hbox{\hb@xt@\indent@fnmark{\@thefnmark\hss}}
            \leftmargin\wd\@fnbox
            \rightmargin\z@
            \linewidth \columnwidth
            \advance \linewidth -\leftmargin
            \parshape \@ne \leftmargin \linewidth
            \@setpar{{\@@par}}%
            \leavevmode
            \llap{\box\@fnbox}%
            #1
            \par\egroup}
\renewcommand\footnoterule{\vfill%
    \kern-3\p@ \hrule \@width \textwidth \kern 2.6\p@ \kern 2\p@}
\setlength{\skip\footins}{\baselineskip}

% Changing the output routine
\gdef \@makecol {%
    \setbox\@outputbox \box\@cclv
    \let\@elt\relax
    \xdef\@freelist{\@freelist\@midlist}%
    \global \let \@midlist \@empty
    \@combinefloats % floats are placed before footnotes (\footins)
    \ifvoid\footins
    \else
    \setbox\@outputbox \vbox {%
            \boxmaxdepth \@maxdepth
            \unvbox \@outputbox
            \vskip \skip\footins
            \color@begingroup
            \normalcolor
            \footnoterule
            \unvbox \footins
            \color@endgroup}%
    \fi
    \ifvbox\@kludgeins
    \@makespecialcolbox
    \else
    \setbox\@outputbox \vbox to\@colht {%
        \@texttop
        \dimen@ \dp\@outputbox
        \unvbox \@outputbox
        \vskip -\dimen@
        \@textbottom
    }%
    \fi
    \global \maxdepth \@maxdepth
}
\makeatother

\usepackage{blindtext}
\usepackage{graphicx}

\begin{document}
\blindtext\footnote{Some Text}
\begin{figure}[b]
    \includegraphics[width=.5\textwidth]{example-image}
\end{figure}
\blindtext\footnote{\blindtext[5]}
\begin{figure}
    \includegraphics[width=.5\textwidth]{example-image}
\end{figure}
\begin{figure}[b]
    \includegraphics[width=.5\textwidth]{example-image}
\end{figure}
\begin{figure}[b]
    \includegraphics[width=.5\textwidth]{example-image}
\end{figure}
\blindtext[4]\footnote{text}
\end{document}

document with working footnotes while using floats etc

Of course, despite my comprehensive testings there may be some hidden flaws. If someone notices such a conflict, I would be happy if he/she gives me a hint.

You must log in to answer this question.

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