1

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?

MaestroGlanz
  • 2,348
  • I found this related question: http://tex.stackexchange.com/questions/108295/how-to-write-a-latex-package-that-bundles-not-only-sty-and-cls-files-but-also – MaestroGlanz Nov 09 '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. – David Carlisle Nov 09 '16 at 16:51
  • so in particular how does the document refer to SongsOfAcients.sty ? \usepackage{SongsOfAcients} ? – David Carlisle Nov 09 '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}. – MaestroGlanz Nov 09 '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‌​} – David Carlisle Nov 09 '16 at 17:00
  • however @currfile probably has the information you are looking for. – David Carlisle Nov 09 '16 at 17:02
  • @DavidCarlisle Then I have to make a script to install packages from any directory. i.e. the package is stored in D:/Songs/S.o.A.sty and should be added to the MikTeX database. – MaestroGlanz Nov 09 '16 at 17:04
  • far more portable than hard-wiring the path from your document to the package into the document. you don't use \usepackage{../../texmf/tex/latex/tools/array} – David Carlisle Nov 09 '16 at 17:08

0 Answers0