0

I am looking to implement a new tcolorbox, with a unique style for each page of my table of contents. The format I desire is such that each box is unbreakable, ensuring that a new box is started at the beginning of each new page. The intention is to keep the entire content of each box confined to a single page, preventing any splits or breaks. Additionally, I wish to preserve the rounded corners for these boxes, maintaining a consistent and aesthetically pleasing design throughout the document.

box toc page1 end of the box

box toc page2 end of the box

For any tip welcome! Thank you

\documentclass{article}

\usepackage[most]{tcolorbox} \usepackage{import} \usepackage{pdfpages} \usepackage{hyperref}

\begin{document}

% tcolorbox for TOC \begin{tcolorbox}[enhanced, title=Table des Matières, fonttitle=\bfseries, colback=blue!5!white,colframe=blue!75!black] \tableofcontents \end{tcolorbox}

\newpage

% Importing pages \import{sections/}{part1.tex} \import{sections/}{part2.tex} \import{sections/}{part3.tex} \import{sections/}{part4.tex}

% ...

\end{document}

Jey
  • 1
  • Perhaps you want to match the middle overlay with your tcplorbox decoration. See https://tex.stackexchange.com/questions/545320/how-to-more-visibly-indicate-that-a-tcolorbox-has-broken – Mane32 Jan 26 '24 at 00:46

1 Answers1

0

I suggest you to make a MWE next time you ask a question. In this way, people will know exactly what you looking for. For example, for your case, which document class you use, what packages you have included, what kind of contents you have need in the tcolorbox and how many pages it cross. These will all influence the answer form of your questions. In the following example, I will use the code snippet you provided in report document with minimal packages which I think it will be related to the question. And I assume the contents in the box will still be the table of contents:

\documentclass{article}
\usepackage[most]{tcolorbox}
\newtcolorbox{abox}[1][]{%
  breakable,
  enhanced standard jigsaw,
  colframe=purple,
  opacityback=0.15,
  opacitybacktitle=0.5, 
  opacityframe=0.9,
  fonttitle=\bfseries\sffamily, 
  coltitle = black,
  center title,
  title={#1},
  left skip=0.7cm,
  drop fuzzy shadow=blue!50!black!50!white,
  boxrule=0.4pt,
}

\begin{document} \begin{abox}[Table of Contents] \makeatletter @starttoc{toc} \makeatother \end{abox} main contents... \newcounter{tempcn} \loop \ifnum\value{tempcn}<30 \stepcounter{tempcn} \addcontentsline{toc}{section}{Testing} \addcontentsline{toc}{section}{Testing} \repeat \end{document}

Output:

enter image description here

Tom
  • 7,318
  • 4
  • 21
  • Hi thank you for your answer ! It's very good idea what you did. But to be more specific, the problem I have is about where the break take place, I mean I'm using a box with rounded angles and what I'm trying to achieve is to have that style (only) of box for each page of my TOC !

    Here's an example, but as you can see the results are with sharp angles where the break happens.

    – Jey Jan 27 '24 at 00:34
  • @Jey Delete the answer you provided to clarify your question. And edit the question to add the clarification there please. And I think the answer is pretty simple. Just use standard jigsaw instead enhanced jigsaw for the skin key. I will update my answer as well. – Tom Jan 27 '24 at 02:26
  • @Jey Just a update for you. I forgot you also want include the shadow effect. In this way you will need to set the skin key to enhanced standard jigsaw instead. I will update my answer. – Tom Jan 27 '24 at 18:03
  • Thank you, it's exactly what I was trying to achieve. I'll take note to provide a MWE + add the document class & packages + be more clear about what I want to achieve for any futur post. Thank's a lot ! :-) – Jey Jan 27 '24 at 19:28