I am working on a project and i want to slim it down a litle so please help me with the following. I have a document structure like this:

 |  |-/images
 |  |-chapter-1.tex

My document is like this:


in my chapters i use both some images and some heavy tikz plots so i use externalize and draft options for quicker compilation. But i want the images to be placed in the respective chapter folders but for example in chapter 3 this works:


and this doesn't


for some reason xelatex has problems with the relative paths of included chapters. I also want to control the location output and the naming of the externalized tikz documents. Any help with that? I am working with miktex and texworks.


1 Answer 1


The idea is simple, just prepare directory paths (to import both chapter files and images files) whenever you include a new chapter.



        \def\GraphicsPath{\ChapterPath Images/}%

    \includegraphics[#1]{\GraphicsPath #2}}    



\chapter{Chapter One}



  1. Folder Chapter-1 is in Docoment-Root folder.

  2. Chapter-1.tex is in folder Chapter-1.

  3. Tulips.jpg is in folder Chapter-1/Images.


  1. If your TikZ code is not "linked" to the text with nodes, for example, then put such TikZ code into a separate, compilable input file. Use article document class plus preview to get a tight PDF output. You can also use standalone document class instead.

  2. If you table is not long enough to span across multiple pages, then put it into a separate, compilable input file to get a tight PDF output.

  3. It is better not to specify the image extension explicitly when invoking \includegraphics.

  4. Define macros for often-used materials and put them into a package such that you can change their definition later in one place and the changes effect the whole document.

  • See also my another answer here. Commented Nov 9, 2013 at 9:28
  • Will these macros work with import or subimport as well ?
    – Anusha
    Commented Aug 4, 2014 at 14:33

You must log in to answer this question.

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