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?

7
  • use xelatex instead
    – user2478
    Jun 4, 2012 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 4, 2012 at 21:02
  • give a complete and minimal example
    – user2478
    Jun 4, 2012 at 21:08
  • added an example to the question
    – Guy
    Jun 4, 2012 at 21:22
  • I get many errors such as ** WARNING ** Interpreting PS code failed!!! Output might be broken!!!, when compiling with xelatex.
    – egreg
    Jun 4, 2012 at 21:59

2 Answers 2

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.

0
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

1
  • 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 5, 2012 at 11:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .