0

I'd like to break this tcolorbox:

\dominitoc

\begin{tcolorbox}[breakable,
    enhanced,
    title=\Huge{Contents},
    colframe=orange,
    colback=Silver!75,
    colbacktitle=Gold1,
    fonttitle=\bfseries,
    coltitle=red,
    attach boxed title to top center={yshift=-0.25mm-\tcboxedtitleheight/2,yshifttext=2mm-\tcboxedtitleheight/2},
    boxed title style={
        boxrule=0.5mm, 
        frame code={ \path[tcb fill frame]([xshift=-4mm]frame.west) -- (frame.north west) -- (frame.north east) -- ([xshift=4mm]frame.east) -- (frame.south east) -- (frame.south west) -- cycle; },
        interior code={ \path[tcb fill interior] ([xshift=-2mm]interior.west) -- (interior.north west) -- (interior.north east) -- ([xshift=2mm]interior.east) -- (interior.south east) -- (interior.south west) -- cycle;} 
    }
]
    \csname @starttoc\endcsname{toc}
\end{tcolorbox}

As you can see I used a tcolorbox that contains \csname @starttoc\endcsname{toc}. If I want to break it in this way: break at part 1 (first part), break at part 2 (middle part), break at part 3 (last part). Keep in mind that my documentcalss{book} is divided in 3 parts, which one owns 3 chapter, each chapter owns several section, subsection and subsubsection.

How could I do? Thank you very much and best regards

1 Answer 1

1

Try

\addtocontents{toc}{\protect\tcbbreak}
\part{title} % for 2nd and 3rd parts

Full example

\PassOptionsToPackage{svgnames, x11names}{xcolor}
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{breakable, skins}

\usepackage{unravel}
\providecommand\unravel[1]{#1}
\providecommand\unravelsetup[1]{}
\unravelsetup{max-action=1000, max-input=1000, max-output=200}


\begin{document}
\begin{tcolorbox}[breakable,
    enhanced,
    title=\Huge{Contents},
    colframe=orange,
    colback=Silver!75,
    colbacktitle=Gold1,
    fonttitle=\bfseries,
    coltitle=red,
    attach boxed title to top center={yshift=-0.25mm-\tcboxedtitleheight/2,yshifttext=2mm-\tcboxedtitleheight/2},
    boxed title style={
        boxrule=0.5mm, 
        frame code={ \path[tcb fill frame]([xshift=-4mm]frame.west) -- (frame.north west) -- (frame.north east) -- ([xshift=4mm]frame.east) -- (frame.south east) -- (frame.south west) -- cycle; },
        interior code={ \path[tcb fill interior] ([xshift=-2mm]interior.west) -- (interior.north west) -- (interior.north east) -- ([xshift=2mm]interior.east) -- (interior.south east) -- (interior.south west) -- cycle;} 
    }
    ]
    \csname @starttoc\endcsname{toc}
\end{tcolorbox}

\part{title}
\section{title}

\addtocontents{toc}{\protect\tcbbreak}
\part{title}
\section{title}

\addtocontents{toc}{\protect\tcbbreak}
\part{title}
\section{title}
\end{document}

enter image description here

1
  • Thank you so much!!!
    – Puck
    Aug 13, 2021 at 14:45

You must log in to answer this question.

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