[Tex/LaTex] Tcolorbox: same boxed title style after break

page-breakingtcolorbox

How can we set the same style of boxed title after a break in a tcolorbox ?

\documentclass{article}
\usepackage{lipsum}%
\usepackage[all]{tcolorbox}%

\begin{document}

\def\TheTitle{Boxed title}

\begin{tcolorbox}[enhanced,breakable,attach boxed title to top center={yshift=-2mm},coltitle=black,boxed title style={boxrule=0.4pt,colback=black!2!white},
title=\TheTitle,title after break={continued \TheTitle}]
\lipsum
\end{tcolorbox}

\end{document}

A boxed title:
enter image description here

The boxed title after the break:
enter image description here

Best Answer

This uses a 'tricky' overlay approach, setting explicitly another tcolorbox as the box title for the broken parts of the box.

The extras middle and last= option is meant to add features to the 'middle' and 'last' box parts, i.e. the ones after breaking the box.

\documentclass{article}
\usepackage{lipsum}%
\usepackage[all]{tcolorbox}%

\begin{document}

\def\TheTitle{Boxed title}



\tcbset{boxtitlestuff/.style={boxrule=0.4pt,colback=black!2!white,coltitle=black,fonttitle={\bfseries},size=normal},
        brokentitle/.style={geometry nodes=true,skin=freelancemiddle,
          extras middle and last={overlay={\node[above,inner sep=-4pt] (A) at (interior.north) {\tcbox[boxtitlestuff]{continued \TheTitle}};}
          }
        }
      }


\begin{tcolorbox}[skin=enhanced jigsaw,
  breakable,
  attach boxed title to top center={yshift=-2mm},
  coltitle=black,
  boxed title style={boxrule=0.4pt,colback=black!2!white},
  title=\TheTitle,
%  title after break={continued \TheTitle},
  brokentitle
  ]
\lipsum
\lipsum
\lipsum
\lipsum
\end{tcolorbox}

\end{document}

enter image description here