in einem tcolorbox wünsche ich die subsection Nummer im titel, ist im Beispiel beschrieben.
das hier ist eines der besten ErklärungenPDF für ein Paket
The tcolorbox package Manual for version 6.7.1 (2025/07/08)
% !TeX document-id = {19f1156d-bdd7-4481-b341-b9423b5f38e5} % !BIB TS-program = biber % !TEX lualatex \documentclass[12pt,a4paper,oneside]{scrbook} \usepackage[ngerman]{babel} \usepackage{geometry} \geometry{ % papersize={130mm,190mm}, % textwidth=120mm, % textheight=170mm, marginparwidth=75pt, left=15mm, right=20mm, top=25mm, bottom=25mm, foot=10mm, } \usepackage[many]{tcolorbox} \usepackage{varwidth} \usepackage{url} \newtcolorbox{myboxTable}[2][]{enhanced, before skip=2mm,after skip=2mm, colback=black!5,colframe=black!50,boxrule=0.2mm, attach boxed title to top left={xshift=1cm,yshift*=1mm-\tcboxedtitleheight}, varwidth boxed title*=-3cm, boxed title style={frame code={ \path[fill=tcbcolback!30!black] ([yshift=-1mm,xshift=-1mm]frame.north west) arc[start angle=0,end angle=180,radius=1mm] ([yshift=-1mm,xshift=1mm]frame.north east) arc[start angle=180,end angle=0,radius=1mm]; \path[left color=tcbcolback!60!black,right color=tcbcolback!60!black, middle color=tcbcolback!80!black] ([xshift=-2mm]frame.north west) -- ([xshift=2mm]frame.north east) [rounded corners=1mm]-- ([xshift=1mm,yshift=-1mm]frame.north east) -- (frame.south east) -- (frame.south west) -- ([xshift=-1mm,yshift=-1mm]frame.north west) [sharp corners]-- cycle; },interior engine=empty, }, fonttitle=\bfseries, title={#2},#1} \newtcolorbox[auto counter,number within=section]{pabox}[2][]{% colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries, title=Examp.~\thetcbcounter: #2,#1} \begin{document} \tableofcontents \renewcommand*\chapterheadstartvskip{\vspace*{-\topskip}} \chapter{Kapitel 1} \section{section 1} mein MWE (= minimal, working example) \section{section 2} \begin{myboxTable}[colbacktitle=green]{hier ist der Titel} Titel der Tabelle\\ mein Wunsch wäre das vor dem Titel eine Nummer hinkommt und zwar ein subsection Nummer welche dann auch im Index auftauchen sollte\\ Das Beispiel ist auf der Seite 188 vom The tcolorbox package Manual for version 6.7.1 (2025/07/08)\\ \url{https://www.ctan.org/pkg/tcolorbox} \end{myboxTable} \section{hier ein Beispiel wo die die Nummer eingefügt wird} für mich müsst das Examp. vorne weg \subsection{subsection 1} \begin{pabox}[colback=yellow]{Hello there} This is my own box with a mandatory numbered title and options. \end{pabox} Diese Box müsste auch im Inhaltsverzeichnis erscheinen \subsection{Subsection 2 müsste aber 3 sein} \end{document}