Gap in tcolorbox after title

With the help of the top option you can define the distance between the text and the frame:

enter image description here

\documentclass{article}

\usepackage[most]{tcolorbox}
\newtcbtheorem[auto counter]{project}{Project}{
lower separated=true,
colback=white!90!blue,
colframe=white,
colbacktitle=white!80!blue,
coltitle=black,
enhanced,
top=5mm, %<------------ Added
boxed title style={colframe=white!80!blue},
attach boxed title to top left={xshift=0.5cm,yshift=-3.5mm},
 }{def}


\begin{document}
\begin{project}{}{}
  with top=5mm
\end{project}
\end{document}

More information on the various spacing options can be found in section "4.7.4 Spacing" (page 39) of the tcolorbox manual.

For "rounder" edges, you can use the arc option as in the following exaggerated example:

enter image description here

\documentclass{article}

\usepackage[most]{tcolorbox}
\newtcbtheorem[auto counter]{project}{Project}{
lower separated=true,
colback=white!90!blue,
colframe=white!90!blue,
colbacktitle=white!80!blue,
coltitle=black,
enhanced,
top=5mm,
boxed title style={colframe=white!80!blue},
attach boxed title to top left={xshift=0.5cm,yshift=-3.5mm},
arc=5mm % <--------------------- Added
}{def}



\begin{document}

\begin{project}{}{}
  with top=5mm and arch=5 mm
\end{project}

\end{document}

More information on how to control the space of box corners can be found in section "4.7.3 Arcs" (page 36) of the tcolorbox manual.


When you use an attached title you should consider that the title box is independent of the contents box, therefore, if you want to place part of the title box below the border of the text box, the contents should be also moved.

In this case you can use yshift* option (page 160 in v4.20 documentation) which fixes the vertical title displacement but also a similar movement for the text into main box. The needed shift can be automatically computed using \tcboxedtitleheight macro.

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\newtcbtheorem[auto counter]{project}{Project}{
lower separated=true,
colback=white!90!blue,
colframe=white,
colbacktitle=white!80!blue,
coltitle=black,
enhanced,
boxed title style={colframe=white!80!blue},
attach boxed title to top left={yshift*=-\tcboxedtitleheight/2, xshift=.5cm},
}{def}

\begin{document}
\begin{project}{Project's title}{Label}
\lipsum[1]
\end{project}

As can be seen in Projetc~\ref{def:Label} \dots
\end{document}

enter image description here

Tags:

Tcolorbox