I would like to create using tcolorbox a filled breakable rectangle with all curved side such as one shown in the

enter image description here

I am not able to fill it correctly. If someone is willing to help, I would be grateful.

  • 1
    We kindly suggest you to include a full minimal working example (MWE) to show what you have worked so far on, so we can help you further with this. – Cragfelt Dec 30 '17 at 10:06
  • 1
    If Christian Hupfer's answer (below) solved your problem please mark it as accepted by clicking the check mark next to the answer. see: How does accepting an answer work? for more information. – Cragfelt Dec 30 '17 at 21:08

This can be achieved with layers and underlays.

The breakability is 'difficult' -- it is necessary to redraw the box bottoms and box bottoms depending on the position in the breaking sequence (in tcolorbox parlour: first, middle and last) -- this can be done with underlay first and underlay middle and last, and if the box is unbroken, use underlay unbroken.

The interior background of the real tcolorbox is not drawn at all, such that it does not paint over the following underlays.

The colors for the inner box and outer boxes can be changed by using new pgfkeys as done in \tcbset.

Please note that this might fail for the last box of a break sequence and produce hilarious results.

Now with broken boxes and the ability to change colours:




\pgfdeclarelayer{background rounded rect}
\pgfsetlayers{background rounded rect,main}


  auto outer arc,
  interior hidden,
  frame hidden,
  attach boxed title to top center,
  boxed title style={colback=tcbcol@outerback,enhanced,frame hidden},
  underlay={% Drawing the blue 
    \begin{pgfonlayer}{background rounded rect}
      \draw[tcbcol@outerboxframe, line width=1.5pt, fill=tcbcol@outerback,rounded corners=1.5\internalshift] ($(frame.north west) + (0pt,1\internalshift)$)  rectangle ($(frame.south east) - (0pt,\internalshift)$);
      \draw[tcbcol@outerboxframe, line width=1.5pt,fill=tcbcol@outerback,rounded corners=1.5\internalshift] ($(frame.north west) - (0.5\internalshift,0.5\internalshift)$) rectangle ($(frame.south east) + (0.5\internalshift,0.5\internalshift)$);
  },% End of underlay 
  % Now the yellow box underlay if the box is unbroken
  underlay unbroken={\draw[tcbcol@frame, line width=1.5pt, fill=tcbcol@innerback,rounded corners=\kvtcb@arc] (frame.north west)  rectangle (frame.south east);},
  % Now the yellow box underlay if the box is broken, provide rounded rectangles for the first at the bottom and for the middle and last on the top. 
  underlay first={\draw[tcbcol@frame, line width=1.5pt, fill=tcbcol@innerback,rounded corners=\kvtcb@arc] (frame.north west)  rectangle (frame.south east);},
  underlay middle and last={\draw[tcbcol@frame, line width=1.5pt, fill=tcbcol@innerback,rounded corners=\kvtcb@arc] (frame.north west)  rectangle (frame.south east);},



enter image description here

| improve this answer | |
  • Thanks for your answer. You saved me a lot of time. Thank you once – Zeljko Hrcek Dec 30 '17 at 20:26

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.