0

I use the code below to have some fancy boxes.

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


\newcommand{\mytitlegen}{                  
    \node[fill=white,%rounded corners,
    draw=white,text=black,line width=3pt,inner sep=4pt,anchor=west,xshift=60pt]
    at (frame.north west){\bfseries In title};}

\newtcolorbox{InsideBox}{                       
    drop shadow=black!50!white,enhanced,overlay unbroken and first={\mytitlegen},colframe=black,colback=white,coltitle=black,boxrule=1pt,arc=3mm,%
    breakable,top=5pt,before=\vskip18pt,width=0.95\linewidth}

\makeatletter
\newtcolorbox{OutBox}[1][]{%
    enhanced, 
    breakable,
    before upper={\parindent15pt},
    colback=white,
    colframe=gray,
    attach boxed title to top right={yshift=-2pt}, title={Out title},
    boxed title size=standard,
    boxrule=0pt,
    boxed title style={%
        sharp corners, 
        rounded corners=northeast, 
        colback=tcbcolframe, 
        boxrule=0pt},
    sharp corners=north,
    overlay unbroken={%
        \path[fill=tcbcolback] 
        ([xshift=2pt]title.south west) 
        to[out=180, in=0] ([xshift=-1.5cm]title.west)--
        (title.west-|frame.west) |- 
        ([xshift=2pt]title.south west)--cycle;
        \path[fill=tcbcolframe] (title.south west) 
        to[out=180, in=0] ([xshift=-1.5cm]title.west)--
        (title.west-|frame.west)
        [rounded corners=\kvtcb@arc] |- 
        (title.north-|frame.north) 
        [sharp corners] -| (title.south west);
        \draw[line width=.5mm, rounded corners=\kvtcb@arc, 
        tcbcolframe] 
        (title.north east) rectangle 
        (frame.south west);
    }, 
    overlay first={%
        \path[fill=tcbcolback] 
        ([xshift=2pt]title.south west) 
        to[out=180, in=0] ([xshift=-1.5cm]title.west)--
        (title.west-|frame.west) |- 
        ([xshift=2pt]title.south west)--cycle;
        \path[fill=tcbcolframe] (title.south west) 
        to[out=180, in=0] ([xshift=-1.5cm]title.west)--
        (title.west-|frame.west)
        [rounded corners=\kvtcb@arc] |- 
        (title.north-|frame.north) 
        [sharp corners] -| (title.south west);
        \draw[line width=.5mm, rounded corners=\kvtcb@arc, 
        tcbcolframe] 
        (frame.south west) |- (title.north) -| 
        (frame.south east);
    }, 
    overlay middle={%
        \draw[line width=.5mm, tcbcolframe] 
        (frame.north west)--(frame.south west) 
        (frame.north east)--(frame.south east);
    }, 
    overlay last={%
        \draw[line width=.5mm, rounded corners=\kvtcb@arc, 
        tcbcolframe] 
        (frame.north west) |- (frame.south) -|
        (frame.north east);
    }, 
    #1
}
\makeatother

\begin{document}

    \begin{InsideBox}
\lipsum[1-6]
    \end{InsideBox}

\begin{OutBox}
\lipsum[1-6]
\end{OutBox}

     \end{document}

As you can see, everything is OK.

enter image description here

But, I would like to put the InsideBox in to OutBox. So I tried to write

 \begin{OutBox}
        \lipsum[1]
            \begin{InsideBox}
            \lipsum[1-6]
        \end{InsideBox}
    \end{OutBox}

\lipsum

Then, as you can see, everything is mess up! The InsideBox is not anymore breakable and some text got in OutBox.

enter image description here

What's happening? Thanks in advance!

  • 3
    Look into tcolorbox documentation - breakable box inside breakable box is not supported, and in most cases "creates mess." That is what you are experiencing and it is documented state of package. Working around this might be possible, but I dont know how and if even Mr. Sturm doesnt know, you will need someone very proficient in tex or use some kind of hybrid solution. – Tomáš Kruliš May 13 '20 at 12:19
  • 1
    You can try with this alternative. It's not the same problem, but similar. – Ignasi May 13 '20 at 14:39
  • 1
    While pages are normally broken by \output, tcolorbox has to do it internally using \vsplit. You can't \vsplit a tcolorbox from the outside. – John Kormylo May 13 '20 at 15:40
  • @Ignasi , this alternative was about having fake double box. I want to write text inside the 'OutBox', but outside the InsideBox. – Kώστας Κούδας May 13 '20 at 16:48
  • So, @TomášKruliš there is no solution about this problem... Thank's for your answer... – Kώστας Κούδας May 13 '20 at 16:50
  • @JohnKormylo , thanks for your answer. If there is no solution,, I 'll find an other way to show my text. Thanks a lot!!! – Kώστας Κούδας May 13 '20 at 16:51

0 Answers0