I would like to obtain a custom frame, which is different from the ones given by mdframed.

Here is the image comes from the package fancytikzposter, which consists in a minipage inside a tikzpicture environment.

This works great, but I can't create a figure in this frame since it is inside a tikzpicture environment.

Is there some solution for this, or any possibility to construct it outside the TikZ environment ?

Ideally, I am looking for something in the following form :

\begin{block}{Block title}


Here is (the graphical part of) the code producing this frame

  %% the content of the block
  \draw let \p1=($(#4)-(2.2,0)$),\p2=($(0,\blocktitleheight cm)-(0,0.5cm)$) in
  node[draw, anchor=north, color=blocktitlefillcolor, fill=blockfillcolor,
  text=blocktextcolor, framefour, rectangle]
  (box) at #1 {


  %% the title of the block
    \clip[rounded corners=20] ($(box.south west)+(0.01,0.01)$) rectangle
    ($(box.north east)-(0.01,0.01)$);

    \draw let \p1=($(#4)-(3.2,0)$),\p2=($(0,\blocktitleheight cm)-(0,0.4cm)$)%
    in node[anchor=bottom right corner, draw=none, %
    bottom color=blocktitlefillcolor, top color=blocktitlefillcolor!85!,
    text=blocktitletextcolor, rounded corners=20, inner xsep=1cm, %
    minimum height=\y2, minimum width=\x1, %
    shape=trapezium, shape border rotate=180, trapezium stretches=true]
    (boxtitle) at ($(box.north west)+(1.5,0)$) {\bf\LARGE #2}

    %% fading on top
    [preaction={path fading=south,fill=blocktitlefillcolor,opacity=.4},draw=none]
    ($(boxtitle.bottom right corner) - (3,\y2)$) rectangle
    ($(boxtitle.bottom left corner)+(3,0)$);

  %% decorative drawing on the title
  \begin{scope}[even odd rule]
    \clip[rounded corners=20] ($(boxtitle.bottom right corner)-(-0.2,0.2)$) --
    ($(boxtitle.bottom left corner) -(0.2,0.2)$) -- (boxtitle.top left corner)
    -- (boxtitle.top right corner) -- cycle %
    (box.south west) rectangle (box.north east) ;

    \draw[draw=none, rounded corners=20, %
    bottom color=blocktitlefillcolor, top color=blocktitlefillcolor!85!]
    ($(boxtitle.bottom right corner)-(0.5,0)$) --
    (boxtitle.bottom right corner) -- (boxtitle.top right corner) --
    ($(boxtitle.bottom right corner)+(3,0)$) --
    ($(boxtitle.bottom right corner)-(0.5,0)$)

    ($(boxtitle.bottom left corner)+(0.5,0)$) --
    (boxtitle.bottom left corner) -- (boxtitle.top left corner) --
    ($(boxtitle.bottom left corner)-(3,0)$) --
    ($(boxtitle.bottom left corner)+(0.5,0)$) ;

  • 2
    Is the width of the title variable? – Marco Daniel Jun 23 '13 at 14:11
  • I don't require it to be a constant. This was just an example frame ;) – Laurent Dudok de Wit Jun 23 '13 at 14:17
  • Not sure I understand the " I can't create a figure in this frame since it is inside a tikzpicture" comment. Also code snippets are useful in explanations, but it is always best to compose a fully compilable MWE that sets up the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Jun 23 '13 at 15:28

Here's one possibility using tcolorbox:



  enhanced standard,
  boxrule=0.4pt,titlerule=-0.2pt,drop fuzzy shadow,
  title style={top color=myblue!30,bottom color=myblue!0.5},
  overlay unbroken and first={
    ([xshift=5pt,yshift=-\pgflinewidth]frame.north west) to[out=0,in=180] ([xshift=20pt,yshift=-5pt]title.south west) -- ([xshift=-20pt,yshift=-5pt]title.south east) to[out=0,in=180] ([xshift=-5pt,yshift=-\pgflinewidth]frame.north east) -- cycle;
  center title,
  top=11pt,topsep at break=-5pt,



\begin{MyBlock}{Some Variable Width Block}

\begin{MyBlock}[.5\linewidth]{Some Title}


enter image description here

The MyBlock environment has a mandatory argument for the title, and an optional one for the width (default width=\linewidth).

And here's an idea of the same environment, but using this time the mdframed package (in its current form, only titles spanning no more than one line are allowed):



  \path[top color=myblue!30,bottom color=myblue!0.5,rounded corners]
    ([xshift=\pgflinewidth,yshift=-\pgflinewidth]O|-P) rectangle
    ([xshift=-\pgflinewidth,yshift=-20pt]P) -- cycle;
    ([xshift=5pt,yshift=-\pgflinewidth]O|-P.north west) to[out=0,in=180]
    ([xshift=20pt,yshift=-25pt]O|-P.north west) --
    ([xshift=-20pt,yshift=-25pt]P.south east) to[out=0,in=180]
    ([xshift=-5pt,yshift=-\pgflinewidth]P.north east) -- cycle;
  \path let \p1=(P), \p2= (O) in 
    node at ([yshift=-12pt]0.5*\x1+0.5*\x2,\y1) {\parbox{\dimexpr\mdf@userdefinedwidth@length-40pt\relax


\begin{MiBlock}{Some Variable Width Block}

\begin{MiBlock}[0.5\linewidth]{Some Title}


enter image description here

  • I need your path ;-) – Marco Daniel Jun 23 '13 at 16:53
  • @MarcoDaniel ooh another nice addition, maybe! – percusse Jun 23 '13 at 17:22
  • @user81566: You need an update of your TeX distribution. – Marco Daniel Jun 23 '13 at 17:28
  • 1
    @user81566 I've made some updated to my answer. – Gonzalo Medina Jun 23 '13 at 18:35
  • 2
    @GonzaloMedina Very nice solution! I just edited some lines of the tcolorbox example (if the peer reviewer approves it) to remove some spaces visible in high resolution; I did not exchange the picture since it's quite the same. I like this example and its solution very much :-) – Thomas F. Sturm Jun 24 '13 at 12: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.