I'm working on a larger thesis assignment, and I've been fiddling around with my various tex files in different folders, trying to make it look nice and orderly.
Atm. my structure is similar to this:
main.tex
img/image.png
tex/chapter01.tex
Where all other .tex files are including in the main file using \include{tex.chapter01.tex}. It works pretty well, I usually work on a single chapter file at the time which I compile by itself, and later on I compile the whole main file to see everything together.
However, I have one little issue. When working on a single chapter file I include images using \includegraphics{../img/image.png}. This obviously won't translate when compiling the whole main file since the correct command there would be \includegraphics{img/image.png}.
So I'm looking at the option of having a separate main folder as well making the structure like this:
main/main.tex
img/image.png
tex/chapter01.tex
Thus I can use the ../ command everywhere. Similar to what is described in the second answer here: Using subfiles package with .sty files (PS. I do not use the subfiles package)
However, this doesn't seem to work with the \include command. Ex: \include{../tex/chapter01} seems to give an error. Is this a common issue?
Hope you understand my problem. Thank you for any input.
EDIT:
I seem to have found an answer here: Restructure classic thesis project with subfolders using Kile
Apparently, \include doesn't really work when navigating upwards in folders.
So I ended up by just putting the main.tex file together with my other .tex files as Christina suggested.
Best Answer
The package
import
is what you are searching for. If I understand correctly, you want also compile chapter without the main file, so this can combined with the packagedocmute
orstandalone
:For chapters you can use
\subincludefrom
instead of\subimport
. Runtexdoc import
for more information.