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!

  • 1
    give a complete example and not only fragments – user2478 Sep 27 '11 at 14:25
  • the example is quite long. I will try to isolate the error on a simple file, and get back to you. – knulp Sep 27 '11 at 14:31
  • ok, now is somehow simpler (but still many lines of code). Should I edit the question? – knulp Sep 27 '11 at 14:38
  • 1
    An alternative approach would be to create the chart as a single page postscript file (with no page number). Then use ps2eps to add a bounding box, and finally use epstopdf to create a pdf for inclusion in your presentation. This is likely to be a lot simpler than getting auto-pst-pdf to work with your code. – Ian Thompson Sep 27 '11 at 15:08
  • @IanThompson I will consider your suggestion. However, I would first like to see if there is a direct solution. (I can also convert all those jpg and png into eps...) – knulp Sep 27 '11 at 15:12

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)
| improve this answer | |
  • It does not work. Try this link for the whole file: retis.sssup.it/~lipari/rtsched.sty – knulp Sep 27 '11 at 16:05
  • To conclude: the problem was the use of \begin{pspicture}. I substituted it with \pspicture, and the corresponding closing with \endpspicture, and it works. Do you know why this happens? – knulp Sep 27 '11 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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