[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 10:24:18 EDT 2012

On Aug 31, 2012, at 9:53 AM, Chris Goedde <cgg.lists at gmail.com> wrote:

> 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.
> Chris

I should have been more clear.  The tree structure is like this:

The latex source of the problem is in problem.tex and contains the line \graphicspath{{../problem-dbase/problemXYZ/}}. The enclosing folder is problemXYZ. All problems in the database are named problem.tex and are identified by the name of the enclosing folder. The root file resides in a folder at the same level as problem-dbase and calls this problem with the command


All of this miraculously works, but what I would like to do now is access from inside problem.tex the name of its enclosing folder and then pass it to \graphicspath, so that instead of hard-coding the name "problemXYZ" in the \graphicspath this would be set automatically in each latex run. I am probably asking for too much of a miracle... 


More information about the MacOSX-TeX mailing list