0

I'm designing some tcolorboxes with the breakable option, which I have used it a few times before, however, now it seems not to be working as usual (breakable option changes the background color and disables drop fuzzy shadow option)

Normal use:

enter image description here

When it comes to the new page break:

enter image description here

MWE:

\documentclass[a4paper, oneside]{book}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[spanish,activeacute]{babel}
\usepackage[usenames,dvipsnames]{xcolor}

\usepackage{tcolorbox}
\tcbuselibrary{theorems, skins, breakable}
\colorlet{naranja}{Peach!70!}
\newcounter{ejemplo}

\tcbset{
    base/.style={
        empty, breakable,
        fonttitle=\bfseries\sffamily,
        fontupper=\normalsize\slshape,
        theorem style=standard,
        separator sign={},
        frame engine=path,
        colframe=yellow!10,
        drop fuzzy shadow,
        sharp corners,
        attach boxed title to top left={yshift*=-\tcboxedtitleheight},
        boxed title style={size=minimal, top=4pt, left=4pt},
        after skip=0.5cm, before skip balanced=0.5cm
    }
}

\newtcbtheorem[number within=chapter]{ejem}{Ejemplo}{
    base, coltitle=black,
    attach boxed title to top left={xshift=-3mm, yshift*=-\tcboxedtitleheight/2},
    boxed title style={right=3pt, bottom=3pt, overlay={
            \draw[draw=naranja, fill=naranja, line join=round]
            (frame.south west) -- (frame.north west) -- (frame.north east) --
            (frame.south east) -- cycle;
    }},
    overlay unbroken={
        \scoped \shade[left color=naranja!10!black, right color=naranja]
        ([yshift=-0.2pt]title.south west) -- ([xshift=-1.5pt, yshift=-0.2pt]title.south-|frame.west) -- ++(0, -6pt) -- cycle;
    }
}{ejem}

\usepackage{lipsum}
\begin{document}
    
\lipsum[1]

\begin{ejem}{}{}
    \lipsum[1] \\\\
    \lipsum[2]\\\\
    \lipsum[1]
\end{ejem}

\end{document}

I have tried to use the colback option instead frame engine=path + colframe (I think that is the error origin), but it didn't work.

1 Answer 1

2

You need extras={frame engine=path} instead of just frame engine=path.

Drawing engine options are special. They are (re)set for every box of a broken break sequence by the specified skin (in your example the skin is empty). Thus your frame engine=path will only take effect if the box is unbroken. To change drawing engines for every box of a break sequence, no matter broken or unbroken, you need extras={<options>}.

See more info in tcolorbox's package manual (v5.1.1), sec. 19.5 "Extra Options for Partial Boxes".

\documentclass[a4paper, oneside]{book}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[spanish,activeacute]{babel}
\usepackage[usenames,dvipsnames]{xcolor}

\usepackage{tcolorbox}
\tcbuselibrary{theorems, skins, breakable}
\colorlet{naranja}{Peach!70!}
\newcounter{ejemplo}

\tcbset{
    base/.style={
        empty, breakable,
        fonttitle=\bfseries\sffamily,
        fontupper=\normalsize\slshape,
        theorem style=standard,
        separator sign={},
        extras={frame engine=path},
        colframe=yellow!10,
        drop fuzzy shadow,
        sharp corners,
        attach boxed title to top left={yshift*=-\tcboxedtitleheight},
        boxed title style={size=minimal, top=4pt, left=4pt},
        after skip=0.5cm, before skip balanced=0.5cm
    }
}

\newtcbtheorem[number within=chapter]{ejem}{Ejemplo}{
    base, coltitle=black,
    attach boxed title to top left={xshift=-3mm, yshift*=-\tcboxedtitleheight/2},
    boxed title style={right=3pt, bottom=3pt, overlay={
            \draw[draw=naranja, fill=naranja, line join=round]
            (frame.south west) -- (frame.north west) -- (frame.north east) --
            (frame.south east) -- cycle;
    }},
    overlay unbroken={
        \scoped \shade[left color=naranja!10!black, right color=naranja]
        ([yshift=-0.2pt]title.south west) -- ([xshift=-1.5pt, yshift=-0.2pt]title.south-|frame.west) -- ++(0, -6pt) -- cycle;
    }
}{ejem}

\usepackage{lipsum}
\begin{document}
    
\lipsum[1]

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

\begin{ejem}{}{}
    \lipsum[2]\\\\
    \lipsum[1]
\end{ejem}

\end{document}

enter image description here

2
  • The folded orange corner disappeared in the breakable box, compare Example 0.1 and Example 0.2
    – Á. Iborra
    Jul 31, 2022 at 14:27
  • That's the expected behavior of overlay unbroken. Replacing it with overlay or overlay unbroken and first will solve the problem. Jul 31, 2022 at 15:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .