我想创建一个类似于tcolorbox 包。所以我这样做了(MWE):
\documentclass[12pt,a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\newcommand{\tablemat}[1]{
\begin{tcolorbox}[enhanced,title=Table des matières,
colframe=black,colback=white,colbacktitle=black!10,
fonttitle=\bfseries,coltitle=black,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;} }]
#1
\end{tcolorbox}
}
\begin{document}
\tablemat{\tableofcontents}
\chapter{a chapter}
\section{a section}
\section{a second section}
\end{document}
这会在 tcolorbox 内创建一个名为“目录”的章节标题,但我并不想这样。
如何在不为目录创建章节标题的情况下使用此设置?
提前感谢您的任何建议。
答案1
我认为回答自己的问题会很有用。以下是完成此工作的一段代码:
\begin{tcolorbox}[breakable,enhanced jigsaw,title={Table },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,
height fixed for=first and middle,
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} % Replace it with \@starttoc{lot} for tables and \@starttoc{lof} for figures.
\makeatother
\end{tcolorbox}