Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!


Click here to return to the 'Hide temporary files created by TeXShop' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
Hide temporary files created by TeXShop
Authored by: chtito on Fri, Sep 7 2007 at 8:15AM PDT
I also have a slightly more polished version of the script:
import os
import sys
import shutil

tmp_dir = '.tmp'

# find out the name of the file to compile
tex_file = sys.argv[-1]
file_name, file_ext = os.path.splitext(tex_file)
assert file_ext[1:] == 'tex'

# create the temporary directory if it doesn't exist
if not os.path.isdir(tmp_dir):
  try:
    os.mkdir(tmp_dir)
  except OSError:
    raise IOError('A file named "%s" already exists in this catalog' % tmp_dir)

# run pdflatex
os.system('pdflatex --shell-escape --output-directory=%s %s' % (tmp_dir, file_name))

# move the pdf file back to the tex directory
try:
  shutil.move('%s%s%s.pdf' % (tmp_dir, os.path.sep, file_name), os.curdir)
except IOError:
  print '\n\nPdf file not found.'


[ Reply to This | # ]
Hide temporary files created by TeXShop
Authored by: hamarkus on Tue, Sep 11 2007 at 12:52PM PDT
Nice improvement. Is there a way to make it show up in the Typset in TeXShop and not only in drop-down menu within the .tex file's window?

[ Reply to This | # ]