I have been banging my head on this problem for a few days, trying many combinations of \def, \edef, \noexpand, \expandafter, etc.

Say I have a module at /tmp/module/ which contains module.tex and image.png. In module.tex I define a macro which, among other things, uses \includegraphics to pull in the image within this submodule with a relative path:

% module.tex
  Quiz #1

And then from my main document I do an \import or \subimport, and then try to use the \myQuizHeader macro:

% main.tex


While import correctly prepends the module path in order to find files and images relative to the module while inside module.tex, those paths get removed when leaving the module, so the macros defined in that module don't work correctly anymore. When I call \myQuizHeader{27} from the main file the image is not found.

What is the correct way to solve this? I tried playing tricks with saving the \Ginput@path variable to a local variable within the module, but then I got into \edef and \noexpand hell.

Many thanks!

  • If you just prepend /tmp/module/: to TEXINPUTS environment variable (or the \Ginput@path) you don't need \import to do anything just \includegraphics{image} should find image.png Mar 25, 2014 at 21:30


You must log in to answer this question.

Browse other questions tagged .