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?
\jobnameis always the right way to go. If you want to get the real main file name, which can be different from the job name if it is changed using the-jobnamecompiler argument, then see Macro to retrieve the real name of the source file if pdflatex is invoked with -jobname – Martin Scharrer May 08 '12 at 07:53