[OS X TeX] I do like ps4pdf questions

Herb Schulz herbs at wideopenwest.com
Fri Feb 11 10:34:54 EST 2005

On 2/10/05 10:37 PM, "Roger Hart" <rhart at mail.utexas.edu> wrote:

> ...
> creating the pics file for ps4pdf clobbers my .aux
> files, which means I need to run pdflatex twice to get my citations,
> equation numbers, etc. back. So I modified his script to save the .aux
> file and use it again for the first pdflatex run. Of course, changing
> pics can change page numbering, etc., so there may be some errors. But
> in general, since I just want to see what the modified pics look like
> without working on a document full of question marks or waiting for a
> second pdflatex run, so this seems to work for me. But perhaps someone
> more expert than I am might know reasons *not* to do this:
> #!/bin/sh
> location=$(dirname "$1")
> basefname="${location}/`basename "$1" .tex`"
> #save aux file
> /bin/cp "${basefname}.aux" "${basefname}.auxcopy"
> # process the figures
> latex --shell-escape "$1"
> dvips -Ppdf -o "${basefname}-pics.ps" "${basefname}.dvi"
> ps2pdf13 "${basefname}-pics.ps" "${basefname}-pics.pdf"
> #use original aux file, clean up
> /bin/cp "${basefname}.auxcopy" "${basefname}.aux"
> /bin/rm "${basefname}-pics.ps" "${basefname}.dvi" "${basefname}.auxcopy"
> #process the file
> pdflatex --shell-escape "$1"
> ...


I don't think there is a problem but some very minor points:

1)On the first run the .aux file doesn't exist so the copy will give rise to
an error message. No harm done. You could correct that by testing for the
existence of the .aux file before copying:

If [ -e "${basefname}.aux" ] ; then .... fi

and a similar thing for the .auxcopy at the end.

2)Since the .aux file will be trashed anyway why not use /bin/mv rather than
/bin/cp in both cases so you don't have to add anything to the /bin/rm
command? Again, trivial.

3)Why not just add a second pdflatex processing line at the bottom? That
will make everything right at the cost of a small amount of time. If you
always do bibliographies add the bibtex call and then two more pdflatex
calls. ...

Good Luck,

Herb Schulz
(herbs at wideopenwest.com)

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the MacOSX-TeX mailing list