I've got a main-file which includes the preamble. I then use \import
to put together all chapters of my final document. When saving the main-file in another directory than the chapter-files I get the message:
! LaTeX Error: File `GDP.tex' not found.
Isn't the idea of \import
to import files from different directories? Is there maybe something wrong with my code?
...
\begin{document}
\maketitle
\tableofcontents
\import{/Users/john/Documents/Uni/Studienarbeit/Latex/Kapitel/GDP}{Methodology}
\import{/Users/john/Documents/Uni/Studienarbeit/Latex/Kapitel/GDP}{GDP}
\end{document}
Best Answer
When using the
import
package (which provides the\import
command), you must ensure that the path argument includes the trailing slash/
. So you need to do:Note the
/
at the end of the path.Update 2020 As of v6.2 (part of TL 2020) the trailing slash is no longer required.
As others have noted in the comments, it's usually better to use the
\include
command for this kind of thing, although theimport
package does have some interesting capabilities for relative names within the included documents. See Keep chapter number of chapters inserted with \include for an example.