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.

Is it possible to hide .aux and .log files? If so, what would be the most low-maintenance/simple way of doing so? They create quite a bit of clutter. I have a folder where I'm tending to a bunch of tex files, and ideally I'd like it so that I just see the .tex and output .pdf files.

ADDENDUM: I am using Windows 7.

share|improve this question
    
Sort them by type? :P –  percusse Jun 30 '12 at 21:35
1  
Related (duplicate?) question: Need *.aux files in separate folder. –  Alan Munn Jun 30 '12 at 21:43
    
latexmk has three options that allow you to clean up as you go: -c, -C, -c1. This seems easier (and to a large degree safer) than fiddling with sending the various created files to non-standard places. –  jon Nov 16 '12 at 10:01

3 Answers 3

up vote 2 down vote accepted

If you have a web2c based system you can experiment with TEXMFOUTPUT

My copy of texmf.cnf has

% Write .log/.dvi/etc. files here, if the current directory is unwritable.
%TEXMFOUTPUT = /tmp

However it's probably not a good idea to do this. .aux files for example need to be read back in by LaTeX so if you manage to move them you need to configure latex to find them in the non standard place. Similar considerations apply to other auxiliary files such as .bib, .bbl, bookmark files written by hyperref etc. Even log files which are not (usually) read back by latex are often parsed by editors and GUI etc so that they can report and step through errors etc.

share|improve this answer
    
if the comment is correct then using this var wouldn't help much as the job input dir is normally writable (for good reasons). –  Frank Mittelbach Jul 1 '12 at 15:23
    
yes true although it wouldn't be if you went chmod a-w . I was sure that I remembered TEXMFOUTPUT originally affecting all output, but perhaps it changed over the years, that's the only relevant one I could see now, but that's essentially why I left in that comment (from a TL2011 cygwin distribution texmf.cnf) –  David Carlisle Jul 1 '12 at 20:12

Here is a simple patch of the LaTeX kernel that moves most auxillary files to a sub directory (which needs to exist). The .log file stays on top and I do not gurantee that I patched everything necessary :-). Specify \DeclareAuxDir{directory/} if you want directory to hold your files.

\begin{filecontents}{aux-to-subdir.sty}

\RequirePackage{etoolbox}

\newcommand\DeclareAuxDir[1]{\gdef\AuxDir{#1}}

\let\AuxDir\@empty

% \document can't be patched using etoolbox so this is done manually here
% regexpatch would work but I have to run, so this is the direct version for now

\def\document{\endgroup
  \ifx\@unusedoptionlist\@empty\else
    \@latex@warning@no@line{Unused global option(s):^^J%
            \@spaces[\@unusedoptionlist]}%
  \fi
  \@colht\textheight
  \@colroom\textheight \vsize\textheight
  \columnwidth\textwidth
  \@clubpenalty\clubpenalty
  \if@twocolumn
    \advance\columnwidth -\columnsep
    \divide\columnwidth\tw@ \hsize\columnwidth \@firstcolumntrue
  \fi
  \hsize\columnwidth \linewidth\hsize
  \begingroup\@floatplacement\@dblfloatplacement
    \makeatletter\let\@writefile\@gobbletwo
    \global \let \@multiplelabels \relax
    \@input{\AuxDir\jobname.aux}%
  \endgroup
  \if@filesw
    \immediate\openout\@mainaux\AuxDir\jobname.aux
    \immediate\write\@mainaux{\relax}%
  \fi
  \process@table
  \let\glb@currsize\@empty  %% Force math initialization.
  \normalsize
  \everypar{}%
  \ifx\normalsfcodes\@empty
    \ifnum\sfcode`\.=\@m
      \let\normalsfcodes\frenchspacing
    \else
      \let\normalsfcodes\nonfrenchspacing
    \fi
  \fi
  \@noskipsecfalse
  \let \@refundefined \relax
  \let\AtBeginDocument\@firstofone
  \@begindocumenthook
  \ifdim\topskip<1sp\global\topskip 1sp\relax\fi
  \global\@maxdepth\maxdepth
  \global\let\@begindocumenthook\@undefined
  \ifx\@listfiles\@undefined
    \global\let\@filelist\relax
    \global\let\@addtofilelist\@gobble
  \fi
  \gdef\do##1{\global\let ##1\@notprerr}%
  \@preamblecmds
  \global\let \@nodocument \relax
  \global\let\do\noexpand
  \ignorespaces}


\patchcmd{\@include}
  {#1.aux}
  {\AuxDir#1.aux}
  {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}

\patchcmd{\@include}
  {\@partaux #1.aux}
  {\@partaux \AuxDir#1.aux}
  {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}


\patchcmd{\@starttoc}
  {\jobname}
  {\AuxDir\jobname}
  {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}

\patchcmd{\@starttoc}
  {\endcsname \jobname}
  {\endcsname \AuxDir\jobname}
  {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}

\patchcmd{\enddocument}
  {\jobname}
  {\AuxDir\jobname}
  {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}

\patchcmd{\makeindex}
  {\jobname}
  {\AuxDir\jobname}
  {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}

\patchcmd{\makeglossary}
  {\jobname}
  {\AuxDir\jobname}
  {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}

% one could also patch \bibliography to load the .bbl file from the dir but I consider a .bbl more as part of a doc 
% so not done

 \end{filecontents}

\begin{filecontents}{bar.tex}
\section{bar}

test for \ref{foo}
\end{filecontents}

\documentclass{article}

\usepackage{aux-to-subdir}

% declaring the subdir to be used for aux/toc/...
% need to exist

\DeclareAuxDir{./auxfiles/}

\begin{document}

\tableofcontents

\section{foo} \label{foo}

\include{bar}

\end{document}

Perhaps the .bbl file should be moved there too ... not done.

share|improve this answer
    
I'd never thought that this would be possible on the (La)TeX level... Having this as a "real" package (tested and working with all standard classes, up to beamer, which tends to create a ton of aux files) would be just ... great! –  Daniel Jul 1 '12 at 16:30
    
What about \edef\jobname{\AuxDir\jobname}? That could save you a bunch of redefinitions, I think. –  Bruno Le Floch Jul 1 '12 at 16:39
    
@Daniel I wouldn't see this being a big issue. The worst problem is the fact that for certain file operations LaTeX2e doesn't offer official interfaces so that some poackage might exist that add their own aux file handling for additional files types. –  Frank Mittelbach Jul 1 '12 at 16:41
    
@Bruno most likely true, would need some chekcing though, it could have side effects. And then you may not want all files be treated like this. For example I didn't move the bbl file because I consider this part of the document (I rather send my bbl file to somebody instead of my bib files) –  Frank Mittelbach Jul 1 '12 at 16:43
    
@Frank, Ah, you're right. For a package, I would personally go for brutally redefining \@@input to do a slow \futurelet-based parsing of the file name (see e.g., my morewrites package which parses file names for \openout), then runs some regexes on that file name to decide where it should go. –  Bruno Le Floch Jul 1 '12 at 17:22

If you use Linux then the Gummi IDE leaves you with just the tex file and PDF file. The Windows version is unstable at this time.

The drawback is that Gummi gives you a live preview of your document so large documents slow down the performance.

share|improve this answer

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.