2

I have a document where I'm using amsthm and thmtools (particularly thmbox) for formatting some definitions. The document also contains some footnotes, which are reasonably-sized (i.e. not more than ~1/4th of the page).

The problem

If a definition stretches over a page, it overflows onto the next, which is not a problem. However, if the definition stretches "over" a footnote (i.e. it goes over a pagebreak where the page ends in with a footnote), there's a weird rendering issue where the start of the definition gets pushed onto its own, otherwise empty, page.

Example

\documentclass{report}


\usepackage{amsthm}
\usepackage{thmtools}

\declaretheorem[thmbox=M, style=definition, name=Definition]{defn}

\begin{document}

Long paragraph pushing the definition over the page.
\footnotemark


\footnotetext{This long footnote means that the beginning of the definition cannot stay on page 1. (BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH )}

    \begin{center}
    \begin{tabular}{c}
        a \\
        b \\
        c \\
        d \\
    \end{tabular}
    \end{center}

    \begin{center}
    \begin{tabular}{c}
        a \\
        b \\
        c \\
        d \\
    \end{tabular}
    \end{center}

    \begin{center}
    \begin{tabular}{c}
        a \\
        b \\
        c \\
        d \\
    \end{tabular}
    \end{center}

    \begin{center}
    \begin{tabular}{c}
        a \\
        b \\
        c \\
        d \\
    \end{tabular}
    \end{center}

    \begin{center}
    \begin{tabular}{c}
        a \\
        b \\
        c \\
        d \\
    \end{tabular}
    \end{center}

    \begin{center}
    \begin{tabular}{c}
        a \\
        b \\
        c \\
        d \\
    \end{tabular}
    \end{center}

    \begin{center}
    \begin{tabular}{c}
        a \\
        b \\
        c \\
        d \\
    \end{tabular}
    \end{center}

    \begin{center}
    \begin{tabular}{c}
        a \\
        b \\
        c \\
        d \\
    \end{tabular}
    \end{center}


\begin{defn}
    Long definition spanning across two pages
    \begin{center}
    \begin{tabular}{c}
        a \\
        b \\
        c \\
        d \\
    \end{tabular}
    \end{center}

    \begin{center}
    \begin{tabular}{c}
        a \\
        b \\
        c \\
        d \\
    \end{tabular}
    \end{center}

    \begin{center}
    \begin{tabular}{c}
        a \\
        b \\
        c \\
        d \\
    \end{tabular}
    \end{center}
\end{defn}

\end{document}

forces the start of Definition 1 onto a new page. This doesn't happen if thmbox is not set.

An example of a bad definition rendering due to a footnote.

What's going on?

It looks almost like amsthm is laying out the definition correctly, then the footnote comes in and, not having enough space to be rendered, shuffles over the end bit of the page. The only issue is that the definition on the next page (and the rest of the document) are not shuffled along to compensate. Instead, the problematic part of the definition is just placed on a new page, to give it the necessary space.

1
  • 1
    Hi, I'm the current maintainer of thmtools. The problem is reproducible with thmbox environment from thmbox package. It seems that thmbox does not take the height of footnote into account when preparing for page break. Jul 30, 2020 at 17:39

1 Answer 1

2

The problem is reproducible with thmbox package alone, see the following example.

\documentclass{article}
\usepackage{lipsum}
\usepackage{thmbox}

\begin{document}
Long paragraph pushing the definition over the page.\footnote{\lipsum[23]}

\lipsum[1-3]

\begin{thmbox}[M]{\bfseries Definition}
    \lipsum[1-2]
\end{thmbox}
\end{document}

enter image description here

Compared to the page-breaking algorithm used by tcolorbox package (more specifically, its source file tcbbreakable.code.tex, the definition of macro \tcb@comp@h@page), I find replacing \vsize with \pagegoal in definition of \thmbox@start solves the problem.

\documentclass{article}
\usepackage{lipsum}
\usepackage{amsthm}
\usepackage{thmtools}
\declaretheorem[thmbox=M, style=definition, name=Definition]{defn}

\usepackage{regexpatch}

\makeatletter
% replace all \vsize by \pagegoal in definition of \thmbox@start
\xpatchcmd*\thmbox@start
  {\vsize}
  {\pagegoal}
  {}{\fail}
\makeatother

\begin{document}
Long paragraph pushing the definition over the page.\footnote{\lipsum[23]}

\lipsum[1-3]

\begin{defn}
    \lipsum[1-2]
\end{defn}
\end{document}

enter image description here

You must log in to answer this question.

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