我有这个:
\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}
我该如何创建它?:
\tikzstyle{X} = [....]
为此:
\draw [X] (a) --{hello} (b);
并产生这个:
非常感谢
答案1
我必须移除[auto]
才能使文本越过虚线。如果这不是必需的,您可以将其放[auto]
回去。
\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}