3

I'm trying to create a nice and clean content box with tcolorbox. For the most part it's been a smooth journey, but there's a strange niggle I've run into that I can't figure out.

The bounding box for the tcolorbox seems to shrink after a page break!?

Demo

When box is on one page

demo1

When box has broken

demo2

MWE

\documentclass{article}

\usepackage{lipsum}

\usepackage[many]{tcolorbox}
\usepackage{interfaces-base}
\LoadInterface{pgfkeys}
\usetikzlibrary{calc}

\tcbset{
    bmcbox/.style={
        enhanced,
        % text
        fonttitle=\large\bfseries,
        coltitle=black,
        colback=black!10!white,
        colbacktitle=black!10!white,
        % frame
        colframe=black!10!white,
        toprule=4pt,titlerule=0pt,bottomrule=0pt,rightrule=0pt,leftrule=0pt,
        segmentation hidden,
        sharpish corners,
        overlay={%
            \draw[line width=2.5pt,#1] (frame.north west)--(frame.south west);
        },
        % margins & padding
        before skip=\baselineskip,
        after skip=\baselineskip,
        boxsep=2pt,
        top=6pt,
        bottom=4pt,
        left=8pt,
        right=6pt,
        breakable=unlimited,
        show bounding box=red
    },
    bmcboxtitle/.style 2 args={
        extras middle and last={%
            top=20pt,
            overlay={%
                \draw[line width=2.5pt,#1] (frame.north west)--(frame.south west);
                \draw[] {([yshift=-12pt,xshift=4.5pt]frame.north west)} node[anchor=west] {#2};
            }
        },
    }
}

\DeclareTColorBox[auto counter]{boxed}{o O{\thetcbcounter} o}{
    bmcbox={blue},bmcboxtitle={blue}{%
        \color{blue}\small%
        \IfNoValueTF{#3}{Box \thetcbcounter}{#3}%
        \fontseries{tx}\selectfont%
        \IfNoValueTF{#1}{}{: #1}\itshape\enspace continued},
    title={%
        \IfNoValueTF{#3}{Box \thetcbcounter}{#3}%
        \IfNoValueTF{#1}{}{: \fontseries{tx}\selectfont#1}}
}

\begin{document}

\begin{boxed}
    \lipsum[1]
\end{boxed}

\section{A Section}

\begin{boxed}
    \lipsum[2-5]
\end{boxed}

\section{Another Section}

\end{document}
0

It seems to be a bug with the breakable=unlimited option which is experimental according to the tcolorbox manual.

\documentclass{article}

\usepackage{lipsum}

\usepackage[many]{tcolorbox}
\usepackage{interfaces-base}
\LoadInterface{pgfkeys}
\usetikzlibrary{calc}

\tcbset{
    bmcbox/.style={
        enhanced,
        % text
        fonttitle=\large\bfseries,
        coltitle=black,
        colback=black!10!white,
        colbacktitle=black!10!white,
        % frame
        colframe=black!10!white,
        toprule=4pt,titlerule=0pt,bottomrule=0pt,rightrule=0pt,leftrule=0pt,
        segmentation hidden,
        sharpish corners,
        overlay={%
            \draw[line width=2.5pt,#1] (frame.north west)--(frame.south west);
        },
        % margins & padding
        before skip=\baselineskip,
        after skip=\baselineskip,
        boxsep=2pt,
        top=6pt,
        bottom=4pt,
        left=8pt,
        right=6pt,
        breakable, %=unlimited, <----------
        show bounding box=red
    },
    bmcboxtitle/.style 2 args={
        extras middle and last={%
            top=20pt,
            overlay={%
                \draw[line width=2.5pt,#1] (frame.north west)--(frame.south west);
                \draw[] {([yshift=-12pt,xshift=4.5pt]frame.north west)} node[anchor=west] {#2};
            }
        },
    }
}

\DeclareTColorBox[auto counter]{boxed}{o O{\thetcbcounter} o}{
    bmcbox={blue},bmcboxtitle={blue}{%
        \color{blue}\small%
        \IfNoValueTF{#3}{Box \thetcbcounter}{#3}%
        \fontseries{tx}\selectfont%
        \IfNoValueTF{#1}{}{: #1}\itshape\enspace continued},
    title={%
        \IfNoValueTF{#3}{Box \thetcbcounter}{#3}%
        \IfNoValueTF{#1}{}{: \fontseries{tx}\selectfont#1}}
}

\begin{document}

\begin{boxed}
    \lipsum[1]
\end{boxed}

\section{A Section}

\begin{boxed}
    \lipsum[2-5]
\end{boxed}

\section{Another Section}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.