4

I am trying to draw a picture like the following in a Latex document file.

I have tried to use Xfig, but when I want to draw a line it does not stop. I mean, there is no end point for the line (I use mac).

My question is that is there a program, which is compatible with mac and the pictures can be be exported to a Latex file, to draw a pictures like the following?

Or is there any way to draw it in xfig?

Any Picture like this

7
  • 3
    See here: texample.net/tikz/examples/tag/graphs
    – Sigur
    Feb 4, 2014 at 21:35
  • @Sigur, thank you for your comment, what I wanted is that to import a kind of free hand draw to a latex document. I need a program to do this drawing.
    – Math757
    Feb 4, 2014 at 21:42
  • If you want to import a raster, take a look at potrace. Feb 4, 2014 at 21:43
  • But you can draw it in a separate file and then include it.
    – Sigur
    Feb 4, 2014 at 21:43
  • @Sigur but this would not be as professional as pictures in, for example, this paper.
    – Math757
    Feb 4, 2014 at 21:49

1 Answer 1

6

This is a solution using automata library that one can plot finite state showing signals/state changes. Here a style is defined for states.

enter image description here

Code:

\documentclass[border=10pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{automata,arrows,positioning,calc}

\begin{document}
\tikzset{state/.style = {
        draw,fill,
        circle,
        inner sep=0pt,
        outer sep=0pt,
        minimum size=2pt
    }}
\begin{tikzpicture}[thick,->,>=stealth', node distance=2cm,semithick]
\node[state] (1) {};
\node[state] (2) [right =2cm of 1] {};
\node[state] (3) [right =2cm of 2] {};
\node[state] (4) [below of =3] {};
\node[state] (5) [left =3cm of 4] {};


\draw[-] (1) -- (2) -- (3)  -- ++(1,0) |- (4) -- (5) -- ++(-2,0) |- (1);
\path    (1) edge [bend left]  node[]{}(4) 
         (4) edge [bend left]  node[]{}(1)
         (3) edge [bend left]  node[]{}(2) 
         (3) edge [loop below] node[]{}(3)
         (5) edge [loop above] node[]{}(5);
\end{tikzpicture}
\end{document}
4
  • Welcome @Math757.
    – Jesse
    Feb 4, 2014 at 22:47
  • Sorry! Is there any way to make it less curve?(form the first node of the top to the second node of the bottom)
    – Math757
    Feb 4, 2014 at 22:58
  • 1
    @Math757 you can use a value for the bending; replace (4) edge [bend left] node[]{}(1) with (4) edge [bend left=20] node[]{}(1) change 20 to the desired value. Feb 4, 2014 at 23:03
  • I was thinking of in/out=<angle> and for example (1) edge [out=-5,in=140] node[]{}(4). But @GonzaloMedina's comment will work too.
    – Jesse
    Feb 4, 2014 at 23:08

You must log in to answer this question.

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