TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have several different chapters I would like to include into a dissertation. Each chapter is a standalone paper and has its own directory structure (figures, tables, etc.). I would like to retain the ability to compile (and work) each chapter separately but include all of them into the dissertation. What is the correct way of doing this? Using \input screws up the directory structure in addition to the fact that I need to ignore the preamble and abstract of each individual paper.

share|improve this question
Sorry, what is the question? – yo' Aug 31 '14 at 22:38
rewrote for clarity – Alex Aug 31 '14 at 22:46
Don't forget to accept an answer if you find one acceptable. – DanielSank Aug 31 '14 at 23:59
just did, thanks! – Alex Sep 1 '14 at 1:01
Do you use some UNIX like system? – Michael Grünewald Sep 1 '14 at 6:42
up vote 8 down vote accepted

Use the import package.

Suppose I write a document describing how to make a banana milkshake. Separate the document into the header and the content:

/banana/bananaMilkshake.tex (pseudocode)



Whatever content you want.

Then, in your thesis, just \import* the content sections as needed:



The nice thing about \import* is that you give a path to the file you want to use. Any \input commands or graphics inclusions in the imported files still work. You can also use \subimport if you want relative paths. The asterisk is there to prevent TeX from using files in the local directory which might have the same name as the thing you want to import. See the documentation linked above.

Cutting the document into header and content sections isn't really an "extra" step because you really should do this anyway. For example, I have my package imports and things like that in a common .tex file which is imported as needed (the one package I have to explicitly \usepackage is... the import package). You should have lines like \input{abstract.tex}, etc.

Now, if you want to do something like add external files as appendices with references to one another, it's trickier. See my recent post (complete with working example) about this.

share|improve this answer
great solution! how do you deal with bibliographies in this case? – Alex Aug 31 '14 at 23:54
@Alex: You should probably ask another question, but basically I just have a massive bibliography file in one location and I use that for everything. You can put relative paths in \bibliography{...} commands, and you can put more than one file (comma separated). – DanielSank Aug 31 '14 at 23:58
@Alex: The place things get weird is if you include pre-existing documents as appendices which need to reference each other. See the link in my answer. – DanielSank Sep 1 '14 at 0:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.