1

I have a document where text should float around a landscape page that I insert with \afterpage{}. If (as is the case for me) a paragraph is 'broken' by afterpage (i.e. the paragraph starts before the landscape page and ends after) and at the same time there is a footnote, then that footnote goes onto an otherwise empty page all by its own.

Here is a MWE:

\documentclass[11pt,a4paper]{book}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{afterpage} %for landscape pages with text floating around
\usepackage{pdflscape}     %for landscape pages
\usepackage{bigfoot}        % for better footnotes
\usepackage{lipsum}            % for testing
\interfootnotelinepenalty=10000

\begin{document}

    \lipsum[1-4]

    \afterpage{
        \begin{landscape}

        It doesn't matter what I put here. 

        \end{landscape}
    \clearpage
}

Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text.\footnote{This is a footnote to a paragraph that starts on the page before afterpage and ends after the afterpage. The footnote should be on the page after, but instead it goes on an extra page. }

\lipsum[7-8]    

\end{document}

Desired behavior: The footnote on what is page 2 when you compile the example should be on what is currently page 4. This should of course eliminate page 2 so that there are only three pages in total (i.e. the footnote would then be on page 3).

Not a solution: I know I could break the concerned paragraph in two, but I prefer to avoid doing so. It is a connected piece of information and a break would be artificial. Same for moving around text since I have footnotes all over.

4
  • 2
    The documentation for afterpage does say: This is really a pre-release, to see whether people like the idea of a command like this. This implementation is not particularly robust. This implementation does not work in two column mode, and can get `confused' by \LaTeX's floating environments. Apr 1, 2018 at 22:30
  • 1
    actually afterpage has code to cope with normal footnotes and if you comment out \usepackage{bigfoot} then it does the right thing. bigfoot appears to be using \marks rather than footnote insertions to encode footnotes and afterpage wasn't expecting that, Apr 1, 2018 at 22:46
  • @JohnKormylo are bigfoot footnotes floats? that would explain things, although normal footnotes are not floats I had a quick look at bigfoot code and the footnotes seem to be \inserts like normal footnotes Apr 1, 2018 at 23:06
  • @DavidCarlisle indeed it works without bigfoot, however I need it in other places. I had thought to work around by redefining the regular footnote via \newcommand{\oldfootnote}{\footnote} before calling \usepackage{bigfoot} but that still gives the undesired result. Then I'm not familiar with defining my own commands so I might be overlooking stuff.
    – mts
    Apr 1, 2018 at 23:33

1 Answer 1

1

This isn't a perfect solution, but it works here. Now the question is why the big empty space at the bottom of page 3?

\documentclass[11pt,a4paper]{book}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{afterpage} %for landscape pages with text floating around
\usepackage{pdflscape}     %for landscape pages
\let\oldoutput\output
\usepackage{bigfoot}        % for better footnotes
\let\newoutput\output
\usepackage{lipsum}            % for testing
\interfootnotelinepenalty=10000

\begin{document}

    \lipsum[1-4]
    \afterpage{\let\clearpage\newpage
       \begin{landscape}

        It doesn't matter what I put here. 

        \end{landscape}
}

Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text.
\footnote{This is a footnote to a paragraph that starts on the page before afterpage and ends after the afterpage. The footnote should be on the page after, but instead it goes on an extra page. }

\lipsum[7-8]    

\end{document}

The above demonstrates the role of \clearpage and \output in the problem. This solution puts \footnotemark and \footnotetext in different paragraphs. \afterpage executes after the first paragraph is formatted but before the end is printed. This should work in general, although it is only needed in cases like this.

\documentclass[11pt,a4paper]{book}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{afterpage} %for landscape pages with text floating around
\usepackage{pdflscape}     %for landscape pages
\usepackage{bigfoot}        % for better footnotes
\usepackage{lipsum}            % for testing
\interfootnotelinepenalty=10000

\begin{document}

    \lipsum[1-4]
    \afterpage{%
       \begin{landscape}

        It doesn't matter what I put here. 

        \end{landscape}
}

Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text. Text text text text text text text text text text text text text text text text.
\footnotemark

\hrule height0pt% removes gap
\footnotetext{This is a footnote to a paragraph that starts on the page before afterpage and ends after the afterpage. The footnote should be on the page after, but instead it goes on an extra page. }

\lipsum[7-9]    

\end{document}
3
  • +1 it does solve the problem but I am afraid the spacing between paragraphs is a big issue so it is not a practical solution. Still, would you mind explaining what these two lines do, or point me to a resource? Thanks!
    – mts
    Apr 2, 2018 at 21:43
  • 1
    I was playing with this for several hours trying to save and restore the footnote, with no luck whatsoever. The footnote is stored in \footins and \NF@savebox, but every time I check they are empty. I was able to remove the extra page using \let\output=\oldoutput, but lost the footnote pemanently. Apr 3, 2018 at 3:29
  • 1
    For references I use source2e.pdf from CTAN and the TeXbook by Knuth. And of course bigfoot.sty. Apr 3, 2018 at 15:25

You must log in to answer this question.

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