[OS X TeX] \jobname+3

Manuel Pégourié-Gonnard mpg at elzevir.fr
Wed Sep 21 18:45:24 EDT 2011


Le 13/09/2011 21:48, Chris Goedde a écrit :
> On Sep 13, 2011, at 2:14 PM, Alain Schremmer wrote:
> 
>> Is there a way to use something along the lines of
>>
>> ../QuestionsBase/\jobname+3/12
>>
>> so as to get, with a file named 4.tex,
>>
>> ../QuestionsBase/7/12
> 
> The sequence
> 
> \newcounter{filenum}
> \setcounter{filenum}{\jobname}
> \addtocounter{filenum}{3}
> 
> will create a counter called filenum that will have value of \jobname + 3.

Or, simpler, \number\numexpr\jobname + 3\relax will do the trick (using e-TeX
extensions).

Manuel.

PS: of course if you don't feel like typing this all over the place in your doc,
you can use a macro such as:

\newcommand \jnplus [1] {\number\numexpr\jobname+#1\relax}

and then

../QuestionsBase/\jnplus{3}/12



More information about the MacOSX-TeX mailing list