![mdframed:带有方程式数组的大型文本在 \documentclass{memoir}(或书籍)中跳过页面](https://linux22.com/image/251521/mdframed%EF%BC%9A%E5%B8%A6%E6%9C%89%E6%96%B9%E7%A8%8B%E5%BC%8F%E6%95%B0%E7%BB%84%E7%9A%84%E5%A4%A7%E5%9E%8B%E6%96%87%E6%9C%AC%E5%9C%A8%20%5Cdocumentclass%7Bmemoir%7D%EF%BC%88%E6%88%96%E4%B9%A6%E7%B1%8D%EF%BC%89%E4%B8%AD%E8%B7%B3%E8%BF%87%E9%A1%B5%E9%9D%A2%20.png)
这个包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}