# Restructure classic thesis project with subfolders using Kile

I would like to change the folder structure of the ClassicThesis project. My current folder setup looks like this.

|-- bib // Some *.bib files.
|-- bst // Some *.bst files.
|-- cfg // Configuration tex file and sty file.
|-- fbm // Front back matter.
|-- img // Images
|-- prj // The main tex file.
|-- src // All tex files that contain content.
|-- CHANGES
|-- COPYING

I changed all the paths to match the new directory structure. Thus Kile complains about accessing the various files.

/usr/local/bin/pdflatex: Not writing to ../fbm/Titlepage.aux (openout_any = p).

! I can't write on file `../fbm/Titlepage.aux'.
\@include ...\immediate \openout \@partaux #1.aux
\immediate \write \@partau...
l.87 \include{../fbm/Titlepage}

(Press Enter to retry, or Control-D to exit; default file extension is `.tex')
Please type another output file name
! Emergency stop.
\@include ...\immediate \openout \@partaux #1.aux
\immediate \write \@partau...
l.87 \include{../fbm/Titlepage}

!  ==&gt; Fatal error occurred, no output PDF file produced!
Transcript written on ClassicThesis.log.

When I remove the subdirectory path Kile produces a PDF with zero bytes.

Optional: If possible, I would also like to have separate folder for the binary and temporary files. Saying, the PDF would go into bin/ and the *.aux files would go into tmp/.

-
Don't use \include: TeX Live inhibits writing in directories whose path includes going above the current working directory. \input doesn't suffer from this limitation, as it doesn't use an .aux file for each input file like \include does. – egreg Apr 9 '12 at 13:40
Nice. That works. Thank you. So how can I grand you the answer.. – JJD Apr 9 '12 at 13:46

Your setup clashes with the "paranoid" setting of TeX Live (and MiKTeX, also) when it comes to writing files. You see it in the information line

/usr/local/bin/pdflatex: Not writing to ../fbm/Titlepage.aux (openout_any = p)

The distribution is set up so that TeX programs never open for writing files whose path includes going up from the working directory, or an absolute path; if you use \include, then you run into this limitation, as

\include{<path>/filename}

starts writing a filename.aux file in the same directory as filename.tex.

An easy solution is to use \input instead of \include, because reading files has no limitation about paths.

You can also set the output directories, using a command line option for pdflatex, namely --output-dir=./tmp, for example; but this will be used also for the produced PDF file.

-
Thx! Is there a way to include the output directory option with the *.tex file so I could add the setting into my version control? – JJD Apr 9 '12 at 14:06
@JJD No, this is an "engine option", which must be launched before the file is read. However there might be some editor related trick; for example, with TeXworks it's possible to specify in the .tex file which command to run for compiling it when the green arrow is pressed, and this command can be a script. I don't know with Kile. – egreg Apr 9 '12 at 14:09