Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
use xelatex instead –  Herbert Jun 4 '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 4 '12 at 21:02
    
give a complete and minimal example –  Herbert Jun 4 '12 at 21:08
    
added an example to the question –  Guy Jun 4 '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 4 '12 at 21:59

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
    
It works! Thanks a lot!! –  Guy Jun 5 '12 at 11:35

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

share|improve this answer
    
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 '12 at 11:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.