2

I have this:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,arrows,calc,positioning}

\begin{document}
\tikzstyle{b} = [rectangle, draw, fill=blue!20, node distance=3cm, text 
 width=6em, text centered, rounded corners, minimum height=4em, thick]

  \tikzstyle{c} = [rectangle, draw, inner sep=0.5cm, dashed]
  \tikzstyle{l} = [draw, -latex',thick]

 \begin{tikzpicture}[auto]
  \node [b] (a) {hello};
  \node [b, below=of a] (b) {hello};

 \end{tikzpicture}
 \end{document}

How can I create this? :

 \tikzstyle{X} = [....]

In order to do this:

\draw [X] (a) --{hello} (b);

And produce this:

enter image description here

Thank you very much

Bernard
  • 271,350
Solid
  • 363

1 Answers1

4

I had to remove the [auto] to make the text go over the dashed line. If this is not a requirement, you can put the [auto] back on.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,arrows,calc,positioning}

\begin{document}
\tikzstyle{b} = [rectangle, draw, fill=blue!20, node distance=3cm, text 
 width=6em, text centered, rounded corners, minimum height=4em, thick]

  \tikzstyle{c} = [rectangle, draw, inner sep=0.5cm, dashed]
  \tikzstyle{l} = [draw, -latex',thick]

 \begin{tikzpicture}%[auto] <- commented this
  \node [b] (a) {hello};
  \node [b, below=of a] (b) {hello};
  \draw [dashed,thick] (a) -- (b) node [midway,fill=white] {hello};

 \end{tikzpicture}
 \end{document}

enter image description here