mdframed:带有方程式数组的大型文本在 \documentclass{memoir}(或书籍)中跳过页面

mdframed:带有方程式数组的大型文本在 \documentclass{memoir}(或书籍)中跳过页面

这个包mdframed用装饰框架封装纯文本效果非常好:即使它们跨越多页,框架也会相应地中断!:-)

不幸的是,当包含大文本时,情况并非如此包含方程数组:我遇到了奇怪的编译错误,现已解决这里通过使用最新的 github 更新 mdframed 包。现在我得到了奇怪的页面跳过行为当带有方程数组的文本跨越多页时 \documentclass{memoir}\documentclass{book}:-(

下面没有奇怪的跳过\documentclass{article},这表明这是 mdframed 和双面样式之间的问题。

下面的 MWE 说明了这一点,其中带有方程式数组的文本跨越 4 页,而 mdframe 跳过了第二页和第四页。如果 mdframe 从第二页开始,则 mdframe 会跳过第三页和第五页。看起来 mdframe 开始和结束在正确的页面中,没有跳过,但跳过了中间的页面。

可能发生什么事?

PS - 抱歉,下面的代码中的虚拟文本包含较大的方程数组,但 mdframed 可以很好地处理较大的 Lorem Ipsum 文本。

% Comment in/out these lines to see which work
\documentclass{memoir}   % mdframed skips page with memoir :(
%\documentclass{book}    % mdframed skips page with book :(
%\documentclass{article} % mdframed works fine with article :)

  \usepackage{amsmath}% http://ctan.org/pkg/amsmath
  \usepackage[framemethod=tikz]{mdframed}% http://ctan.org/pkg/mdframed

  \newenvironment{coderule}
  {  
\allowdisplaybreaks[1]
\begin{mdframed}
[topline=false,rightline=false,bottomline=false,
innertopmargin=0pt,innerrightmargin=0pt,innerbottommargin=0pt,
skipabove=\parskip,skipbelow=0.3\baselineskip,
innerleftmargin=1em,outerlinewidth=1em,linecolor=black]
  }
  {
\end{mdframed}
  }

\begin{document}

%Comment in/out the line below to start mdframe in second page
%\mbox{}\newpage

\newcommand{\TestText}
{
Temos ent\~{a}o que
\begin{align}
\cos'\left(0\right) & = & - \lim_{h \to 0} \frac{\sin^2\left(h\right)}{h^2}\frac{h}{\cos\left(h\right) + 1} \\
& = & - \left(\lim_{h \to 0} \frac{\sin\left(h\right)}{h}\right)^2 \lim_{h \to 0}\frac{h}{\cos\left(h\right) + 1} \\
& = & -\left(\sin'\left(0\right)\right)^2\frac{0}{\cos\left(0\right) + 1} = 0.
\end{align}
}

\begin{coderule}
Para mostrarmos que $\sin'\left(0\right) = 1$, primeiro notamos que
\begin{equation}\nonumber
\sin'\left(0\right) = \lim_{h \to 0} \frac{\sin\left(h\right) - \sin\left(0\right)}{h} = \lim_{h
\to 0} \frac{\sin\left(h\right)}{h}.
\end{equation}
Temos que
\[
0 < \sin\left(h\right) < h < \tan\left(h\right),
\]
para todo $0 < h < \pi/2$. Dividindo por $\sin\left(h\right) > 0$, obtemos que
\[
1 < \frac{h}{\sin\left(h\right)} < \frac{1}{\cos\left(h\right)}.
\]
Invertendo todos os membros das desigualdades acima, segue que
\begin{equation}\nonumber
1 > \frac{\sin\left(h\right)}{h} > \cos\left(h\right).
\end{equation}
Pela continuidade do cosseno e pelo Teorema do Sandu\'{\i}che, segue ent\~{a}o que
\begin{equation}\nonumber
\sin'\left(0 \downarrow\right) = \lim_{h \downarrow 0} \frac{\sin\left(h\right)}{h} = 1.
\end{equation}
Como $h \downarrow 0$ se e s\'{o} se $-h \uparrow 0$, segue que
\[
\sin'\left(0 \uparrow\right) = \lim_{h \downarrow 0} \frac{\sin\left(-h\right)}{-h} = \lim_{h \downarrow 0} \frac{\sin\left(h\right)}{h} = 1,
\]
onde utilizamos o fato de que seno \'{e} \'{\i}mpar. Isso mostra que $\sin'\left(0\right) = 1$.
%\end{coderule}
%\begin{coderule}
Para mostrarmos que $\cos'\left(0\right) = 0$, primeiro notamos que
\begin{equation}\nonumber
\cos'\left(0\right) = \lim_{h \to 0} \frac{\cos\left(h\right) - \cos\left(0\right)}{h} = \lim_{h
\to 0} \frac{\cos\left(h\right) - 1}{h}.
\end{equation}
Consideramos ent\~{a}o as seguintes igualdades
\begin{align}
\cos'\left(0\right)& = & \lim_{h \to 0} \frac{\cos\left(h\right) - 1}{h}\frac{\cos\left(h\right) + 1}{\cos\left(h\right) + 1} \\
& = & \lim_{h \to 0} \frac{\cos^2\left(h\right) - 1}{h}\frac{1}{\cos\left(h\right) + 1} \\
& = & \lim_{h \to 0} \frac{-\sin^2\left(h\right)}{h}\frac{1}{\cos\left(h\right) + 1}
\end{align}
onde utilizamos o fato que $\cos^2\left(h\right) - 1 = -\sin^2\left(h\right)$. 
Temos ent\~{a}o que
\begin{align}
\cos'\left(0\right) & = & - \lim_{h \to 0} \frac{\sin^2\left(h\right)}{h^2}\frac{h}{\cos\left(h\right) + 1} \\
& = & - \left(\lim_{h \to 0} \frac{\sin\left(h\right)}{h}\right)^2 \lim_{h \to 0}\frac{h}{\cos\left(h\right) + 1} \\
& = & -\left(\sin'\left(0\right)\right)^2\frac{0}{\cos\left(0\right) + 1} = 0.
\end{align}

\TestText
\TestText
\TestText
\TestText
\TestText
\TestText
\TestText
\TestText
\TestText
\TestText
\TestText
\TestText
\TestText

\end{coderule}
\end{document}

相关内容