1

I am trying to adapt the solution given in this thread.

Multi-page tcolorbox with complete box on each page

What I am looking for is to have a nice tcolorbox for my theorems that is breakable and such that on the bottom end of the first page and on the upper end of the second page, the frame has rounded corners. (Additionnaly I would like to be able to personnalize the title with the name of the theorem when it has one but maybe I should post it as a different question).

I think one difficulty is that the title is shifted on the main frame of the box. This is what I am using right now:

\documentclass{article}
\usepackage{lipsum} 
\usepackage{xcolor}
\usepackage[skins,many]{tcolorbox}
\newtcolorbox{theo}{enhanced,title=Théorème,breakable,
        overlay first={\draw[line width=.5mm, magenta!70!white] (frame.south west)--(frame.south east);},
        overlay middle={\draw[line width=.5mm, magenta!70!white] (frame.south west)--(frame.south east);\draw[line width=.5mm, magenta!70!white] (frame.north west)--(frame.north east);},
        overlay last={\draw[line width=.5mm, magenta!70!white] (frame.north west)--(frame.north east);},
        colframe=magenta!60!white,colback=magenta!10!white,
        arc=1mm,colbacktitle=magenta!10!white,
        fonttitle=\bfseries,coltitle=magenta!50!black,
        attach boxed title to top left=
        {xshift=-2mm,yshift=-2mm},
        boxed title style={size=small,colframe=magenta!60!white, colback=white!65!magenta}
    }

\begin{document}
\begin{theo}{}{}
\lipsum[1-7]
\end{theo
\end{document}

If anyone car help with that I would very much appreciate it.

2 Answers 2

2

For theorems and similar constructions is better to use \newtcbtheorem command. This is what I've done in this solution. This box declaration creates a theo box with two mandatory parameters, the first one is a particular title and the second a label suffix (not used in this example).

About the complete frame for broken boxes, you can fix which skin to use with skin first, skin middle and skin last options. As you want a complete frame with rounded corners, all three are fixed to enhanced. The initial enhanced option fixes them to be broken and these options restores again to unbroken aspect.

As many already loads skins library, you don't need to add it as option when loading the package.

\documentclass{article}
\usepackage{lipsum} 
\usepackage{xcolor}
\usepackage[many]{tcolorbox}
\newtcbtheorem{theo}{Theorem}{enhanced, breakable, 
            skin first=enhanced,
            skin middle=enhanced,
            skin last=enhanced,
        colframe=magenta!60!white,colback=magenta!10!white,
        arc=1mm,colbacktitle=magenta!10!white,
        fonttitle=\bfseries,coltitle=magenta!50!black,
        attach boxed title to top left=
        {xshift=-2mm,yshift=-2mm},
        boxed title style={size=small,colframe=magenta!60!white, colback=white!65!magenta}
    }{theo}

\begin{document}
\begin{theo}{My first theorem}{}
\lipsum[1-10]
\end{theo}

\begin{theo}{My second theorem}{}
\lipsum[1]
\end{theo}

\end{document}

enter image description here

2
  • Hey, thank you! That looks really better, I have to study this package one day because I do not get what is the use of the first enhanced then.
    – WrabbitW
    Feb 8, 2023 at 16:03
  • 1
    @WrabbitW the first enhanced adds all possibilities to change the aspect of boxes, like the boxed title that you use. But this option also decides how parts of broken boxes looks like, and this is what can be changed with skin first, middle and last option.
    – Ignasi
    Feb 8, 2023 at 18:11
0

From your post, I could understand that you don't want the bottom rule of the first page and the top rule of the second page, if my understanding is correct, then it was the default setting in tcolorbox, the problem is because of you defined the overlay first and overlay middle and overlay last, just comment it and the output comes as you expected, and the modified MWE is:

\documentclass{article}
\usepackage{lipsum} 
\usepackage{xcolor}
\usepackage[skins,many]{tcolorbox}
\newtcolorbox{theo}{enhanced,title=Theorem,breakable,
%        overlay first={\draw[line width=.5mm, magenta!70!white] (frame.south west)--(frame.south east);},
%        overlay middle={\draw[line width=.5mm, magenta!70!white] (frame.south west)--(frame.south east);\draw[line width=.5mm, magenta!70!white] (frame.north west)--(frame.north east);},
%        overlay last={\draw[line width=.5mm, magenta!70!white] (frame.north west)--(frame.north east);},
        colframe=magenta!60!white,colback=magenta!10!white,
        arc=1mm,colbacktitle=magenta!10!white,
        fonttitle=\bfseries,coltitle=magenta!50!black,
        attach boxed title to top left=
        {xshift=-2mm,yshift=-2mm},
        boxed title style={size=small,colframe=magenta!60!white, colback=white!65!magenta}
    }

\begin{document}
\begin{theo}{}{}
\lipsum[1-7]
\end{theo}

\end{document}
1
  • Hi and thank you for your answer. Actually what I would like is to have both bottom rule and top rule at the break but I would like the corners to be rounded.
    – WrabbitW
    Sep 6, 2022 at 18:20

You must log in to answer this question.

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