Graphics, Figures & Tablespst-pdf and gastex

Information and discussion about graphics, figures & tables in LaTeX documents.
benti
Posts: 42
Joined: Fri Mar 06, 2009 4:51 pm

pst-pdf and gastex

Post by benti »

Hi,

(I hope this is in the right forum; posting here because a related thread was posted here as well).

I'm running MiKTeX and TexNicCenter, I wonder if someone could help me with the following:

I want to use the gastex-package to draw automata. Gastex uses postscript, which makes it incompatible with pdftex. However, I really need to compile with pdftex, because I also want to use the microtype-package.

So, I included the pst-pdf-package in my preamble, and set up TexNicCenter according to the instructions I found in this thread: http://www.latex-community.org/forum/vi ... ?f=4&t=785. But, there is a problem:

Gastex requires that commands are embedded in a {picture}-environment, while pst-pdf requires the a {pspicture} to work properly. I tried to embed the former into the latter, but that doesn't work. Whatever I try, I keep ending up with a blank pdf, and pdftex complaining about the use of \special's.

Can anyone tell me where I'm going wrong? A working example is attached below.

thanks,
Niels

Code: Select all

%example automaton, taken from the gastex homepage
%to be compiled with pdftex, using the appropriate output profile as specified in Thorsten's post in the other thread
\documentclass{article}
\usepackage{gastex}
\usepackage{pst-pdf}
\usepackage{microtype} %not relevant now, but this is what it's all about

\begin{document}

\begin{center}
%\begin{postscript}     %a {postscript} shell around the {picture} environment does not work
\begin{picture}(85,33)(-20,-28)  %changing this to a {pspicture} environment causes gastex commands to stop working
\put(-20,-28){\framebox(85,33){}}
  \gasset{Nadjust=w,Nadjustdist=2,Nh=6,Nmr=1}
  \node[Nmarks=i](A)(0,0){idle}
  \node(B)(50,0){wait}
  \node(C)(50,-20){wait}
  \node[Nmarks=r](D)(0,-20){critical}
 
  \drawedge(A,B){req1:=true}
  \drawedge(B,C){turn:=2}
  \drawedge[syo=-1,eyo=-1](C,D){turn=1?}
  \drawedge[syo=1,eyo=1,ELside=r](C,D){req2=false?}
  \drawedge(D,A){req1:=false}
\end{picture}
%\end{postscript}
\end{center}

\end{document}

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

pst-pdf and gastex

Post by localghost »

The (auto-)pst-pdf package only works with the packages from the pstricks family (pst-xxx). I suggest either to translate the code to the pstricks or to the pgf/tikZ syntax. The latter one has a special library for drawing automata which is described in its manual. The examples should help with the first steps.


Best regards
Thorsten
benti
Posts: 42
Joined: Fri Mar 06, 2009 4:51 pm

Re: pst-pdf and gastex

Post by benti »

Thanks, Thorsten.

I feared that much... well, since that would mean re-coding my automata, I'll just generate pdfs of the graphics, cut them to size and include them as figures. Nasty unprofessional solution, but it works and is currently a better solution for me :)
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Re: pst-pdf and gastex

Post by phi »

Some features of the microtype package are usable for DVI output, too.
benti
Posts: 42
Joined: Fri Mar 06, 2009 4:51 pm

Re: pst-pdf and gastex

Post by benti »

Thanks for that comment phi.

For now, I am only interested in using microtype's default settings, which in my document already yield a considerable optical improvement when I compile to PDF with pdflatex. I am afraid I don't understand the microtype manual: can pdflatex also handle these default settings when spitting out dvi?

A related question: can anybody upload a TexNixCenter .tco-file with the appropriate settings for the compilation routine "pdflatex-> PS->PDF"? I am yet to find a good explanation online on how to set my own profiles in Texniccenter...

thanks heaps,
Niels
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Re: pst-pdf and gastex

Post by phi »

Just compile with latex instead of pdflatex to produce a DVI. pdfTeX is used in any case.
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

pst-pdf and gastex

Post by CrazyHorse »

Code: Select all

\documentclass{article}
\usepackage{gastex}
\usepackage{auto-pst-pdf}
\usepackage{microtype}

\begin{document}

\begin{center}
\begin{postscript}     %a {postscript} shell around the {picture} environment does not work
\special{header=gastex.pro}
\fbox{%
\begin{picture}(85,33)(-20,-28)  %changing this to a {pspicture} environment causes gastex commands to stop working
%\put(-20,-28){\framebox(85,33){}}
  \gasset{Nadjust=w,Nadjustdist=2,Nh=6,Nmr=1}
  \node[Nmarks=i](A)(0,0){idle}
  \node(B)(50,0){wait}
  \node(C)(50,-20){wait}
  \node[Nmarks=r](D)(0,-20){critical}

  \drawedge(A,B){req1:=true}
  \drawedge(B,C){turn:=2}
  \drawedge[syo=-1,eyo=-1](C,D){turn=1?}
  \drawedge[syo=1,eyo=1,ELside=r](C,D){req2=false?}
  \drawedge(D,A){req1:=false}
\end{picture}}
\end{postscript}
\end{center}

\end{document}
run it with pdflatex --shell-escape file
or for MiKTeX with pdflatex --enable-write18 file

Herbert
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

pst-pdf and gastex

Post by CrazyHorse »

localghost wrote:The (auto-)pst-pdf package only works with the packages from the pstricks family (pst-xxx). I suggest either to translate the code to the pstricks or to the pgf/tikZ syntax. The latter one has a special library for drawing automata which is described in its manual. The examples should help with the first steps.
pst-pdf works with _every_ package

Herbert
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

pst-pdf and gastex

Post by CrazyHorse »

benti wrote:Thanks for that comment phi.

For now, I am only interested in using microtype's default settings, which in my document already yield a considerable optical improvement when I compile to PDF with pdflatex. I am afraid I don't understand the microtype manual: can pdflatex also handle these default settings when spitting out dvi?

A related question: can anybody upload a TexNixCenter .tco-file with the appropriate settings for the compilation routine "pdflatex-> PS->PDF"? I am yet to find a good explanation online on how to set my own profiles in Texniccenter...
http://mirror.ctan.org/graphics/pstricks/pst-support/

Herbert
benti
Posts: 42
Joined: Fri Mar 06, 2009 4:51 pm

pst-pdf and gastex

Post by benti »

CrazyHorse wrote:
pst-pdf works with _every_ package

Herbert
Unfortunately not quite true, Herbert. It _really_ doesn't work with gastex. Unless you have a solution for the problem alluded to in the OP, in which case you have my thanks in advance.

best,
Niels
Post Reply