\begin{filecontents}{foo.tex}
\def\foo{\jobname}
\end{filecontents}
\documentclass{article}
\begin{document}
\input{foo}
\foo
\end{document}
This outputs the jobname of the main file not "foo". How can I define a macro that outputs the jobname of the inputted file?
\edef doesn't work either.
\@currname, maybe? – Bruno Le Floch Mar 11 '11 at 13:30\@currnameis only valid inside packages or classes and holds the name of this package or class. It is empty otherwise. – Martin Scharrer♦ Mar 11 '11 at 13:59