# Making a stand-alone image with gastex

I want to do the following:

1. Make an image using gastex.
2. Compile the image to a stand-alone pdf image. I.e., at the end of this stage I'll have a myImage.pdf file.
3. Include my image in a large latex file.

The idea is that I like working with gastex but I want to compile my latex file with pdflatex. (I know there is a new feature of compiling gastex with pdflatex but I can't make it work so I prefer going this way.)

The problem with step (2) is that I don't know what should be the documentclass I should use. E.g., using \documentclass{article} produces a A4 page with the image on it. I want the file to contain only the image. Also, maybe there a way to do this with \documentclass{article} and with playing with the page sizes?

For some reason standalone doesn't work for me. This code passes latex but dvipdf crashes on it:

\documentclass{standalone}

\usepackage{gastex}

\begin{document}
\begin{picture}(100,10)(0,0)
\setlength{\unitlength}{3.5pt}
\gasset{Nw=5,Nh=5} %nWidth nHeight
\node[Nmarks=i,iangle=90](A1)(5,0){$s_1$}
\node(A2)(15,0){$s_2$}
\end{picture}
\end{document}

-
A first attempt should be with the standalone class. Can you give a simple example of a picture file? –  egreg Jun 10 '12 at 10:41
You can't use dvipdfm with gastex, only latex+dvips+ps2pdf –  egreg Jun 10 '12 at 11:13
I usually compile with latex+dvipdf and it works. Using latex+dvips+ps2pdf doesn't work on this code as well. (Fails in the last step) –  Guy Jun 10 '12 at 11:14
If the problems with standalone persist, you could always use article (don't forget \pagestyle{empty}) and postprocess with pdfcrop. –  Stephan Lehmke Jun 10 '12 at 11:25
This is a good solution. Do you want to post it as an answer so you could get credit? –  Guy Jun 10 '12 at 13:30

With this input file guy.tex

\documentclass{standalone}
\usepackage{gastex}

\begin{document}
\begin{picture}(200,200)(-100,-100)
\setlength{\unitlength}{3.5pt}
\gasset{Nw=5,Nh=5} %nWidth nHeight
\node[Nmarks=i,iangle=90](A1)(5,0){$s_1$}
\node(A2)(15,0){$s_2$}
\end{picture}
\end{document}


and the command line

simpdftex latex guy && pdfcrop guy.pdf


(simpdftex just uses latex+dvips+ps2pdf) I get the following guy-crop.pdf

With the command line

latex guy && dvipdf guy && pdfcrop guy.pdf


the output is similar (but wrong):

Notice the arrow tip. The (200,200)(-100,100) coordinates for picture are just for being sure the bounding box will contain the picture, so pdfcrop will find the right boundaries. It seems that gastex doesn't advertise the bounding box of what it's producing.

However, the page http://www.lsv.ens-cachan.fr/~gastin/gastex/index.php tells that version 2.9b6 (not on TeX Live) works with auto-pst-pdf and so is "compatible" with pdflatex.

-
simpdftex latex guy is failing for me. I get Error: /undefined in !BP, GPL Ghostscript 8.71: Unrecoverable error, exit code 1, and a stack trace. Can I supply any other information that might help? –  Guy Jun 10 '12 at 13:23
@Guy Operating system and TeX distribution? –  egreg Jun 10 '12 at 14:38
@Guy It doesn't work with standalone in TeX Live 2009 and 2010, unfortunately. Probably the article method is the way to go with such an old system. –  egreg Jun 10 '12 at 14:46
I'm using Ubuntu. And: pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian). So, it shouldn't work... –  Guy Jun 10 '12 at 16:48
@Guy: The v0.x standalone uses preview by default which seems cause the issue. The v1.x crop option however works. I heavily recommend you to install TeX Live yourself. See How to install “vanilla” TeXLive on Debian or Ubuntu? –  Martin Scharrer Jun 10 '12 at 19:45
show 1 more comment