Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
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
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

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.