21

hpekristiansen answer from Using \import correctly There are three ways to put subfile.tex file into main.tex:

  1. \include{⟨filename⟩}
  2. \input{⟨filename⟩}
  3. \import{⟨path⟩}{⟨filename⟩}

It is clear that

  • \include is only used in the main.tex and \include can not be used in subfile.tex

  • \input can be used in main.tex or subfile.tex

  • \import needs \usepackage{import}.

Now I'm confused about using \import. When this should be used? What is the use of \subimport?

The point is that there is no example in the manual for import. I have different files in different folders. How to use \import with giving the path of subfile.tex?

Should I use \input for importing TikZ pictures using a standalone file subfile.tex?

3
  • 5
    In short, you need to use \import (absolute paths) or \subimport (relative paths) if you want to nest imports, and want the imported file (first level) to use its own path as the base for further imports (second level). If your TikZ picture doesn't make further imports, you don't need to use \import. I've recently posted an example, let me know whether or not it's sufficiently clear (there's room for improvement, I guess).
    – dgs
    Jun 12, 2012 at 10:33
  • @dgs \input: inverse search is not possible in YAP when the input file is in subfloders. But using \import it is possible.
    – sandu
    Jun 19, 2012 at 6:25
  • 5
    @dgs, your comment seems to answer this question. Please post it as such, maybe with a little more explanation, so that it can be accepted.
    – bodo
    Aug 3, 2012 at 16:16

1 Answer 1

7

When you use the import package (which provides the \import command), you must use slashes / in your path.

E.g.

\import{/Users/Public/Documents/}{subfile}

Also, be sure that you put / at the end of the path.

You must log in to answer this question.

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