(My personal interest in this question is mainly for OS X but solutions/approaches for other operating systems are also appreciated.)

What I see as a main distraction with using TeX/LateX is that it creates too many auxiliary files beneath the files which are interesting. Especially, when browsing the folders to look for that certain file to print, I’m only interested in the PDF file which was generated. Of course, that’s a thing which is much easier with Word and OpenOffice files; you could have hundreds of those files in a directory and just quickview them.

Since it is good practice to have only a single document per folder, I wonder if there is a tool to make that folder a bundle which hides its contents from the Finder and only opens the PDF file.

Or is there a TeX editor which uses this technique for its project files? How is the best approach to deal with this distraction on the file system?

To clarify things, I’m not so much interested in deleting the auxiliary files or putting them somewhere else. The problem is that, even with a makefile and a clean target or a special command which removes all aux files, I’ll still need to have a separate folder for each PDF target anyway. Just because thing get messier and messier when you have multiple documents per directory. It’s just that folders are distracting in their very own way. You can’t really preview the contents (e.g. the PDF) of them and actually the OS X finder does not look as if it’s designed for folders containing only folders but that’s another story.

I just want to have a way that the GUI layer of the file system shows my latex document folders in the same way it shows .app bundles. (Or XML Word/OpenOffice files, only that these files are actively bundled in a zip container, of course, but the principle is similar.)

  • 2
    "actually the OS X finder does not look as if it’s designed for folders containing only folders" That doesn't make any sense. There are no problems with folders only containing folders.
    – TH.
    Sep 11, 2010 at 1:38
  • pressing control+apple+5 sorts by type. Sep 11, 2010 at 8:04
  • I am not aware of any TeX system that treats these directories as a bundle. Very interesting idea, though.
    – topskip
    Sep 11, 2010 at 8:50
  • 1

5 Answers 5


You can specify different directories for auxiliary files and output files.

  -aux-directory=DIR              Use DIR as the directory to write auxiliary
                                  files to.
  -output-directory=DIR           Use DIR as the directory to write output
                                  files to.

These are MikTeX option names. They might be called something differently in your TeX distribution.

Alternatively, define a :clean target in your Makefile.

  • 1
    On OS X, at least, pdflatex (and the other tex commands I tested) supports the --output-directory=DIR options as the directory to write all files to: .aux, .log, .pdfsync, etc., as well as the final output itself. Oct 13, 2010 at 17:45
  • This is amazing! I have been looking for a way to do this ever since I started using LaTeX! I'm pretty sure I've come across a question here which your advice would answer perfectly, I'll try to find it. Is there a way to tell pdfTex to create the directory if it doesn't exist?
    – doncherry
    Apr 11, 2011 at 20:03
  • None that I know off. Naturally, you could add \immediate\write18{mkdir -p TeXaux} and compile with shell escape enabled. But I don't think there is a flag for creating the aux-dir. Apr 14, 2011 at 23:42
  • A small query.. do I need to write option -aux--directory= dir etc everytime I run the tex file or can it be set for all further tex files. Can it be specified for the latex editor being used?
    – Anusha
    Jun 30, 2012 at 0:48
  • I came to this after I accidentally deleted my .tex file last night, while attempting to delete all the aux files. In answer to doncherry's question, if you're running in the Linux bash shell (and probably in other systems), you can define an alias in your .bashrc file. Mine is alias xet="if [ ! -w aux ] ; then mkdir aux ; fi ; xelatex --output-directory=aux". There is still an issue if you want to import/include a file from a subdir (e.g. include{foo/bar}), since the aux dir needs to have a matching subdir (e.g. aux/foo). Nov 10, 2017 at 16:05

A Mac OS X bundle is nothing but a particular directory structure. Some bundles (e.g., application bundles) are displayed by the Finder as single files. See the documentation for details.

That said, I was able to package a pdf into an application bundle.

$ ls -R paper.app

Info.plist  MacOS  Resources



$ cat paper.app/Contents/Info.plist 
        CFBundleExecutable = paper;
        CFBundleSignature = THth;
        CFBundlePackageType = APPL;
        CFBundleVersion = "1.0";
        CFBundleIdentifier = "foo.bar";
        CFBundleDisplayNam = paper;
        CFBundleName = paper;

$ cat paper.app/Contents/MacOS/paper 
dir="`dirname $0`"
open "$dir"/../Resources/paper.pdf

So you do your building inside paper.app/Contents/Resources and then double clicking on paper.app in the Finder opens your pdf.

I don't think this is particularly useful though.

  • Looks good. Maybe I should try and tweak it a little so that it’s not an Application Bundle but a Document Package (which Preview.app can understand).
    – Debilski
    Sep 11, 2010 at 11:26
  • I wasn't sure which document bundles Preview was willing to open nor their structure, so I didn't bother.
    – TH.
    Sep 11, 2010 at 11:52

Jerome Laurens has written a specification for doing exactly this in iTeXMac: http://www.tug.org/TUGboat/Articles/tb27-0/laurens.pdf

iTeXMac is no longer under development, I believe, but I always liked this idea.


TextMate filters its file list, so it does not show the .aux, .bbl, etc.

But for the Finder, a more pragmatic alternative is to simply clean up your directory once you have generated the PDF. A convenient way to do that is by invoking latexmk -c.

  • But still this means that everything looks like a directory and you have to check inside the directory to find the pdf. Also, it’s easy to mess around and accidentally hide stuff by putting it into the wrong directory.
    – Debilski
    Sep 10, 2010 at 15:39
  • Well, yes, but since you're editing the TeX document, you're supposed to know how it's organized. How do you deal with multi-file projects in general? Sep 27, 2010 at 14:46

In this answer to another, similar question, there's a basic app that provides simple bundle support for .texd folders. You might be interested in it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.