[OS X TeX] Can latex read the name of the folder that contains my latex file?
Themis Matsoukas
tmatsoukas at me.com
Tue Sep 4 10:47:39 EDT 2012
On Aug 31, 2012, at 5:00 PM, Ross Moore <ross.moore at mq.edu.au> wrote:
> Sent from my iPad
>
> On 01/09/2012, at 0:24, Themis Matsoukas <tmatsoukas at me.com> wrote:
>>
>> \input{../problem-dbase/problemXYZ/problem.tex}
>>
>> 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...
>
> No, not too much, if you do a bit of work.
>
> Use TeX's \write18 to run a shell command, such as
> cat `pwd`> pwd.txt
> giving you the name of the directory written inside a simple text file.
>
> [...]
I'll have to digest this and give it a try. Thanks.
Themis
More information about the MacOSX-TeX
mailing list