I take over the relay from Christian Hupfer and give a tcolorbox
based solution. I tried to mimicry the original macros to get an equivalent appearance. The main difference is that lemma and proof are now breakable boxes. I left out the \qed
since I don't know what is used for that one.
The macros take an optional parameter (any tcolorbox
option). E.g., use \lem[label=MyLabel]{....}
to set a label for reference.
\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}
UPDATE:
To number within the chapter, add number within=chapter
to the initialization options of the boxes.
To label an individual box, add label=mylabel
to the option list of a lemma or proof.
Here is the code to show the application:
\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}
Best Answer
It’s a bit sad to see how easily people are inclined to forget the good ol’ ways of doing things… Seriously, this question (like others I have already seen on TeX.SX) looks like a classical problem which is discussed, and solved, on page 111 of The TeXbook, where the
\filbreak
command is introduced. Quoting from there:The
\filbreak
macro is defined in LaTeX too (inltplain.dtx
), and the definition is exactly the same as that of Appendix B of The TeXbook:So you could just use it in your documents, without loading any package:
This works as expected; but one might object that it requires typing
\filbreak
at the end of every paragraph. Well, of course this can be made automatic:Obviously, it is necessary to redefine
\filbreak
to invoke\@@par
, instead of\par
, to avoid infinite recursion.