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?




  • 2
    I think you might be looking for \input{/Users/john/Documents/Uni/Studienarbeit/Latex/Kapitel/GDP/Methodology}. That is, \input rather than \import.
    – Werner
    Feb 14, 2012 at 0:56
  • What package are you using that provides an \import command? Usually files are included with \include (or sometimes \input).
    – Alan Munn
    Feb 14, 2012 at 0:58
  • Is Methodology.tex found? Is both files placed in /Users/john/Documents/Uni/Studienarbeit/Latex/Kapitel/GDP? If you are not using \input(or like) in the files, then you should just use \include in your main file. Feb 14, 2012 at 1:01
  • 1
    @Werner: When it is in the main file, \include is preferred over \input. Feb 14, 2012 at 1:02
  • 1
    @Brent.Longborough: Yes - I should probably have written "I prefer ...". But I also believe that \include suits the purpose best here. Feb 14, 2012 at 21:00

4 Answers 4


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 the import 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.

  • 2
    Because of this confusion, import.sty was updated to work when the trailing "/" is omitted. Nov 28, 2020 at 9:26

I know of three ways to put one .tex file into an other:

1. \include{⟨filename⟩}
2. \input{⟨filename⟩}
3. \import{⟨path⟩}{⟨filename⟩}
  1. \include is only used in the main document, and is the preferred way in large documents. You can not use \include in documents that has themselves been included with \include. \include will always start on a new page. With \includeonly{⟨filename1⟩,⟨filename2⟩,...} you can tell the main document to only include some documents, for testing purpose. E.g. if you are working on chapter7.tex in your huge book, and want to see the compiled result, without compiling everything, then just place \includeonly{chapter7} in the preamble of your main document. ⟨filename⟩ needs to be a .tex file. Type either just the name of the file, a relative path, or a full path, but do not use the .tex extension.

  2. \input is used in subdocuments, to input e.g. figures. It can also be used directly in the main document for smaller documents. Works exactly as if the contend of the file was written at the point of \input. Here ⟨filename⟩ can have any extension, but if none is written, then .tex is chosen.

  3. \import needs the \usepackage{import}, and is only used, when the imported files needs the path to e.g. \input other files. - see the import manual. Here ⟨path⟩ needs to end with a "/".

  • I tried it with \include but since the argument cannot be a path the include-approach does not fit to my problem. But thank you for the detailed information! :)
    – John
    Feb 14, 2012 at 1:46
  • 3
    @John: ⟨filename⟩ can be both a filename(name), a relative path(dir/name) or a full path(/dir/name) Feb 14, 2012 at 1:52
  • Okay, I did not know that, sorry. I'll keep that in mind but for the moment \import works. Thanks. :)
    – John
    Feb 14, 2012 at 1:55
  • 2
    @John: You are welcome - plz up-vote. One approach is if it is working, don't touch it, but I like Do it right from the start better. Feb 14, 2012 at 2:21
  • Great summary of the various approaches. Thanks! Upvoted.
    – SSilk
    Apr 17, 2013 at 20:01

Note that using relative paths is in general better if you want to compile later on a different system or from a different path:


instead of

  • 2
    Hi and welcome, nice user name :-)
    – Johannes_B
    May 16, 2015 at 14:02
  • To use a relative path as you say, one should use \subimport instead of \import. Use of \import with absolute paths will works sometimes but start to fail if the imported files also use import.
    – carandraug
    Aug 28, 2016 at 16:42

You need to put this in your preamble(or second package): \usepackage{import}. Then you can import as many files as you like.

Here's the full document template:


path can be of the form ./folder1/…/, /folder1/…/, or an absolute path.

  • 3
    Please, can you explain with the details your solution with a screenshot?
    – Sebastiano
    Mar 12, 2020 at 17:18
  • I'm not sure how to take a screenshot.
    – Someone
    Mar 13, 2020 at 15:49
  • Here's more code: ...\usepackage{import}...\begin{document}...\import{...}{...}...\end{document}
    – Someone
    Mar 13, 2020 at 15:56
  • Also, use relative positioning.
    – Someone
    Mar 13, 2020 at 15:58
  • A ... means it doesn't matter what goes there, as long as it's correct.
    – Someone
    Mar 13, 2020 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .