[pdftex] ps4pdf on Mac OS X

Troy Goodson Troy.D.Goodson at jpl.nasa.gov
Wed Dec 3 23:57:26 CET 2003

I use Mac OS X 10.3 (Panther) and TeXShop

I recently installed ps4pdf.  It was a bit of work so I thought I'd  
post my notes on the experience here in case they would benefit others.  
It's entirely possible that I've made a typo or left something out.

ps4pdf, like pdftricks, lets you use pstricks with pdflatex.  More  
information is at

I am now able to run ps4pdf with TeXShop rather smoothly.  Personally,  
I think I'll prefer ps4pdf over pdftricks.  I'll have to use a bit  
before I really decide, though.

Things I needed to install or do for ps4pdf:
- preview.sty, part of preview-latex
- pdfinfo, etc. (comes with xpdf)
- t1lib (needed by xpdf)
- seq of GNU sh-utils (comes with GNU coreutils)
   (actually, I avoided this one by re-writing create-eps)
- I had to edit the script ps4pdf to include '--shell-escape'
- I had to edit the script ps4pdf for use with TeXShop

So, here's what I did:

--- install part of preview-latex
see also <http://preview-latex.sourceforge.net/>
Inside this archive is 'preview.ins', from Terminal.app, I did "tex  
preview.ins" which made a bunch of files.  I copied all of them into  
Here's the files I put in there: README-preview, prauctex.cfg,  
prauctex.def, prcounters.def, preview.drv, preview.dtx, preview.ins,  
preview.log, preview.sty, prfootnotes.def, prlyx.def, prshowbox.def,  
prshowlabels.def, prtightpage.def, prtracingall.def

--- download & install t1lib (needed by xpdf)
see also <http://www.foolabs.com/xpdf/download.html>
downloaded <ftp://ftp.foolabs.com/pub/xpdf/t1lib-1.3.tar.gz>
In Terminal.app, I did './configure --prefix=$HOME', 'make', then 'make  
Somewhere in there, the documentation for t1lib starting printing out.   
I don't know what option I should've used to avoid this, but I did  
cancel the print job from "Printer Setup Utility.app"

--- download & install xpdf
see also <http://www.foolabs.com/xpdf/download.html>
downloaded <ftp://ftp.foolabs.com/pub/xpdf/xpdf-2.03.tar.gz>
In Terminal.app, I did './configure --prefix=$HOME', 'make', then 'make  
There was a message "configure: WARNING: Couldn't find X / Motif -- you  
will be able to compile pdftops, pdftotext, pdfinfo, pdffonts, and  
pdfimages, but not xpdf"

--- download & install ps4pdf
I moved 4-10-8.inl and penguin.eps to ~/Library/texmf/tex/latex/ps4pdf/
(the above two files are needed for the test case ps4pdf-test.tex)
I moved ps4pdf.sty to ~/Library/texmf/tex/latex/ps4pdf/
Based on the file "ps4pdf", I made a file "pdflatex_ps4pdf" and put it  
in my "bin" folder, ~/bin
----------BEGIN pdflatex_ps4pdf
# a script to build a pdf file with pstricks macros
# Herbert Voss http://www.perce.de/LaTeX/ps4pdf/
# 2003-03-10
# usage: ps4pdf.sh file
# (without suffix tex!)

set path = ($path ~/bin)

latex `basename -s .tex "$1"`.tex
dvips -Ppdf -o `basename -s .tex "$1"`-pics.ps `basename -s .tex  
ps2pdf `basename -s .tex "$1"`-pics.ps `basename -s .tex "$1"`-pics.pdf
pdflatex --shell-escape `basename -s .tex "$1"`.tex
and, in the Terminal.app, made it executable, 'chmod u+x  
Based on the file "create-eps", I made my own "create-eps" and it in  
----------BEGIN create-eps
#!/usr/bin/env perl

use strict;
use warnings;

my $File="\"$ARGV[0]\"";
my $n=`pdfinfo $File | awk '(\$1 ~ /Pages:/) {print \$2}'`;

for (my $i = 1; $i <= $n; $i++) {
   system("pdftops -f $i -l $i -eps $File picture$i.eps");
and, in the Terminal.app, made it executable, 'chmod u+x  

--- set-up TeXShop.app for ps4pdf:
Under TeXShop -> Preferences... -> Misc -> Personal Script -> Latex  
I entered "/Users/tdg/bin/pdflatex_ps4pdf", of course, you'd use your  
own user's name.

More information about the pdftex mailing list