I'm writing my Lieder-Package right now, which provides commands to build sty-files which are basically data bases for songs. Inside these data base files, I use \includegraphics and a relative path to call samples. These samples are stored in the same path as the data base file or nearby. i.e.: ~somePath/SoA/SongsOfAcients.sty and ~somePath/SoA/SongsOfAcients/sample1.pdf

The problem is, that when I call the data base file, the relative path refers to my document and not to the package. This is somehow logical, because the code is executed after full expansion, which is in the document.

As far as I can see, the currfile package isn't suitable, because it works only for packages loaded after currfile. Is there maybe a way for a work around with \edefs or is there any TeX-primitive, which could be helpfull?

  • I found this related question: tex.stackexchange.com/questions/108295/… Nov 9 '16 at 16:50
  • hard to see as you have provided no code but either your database file is in tex input path in which case it and the graphics files should be found without specifying any path, or they are not in which case the document must provide a path to the database file which your macros can then adapt to find the images. Nov 9 '16 at 16:51
  • so in particular how does the document refer to SongsOfAcients.sty ? \usepackage{SongsOfAcients} ? Nov 9 '16 at 16:53
  • @DavidCarlisle In my case, I have to use something like \usepackage{../songbooks/SoA/SongOfAncients}. Otherwise the package wont be found. The package itself contains \includegraphics[width=\linewidth]{../SongOfAncients/sample1}. Nov 9 '16 at 16:56
  • 1
    which is wrong of course, the argument to \usepackage should be a package name not a filepath. If the package was properly installed you would be able to use \usepackage{SongOfAncients} in the document and the file could use \includegraphics[width=\linewidth]{sample1‌​} Nov 9 '16 at 17:00

Your Answer

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

Browse other questions tagged or ask your own question.