First of let me admit that I've very new to the LaTeX, so this may be obvious and I just do see it, but here's my question:

I'm trying to write a set of macros to automatically downsample images... sort of like degrade.sty, but for images that are inserted at arbitrary sizes in the document. What I would like to do is redefine \includegraphics so that this can be accomplished for existing documents. In order to find the intended graphics file, I need to know what paths are currently in the graphics path. Alas, I cannot figure out how to determine what those paths are. Is this possible?

  • 1
    Are you just interested in seeing what it holds? For this you can use \makeatletter\typeout{\Ginput@path}\makeatother. The former stems doing a \show\graphicspath. Or do you want to do something with it programmatically? – Werner Apr 21 '12 at 1:26
  • Ugh, I feel really stupid. I had tried just what you suggested, but decided it didn't work because I was getting an error about an undefined control sequence... It turns out that the error was the result of a debugging call to my macro - before I had ever called \graphicspath. Anyway, ultimately, I'd like to provide it as an input to a script using \write18. – Michael Apr 21 '12 at 1:33
  • You can check whether \Ginput@path exists (in other words, actually test whether a call to \graphicspath has been made) and consequently use/act on \Ginput@path. I'm not sure how to do that with \write18 though. – Werner Apr 21 '12 at 1:42
  • @Michael Have a look at this answer of mine that may help you. – egreg May 5 '12 at 22:26

The paths for graphics - set using \graphicspath - is stored in \Ginput@path as is indicated by \show\graphicspath and viewing the .log file:

> \graphicspath=macro:
#1->\def \Ginput@path {#1}.

\makeatletter\typeout{\Ginput@path}\makeatother will show its contents.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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