[OS X TeX] Can latex read the name of the folder that contains my latex file?

Themis Matsoukas tmatsoukas at me.com
Fri Aug 31 08:56:33 EDT 2012

I have a large database of homework problems, each as a separate latex file in its own folder that contains all associated material such solution, figures, etc. The source file of the problem contains the command


where "problemXYZ" is the name of the folder where that problem lives. This allows the root file to find the associated graphics when this problem is called from the database. From time to time I have to renumber problems and rename problemXYZ to something different. Then I must also manually update the \graphicspath command to point to the new name. Is there a way that graphicspath can read the _current_ name of the folder that contains the file in which the graphicspath appears? I can do this updating with a script outside latex but I was wondering if I can do it on the fly while I run latex. 


More information about the MacOSX-TeX mailing list