LaTeX forum ⇒ Theses, Books, Title pagesSection names in a tcolorbox

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

Section names in a tcolorbox

Postby bstex » Fri Nov 03, 2017 12:56 pm

Hi,
I'm trying to put all the section names of my book in a tcolorbox.
I have this code:
  1. \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.
Thank you in advance.

User avatar
Johannes_B
Site Moderator
Posts: 3584
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri Nov 03, 2017 6:55 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.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8525
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri Nov 03, 2017 7: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
Site admin

bstex
Posts: 27
Joined: Mon Oct 23, 2017 10:22 am

Postby bstex » Fri Nov 03, 2017 10:36 pm

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.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8525
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri Nov 03, 2017 10:52 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
Site admin


Return to “Theses, Books, Title pages”

Who is online

Users browsing this forum: No registered users and 3 guests