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 trying to draw an automata using tikz package, and i want to decrease the size of node and labels on each edge , im have trying to put the option [scale=0.5] but it doesn't work ! I have :

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


 \begin{document}


\begin{tikzpicture}[shorten >=1pt, node distance=2.5cm, on grid, auto,thick,initial text=,scale=0.3]
 \node[state, initial]            (0)                          {0};
 \node[state]                     (1)   [above right =of 0]    {1};
 \node[state]                     (2)   [right =of 0]          {2};
 \node[state,accepting]           (3)   [right =of 2]          {3};



 \path[->]      (0)  edge       node           {a:a / 1.61}   (1)
             (0)  edge       node           {b:b/ 0.22}   (2)
             (2)  edge       [loop below]  node         {b:a/ 0.69}   ()
             (2)  edge       node           {b:a/ 0.69}   (3);

 \end{tikzpicture}
\end{document}

this give me a not pretty picture : enter image description here

share|improve this question
1  
I think you can refer to How to reduce font size in tikz nodes. –  Claudio Fiandrino Jun 15 '12 at 12:56
1  
And the "inner sep" property. \draw[inner sep=x]. –  utdiscant Jun 15 '12 at 12:58
add comment

2 Answers

up vote 9 down vote accepted
\documentclass{article} 
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,automata,shadows,fit,shapes}


 \begin{document}


\begin{tikzpicture}[shorten >=1pt, node distance=2.5cm, on grid, auto,thick,initial text=,scale=0.3]
 \node[state, initial]            (0)                          {0};
 \node[state]                     (1)   [above right =of 0]    {1};
 \node[state]                     (2)   [right =of 0]          {2};
 \node[state,accepting]           (3)   [right =of 2]          {3};



 \begin{scope}[every node/.style={scale=.5}]
     \path[->]   (0)  edge       node           {a:a / 1.61}   (1)
                 (0)  edge       node           {b:b/ 0.22}   (2)
                 (2)  edge       [loop below]  node         {b:a/ 0.69}   ()
                 (2)  edge       node           {b:a/ 0.69}   (3);  
 \end{scope}


 \end{tikzpicture}
\end{document} 

enter image description here

share|improve this answer
    
thank u and how about the size of node ? –  Wassim Sboui Jun 15 '12 at 13:27
1  
For the nodes, I think the library automata fixes some dimensions, you need to add something like minimum size=4ex after state or/and initial : \node[state,minimum size=4ex]. Perhaps you can redefine the options state, etc. –  Alain Matthes Jun 15 '12 at 13:56
    
\node[state,minimum size=4ex] works ! –  Wassim Sboui Jun 15 '12 at 14:07
add comment

[en] For my part, when it comes to plot a graph, I prefer to note all distances in ems which allows, by changing locally the size of the font to change the graph size

[fr] pour ma part, lorsqu'il s'agit de tracer un graphe, je préfère noter toutes les distances en em ce qui permet, en changeant localement la taille de la font de modifier la taille du graphe

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


 \begin{document}


 {\tiny
 \begin{tikzpicture}[shorten >=1pt, node distance=5em ,auto,thick,initial text=,]
 \node[state, initial]            (0)                          {0};
 \node[state]                     (1)   [above right =of 0]    {1};
 \node[state]                     (2)   [right =of 0]          {2};
 \node[state,accepting]           (3)   [right =of 2]          {3};



 \path[->]      (0)  edge       node           {a:a / 1.61}   (1)
             (0)  edge       node           {b:b/ 0.22}   (2)
             (2)  edge       [loop below]  node         {b:a/ 0.69}   ()
             (2)  edge       node           {b:a/ 0.69}   (3);

 \end{tikzpicture}
 }

 {\small
 \begin{tikzpicture}[shorten >=1pt, node distance=5em ,auto,thick,initial text=,]
 \node[state, initial]            (0)                          {0};
 \node[state]                     (1)   [above right =of 0]    {1};
 \node[state]                     (2)   [right =of 0]          {2};
 \node[state,accepting]           (3)   [right =of 2]          {3};



 \path[->]      (0)  edge       node           {a:a / 1.61}   (1)
             (0)  edge       node           {b:b/ 0.22}   (2)
             (2)  edge       [loop below]  node         {b:a/ 0.69}   ()
             (2)  edge       node           {b:a/ 0.69}   (3);

 \end{tikzpicture}
 }

 {\Large
  \begin{tikzpicture}[shorten >=1pt, node distance=5em ,  auto,thick,initial text=,]
 \node[state, initial]            (0)                          {0};
 \node[state]                     (1)   [above right =of 0]    {1};
 \node[state]                     (2)   [right =of 0]          {2};
 \node[state,accepting]           (3)   [right =of 2]          {3};



 \path[->]      (0)  edge       node           {a:a / 1.61}   (1)
             (0)  edge       node           {b:b/ 0.22}   (2)
             (2)  edge       [loop below]  node         {b:a/ 0.69}   ()
             (2)  edge       node           {b:a/ 0.69}   (3);

 \end{tikzpicture}
 }


\end{document}

enter image description here

share|improve this answer
add 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.