Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

As shown in the working example below, I have red box around all the boxes. I want to label the box but I couldn't manage to do it. I tried to use some of the ways in given in the tikz examples but I was also unsuccessful. Could anybody please help me with this ? Thanks in advance.

\documentclass[a4paper,11pt,twoside]{report}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{amsmath, graphicx, tikz, enumerate, amssymb, pgf}
\usepackage{fancyhdr}
\usepackage{cite}
\usepackage{setspace}
\usepackage{pgfplots}
\usepackage{slashbox}
\usepackage{bchart}
\usepackage{float}
\restylefloat{table}
\usepackage{caption}
\raggedbottom
\usepackage[bottom]{footmisc}


\usetikzlibrary{trees}

\usetikzlibrary{arrows,automata}

\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols,automata}

\tikzset{
 >=stealth',
 punktchain/.style={
 rectangle, 
 rounded corners, 
% fill=black!10,
draw=black, very thick,
text width=10em, 
minimum height=3em, 
text centered, 
on chain},
 line/.style={draw, thick, <-},
  element/.style={
    tape,
    top color=white,
    bottom color=blue!50!black!60!,
    minimum width=8em,
      draw=blue!40!black!90, very thick,
      text width=10em, 
      minimum height=3.5em, 
      text centered, 
      on chain},
      every join/.style={->, thick,shorten >=1pt},
      decoration={brace},
      tuborg/.style={decorate},
      tubnode/.style={midway, right=2pt},
      every rectangle node/.style={color=black,thick}
    }

  \begin{document}

   \begin{tikzpicture}
     [node distance=.5cm,
      start chain=going below,]
        \node[punktchain, join] (timing) {Timing Solver};
        \node[punktchain, join] (solver)      {Solver};
        \node[punktchain, join] (impl)      {SolverImpl};
        \node[punktchain, join] (stp) {STPSolver};
        \node[punktchain, join, ] (stpimpl) {STPSolverImpl};

        \draw[tuborg, decoration={brace}] let \p1=(solver.north), \p2=(impl.south) in
        ($(2.5, \y1)$) -- ($(2.5, \y2)$) node[tubnode] {*};

      \draw[red,thick,dashed] ($(timing.north west)+(-1,0.3)$)  rectangle    ($(stpimpl.south     east)+(1,-0.2)$); 


 \end{tikzpicture}

 \end{document}
share|improve this question
    
Where do the label should go? –  Gonzalo Medina Aug 12 '12 at 1:38
    
Probably on top or below is the best place –  Cemre Aug 12 '12 at 10:23

1 Answer 1

up vote 5 down vote accepted

If I understand your question correctly, you can use the current bounding box to place a node containing the label:

\documentclass[a4paper,11pt,twoside]{report}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{amsmath, graphicx, tikz, enumerate, amssymb, pgf}
\usepackage{fancyhdr}
\usepackage{cite}
\usepackage{setspace}
\usepackage{pgfplots}
\usepackage{slashbox}
\usepackage{bchart}
\usepackage{float}
\restylefloat{table}
\usepackage{caption}
\raggedbottom
\usepackage[bottom]{footmisc}


\usetikzlibrary{trees}

\usetikzlibrary{arrows,automata}

\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols,automata}

\tikzset{
 >=stealth',
 punktchain/.style={
 rectangle, 
 rounded corners, 
% fill=black!10,
draw=black, very thick,
text width=10em, 
minimum height=3em, 
text centered, 
on chain},
 line/.style={draw, thick, <-},
  element/.style={
    tape,
    top color=white,
    bottom color=blue!50!black!60!,
    minimum width=8em,
      draw=blue!40!black!90, very thick,
      text width=10em, 
      minimum height=3.5em, 
      text centered, 
      on chain},
      every join/.style={->, thick,shorten >=1pt},
      decoration={brace},
      tuborg/.style={decorate},
      tubnode/.style={midway, right=2pt},
      every rectangle node/.style={color=black,thick}
    }

  \begin{document}

   \begin{tikzpicture}
     [node distance=.5cm,
      start chain=going below,]
        \node[punktchain, join] (timing) {Timing Solver};
        \node[punktchain, join] (solver)      {Solver};
        \node[punktchain, join] (impl)      {SolverImpl};
        \node[punktchain, join] (stp) {STPSolver};
        \node[punktchain, join, ] (stpimpl) {STPSolverImpl};

        \draw[tuborg, decoration={brace}] let \p1=(solver.north), \p2=(impl.south) in
        ($(2.5, \y1)$) -- ($(2.5, \y2)$) node[tubnode] {*};

      \draw[red,thick,dashed] ($(timing.north west)+(-1,0.3)$)  rectangle    ($(stpimpl.south     east)+(1,-0.2)$); 

      \node[anchor=south] at (current bounding box.north) {Some Text};
 \end{tikzpicture}

 \end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.