views:

161

answers:

1

If you take a look at http://www.texample.net/tikz/examples/boxes-with-text-and-math/ the boxes there are with rounded corners. In the examples, both the box itself and the title is a box. I want the title box to not have the bottom corners rounded.

On page 120 in the manual, there is a description of how to draw with and without rounded corners. However, I want to use this in a fancytitle. It looks a bit silly to have the fancytitle as a box where all corners are rounded when it is as wide as the box itself.

  \begin{tikzpicture}[baseline=-2cm]
    \node [mybox] (box){
      \begin{minipage}[t!]{0.50\textwidth}
        Help, I'm a box
      \end{minipage}
    };
    \node[fancytitle, text width=0.5423\textwidth, text centered, rounded corners] at (box.north) {Help, I'm a title};
  \end{tikzpicture}

The style I use is this

  \tikzstyle{mybox} = [draw=red, fill=blue!20, very thick,
    rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
  \tikzstyle{fancytitle} = [fill=red, text=white]
+2  A: 

Possibly the most simple way to achieve the effect (with out solving the problem) is as follows.

Add name=title to the title node.

then draw a line along the bottom of the title node.

\draw [draw=red,line width=2pt] (title.south west) -- (title.south east);

This gives two little spots where the line over shoots, to fix this you can add.

\usetikzlibrary{calc}

And move make the line 1 point shorter at each end, and up a bit.
\draw [draw=red,line width=2pt] ($(title.south west)+(+1pt,+1pt)$) -- ($(title.south east)+(-1pt,+1pt)$) ;

Niall Murphy
That worked perfectly. :)
Christian Jonassen