我正在使用 mdframed 并遇到以下问题:
我正在写一些数学讲义,并使用 mdframed 来记录定理、定义等。有时会发生这样的情况:某些定义或定理的文本在某些页面上有足够的空间,但下一页上仍然有一些额外的空白框。
这里有一些明确的例子:(抱歉,我无法创建一些简单的例子,因此我只是在我的文本中复制了一个明确发生的例子)
\documentclass[11pt,a4paper,twoside]{book}
\usepackage[paper=a4paper,left=25mm,right=25mm,top=35mm,bottom=40mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
%Layoutstyle:
\usepackage[Lenny]{fncychap}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[RO]{\nouppercase{\leftmark}}
\fancyhead[LE]{\nouppercase{\rightmark}}
\fancyhead[RE,LO]{\thepage}
\fancyfoot[C]{\small\copyright\,First Name Second Name}
%Structures: Theorems, Definitions, Remarks,...
\usepackage{amsthm}%includes \newtheorem
\usepackage{mdframed}%framed environments
\theoremstyle{definition}%not italic inside environment
\newmdtheoremenv[everyline=true,linewidth=1.1pt,innertopmargin=-2pt, innerbottommargin=7pt]{Definition}{Definition}[chapter]
\newmdtheoremenv[everyline=true,linewidth=1.1pt,innertopmargin=-2pt, innerbottommargin=7pt]{Theorem}[Definition]{Theorem}
\newmdtheoremenv[everyline=true,linewidth=1.1pt,innertopmargin=-2pt, innerbottommargin=7pt]{Lemma}[Definition]{Lemma}
%Examples with Black Triangle:
\newtheorem{Examplep}[Definition]{Example}
\newenvironment{Example}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\blacktriangle$}
\Examplep}{\popQED\endExamplep}
\begin{document}
\newpage
\section{Theorem of Banach-Steinhaus}
\begin{Definition} (Convex Sets)\newline
Let $V$ be a real vector space and $M\subset V$. We call $M$ ``convex'', if $\forall x,y\in M$ and for all $\lambda\in [0,1]$:
\begin{align*}\lambda x+(1-\lambda)y\in M\end{align*}
\end{Definition}
\begin{Example}\label{BallConvex} Let $(X,\Vert\cdot\Vert)$ be a real normed vector space. Then every ball $B_{r}(z)$ for some $r\in\mathbb{R}_{>0}$ and $z\in X$ is a convex set, because
\begin{align*}\Vert z-(\lambda x+(1-\lambda)y)\Vert=\Vert \lambda (z-x)+(1-\lambda)(z-y)\Vert\leq \lambda r+(1-\lambda)r=r\end{align*}
for all $x,y\in B_{r}(z)$ and for all $\lambda\in [0,1]$.
\end{Example}
\begin{Lemma}\label{LemmaConv1} (Linear Operator preserve Convexity)\newline
Let $V$ and $W$ be two real vector spaces and $T\in L(V,W)$. If $M\subset V$ is convex, then also $T(M)$.\end{Lemma}
\begin{proof}Let $a,b\in T(M)$. Then there is are $x,y\in M$ such that $a=Tx$ and $b=Ty$. Using convexity of $M$, we have that
\begin{align*}\lambda a+(1-\lambda)b=\lambda T(x) + (1-\lambda)T(y)=T(\lambda x+(1-\lambda)y)\in T(M)\end{align*}find for all $\lambda\in [0,1]$.\end{proof}
\begin{Lemma}\label{LemmaConv2} (Closure of convex set is convex)\newline
Let $(X,\Vert\cdot\Vert)$ be a real normed vector space and $M\subset X$ be a convex set. Then $\overline{M}$ is convex.
\end{Lemma}
\begin{proof}Let $x,y\in\overline{M}$ and $\lambda\in [0,1]$. Then there is are sequences $(x_{n})_{n\in\mathbb{N}},(y_{n})_{n\in\mathbb{N}}\in M^{\mathbb{N}}$ such that $\lim_{n\to\infty}x_{n}=x$ and $\lim_{n\to\infty}y_{n}=y$. We define a sequence $(z_{n})_{n\in\mathbb{N}}\in M^{\mathbb{N}}$ via
\begin{align*}z_{n}=\lambda x_{n}+(1-\lambda)y_{n}\end{align*}
It follows that $\lim_{n\to\infty}z_{n}=\lambda x + (1-\lambda) y$, because
\begin{align*}\Vert z_{n}-z\Vert\leq \lambda\underbrace{\Vert x_{n}-x\Vert}_{\to 0}+(1-\lambda)\underbrace{\Vert y_{n}-y\Vert}_{\to 0}\to 0.\end{align*}
This shows that $\lambda x + (1-\lambda) y\in M$.\end{proof}
\begin{Theorem} (of Banach-Steinhaus, Uniform Boundedness Principle)\newline
Let $(X,\Vert\cdot\Vert_{X})$ be a Banach space and $(Y,\Vert\cdot\Vert_{Y})$ be a normed space over the same field $\mathbb{F}\in\{\mathbb{R},\mathbb{C}\}$. Furthermore, let $I$ be an arbitrary index set and $(T_{i})_{i\in I}\in \mathcal{L}(X,Y)^{I}$ be a collection of bounded operators from $X$ to $Y$. Then:
\begin{align*}\forall x\in X:\sup_{i\in I}\Vert T_{i}x\Vert_{Y}<\infty\hspace*{1cm}\Rightarrow\hspace*{1cm} \sup_{i\in I}\Vert T_{i}\Vert <\infty\end{align*}
\end{Theorem}
\end{document}
第一页末尾和第二页开头的输出如下:
有人知道如何避免下一页出现这个空白框吗?
谢谢!
答案1
正如 daleif 在评论中所建议的,tcolorbox 是更好的选择。您可以使用内置库theorems
,但也可以使用 用 tcolorbox 包装 amsthm 环境\tcolorboxenvironment
。在这里,我定义了一个命令,然后\newboxedtheorem
调用最后一个参数作为 tcolorbox 选项。\newtheorem
\tcolorboxenvironment
\documentclass[11pt,a4paper,twoside]{book}
\usepackage[paper=a4paper,left=25mm,right=25mm,top=35mm,bottom=40mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
%Layoutstyle:
\usepackage[Lenny]{fncychap}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[RO]{\nouppercase{\leftmark}}
\fancyhead[LE]{\nouppercase{\rightmark}}
\fancyhead[RE,LO]{\thepage}
\fancyfoot[C]{\small\copyright\,First Name Second Name}
%Structures: Theorems, Definitions, Remarks,...
\usepackage{amsthm}%includes \newtheorem
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\theoremstyle{definition}%not italic inside environment
\NewDocumentCommand{\newboxedtheorem}{s m o m o m}{
\IfBooleanTF{#1}
{\newtheorem*{#2}{#4}}
{%
\IfNoValueTF{#3}
{%
\IfNoValueTF{#5}
{\newtheorem{#2}{#4}}
{\newtheorem{#2}{#4}[#5]}
}
{\newtheorem{#2}[#3]{#4}}
}
\tcolorboxenvironment{#2}{#6}
}
\tcbset{
boxthsty/.style={
colback=white,
sharp corners,
boxrule=1.1pt,
boxsep=0pt,
breakable,
}
}
\newboxedtheorem{Definition}{Definition}[chapter]{boxthsty}
\newboxedtheorem{Theorem}[Definition]{Theorem}{boxthsty}
\newboxedtheorem{Lemma}[Definition]{Lemma}{boxthsty}
%Examples with Black Triangle:
\newtheorem{Examplep}[Definition]{Example}
\newenvironment{Example}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\blacktriangle$}
\Examplep}{\popQED\endExamplep}
\begin{document}
\newpage
\section{Theorem of Banach-Steinhaus}
\begin{Definition} (Convex Sets)\newline
Let $V$ be a real vector space and $M\subset V$. We call $M$ ``convex'', if $\forall x,y\in M$ and for all $\lambda\in [0,1]$:
\begin{align*}\lambda x+(1-\lambda)y\in M\end{align*}
\end{Definition}
\begin{Example}\label{BallConvex} Let $(X,\Vert\cdot\Vert)$ be a real normed vector space. Then every ball $B_{r}(z)$ for some $r\in\mathbb{R}_{>0}$ and $z\in X$ is a convex set, because
\begin{align*}\Vert z-(\lambda x+(1-\lambda)y)\Vert=\Vert \lambda (z-x)+(1-\lambda)(z-y)\Vert\leq \lambda r+(1-\lambda)r=r\end{align*}
for all $x,y\in B_{r}(z)$ and for all $\lambda\in [0,1]$.
\end{Example}
\begin{Lemma}\label{LemmaConv1} (Linear Operator preserve Convexity)\newline
Let $V$ and $W$ be two real vector spaces and $T\in L(V,W)$. If $M\subset V$ is convex, then also $T(M)$.\end{Lemma}
\begin{proof}Let $a,b\in T(M)$. Then there is are $x,y\in M$ such that $a=Tx$ and $b=Ty$. Using convexity of $M$, we have that
\begin{align*}\lambda a+(1-\lambda)b=\lambda T(x) + (1-\lambda)T(y)=T(\lambda x+(1-\lambda)y)\in T(M)\end{align*}find for all $\lambda\in [0,1]$.\end{proof}
\begin{Lemma}\label{LemmaConv2} (Closure of convex set is convex)\newline
Let $(X,\Vert\cdot\Vert)$ be a real normed vector space and $M\subset X$ be a convex set. Then $\overline{M}$ is convex.
\end{Lemma}
\begin{proof}Let $x,y\in\overline{M}$ and $\lambda\in [0,1]$. Then there is are sequences $(x_{n})_{n\in\mathbb{N}},(y_{n})_{n\in\mathbb{N}}\in M^{\mathbb{N}}$ such that $\lim_{n\to\infty}x_{n}=x$ and $\lim_{n\to\infty}y_{n}=y$. We define a sequence $(z_{n})_{n\in\mathbb{N}}\in M^{\mathbb{N}}$ via
\begin{align*}z_{n}=\lambda x_{n}+(1-\lambda)y_{n}\end{align*}
It follows that $\lim_{n\to\infty}z_{n}=\lambda x + (1-\lambda) y$, because
\begin{align*}\Vert z_{n}-z\Vert\leq \lambda\underbrace{\Vert x_{n}-x\Vert}_{\to 0}+(1-\lambda)\underbrace{\Vert y_{n}-y\Vert}_{\to 0}\to 0.\end{align*}
This shows that $\lambda x + (1-\lambda) y\in M$.\end{proof}
\begin{Theorem} (of Banach-Steinhaus, Uniform Boundedness Principle)\newline
Let $(X,\Vert\cdot\Vert_{X})$ be a Banach space and $(Y,\Vert\cdot\Vert_{Y})$ be a normed space over the same field $\mathbb{F}\in\{\mathbb{R},\mathbb{C}\}$. Furthermore, let $I$ be an arbitrary index set and $(T_{i})_{i\in I}\in \mathcal{L}(X,Y)^{I}$ be a collection of bounded operators from $X$ to $Y$. Then:
\begin{align*}\forall x\in X:\sup_{i\in I}\Vert T_{i}x\Vert_{Y}<\infty\hspace*{1cm}\Rightarrow\hspace*{1cm} \sup_{i\in I}\Vert T_{i}\Vert <\infty\end{align*}
\end{Theorem}
\end{document}