[Tex/LaTex] pdflatex and pstricks


Sometimes ago I wrote a style file for drawing GANNT charts with pstricks. I typically compile my code with latex+dvips+ps2pdf, and everything works fine.
However, I am now preparing a presentation where I also need to include a lot of jpg and png files, and I do not want to convert all of them into eps. So, I have to use pdflatex.

However, my style does not work with pdflatex. I tried to include packages:


and also


But I always get this error:

! LaTeX Error: \begin{pspicture} on input line 469 ended by \end{RTGrid}.

The problem is that I define an environment \begin{RTGrid} \end{RTGRid}, which uses pspicture inside. It looks like auto-pst-pdf cannot correctly expand my environment.
Does anybody has any clue on how to solve this?

Here is my style file rtsched.sty (I apologize if my coding style is not very good!):

\typeout{'rtsched' style for Latex and PSTricks}
\typeout{Easily draw real-time schedules in TeX/Latex.}
\typeout{(c) 2005, Giuseppe Lipari, Pisa, Italy (g.lipari@sssup.it)}
\typeout{Version 1.0}


% something removed here


    \begin{pspicture}(0,0)(\RTWindowLength,\hy) %
      %% draw grid (if not invisible)
   \xx = #1\sx
   \divide \xx by \RTXScale
   \advance \xx by \sx
    \xxx = #1\sx
    \divide \xxx by \RTXScale
    \advance \xxx by \sx

   \yy = -3\sy \multiply \yy by #1
   \advance \yy by \hy
   \yyy = \yy \advance \yyy by 2\sy
   \advance \xx by #4\sx
   \yyy = \yy \advance \yyy by \sy
   \advance \xx by \xxx \xx = .5\xx

And here is the example:


PS: since I removed many lines of code from rtsched.sty, it may be possible that after solving the error described in this post, other errors will pop up. However, it is important for me to go past this error!

Best Answer

That example cannot work because a lot of variables are not defined. The reason why I cannot test it.

However, try this:

      %% draw grid (if not invisible)