TeXShop temporary Files

From Flo's Knowledge in a Nutshell

Jump to: navigation, search

Introduction

I was always nerved by the temporary files (.log, .aux, .vrb and so on) created by TeXShop. Often i want to keep the pdf file, so the parameter pdflatex --output-directory=/tmp wont work. I found this handy Python solution to keep your directories clean:

Create Script

Create python script calles pdflatex.py at location of your choice (eg ex. /Library/TeX/Root/bin) which puts the Temporary Files to /tmp and copies back the pdf file to the origin directory.

#!/usr/bin/python
tmp_dir = '/tmp'
import os, sys, shutil
tex_file = sys.argv[-1]
f, ext = os.path.splitext(tex_file)
assert ext[1:] == 'tex'
if not os.path.isdir(tmp_dir):
  os.mkdir(tmp_dir)

os.system('pdflatex --shell-escape --output-directory=%s %s' % (tmp_dir, f))
shutil.copy('%s%s%s.pdf' % (tmp_dir, os.path.sep, f), os.curdir)

Change TexShop Engine

Modify your TexShop Settings Engine (Preferences - Engine) for Latex to /Library/TeX/Root/bin/pdflatex.py Now your Latex directory contains after generating only the .tex and .pdf file.


//Source: http://www.macosxhints.com/article.php?story=20070906022746216

Personal tools