3

According to the documentation, the breakable flag of tcolorbox should create two partialy boxed parts, that is, the first page part has no bottomrule and the second page part has no toprule.

documentation

Unfortunately, I do not understand why my example yields two parts with two completely boxed parts. What am I missing here?

my break

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{natbib}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{tcolorbox}
\usepackage{amsmath}
\tcbuselibrary{breakable}

\newcounter{myexamplectr}
\newenvironment{example}[1][]
{\refstepcounter{myexamplectr} \begin{tcolorbox}[boxrule=0.5mm, arc=0mm, breakable=true, #1] 
        \texttt{Example \themyexamplectr}: }{\end{tcolorbox}}

\begin{document}

\lipsum[1]
\begin{example}[before skip=1cm,after skip=1cm]
\lipsum[1-6]
\end{example}
\lipsum[1]
\end{document}

1 Answer 1

4

The appearance of the three different kinds of parts of a breakable box is governed by three skins: /tcb/skin first, /tcb/skin middle and /tcb/skin last. By default, they are all set to standard, thus you obtain the same appearance for the various parts. You need to use a skin that has visually-distinguishable variants to see the difference. For instance, you can use enhanced from the skins library:

\documentclass{article}
\usepackage{lipsum}
\usepackage{tcolorbox}
\tcbuselibrary{skins, breakable}

\newcounter{myexamplectr}

\newenvironment{example}[1][]{%
 \refstepcounter{myexamplectr}%
 \begin{tcolorbox}[enhanced, boxrule=0.5mm, arc=0mm, breakable=true, #1]
 \texttt{Example \themyexamplectr}: % one space token here
 \ignorespaces}
 {\unskip
  \end{tcolorbox}%
  \ignorespacesafterend
}

\begin{document}

\lipsum[1]
\begin{example}[before skip=1cm,after skip=1cm]
\lipsum[1-6]
\end{example}
\lipsum[1]

\end{document}

Page 1:

Page 1


Page 2:

Page 2

You may want to read section Break Sequence for the Skins of the tcolorbox manual (page 388 in the manual for version 4.20).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.