[OS X TeX] jobname

Alain Schremmer Schremmer.Alain at gmail.com
Wed Jan 24 12:28:44 EST 2007


Maarten Sneep wrote:

> On Jan 24, 2007, at 16:08, Alain Schremmer wrote:
>
>> 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?
>
>
> FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=filename

Thanks: I had looked but of course didn't find this.

However, I cannot make it work. The code given there,

    \def\ThisFile{\jobname}
    \newcounter{FileStack}
    \let\OrigInput\input
    \renewcommand{\input}[1]{%
      \stackinput{#1}{\OrigInput}%
    }
    \newcommand{\stackinput}[2]{%
      \stepcounter{FileStack}%
      \expandafter\let
        \csname NameStack\theFileStack\endcsname
        \ThisFile
      \def\ThisFile{#1}%
      #2{#1}%
      \expandafter\let\expandafter
        \ThisFile
        \csname NameStack\theFileStack\endcsname
      \addtocounter{FileStack}{-1}%
    }

gives me "This makes 100 errors; please try again"

With the lines

    \renewcommand{\input}[1]{%
      \stackinput{#1}{\OrigInput}%
    }

commented out I don't get any error so this would seem to be where the 
problem is.

I tried with these lines at the end, that is after the definition of 
\stackinput, but it makes no difference.

I looked at the reference, patching techniques, but this is way beyond 
the little bit I have learned so I am crying for help.

Hopeful regards
--schremmer

 





------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the MacOSX-TeX mailing list