## LaTeX forum ⇒ Theses, Books, Title pages ⇒ Section names in a tcolorbox

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
bstex
Posts: 65
Joined: Mon Oct 23, 2017 10:22 am

### Section names in a tcolorbox

Hi,
I'm trying to put all the section names of my book in a tcolorbox.
I have this code:
\titleformat{\section}[hang]{\LARGE\bfseries\color{red}}{}{0pt}{\LARGE\bfseries\color{red}}

but I can't find out where to put the \begin{tcolorbox} and \end{tcolorbox} to make the section name (I don't mind about the section number) into a tcolobox.

Johannes_B
Site Moderator
Posts: 3763
Joined: Thu Nov 01, 2012 4:08 pm
Isn't this the same as viewtopic.php?f=59&t=30583?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Stefan Kottwitz
Posts: 8905
Joined: Mon Mar 10, 2008 9:44 pm
Hi Johannes,

it's now tcolorbox instead of colorbox but it could be the same. In the other topic it was made by redefining LaTeX' internal macro, not titlesec as it's mentioned here.

Stefan

bstex
Posts: 65
Joined: Mon Oct 23, 2017 10:22 am
I'm not using the same template yet.
I found out that the "\thesection" is referring to the section number.
What is the code for the section name? I can't find it to put it in a tcolorbox.

Stefan Kottwitz
Posts: 8905
Joined: Mon Mar 10, 2008 9:44 pm
In the other topic I patched the internal LaTeX macro \@ssect. It's default LaTeX, independent of the template, so you can use it in a similar way here. Just if a package redefines such internal stuff (titlesec may do) it can make a difference, but just test it with the \@ssect patch.

\@ssect is from kind of 25 old base LaTeX internals, that's why it doesn't look so user friendly like having a macro for the section name that could be redefined easily.

Stefan