5

My goal is to have an image created with gastex and include an image (a png,jpg,pdf,.. image) into the gastex one. For example, draw an automaton with a smiley picture in a state.

I've read around about including images using latex+dvipdf. From what I've seen (here) it's not possible to include images using these two tools. My problem is that gastex compiles only with these two tools and not with pdflatex. So I'm stuck..

This is my code (red-x.jpg is a standard jpg image):

\documentclass{beamer}
\usepackage{gastex}
\usepackage{graphicx}

\begin{document}
\begin{frame}
\begin{picture}(40,20)(-25,-28) 
\gasset{Nw=6,Nh=6,Nmr=10} %nWidth nHeight
\node(A)(25,0){} 
\node[linewidth=0.4,linecolor=orange](B)(12,-10){}
\end{picture}
\begin{figure}
\includegraphics{red-x.jpg}
\end{figure}
\end{frame}
\end{document}

In order to compile with latex+dvipdf you need to use: \includegraphics[bb=0 0 20 20]{red-x.jpg}. Using xelatex, the gastex image does not show and only the red-x shows.

Suggestion?

Guy
  • 1,223
  • use xelatex instead –  Jun 04 '12 at 20:51
  • xelatex doesn't compile my gastex image. I.e., the image appears with no lines/nodes/... I'm using Ubuntu if it helps.. – Guy Jun 04 '12 at 21:02
  • give a complete and minimal example –  Jun 04 '12 at 21:08
  • added an example to the question – Guy Jun 04 '12 at 21:22
  • I get many errors such as ** WARNING ** Interpreting PS code failed!!! Output might be broken!!!, when compiling with xelatex. – egreg Jun 04 '12 at 21:59
  • I get the same warning. When using latex+dvipdf I get GPL Ghostscript 8.71: Unrecoverable error, exit code 1 and a stack trace which is not informative. – Guy Jun 05 '12 at 08:23
  • @Guy I suspect that gastex is not compatible with XeLaTeX, because it uses low level specials that xdvipdfmx can't understand. – egreg Jun 05 '12 at 10:31

2 Answers2

3

Try using jpeg2ps to convert red-x.jpg into an eps file (note that this is not a 'true' conversion; it just puts a postscript wrapper around the bitmap image). Using your example with

\includegraphics[width=4cm]{red-x.eps}

worked for me.

Ian Thompson
  • 43,767
2

gastex uses it's own interface to PostScript which is far different to what PSTricks does. However, with a simple trick we can get it run. We load pstricks to get a clean interface to auto-pst-pdf and put the gastex image into a pspicture environment.

\documentclass{beamer}
\usepackage{auto-pst-pdf}
\usepackage{pstricks}
\usepackage{gastex}

\begin{document}

\begin{frame}
\psset{unit=1pt}
\fbox{\begin{pspicture}(0,-10)(40,20) 
\pstheader{gastex.pro}
\gasset{Nw=6,Nh=6,Nmr=10} %nWidth nHeight
\node(A)(25,0){} 
\node[linewidth=0.4,linecolor=orange](B)(12,-10){}
\end{pspicture}}

\begin{figure}
\includegraphics[width=2cm]{tiger}
\end{figure}
\end{frame}
\end{document}

run the example with pdflatex -shell-escape <file> and it will create the following output:

enter image description here

  • Thanks for the reply. It seems from the votes-up that your solution works, but I rather not move to pdflatex in this presentation. – Guy Jun 05 '12 at 11:36