[Tex/LaTex] How to set the size of an empty rectangle node

tikz-pgf

I'm drawing Petri nets with TikZ. But, according to the style I've defined, transitions are rectangle nodes with a 1:1 ratio (squares, actually).

I'm very used to have more flat transitions, but I can't figure out how to set their default height. I've tried something using yscale, but this affects the distance between nodes.

\documentclass[a4paper, 12pt]{article}
\usepackage{tikz}
\usetikzlibrary{petri}
\tikzstyle{place}= [circle, draw=blue!50, fill=blue!20, thick, minimum size=0.6cm]
\tikzstyle{transition}= [rectangle, draw=black!50, fill=black!20, thick, minimum size=0.6cm]
\tikzstyle{pre}=    [<-, semithick]
\tikzstyle{post}=   [->, semithick]

\begin{document}
\begin{figure}[h]
\begin{center}
    \begin{tikzpicture}[node distance=2cm]
            \node[place] (p1){};
            \node[transition] (t1) [below of=p1]{}
                edge[pre] (p1);
            \node[place] (p2) [below of=t1]{};
            \node[transition] (t2) [below of=p2]{}
                edge[pre] (p2);
    \end{tikzpicture}
    \caption{Train n°1}
\end{center}
\end{figure}
\end{document}

Best Answer

Some thing like this?

\documentclass[a4paper, 12pt]{article}
\usepackage{tikz}
\usetikzlibrary{petri}
\tikzset{place/.style = {circle, draw=blue!50, fill=blue!20, thick, minimum size=0.6cm},
    transition/.style = {rectangle, draw=black!50, fill=black!20, thick, minimum width=0.6cm,
                        minimum height = 1cm},
    pre/.style =    {<-, semithick},
    post/.style =   {->, semithick}
}

\begin{document}
\begin{figure}[h]
\begin{center}
    \begin{tikzpicture}[node distance=2cm]
            \node[place] (p1){};
            \node[transition] (t1) [below of=p1]{}
                edge[pre] (p1);
            \node[place] (p2) [below of=t1]{};
            \node[transition] (t2) [below of=p2]{}
                edge[pre] (p2);
    \end{tikzpicture}
    \caption{Train n°1}
\end{center}
\end{figure}
\end{document}

enter image description here

minimum size sets both width and height to be equal so you get a square. Instead you can set width and height separately by minimum width=<dimen> and minimum height = <dimen>.

Related Question