I have a main.tex
file, which in the preamble contains the following path definition
\def\commonpath{C:/Users/Default/Documents/Folder}
This compiles just fine. If I break the code into separate lines as such:
\def\commonpath{%
C:/Users/Default/Documents/Folder%
}
Everything compiles just fine as well.
What I would like to do is to take the path out into a separate file. For example, I would like to create a file folderpath.tex
and place it in the same directory as main.tex
. folderpath.tex
should contain only the following line:
C:/Users/Default/Documents/Folder
Then, in main.tex
I would like to have something like
\def\commonpath{%
\input{folderpath.tex}%
}
However when I do that and try to compile I get a missing \begin{document}
error.
How can I get around this problem? I thought that the \input{}
command takes literally the content of the file that is being inputted.
Any help would be appreciated.
Best Answer
You can do this using
expl3
rather easily: