Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

1 Answer

up vote 5 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

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}
share|improve this answer
    
That is very nice! Thank you :) –  Math757 Feb 4 at 22:44
    
Welcome @Math757. –  Jesse Feb 4 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 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. –  Gonzalo Medina Feb 4 at 23:03
    
Thank you again... –  Math757 Feb 4 at 23:05
show 1 more comment

Your Answer

 
discard

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.