我现在对 Petri 网的印象是
问题:'条'(灰色)太高,尽管minimum height=0.1mm
(似乎没有任何效果)。是否可以将这些灰色矩形变得更薄?
代码是(不需要阅读全部内容,只需查看两条注释):
\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,automata,positioning,calc,patterns,petri}
\begin{document}
\begin{tikzpicture}[node distance=1.3cm,>=stealth',bend angle=45,auto]
\tikzstyle{place}=[circle,thick,draw=blue!75,fill=blue!20,minimum size=6mm]
\tikzstyle{red place}=[place,draw=red!75,fill=red!20]
\tikzstyle{transition}=[rectangle, % <------Can we make them thinner?
thick,
draw=black!75,
fill=black!25,
minimum height=0.1mm, %<------------------ this doesn't help
minimum width=8mm,
rounded corners]
\tikzstyle{every label}=[red]
\node [place,tokens=1] (start) {$start$};
\node [transition] (start_to_start_q0) [below left of=start] {};
\node [transition] (start_to_q0_ok) [below right of=start] {};
\node [place] (q0) [below of=start_to_start_q0] {$q_0$};
\node [place] (ok) [below of=start_to_q0_ok] {$ok$};
\node [place] (q) [below left of=q0] {$q$};
\node [transition] (from_q_ok) [below right of=q] {};
\node [place] (qsa) [below left of=from_q_ok] {$q_{a!!}$};
\node [place] (a) [right of=qsa] {$a$};
\node [transition] (from_qsa_a) [below right of=qsa] {};
\node [place] (p) [right of=a] {$p$};
\node [transition] (from_a_p) [below right of=a] {};
\node [place] (qend) [below of=from_qsa_a] {$q'$};
\node [place] (pra) [below of=from_a_p] {$p_{a??}$};
\node [transition] (from_ok_pra) [right of=pra] {};
\node [place] (pend) [right of=from_ok_pra] {$p'$};
\path (start_to_start_q0)
edge [pre,bend right] (start)
edge [post] (start)
edge [post] (q0);
\path (start_to_q0_ok)
edge [pre] (start)
edge [post] (q0)
edge [post] (ok);
\path (from_q_ok)
edge [pre] (q)
edge [pre] (ok)
edge [post] (qsa)
edge [post] (a);
\path (from_qsa_a)
edge [pre] (qsa)
edge [pre] (a)
edge [post] (qend)
edge [post] (ok);
\path (from_a_p)
edge [pre] (a)
edge [pre] (p)
edge [post] (pra)
edge [post] (a);
\path (from_ok_pra)
edge [pre] (ok)
edge [pre] (pra)
edge [post] (ok)
edge [post] (pend);
\end{tikzpicture}
\end{document}
答案1
节点inner sep
选项是节点填充,用于确保节点文本和节点边框之间的空间。通过将其设置为零,您可以根据minimum height
需要控制节点高度。
此代码:
\tikzstyle{transition}=[rectangle,
thick,
draw=black!75,
fill=black!25,
minimum height=1mm,
minimum width=8mm,
rounded corners,
inner sep=0]
节点高度为 1 毫米,但圆角现在看起来很奇怪。也许这是另一个问题。