[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
<http://www.uoregon.edu/~koch/texshop/texshop.html>
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
<http://www.perce.de/LaTeX/ps4pdf/>
<http://www.perce.de/LaTeX/ps4pdf/README>
<http://www.perce.de/LaTeX/ps4pdf/tb72voss4pdf.pdf>
<http://www.ctan.org/tex-archive/help/Catalogue/entries/ps4pdf.html>
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/>
downloaded
<ftp://tug.ctan.org/tex-archive/macros/latex/contrib/preview.tar.gz>
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
~/Library/texmf/tex/latex/preview/
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
install'
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
install'
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
downloaded:
<http://www.perce.de/LaTeX/ps4pdf/README>
<http://www.perce.de/LaTeX/ps4pdf/create-eps>
<http://www.perce.de/LaTeX/ps4pdf/test.tex>
<http://www.perce.de/LaTeX/ps4pdf/ps4pdf>
<http://www.perce.de/LaTeX/ps4pdf/test.pdf>
<http://www.perce.de/LaTeX/ps4pdf/tb72voss4pdf.pdf>
<http://www.perce.de/LaTeX/ps4pdf/ps4pdf.sty>
<http://www.perce.de/LaTeX/ps4pdf/ps4pdf.cfg>
<http://www.perce.de/LaTeX/ps4pdf/ps4pdf-test.tex>
<http://www.ctan.org/tex-archive/macros/latex/contrib/ps4pdf/4-10-8.inl>
<http://www.ctan.org/tex-archive/macros/latex/contrib/ps4pdf/
penguin.eps>
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
#!/bin/csh
# 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
"$1"`.dvi
ps2pdf `basename -s .tex "$1"`-pics.ps `basename -s .tex "$1"`-pics.pdf
pdflatex --shell-escape `basename -s .tex "$1"`.tex
----------END
and, in the Terminal.app, made it executable, 'chmod u+x
~/bin/pdflatex_ps4pdf'
Based on the file "create-eps", I made my own "create-eps" and it in
~/bin
----------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");
}
----------END
and, in the Terminal.app, made it executable, 'chmod u+x
~/bin/create-eps'
--- set-up TeXShop.app for ps4pdf:
Under TeXShop -> Preferences... -> Misc -> Personal Script -> Latex
Program
I entered "/Users/tdg/bin/pdflatex_ps4pdf", of course, you'd use your
own user's name.
More information about the pdftex
mailing list