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

Chris Goedde cgg.lists at gmail.com
Fri Aug 31 09:53:41 EDT 2012

On Aug 31, 2012, at 7:56 AM, Themis Matsoukas <tmatsoukas at me.com> wrote:

> 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
> \graphicspath{{../problem-dbase/problemXYZ/}}
> 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. 

I can't answer, because I don't quite understand what you're asking. The layout of files/folders is not clear to me; a specific example would help. (I think you're talking about a latex file accessing the name of its enclosing folder, but the actual string you seem to want to change points to a different folder).

Is the latex file in question also named problemXYZ? In that case, you can probably use \jobname to cobble together the string you want.


More information about the MacOSX-TeX mailing list