I stumbled upon the following question:
In the preamble of my main tex file for my thesis, I've included several other files with definitions for abbreviations which are in the same path as main.tex
, so I've only used the filename with the relative path to include them:
\include{abbrevations.tex}
For using some of my definitions also in other TeX-Documents (e. g. graphics created with IPE) I've created a file called IPE-Preamble.tex
, which contains selected parts of my preamble, so also the lines \include{abbrevations.tex}
.
Both mentioned files are located in the same path THESIS/
I've included the file IPE-Preamble.tex
in many other files which are located in the path THESIS/graphics successfully, it works:
\input{/drive/path/path2/THESIS/IPE-Preamble.tex}
Now I wanted to use this file also in .tex files which are located elsewhere on the same computer (let's say path /drive/path3/path4/main2.tex
). I used the same input command with the full path for IPE-Preamble as stated above, but I get an error message, that commands (which are defined in abbreviations.tex
are "not defined", so it seems that the include
command does not work in this case.
Does TeX
search for the file /drive/path3/path4/abbreviations.tex
because of the relative path of the include
command in IPE-Preamble.tex
?
\include{abbrevations.tex}
is wrong it should be called without any extension:\include{abbrevations}
. While\input
can be used with and without (defaults to.tex
) extension to load any kind of text file (e.g.\lstinputlisting
is using it internally),\include
is explicitly for.tex
files only. If you use the extension a fileabbrevations.tex.aux
is created notabbrevations.aux
. I'm not sure if and what issues that may cause.TEXINPUT=".:/drive/path/path2/THESIS:"
, to make LaTeX look for files also there. I do this a lot for my thesis.\include{abbrevations}
in my Ph.D. thesis, so I can just use\includeonly
if I need to give that list to my supervisor as PDF. Same for the ToC etc. They all belong on pages of their own anyway. But you are of course right, that\include
shouldn't be used for code snippets and only if you have a reason to use it.