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!

lukeflo
  • 1,555
  • You will need to modify \output. The key question is: are there any convenient hooks available? – John Kormylo Jul 19 '23 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. – Ulrike Fischer Jul 19 '23 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. – Ulrike Fischer Jul 19 '23 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. – John Kormylo Jul 19 '23 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 '23 at 17:47
  • yes handling the output routine is hard. So why don't you use footmisc? – Ulrike Fischer Jul 19 '23 at 17:59
  • First of all, I want to learn how LaTeX/TeX handles such things in general. Furthermore, if I use the packages later, I understand better what they are doing and how to modify things; if necessary. Of course, I tried different things before posting the question here, also for learning purposes. Last but not least, at the moment, I'm writing a class file ans want to reduce the usage of packages as much as possible. In case of footmisc the latter may not be necessary. But in general, the more packages I load, the higher the chances that some options/aspects can collide. – lukeflo Jul 19 '23 at 18:28
  • well you currently have to patch internal core commands of the output routine to change the footnote placement. The danger that your manual patches collides with other packages or future development in this area is high. Here it is much better to use footmisc which is maintained by a LaTeX team member who really knows what is going on here. – Ulrike Fischer Jul 20 '23 at 07:52
  • @UlrikeFischer, you are right. Understanding the output stuff is too much right now. Maybe another day. For now i'll use footmisc. – lukeflo Jul 20 '23 at 08:22

1 Answers1

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.

lukeflo
  • 1,555