I am writing a package that saves information to an external file. I would like to name that file according to the source one; something like
foo.tex -> foo.bar
But I cannot find any variable that contains 'foo'. I am pretty sure that there must be one because the table of contents is saved to foo.toc.
Any pointers?
Best Answer
You want the macro
\jobname
. This isn't quite the filename; to quote from the TeX FAQ:So if you're processing
foo.tex
,\jobname
will befoo
(which, of course, is probably what you want anyway).