[Tex/LaTex] bclogo page breaks

formattingpage-breaking

I am using the Bclogo package http://www.ctan.org/pkg/bclogo. I have created environments for lemmas and proofs with it. The proof was too big to fit on the bottom of the page, so it just inserted a page break and moved it to the next page (see image below). Is there a way to have it start on the page below the lemma and then continue on the next page rather than moving everything to the next page and leaving a large gap between?

I currently have the following commands set up in a different file and just call them in the document for typing the lemmas and proofs.

\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}}

Page Break

Best Answer

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}

enter image description here enter image description here enter image description here

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}

enter image description here

Related Question