16

I am trying to define a central graphics path for my thesis, however, the chapters are included with the \include command and by using \include with \graphicspath, pdflatex complains about it can not find the pictures, is not that possible to use \graphicspath and \include together, for which I do not see a sound reasoning behind.

I use in the preamble

\graphicspath{{/home/utab/thesis/phd_text/figures_all//}}

and use

\include{ch9} 

Then it can can not find the pictures on the above mentioned directories recursively.

12
  • 1
    @Umut: A tip: If you indent lines by 4 spaces, then they are marked as a code sample. You can also highlight the code and click the "code" button (with "101010" on it).
    – lockstep
    Apr 16, 2011 at 15:56
  • @lockstep, Thx for the hints
    – Umut Tabak
    Apr 16, 2011 at 15:57
  • 1
    It should work with an absolute path. Try to remove the doubled / at the end. That's the only thing I see here. Apr 16, 2011 at 16:07
  • Does not that extra / make that to search the directories recursively?
    – Umut Tabak
    Apr 16, 2011 at 16:15
  • @Umut what operating system are you using? Apr 16, 2011 at 16:20

3 Answers 3

12

You can use relative path : give as a second argument to \graphicspath what would be the relative path seen from your chapter. In my own case, I have a thesis folder containing chapter folders and a Figures folder. I use :

\graphicspath{{Figures/}{../Figures/}}
1
  • 2
    With relative folders that should also work just using \graphicspath{{Figures/} as long as every \includegraphics the works in that directory. At least for me the secont part you use isn't necessary.
    – Ronny
    Feb 13, 2013 at 13:54
12

The \graphicspath command does not influence the directories \include takes into consideration, because \graphicspath is from the graphics package, while \include is plain LaTeX.

Unfortunately, like stated on Bits of document from other directories, there is no trivial way to build, e.g., an \includepath command. Nevertheless, the site mentioned above links two packages as a possible solution: chapterfolder and import, and especially the \cfinput command from chapterfolder might help. There is also another blog post describing the use of chapterfolder.

2

I could not get

\graphicspath{figures\}

to work as desired. I am using a makefile in my writing, though, so I specified an extra rule:

%.pdf: export TEXINPUTS=.:figures:
%.pdf: %.tex
latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" -use-make $<

You must log in to answer this question.

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