![如何在节点中写入较小的文本以及如何更改节点颜色](https://linux22.com/image/331059/%E5%A6%82%E4%BD%95%E5%9C%A8%E8%8A%82%E7%82%B9%E4%B8%AD%E5%86%99%E5%85%A5%E8%BE%83%E5%B0%8F%E7%9A%84%E6%96%87%E6%9C%AC%E4%BB%A5%E5%8F%8A%E5%A6%82%E4%BD%95%E6%9B%B4%E6%94%B9%E8%8A%82%E7%82%B9%E9%A2%9C%E8%89%B2.png)
因此,我在 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}
提前致谢。