[OS X TeX] FSA via TikZ

David Watson dewatson at me.com
Tue Dec 30 21:05:22 EST 2008


Perhaps this is what you want?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,automata,positioning}

\begin{document}
\begin{center}
  \begin{tikzpicture}[shorten >=1pt,node distance=1in,on grid,auto,
    initial text=]
    \node[state,initial]      (q1)               {$q_1$};
    \node[state,accepting]    (q2) [right=of q1] {$q_2$};
    \node[state]              (q3) [right=of q2] {$q_3$};
    \path[->]
    (q1) edge [loop above] node {0} ()
    edge node {1} (q2)
    (q2) edge [loop above] node {1} ()
    edge [bend left] node {0} (q3)
    (q3) edge [bend left] node {0,1} (q2);
  \end{tikzpicture}
\end{center}
\end{document}

On Dec 30, 2008, at 6:40 PM, Art Werschulz wrote:

> Hi.
>
> I'm asymptotically approaching what I want here.  However, I have  
> one problem with the following example:
>
> \documentclass{article}
> \usepackage{tikz}
> \usetikzlibrary{arrows,automata,positioning}
>
> \begin{document}
> \begin{center}
>  \begin{tikzpicture}[shorten >=1pt,node distance=1in,on grid,auto,
>    initial text=]
>    \node[state,initial]      (q1)               {$q_1$};
>    \node[state,accepting]    (q2) [right=of q1] {$q_2$};
>    \node[state]              (q3) [right=of q2] {$q_3$};
>    \path[->]
>    (q1) edge [loop above] node {0} ()
>    edge node {1} (q2)
>    (q2) edge [loop above] node {1} ()
>    edge node [above right] {1} (q3)
>    (q3) edge node [below left] {0,1} (q2);
>  \end{tikzpicture}
> \end{center}
> \end{document}
>
> This gives a double-arrow from q2 to q3; the top is labelled with 0  
> and the bottom is labelled with 0,1.
> I want two arrows: one from q2 to q3, labelled with 0, and one from  
> q3 to q2, labelled with 0,1.
>
> How does one make this happen?
>
> Thanks.
>
> Art Werschulz
> 207 Stoughton Avenue, Cranford  NJ 07016-2838
> (908) 272-1146
>
>




More information about the MacOSX-TeX mailing list