2

I need to define a tcolorbox with a title for the upper part and another for the lower part as in the image. But I can't find a solution to properly insert the fancy "POR QUE?" on the lower part of tcolorbox.

enter image description here

I used 'underlay boxed title' as in the code below, but I don't know how to refer to an upper corner of the lower part of the box to use in the second part of the underlay boxed title. As it is in the code below, the second title has an absolute position in the box. So, if the upper part gets bigger, then its text would be over the "POR QUE".

\newtcolorbox{openningbox}{enhanced, jigsaw, colback=white, colframe=white, lower separated=false, 
\titlefont, title={O QU\^E?},
boxed title style={empty,arc=0pt,outer arc=0pt,boxrule=0pt}, 
attach boxed title to top left={ yshift=-10 mm},
underlay boxed title={
\fill[green] ($(title.north west) + (0,-7mm)$) coordinate (x1) -- ++ (23 mm,0mm) arc [start angle=-90, end angle=90, x radius=3mm, y radius=3mm] coordinate (x2) -- ++ (-23 mm,0mm) -- cycle;

\fill[green] ($(frame.north west) + (0,-53mm)$) coordinate (c1) -- ++ (23 mm,0mm) arc [start angle=-90, end angle=90, x radius=3mm, y radius=3mm] coordinate (c2) -- ++ (-23 mm,0mm) -- cycle;
\node[right] at ($(c1)!0.5!(c2)+ (-8mm,0)$) {POR QU\^E?};}
}

Any idea about how to get it done?

1
  • 3
    Please provide a complete MWE to make sure that your question receives the desired attention.
    – user121799
    Commented May 24, 2018 at 3:02

1 Answer 1

7

You could use before upper and before lower to insert subtitles.

MWE

\documentclass{article}
\usepackage{lipsum}
\usepackage{tcolorbox}

\newtcolorbox{openningbox}{
    frame empty,
    arc = 8pt,
    lower separated = false,
    before upper = \tcbsubtitle{O QU\^E?},
    before lower = \tcbsubtitle{POR QU\^E?},
    font upper = \sffamily,
    font lower = \sffamily,
    sharp corners = north,
    subtitle style = {
      frame empty,
      fontupper = \sffamily\bfseries,
      colback = cyan!90!black,
      coltext = black!70,
      width = 3cm,
      arc = 8pt,
      rounded corners = east
    }
  }

\begin{document}

\begin{openningbox}{}
  \lipsum*[1]
  \tcblower
  \lipsum*[2]
\end{openningbox}

\end{document}

enter image description here

1
  • Thank you! I didn't know 'before upper' and 'before lower'! Commented May 24, 2018 at 19:16

You must log in to answer this question.

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