# [OS X TeX] jobname

Alain Schremmer schremmer.alain at gmail.com
Mon May 7 19:43:27 EDT 2007

On Apr 23, 2007, at 6:49 PM, Alain Schremmer wrote:

> […] my original query which was:
>
>> Given a file ROOT that \include{FILE}, \jobname in FILE returns
>> ROOT which makes sense but is there a way to get FILE instead of
>> ROOT?

I have finally solved the problem or, rather, after looking up the
site suggested by Sneep,

http://www.tex.ac.uk/cgi-bin/texfaq2html?label=filename

in which there was the code that Moore then said "doesn't seem to
have been well-tested with modern LaTeX. It falls foul of things that
happen both at  \begin{document}  and  \end{document}", I finally
looked-up the package mentioned at the bottom of that site:

macros/latex/contrib/fink

1) It almost worked, in the sense that \finkfile did get replaced by
the name of the included file rather than by the name of the root.
However, it also included the extension .tex which didn't work for me
since I am using the file name as part of names within the included
files.

The author, Didier Verna, kindly added a command to his package,
\finkfilese, which is replaced by the included file name "sans
extension", and now the various root files compile with the included
chapter files and the includedExercises files in the included chapters.

2) When I wanted to use \ finkfilese with probsoln, as part of
\newproblems numbers, though, it didn't work because of the way
probsoln works.

Verna then suggested placing \xdef\thisfile{\finkfilese} on top of
each problem file and then to number the \newproblems using
\thisfile. And now the multiple choice examples compile.

So, thanks to Gerhardt, Goedde, Moore, Sneep, Talbot and Verna who
each helped automate one aspect, my file making is now completely
automated with just one template for the chapters, one template for
the chapter exercises set, one template for the problem files, etc.
In the (very, very many) copies of each template—automatically
created and numbered by an applescript, the relevant numbering is now
automatically completed with \finkfilese picking up, directly or
indirectly, the filename of the copy. It all works beautifully.

I will be glad to send anyone interested all the pertinent
information/examples, etc.

Best regards to all
--schremmer