Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

(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?

Edit:
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.)

share|improve this question
1  
"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 '10 at 1:38
    
pressing control+apple+5 sorts by type. –  Taco Hoekwater Sep 11 '10 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 '10 at 8:50
    
add comment

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.

share|improve this answer
    
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. –  Antal S-Z Oct 13 '10 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 '11 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. –  Martin Heller Apr 14 '11 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 '12 at 0:48
add comment

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
paper.app:
Contents

paper.app/Contents:
Info.plist  MacOS  Resources

paper.app/Contents/MacOS:
paper

paper.app/Contents/Resources:
paper.pdf

$ 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 
#!/bin/sh
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.

share|improve this answer
    
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 '10 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 '10 at 11:52
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
    
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 '10 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? –  Damien Pollet Sep 27 '10 at 14:46
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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