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.

This is my code:

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

\begin{document}

\begin{tikzpicture}[shorten >=1pt,auto,node distance=7 cm, scale = 0.6, transform shape]

      \node[initial,state] (A)                      {$e, n, s$};
      \node[state]         (B) [right of=A]         {$w, (p+1)\%W, (p+1)\%N$};
      \node[state]         (C) [below of=A]     {$(q+1)\%W, n, x$};



\end{tikzpicture}

\end{document}

This is the following output:

enter image description here

How can I make all of them of same size? how to draw ellipse instead such that it doesn't look that big?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

It is possible to define a state elliptic, for example by means of:

\tikzset{elliptic state/.style={draw,ellipse}}

The ellipse requires the library shapes.geometric.

Code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,shapes.geometric,arrows,fit,calc,positioning,automata,}

\begin{document}
\tikzset{elliptic state/.style={draw,ellipse}}
\begin{tikzpicture}[shorten >=1pt,auto,node distance=7 cm, scale = 0.6, transform shape]

      \node[initial,elliptic state] (A)                      {$e, n, s$};
      \node[elliptic state]         (B) [right of=A]         {$w, (p+1)\%W, (p+1)\%N$};
      \node[elliptic state]         (C) [below of=A]     {$(q+1)\%W, n, x$};

\end{tikzpicture}

\end{document}

Result:

enter image description here


To have nodes of the same size you can specify which are the minimum width and height of the shape, but beware that ultimately this depends of the width of your text.

The example:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,shapes.geometric,arrows,fit,calc,positioning,automata,}

\begin{document}
\tikzset{elliptic state/.style={draw,ellipse,minimum width=6cm,minimum height=1.5cm}}
\begin{tikzpicture}[shorten >=1pt,auto,node distance=7 cm, scale = 0.6, transform shape]

  \node[initial,elliptic state] (A)                      {$e, n, s$};
  \node[elliptic state]         (B) [right of=A]         {$w, (p+1)\%W, (p+1)\%N$};
  \node[elliptic state]         (C) [below of=A]     {$(q+1)\%W, n, x$};

\end{tikzpicture}

\end{document}

Result:

enter image description here

share|improve this answer
    
Thanks a lot :). Is there some way to make all these nodes of the same size? –  tikzlearner Oct 5 '12 at 10:54
    
Do you mean like my last update? –  Claudio Fiandrino Oct 5 '12 at 11:28
    
Ya. Thanks again :) –  tikzlearner Oct 5 '12 at 11:56
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.