Rendering a pdf in a different location, from a standalone tex-file that combines several chapters [duplicate]

I've seen a lot of these questions, but in my search I haven't managed to find an answer to my problem. I am building a directory system for simple use, where I have divided the first folder into "Parts" and "Results". In the Parts directory, I have folders called "Tex", "Img" and "Combo".

Tex contains four different tex files, chapters. Img contains all images from every chapter. I want all images in one location because some of them appear more than once. If I need to replace one of the images I want it to do so everywhere where it appears. Combo contains the tex file which combines the four chapters into one big book, of sorts. I use the package standalone to rid the chapters from their preamble and to make it a main file. I then use \include with a relative path to the different chapter-files that I want to include.

Going back to the root folder of this directory-system, the other folder is called "Results". This is where I want all of the rendered content (html and pdf). The reason why I am building the system this way is because I am not the end user of the files, which means it should be simple to navigate and understand.

The problem I have appears when I want to use pdflatex to compile the main file. A lot of what I understand is called "nesting" is happening here. I'm rendering the results in the "Results"-folder, which fetches information from the texin the "Combo"-folders which in turn retrieves files from the "Tex"-folder. All of these chapters then wants images from the "Img"-folder.

I get these errors in the terminal when trying the pdflatex command while working in the "Results"-directory:

! LaTeX Error: File `../tex/Chapter1.tex' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: tex)

Enter file name:

If I enter the absolute path to the Chapter1-file

Enter file name: /Users/Rikardny/Documents/temp/Assets/tex/Chapter1.tex

I instead get the error

! Package pdftex.def Error: File `login.jpg' not found.

See the pdftex.def package documentation for explanation.
Type  H <return>  for immediate help.
...

l.48 ...degraphics[width=0.8\textwidth]{login.jpg}

?

I understand this is a problem because of the relative paths to other files in each of the documents. Whilst in the "Results"-directory, the relative paths point to a different place than in the "Combo"-directory. However I would like to use relative paths because the folders are going to move to different machines later. Is there a way to maintain the directory-system but not change all the relative paths to absolute paths?

• If the filenames are unique then you could add the top directory to your TEXINPUTS environment variable and add // after it so that tex will search subdirectories: export TEXINPUTS="....:My_Directory//:...". This should work for *unix-like systems.
– user30471
Jul 24 '14 at 14:22
• – JPi
Jul 24 '14 at 14:25
• @Andrew How exactly do I do this? Does it work with images as well? The question which i duplicated does not answer this question on a level that I can understand really... Jul 28 '14 at 7:36
• @Rikardny What operating system (and shell) do you use?
– user30471
Jul 28 '14 at 8:34
• @Andrew I use OS X and bash. Does using your method work on every machine that the file-system is moved to? Or is it specific for my computer? Jul 28 '14 at 8:49