My current picture of a Petri net is below

The problem: the 'bars' (in grey) are too tall, although minimum height=0.1mm (seems doesn't have any effect). Is it possible to make these grey rectangles even thinner?

The code is (no need to read the whole, just look into two comments):


\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?
          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);    


  • Welcome to TeX.SX! Please make your code compilable, starting with \documentclass{...} and ending with \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to help you. Help them help you: remove that one hurdle between you and a solution to your problem. – jub0bs Sep 30 '13 at 18:41
  • Sorry - I gave up half way through an answer. -Too much code, where only a small part is nedded, and it is not compileable. I think you need to look at inner sep option. – hpekristiansen Sep 30 '13 at 18:48
  • 1
    Yes - If you add inner sep=0 to your nodes, then you can control the heigth with minimum height. But be aware, that the rounded corners will look strange with a very small height. – hpekristiansen Sep 30 '13 at 19:00
  • @Hans-PeterE.Kristiansen i would accept your comment as an answer, but cannot.) rounded corners are not an issue -- i removed them. thaanks! – Ayrat Sep 30 '13 at 19:09

The inner sep node option is a node padding, that insures space between node text and node border. By setting it to zero, you can control the node height with minimum height as wished.

This code:

          minimum height=1mm,
          minimum width=8mm,
          rounded corners,
          inner sep=0]

1 mm nodes

gives 1 mm high nodes, but the rounded corners now look odd. Maybe that is an issue for an other question.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.