[OS X TeX] TeXShop wish list

Robert Bruner rrb at math.wayne.edu
Mon Sep 4 09:04:26 EDT 2006

FWIW, I use the following script to clean up after TeX.  
I call it texclean, and save it someoplace executable (I have a
"bin" subdirectory in my home directory which I have added to my
path where I keep things like this).  Then excuting texclean in any
 - looks for .tex files and 
 - removes  the associated .aux, .log, .dvi, .ps and .pdf files.  
If you invoke it as "texclean -i" it will ask before removing each

It is easily modified to leave the .pdf files or to remove others.
The safety feature of only removing .ps or .pdf files which are
associated to .tex files is crucial, of course, and could be enhanced
by checking dates.  Conceivably, one might wish to retain .pdf files
which are older than their associated .tex files, on the theory that
the newer .tex file cannot be used to regenerate the older .pdf file,
but I have not found that to be a problem.

Save this as a file, say 'texclean' with the # character as the first
character of the file.  Make it executable:
  chmod +x texclean
and then texclean will do the cleanup for all .tex files in the
directory in which it is executed.

WARNING: if you use periods in your tex file names, IT WILL MISBEHAVE.
Precisely, if you have files named bad.name.tex or bad.bad.name.tex or
bad.old.file.tex, etc, then texclean will remove all files bad.aux,
bad.log, bad.dvi, bad.ps, bad.pdf.  I have not 'fixed' this since
I do not use periods except to separate the file name from the .tex,

#! /bin/csh

set i=""
if ($1 == "-i") set i=$1

foreach file (*.tex)
set name=`echo $file | awk -F. '{print $1}'`
rm $i ${name}.aux ${name}.log ${name}.dvi ${name}.ps ${name}.pdf

Bob Bruner

------------------------- 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 Archive: http://tug.org/pipermail/macostex-archives/

More information about the MacOSX-TeX mailing list