我正在使用 Bclogo 包http://www.ctan.org/pkg/bclogo。我用它创建了引理和证明的环境。证明太大,无法放在页面底部,因此它只是插入了一个分页符并将其移动到下一页(见下图)。有没有办法让它从引理下面的页面开始,然后继续到下一页,而不是将所有内容移动到下一页并留下很大的间隙?
我目前在不同的文件中设置了以下命令,并且只需在文档中调用它们即可输入引理和证明。
\newcounter{LemmaBoxCounter}
\newcommand{\lem}[1]{\begin{bclogo}[logo=\bclampe, noborder=true, couleurBarre=Red, couleurBord=Black, couleur=blue!20, arrondi = 0.2, epBarre=0]{Lemma \arabic{LemmaBoxCounter}}
\raggedright #1
\addtocounter{LemmaBoxCounter}{1}
\end{bclogo}}
\newcounter{ProofBoxCounter}
\renewcommand{\proof}[1]{\begin{bclogo}[logo=\bclampe, noborder=true, couleurBarre=Red, couleurBord=Black, couleur=orange!10, arrondi = 0.2, epBarre=3.5]{Proof \arabic{ProofBoxCounter}}
\raggedright #1 \qed
\addtocounter{ProofBoxCounter}{1}
\end{bclogo}}
答案1
我接手了 Christian Hupfer 的接力并给出了一个tcolorbox
基础解决方案。我尝试模仿原始宏以获得等效的外观。主要区别在于引理和证明现在是可破坏的框。我省略了,\qed
因为我不知道那个是用来做什么的。
宏带有可选参数(任何tcolorbox
选项)。例如,用于\lem[label=MyLabel]{....}
设置参考标签。
\documentclass[paper=a4,12pt]{scrbook}
\usepackage{etoolbox}%
\usepackage{blindtext}%
\usepackage[tikz]{bclogo}%
\usepackage[skins,breakable,xparse]{tcolorbox}%
\DeclareTotalTColorBox[auto counter]{\lem}{ O{} m }
{ enhanced,breakable,
boxrule=0pt,boxsep=0pt,arc=2mm,toptitle=3mm,top=3mm,left=7mm,right=1mm,pad at break=2mm,
colframe=blue!20!white,interior hidden,
coltitle=black,fonttitle=\bfseries\large,title={Lemma~\thetcbcounter},
overlay unbroken and first={\node at ([xshift=4mm,yshift=-5mm]frame.north west) {\bclampe};},
#1}
{\raggedright #2}
\DeclareTotalTColorBox[auto counter]{\proof}{ O{} m }
{ enhanced,breakable,
boxrule=0pt,boxsep=0pt,arc=2mm,toptitle=3mm,top=3mm,left=7mm,right=1mm,pad at break=2mm,
colframe=orange!10!white,interior hidden,
coltitle=black,fonttitle=\bfseries\large,title={Proof~\thetcbcounter},
overlay unbroken and first={\node[inner sep=0pt] (logo) at ([xshift=4mm,yshift=-5mm]frame.north west) {\bclampe};
\draw[red,line width=3.5pt] (logo) -- ([xshift=4mm,yshift=1.5mm]frame.south west); },
overlay middle and last={\draw[red,line width=3.5pt] ([xshift=4mm,yshift=-1.5mm]frame.north west) -- ([xshift=4mm,yshift=1.5mm]frame.south west); },
#1}
{\raggedright #2%\qed
}
\begin{document}
\chapter{First}
\section{First}
\lem{\blindtext[1]}
\proof{\blindtext[1]}
\lem{\blindtext[2]}
\proof{\blindtext[4]}
\end{document}
更新:
按章节内的编号,添加
number within=chapter
到框的初始化选项。要标记单个框,请将其添加
label=mylabel
到引理或证明的选项列表中。
以下是显示应用程序的代码:
\documentclass[paper=a4,12pt]{scrbook}
\usepackage{etoolbox}%
\usepackage{blindtext}%
\usepackage[tikz]{bclogo}%
\usepackage[skins,breakable,xparse]{tcolorbox}%
\DeclareTotalTColorBox[auto counter,number within=chapter]{\lem}{ O{} m }
{ enhanced,breakable,
boxrule=0pt,boxsep=0pt,arc=2mm,toptitle=3mm,top=3mm,left=7mm,right=1mm,pad at break=2mm,
colframe=blue!20!white,interior hidden,
coltitle=black,fonttitle=\bfseries\large,title={Lemma~\thetcbcounter},
overlay unbroken and first={\node at ([xshift=4mm,yshift=-5mm]frame.north west) {\bclampe};},
#1}
{\raggedright #2}
\DeclareTotalTColorBox[auto counter,number within=chapter]{\proof}{ O{} m }
{ enhanced,breakable,
boxrule=0pt,boxsep=0pt,arc=2mm,toptitle=3mm,top=3mm,left=7mm,right=1mm,pad at break=2mm,
colframe=orange!10!white,interior hidden,
coltitle=black,fonttitle=\bfseries\large,title={Proof~\thetcbcounter},
overlay unbroken and first={\node[inner sep=0pt] (logo) at ([xshift=4mm,yshift=-5mm]frame.north west) {\bclampe};
\draw[red,line width=3.5pt] (logo) -- ([xshift=4mm,yshift=1.5mm]frame.south west); },
overlay middle and last={\draw[red,line width=3.5pt] ([xshift=4mm,yshift=-1.5mm]frame.north west) -- ([xshift=4mm,yshift=1.5mm]frame.south west); },
#1}
{\raggedright #2%\qed
}
\begin{document}
\chapter{First}
Lemma~\ref{A} on page~\pageref{A}, followed by
Lemma~\ref{B} on page~\pageref{B}.
Also see Proof~\ref{pA} on page~\pageref{pA}
and Proof~\ref{pB} on page~\pageref{pB}.
\section{First}
\lem[label=A]{\blindtext[1]}
\proof[label=pA]{\blindtext[1]}
\lem[label=B]{\blindtext[2]}
\proof[label=pB]{\blindtext[4]}
\end{document}
答案2
由于时间不足和对 TikZ 缺乏了解,这不是一个完整的解决方案,而是一个起点;-)
我尝试使用tcolorbox
易碎和覆盖功能及其theorem
样式来制作盒子。bclogo
可以插入包装上的徽标,但我无法正确定位它们。这也导致盒子内容向右移动。
\documentclass[paper=a4,12pt]{scrbook}
\usepackage{etoolbox}%
\usepackage{blindtext}%
\usepackage{bclogo}%
\usepackage[theorems,skins,breakable]{tcolorbox}%
\begin{document}
\chapter{First}
\section{First}
\newtcbtheorem[number within=section]{lem}{Lemma}%
{overlay={\bclampe},left=5pt,breakable,colback=green!5,colframe=green!35!black,fonttitle=\bfseries,title after break={Lemma \csuse{the\tcbcounter} -- \raggedleft Continued}}{lem}
\newtcbtheorem[number within=section]{proof}{Proof}{breakable,overlay={\bclampe},colback=green!5,colframe=green!35!black,fonttitle=\bfseries,title after break={Proof \csuse{the\tcbcounter} -- \raggedleft Continued}}{prf}
\begin{lem}{On Brontosaurs}{}
\textbf{By Ann Elk (Misses)}
Brontosaurs are thin at one end, thick in the middle and thin again on the other end.
\end{lem}
\begin{proof}{On Brontosaurs}{}
\textbf{By Ann Elk (Misses)}
See the excavations ;-)
\blindtext[4]%
\end{proof}
\end{document}