[pstricks] PSTricks vs. Beamer

Mike Daven daven at msmc.edu
Sat Apr 7 19:05:00 CEST 2007

pstricks-request at tug.org wrote:
>> From: Rolf Niepraschk <Rolf.Niepraschk at ptb.de>
>> Subject: Re: [pstricks] PSTricks vs. Beamer
>> You should try the following calls instead of using the script `ps4pdf':
>> latex beamer0.tex
>> dvips -o beamer0-pics.ps beamer0.dvi
>> ps2pdf beamer0-pics.ps
>> pdflatex beamer0.tex
> ------------------------------
> From: Herbert Voss <LaTeX at zedat.fu-berlin.de>
> Subject: Re: [pstricks] PSTricks vs. Beamer
> Mike,
> can you provide a script which works for you? Then we can put it
> to the list of the other scripts.

Here's what I have:

  rem This script is intended to turn LaTeX/Beamer files into PDF files
  rem (I needed something like this when using PSTricks)
  rem This script is based on ps4pdf.bat.w95 from the PSTricks website

  @echo off
  set FILE=%1
  latex %FILE%.tex
  dvips -o %FILE%-pics.ps %FILE%.dvi
  ps2pdf %File%-pics.ps
  pdflatex %File%.tex
  pdflatex %File%.tex

  rem The second call to 'pdflatex' brings in navigation elements

I have saved this as a file in my TeX tree.  I run this from a DOS prompt
-- I'm don't how to train my editor (Emacs) to recognize the script.

Some other savvy users could improve this script, including the following:

(1) My comments are sparse, since I don't know much about script speak. 
For example, I don't know what the "echo" or "set" lines do, and I don't
know why the "%.tex" at the end is for.  Also, being a klutz, I didn't
realize for a while that a script named "psFOOpdf" could do something
other than convert from PS to PDF!

(2) It would be nice if the messages were more detailed.  In my dos/cmd
window, a longish string of messages flash by, the usual .log content and
other messages from the 'dvips' and 'ps2pdf' runs.  But if there is an
error in the .tex file, it's not always easy to trace from those messages.
 My guess is that this has more to do with Beamer.  If there is an error
on some frame, then the script will stop abruptly (for instance "File
ended while scanning use of \frame") but it's not clear what frame has the

(3) One of the messages that appears is about compiling again to make sure
the references are correct, which I believe is from the line "latex
%FILE%.tex".  This doesn't stop the script, but it makes me wonder if the
script should know when to compile a second time for this reason.  I
haven't had a problem, but does "pdflatex" later take care of this?

(4) The script will stop if I currently have the endproduct PDF open
already in Adobe -- "I can't write on file 'FILE.pdf', Please type another
file name for output:".  I currently watch the pdf in GSview and the
script doesn't notice this, but I can't see the Beamer effects in GSview. 
It would be nice to be able to keep the file open in Adobe and have the
script refresh the file when it's done.  But now I'm being picky and I can
live with what I have now.

(5) For the file I am working on now, about 25 pages and 40 frames with a
fair share of sloppy code, the script takes 40-50 seconds.  I'm okay with
this, but I imagine others with larger files may want to speed this up.

I've rambled enough.  Thanks to Rolf and Herbert for their help...


More information about the PSTricks mailing list