Graphics, Figures & TablesAutomata with LaTeX

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
tonguim
Posts: 24
Joined: Fri Nov 06, 2009 4:32 pm

Automata with LaTeX

Post by tonguim »

Hi all,

I would like to draw some automata in a tex file.
I use the

Code: Select all

\usepackage{vaucanson-g} and
\usepackage{texlive-pstricks}
and have been required by my system to update the pstricks.sty file.
So I downloaded it from here PSTricks web site and according to this file, tried to update my tex directory as it is shown here:
dirtree.jpg
dirtree.jpg (35.62 KiB) Viewed 10916 times
After that, I tried to run the texhash command.

After that I tried to run my tex file by this command line

Code: Select all

xelatex --shell-escape tp1.tex
(as pdflatex doesn't works with vaucanson and pstricks package), but still have this error message:

Code: Select all

sun@localhost:~/Desktop/tp/tp1$ xelatex --shell-escape tp1.tex 
This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009/Debian)
 \write18 enabled.
entering extended mode
(./tp1.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, farsi, arabic, croatian, bulgarian, ukrainian, russian, czech, slov
ak, danish, dutch, finnish, french, basque, ngerman, german, german-x-2009-06-1
9, ngerman-x-2009-06-19, ibycus, monogreek, greek, ancientgreek, hungarian, san
skrit, italian, latin, latvian, lithuanian, mongolian2a, mongolian, bokmal, nyn
orsk, romanian, irish, coptic, serbian, turkish, welsh, esperanto, uppersorbian
, estonian, indonesian, interlingua, icelandic, kurmanji, slovenian, polish, po
rtuguese, spanish, galician, catalan, swedish, ukenglish, pinyin, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size12.clo))
(/usr/share/texmf-texlive/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texmf-texlive/tex/latex/answers/answers.sty
(/usr/share/texmf-texlive/tex/latex/tools/verbatim.sty))
(/usr/share/texmf-texlive/tex/generic/vaucanson-g/vaucanson-g.sty
(/usr/share/texmf-texlive/tex/latex/base/ifthen.sty)
(/usr/share/texmf/tex/latex/xcolor/xcolor.sty
(/etc/texmf/tex/latex/config/color.cfg)
(/usr/share/texmf-texlive/tex/xelatex/xetex-def/xetex.def))
(/usr/share/texmf-texlive/tex/generic/vaucanson-g/VCColor-names.def)
(/usr/share/texmf-texlive/tex/latex/pstricks/pstricks.sty
(/usr/share/texmf-texlive/tex/generic/pstricks/pstricks.tex
`PSTricks' v1.29  <2009/05/19> (tvz)
(/usr/share/texmf-texlive/tex/xelatex/xetex-pstricks/pstricks.con
(/usr/share/texmf-texlive/tex/generic/pstricks/xdvipdfmx.con))
(/usr/share/texmf-texlive/tex/xelatex/xetex-pstricks/pstricks.con
(/usr/share/texmf-texlive/tex/generic/pstricks/xdvipdfmx.con
Using PSTricks configuration for XeTeX+xdvipdfmx
)))) (/usr/share/texmf-texlive/tex/latex/pstricks/pst-node.sty
(/usr/share/texmf-texlive/tex/generic/pstricks/pst-node.tex  v1.01, 2008/11/26)
) (/usr/share/texmf-texlive/tex/latex/pstricks/pst-plot.sty
(/usr/share/texmf-texlive/tex/generic/pstricks/pst-plot.tex
(/usr/share/texmf-texlive/tex/generic/multido/multido.tex
 v1.41, 2004/05/18 <tvz>)  v1.04, 2009/06/08))
(/usr/share/texmf-texlive/tex/latex/pst-coil/pst-coil.sty
(/usr/share/texmf-texlive/tex/generic/pst-coil/pst-coil.tex  v1.04, 2009/06/08
(/usr/share/texmf-texlive/tex/generic/xkeyval/pst-xkey.tex
(/usr/share/texmf-texlive/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texmf-texlive/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texmf-texlive/tex/generic/xkeyval/keyval.tex))))))
(/usr/share/texmf-texlive/tex/latex/multido/multido.sty)
(/usr/share/texmf-texlive/tex/latex/pst-3d/pst-3d.sty
(/usr/share/texmf-texlive/tex/generic/pst-3d/pst-3d.tex
`PST-3d' v1.00, 2005/09/03 (tvz)))
(/usr/share/texmf-texlive/tex/latex/tools/calc.sty)
(/usr/share/texmf-texlive/tex/generic/vaucanson-g/Vaucanson-G.tex)
(/usr/share/texmf-texlive/tex/generic/vaucanson-g/VCPref-default.tex))

! LaTeX Error: File `texlive-pstricks.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 
This is my tex file:

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage{ifpdf}
\usepackage{answers}%\usepackage[nosolutionfiles]{answers}
\usepackage{vaucanson-g}
\usepackage{texlive-pstricks}

    \ifpdf

      % one of these two:
      \usepackage[pdftex]{graphicx}  % note the x at the end
      \usepackage[pdftex]{epsfig}

      % hyperref should be the last package loaded:
      \usepackage[pdftex]{hyperref}

    \else

      % one of these two:
      \usepackage[dvips]{graphicx}  % note the x at the end
      %\usepackage[dvips]{epsfig}

      % make the command \href from hyperref available as a 'print only'
      \newcommand{\href}[2]{#2}

    \fi

\begin{document}

%\begin{postscript}
\begin{VCPicture}{(0,-2)(6,2)}

% states
\State[p]{(0,0)}{A} \State{(3,0)}{B} \State[r]{(6,0)}{C}
% initial--final
\Initial{A} \Final{C}
% transitions
\EdgeL{A}{B}{a} \ArcL{B}{C}{b} \ArcL{C}{B}{b}
\LoopN{A}{a} \LoopS{C}{d}
%
\end{VCPicture}
%\end{postscript}

\end{document}
This is my latex version:

Code: Select all

pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian)
kpathsea version 5.0.0
Copyright 2009 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.2.42; using libpng 1.2.42
Compiled with zlib 1.2.3.3; using zlib 1.2.3.3
Compiled with poppler version 0.12.4
Any help to fix this problem will be very appreciate. Thank you.
Last edited by tonguim on Wed Feb 16, 2011 4:58 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Automata with LaTeX

Post by frabjous »

Simply remove the line that reads "\usepackage{texlive-pstricks}". The package is simply called "pstricks", not "texlive-pstricks", and you can tell from the log snippet that the pstricks package is already being loaded anyway, so there is no need to try to load it twice.

Works for me anyway.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Automata with LaTeX

Post by localghost »

Not a solution to the actual problem. Just a suggestion how to do that with pgf/tikZ.

Code: Select all

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{automata,positioning}

\begin{document}
  \begin{tikzpicture}[%
    >=stealth,
    shorten >=1pt,
    node distance=2cm,
    on grid,
    auto,
    state/.append style={minimum size=2em},
    thick
  ]
    \node[state] (A)              {$p$};
    \node[state] (B) [right of=A] {};
    \node[state] (C) [right of=B] {$r$};

    \path[->] (A) +(-1,0) edge (A)
              (A)         edge [loop above] node {$a$} ()
              (A)         edge              node {$a$} (B)
              (B)         edge [bend left]  node {$b$} (C)
              (C)         edge [bend left]  node {$b$} (B)
              (C)         edge [loop below] node {$d$} ()
              (C)         edge                         +(1,0);
  \end{tikzpicture}
\end{document}
Output in the attachment. Details in the package manual.


Thorsten
Attachments
The rendered output of the given code.
The rendered output of the given code.
tikz-automata.png (3.69 KiB) Viewed 10916 times
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

Automata with LaTeX

Post by CrazyHorse »

tonguim wrote: I would like to draw some automata in a tex file.

Any help to fix this problem will be very appreciate.
With xetex you do not need to load the package ifpdf and also the \ifpdf .\else..\fi. Simply use:

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage{vaucanson-g}
\begin{document}

\begin{VCPicture}{(0,-2)(6,2)}
\State[p]{(0,0)}{A} \State{(3,0)}{B} \State[r]{(6,0)}{C}
\Initial{A} \Final{C}
\EdgeL{A}{B}{a} \ArcL{B}{C}{b} \ArcL{C}{B}{b}
\LoopN{A}{a} \LoopS{C}{d}
\end{VCPicture}

\end{document}
and run it with "xetex file"


Herbert
Attachments
Rendered output of the given example.
Rendered output of the given example.
automata-pstricks.png (3.87 KiB) Viewed 10905 times
tonguim
Posts: 24
Joined: Fri Nov 06, 2009 4:32 pm

Re: Automata with LaTeX

Post by tonguim »

Hi all,

thank you for your answers. The solution to my problem was the answer given by Frabjous. I also removed the unuseful package ifpdf and also the \ifpdf \else as CrazyHorse said.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Automata with LaTeX

Post by localghost »

tonguim wrote:[…] The solution to my problem was the answer given by Frabjous. […]
Then please mark the topic (not the last post) accordingly as written in Section 3 of the Board Rules (to be read before posting). You are not new to the forum so you should know that. Please keep that in mind for the future.


Thorsten
tonguim
Posts: 24
Joined: Fri Nov 06, 2009 4:32 pm

Automata with LaTeX

Post by tonguim »

localghost wrote: Then please mark the topic (not the last post) accordingly as written in Section 3 of the Board Rules (to be read before posting). You are not new to the forum so you should know that. Please keep that in mind for the future.
Thorsten
I'm sorry. Before your post, I spend many times seeking how to mark the post as solved; I haven't seen yet where to click :|
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Automata with LaTeX

Post by localghost »

tonguim wrote:I'm sorry. Before your post, I spend many times seeking how to mark the post as solved; I haven't seen yet where to click :|
The rules actually can't be overlooked since they are placed on top of each forum in the »Announcements« section. Section 3 describes exactly what to do after a problem is solved. Post icons are displayed right above the input window.
Post Reply