TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
See here: texample.net/tikz/examples/tag/graphs – Sigur Feb 4 '14 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 '14 at 21:42
If you want to import a raster, take a look at potrace. – Sean Allred Feb 4 '14 at 21:43
But you can draw it in a separate file and then include it. – Sigur Feb 4 '14 at 21:43
@Sigur but this would not be as professional as pictures in, for example, this paper. – Math757 Feb 4 '14 at 21:49
up vote 6 down vote accepted

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




\tikzset{state/.style = {
        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);
share|improve this answer
That is very nice! Thank you :) – Math757 Feb 4 '14 at 22:44
Welcome @Math757. – Jesse Feb 4 '14 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 '14 at 22:58
@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. – Gonzalo Medina Feb 4 '14 at 23:03
Thank you again... – Math757 Feb 4 '14 at 23:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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