[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 12:57:44 EDT 2012

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

> I should have been more clear.  The tree structure is like this:
>      /problem-dbase/problemXYZ/problem.tex
> 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
>      \input{../problem-dbase/problemXYZ/problem.tex}

I think the following should work, but I haven't really tested it. In the root file do something like this:

%% Begin example







%% End example

Then, in problem.tex, use \graphicspath{{\graphicsPath}} instead of \graphicspath{{../problem-dbase/problemXYZ/}}. (I'm not sure the double brackets are necessary, but they are in the original example you provided.)

If you have multiple input files, then you can just redefine \graphicsPath before each \inputFile.

Good luck.

Oh, I see Michael Sharpe suggests a similar solution.


More information about the MacOSX-TeX mailing list