定理框延伸到脚注上方导致页面分裂

定理框延伸到脚注上方导致页面分裂

我有一份文档,其中我使用amsthmthmtools(特别是thmbox)来格式化一些定义。该文档还包含一些脚注,其大小合理(即不超过页面的 1/4)。

问题

如果定义超出一页,它会溢出到下一页,这不是问题。但是,如果定义超出了脚注(即它超出了以脚注结尾的页面分页符),则会出现奇怪的渲染问题,即定义的开头会被推到它自己的(否则是空的)页面上。

例子

\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}

强制将定义 1 的开始位置设在新页面上。如果thmbox未设置,则不会发生这种情况。

由于脚注而导致定义渲染不佳的示例。

这是怎么回事?

看起来,amsthm定义布局几乎正确,然后脚注出现,由于没有足够的空间来呈现,所以会拖拽到页面的末尾。唯一的问题是下一页(以及文档的其余部分)上的定义没有被拖拽到一起以进行补偿。相反,定义中有问题的部分只是放在新的页面上,以给它提供必要的空间。

答案1

仅使用包即可重现该问题thmbox,请参见以下示例。

\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}

在此处输入图片描述

与包使用的分页算法相比tcolorbox(更具体地说,它的源文件tcbbreakable.code.tex,宏的定义\tcb@comp@h@page),我发现在的定义\vsize中用替换可以解决问题。\pagegoal\thmbox@start

\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}

在此处输入图片描述

相关内容