2

In the tcolorbox manual we see the following toc format

enter image description here

I would like to reproduce it however I have no idea how to do it. I don't even know where to begin from. I am not familiar with the packages presented in the tcolorbox manual.

I would appreciate your help.

4

The ToC style presented in tcolorbox manual is written in tcolorbox.doc.abtract.tex which can be found in the documentation directory of tcolorbox, i.e. on my personal computer the path for TL 2017 is

/usr/local/texlive/2017/texmf-dist/doc/latex/tcolorbox

I've copied the code from there and wrapped a small document around it.

Basically, the settings are just tcolorbox 'standards', then use \@starttoc{toc} in order to load the contents of \jobname.toc, as is done basically in any \tableofcontents macro.

The file goldshade.png is shipped with the tcolorbox package

\documentclass{article}

\usepackage[most]{tcolorbox}

\usepackage{blindtext}


\begin{document}


\begin{tcolorbox}[breakable,enhanced jigsaw,title={Contents},fonttitle=\bfseries\Large,
  colback=yellow!10!white,colframe=red!50!black,before=\par\bigskip\noindent,
  interior style={fill overzoom image=goldshade.png,fill image opacity=0.25},
  colbacktitle=red!50!yellow!75!black,
  enlargepage flexible=\baselineskip,pad at break*=3mm,
  watermark color=yellow!75!red!25!white,
  watermark text={\bfseries\Large Contents},
  attach boxed title to top center={yshift=-0.25mm-\tcboxedtitleheight/2,yshifttext=2mm-\tcboxedtitleheight/2},
  boxed title style={enhanced,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;}  },
  drop fuzzy shadow]
\makeatletter
\@starttoc{toc}
\makeatother
\end{tcolorbox}

\blinddocument

\end{document}

enter image description here

  • Christian, any way to achieve the space in the toc that the image in my post shows? After some sections the number and the title of the section in toc gets add together .... !! – Tolaso Dec 16 '17 at 19:58

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.