因此,我在 tikz 项目中绘制了状态和节点。现在我想让我的节点的文本看起来更小,并进入节点的中间。此外,如何更改文本和节点颜色?
我的节点代码:
\documentclass{article}
\usepackage{verbatim}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\usepackage{iftex}
\ifPDFTeX
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\else
\ifXeTeX
\usepackage{xltxtra}
\else
\usepackage{luatextra}
\fi
\defaultfontfeatures{Ligatures=TeX}
\fi
\usetikzlibrary{positioning}
\tikzset{
state/.style={
rectangle,
rectangle split,
rectangle split parts=2,
rectangle split part fill={red!30,blue!20},
rounded corners,
draw=black, very thick,
minimum height=4em,
inner sep=3pt,
text width=3cm,
text centered,
},
}
\begin{document}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=4cm,
semithick]
\node[state] (A) {};
\node[state] (B) [below right of=A]{};
\node[state] (C) [right of=B] {};
....
\path (A) edge node {}(D)
(B) edge node {OK} (E)
edge [bend right]node {Error} (F)
(C) edge node {OK} (E)
edge node {} (F)
(D) edge [bend right] node {Error} (F)
edge node {OK} (E)
(E) edge node {} (B)
edge [bend left]node {>}(C)
edge node{}(G)
(F) edge [loop above]node{Error}(F)
edge node{OK}(E)
(G) edge [bend right] node{Error}(F);
\end{tikzpicture}
提前致谢。