Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Hide temporary files created by TeXShop' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Hide temporary files created by TeXShop
Authored by: chtito on Sep 07, '07 08:15:17AM
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 Sep 11, '07 12:52:21PM

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 | # ]