6

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

1
  • 1
    I don't know whether this is possible at all out of the box. Perhaps you have to use an explicity overlay for the broken parts
    – user31729
    Jun 16, 2016 at 15:45

1 Answer 1

8

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

2
  • Your solution works very well when the frame of the tcolorbox is a continuous line. But, with a dashed frame, it works partially... This is why I posted a second question for that particular issue.
    – SDrolet
    Jun 16, 2016 at 21:19
  • hi Christian. What is a break in latex and why is it not the same box after the break? Apr 27, 2018 at 18:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .