[pdftex] Getting the -output-directory command-line option value from within TeX

Reinhard Kotucha reinhard.kotucha at web.de
Tue Sep 6 23:45:06 CEST 2011


On 2011-09-06 at 17:29:50 +0200, Anthony Truchet wrote:

 > Hello,
 > 
 > I'm trying to revival the python.sty package [1] which enable executing 
 > an embedded python script during tex compilation and then inputing the 
 > python's output.
 > This implies playing with writing files through \openout and \write.
 > Those files are --- if the newbie I am is not too mistaken ;-) --- 
 > written in the directory given as  -output-directory command-line option 
 > to pdf(la)tex, which defaults to the current directory.
 > But then, I do need to invoke the python interpreter with a \write18, 
 > and for that I need to know the path to the file I just outputted.
 > 
 > The question is : how do I know from (La)Tex where are output the file / 
 > which is the value of  the -output-directory command-line option ?
 > 
 > Please don't hesitate to point me to a more relevant package instead of 
 > answering :I would be glad to help maintain such a work if it has 
 > already be done ;-)

It's easy with LuaTeX because Lua can access the argument vector:

for k,v in pairs(arg) do
   if string.find(v, '%-output%-directory=') then
      outputdir=string.explode(v, '=')[2]
   end
end

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------


More information about the pdftex mailing list