![\tcolorbox 损坏问题](https://linux22.com/image/438028/%5Ctcolorbox%20%E6%8D%9F%E5%9D%8F%E9%97%AE%E9%A2%98.png)
我想打破这个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}
如您所见,我使用了tcolorbox
包含 的\csname @starttoc\endcsname{toc}
。如果我想以这种方式拆分它:在第 1 部分(第一部分)处拆分,在第 2 部分(中间部分)处拆分,在第 3 部分(最后一部分)处拆分。请记住,我的documentcalss{book}
分为 3 个部分,每个部分包含 3 个章节,每个章节包含多个部分、小节和小节。
我该怎么办?非常感谢,并致以最诚挚的问候
答案1
尝试
\addtocontents{toc}{\protect\tcbbreak}
\part{title} % for 2nd and 3rd parts
完整示例
\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}