TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for some way to have a tidy folder system.

My idea is, when I create a new file for latex to automatically create a new folder under the same name inside my working directory and put all files in that folder (.aux, .pdf, .tex, .loc etc). It might be the case that some package does that, but I am relatively new to this.

Do you know any way of achieving something like this?

share|improve this question
Welcome to TeX.sx! We typically do not include greetings or thanks in Q-A. Upvoting comments or answers is the preferred way to show appreciation. – Peter Jansson Jan 18 '13 at 14:55

latex has the -output-directory option. In Linux with the bash shell you can use the shell script

name=`basename $1 .tex`
if [ ! -d "$name" ]; then
    mkdir $name
latex -output-directory $name $1

Save the above code to somewhere in your $PATH called newlatex.sh and remember to chmod it 700. Then from the directory in which you placed the .tex file call

$ newlatex.sh filename.tex


$ newlatex.sh filename
share|improve this answer
Anything similar for (lame) Windows? – korni Jan 19 '13 at 19:10
I am not that familiar with Windows, but if MikTeX (or whatever LaTeX distribution you use) supports command line commands, and if your IDE allows you to change the command used to compile the document, then in principle you can write a batch file to do so. But if you want a more tailor-made solution, please edit your original post to include (1) Operating system [I assume Windows] (2) LaTeX distribution (3) Any software you use in the workflow to create your document: what editor you use, how you compile the TeX file into DVI/PDF etc. – Willie Wong Jan 21 '13 at 8:51

Your Answer


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.