2

consider the following code:

\documentclass{article}
\usepackage[version=0.96]{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,automata,petri}

  \tikzset{
  place/.style={
    circle,
    thick,
    draw=blue!75,
    fill=blue!20,
    minimum size=6mm
  },
  transition/.style={
    rectangle,
    thick,
    fill=black,
    minimum width=8mm,
    inner ysep=2pt
    }
  }            

\begin{document}

\begin{tikzpicture}[node distance=1.3cm,>=stealth',bend angle=45,auto]
    \node [place] (C) []     {C};
    \node [transition] (t4) [below left of=C,label=right:$t4$]     {};
    \node [place] (E) [below right of=t4]     {E};
    \draw [<-] (E.west) to [out=180,in=270] (t4);
    \draw [<-] (C.west) to [out=180,in=90] (t4);
\end{tikzpicture}

\end{document}

I would like to add a label to the two edges I created with the draw command. I know that there have already been some questions on this site regarding the labelling of edges in Tikz (eg, here and here) but these all use a different syntax for the draw command. I know I have to create an extra node in my draw command but unfortunately I failed to find the right the position for this within the draw command and I keep getting errors.

By the way, I am somewhat confused by the multiple syntactic variants of the draw command. Is there a good overview of its usage somewhere?

Thanks for your help!

0

1 Answer 1

1

May be this is what you want:

\documentclass{article}
\usepackage[version=0.96]{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,automata,petri}

  \tikzset{
  place/.style={
    circle,
    thick,
    draw=blue!75,
    fill=blue!20,
    minimum size=6mm
  },
  transition/.style={
    rectangle,
    thick,
    fill=black,
    minimum width=8mm,
    inner ysep=2pt
    }
  }

\begin{document}

\begin{tikzpicture}[node distance=1.3cm,>=stealth',bend angle=45,auto]
    \node [place] (C) []     {C};
    \node [transition] (t4) [below left of=C,label=right:$t4$]     {};
    \node [place] (E) [below right of=t4]     {E};
    \draw [<-] (E.west) to[out=180,in=270]node[pos=0.5,left]{here} (t4) ;
    \draw [<-] (C.west) to[out=180,in=90]node[pos=0.5,left]{here}  (t4);
\end{tikzpicture}

\end{document}

enter image description here

Adjust the pos key suitably and use left/right/above/below as you need.

The best source for these commands is the pgfmanual itself, IMO.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .