Comprehensive TeX Archive Network

Direc­tory macros/latex/contrib/varsfromjobname



Sources for my vars­fromjob­name pack­age, avail­able also from CTAN:



vars­fromjob­name.sty is based on code by sup­plied by Friedrich Vos­berg, En­rico Gre­go­rio and Markus Kohm, help from Rolf Niepraschk, Sven Nau­mann, Ul­rich Sch­warz and An­dreas Mathias was greatly ap­pre­ci­ated.

What does this pack­age do?

Us­ing varsfromjobname.sty one can eas­ily ex­tract in­for­ma­tion from the file­name, if it fol­lows a cer­tain form.

The stan­dard com­mand \jobname re­turns the name of the (mas­ter) file. If the file­name con­sists of to­kens sep­a­rated by hy­phen we can eas­ily ex­tract cer­tain to­kens that can be used in­side the doc­u­ment.

The pack­age ex­pects the file­name to be of the form one-two-three-four-five-six-seven-eight-nine.tex and of­fers the fol­low­ing com­mands:

  • \getfromjobname{param}, with param in the range of 1 to 9 (a high­level

in­ter­face to the fol­low­ing com­mands)

  • \getonefromjobname
  • \gettwofromjobname
  • \getthreefromjobname
  • \getfourfromjobname
  • \getfivefromjobname
  • \getsixfromjobname
  • \getsevenfromjobname
  • \geteightfromjobname
  • \getninefromjobname

Why can it be use­ful?

You can use this pack­age for ex­am­ple to de­fine the date of the doc­u­ment in the file­name, per­son­ally I use it e.g. for scrlttr2 let­ters.


  • \getfromjobname is not fully ex­pand­able, use one of the other com­mands if you need ex­pan­sion
  • Ver­sion 1.0 can­not ex­tract in­for­ma­tion from in­cluded sub-doc­u­ments
  • The pack­age can­not han­dle more than nine to­kens, see the ref­er­ence to egreg's an­swer on TSX be­low for an up­dated ver­sion


Re­mark: egreg gave an im­proved ver­sion of the code writ­ten with ex­pl3 which also over­comes the lim­i­ta­tion of nine pa­ram­e­ters.

  • Ger­man ar­ti­cle in the DTK on page­wise ver­sion­ing with Sub­ver­sion (to be pub­lished)

Change His­tory

  • Ver­sion 0.5, as of Jan­uary 11th 2009: Ini­tial ver­sion pub­lished
  • Ver­sion 1.0, to be pub­lished May 2017:
    • Added var­i­ous com­mands which ex­tract nec­es­sary in­for­ma­tion also from in­cluded doc­u­ments
    • Mod­i­fied code as sug­gested by egreg

2017-04-30, Uwe Ziegen­hagen

Down­load the con­tents of this pack­age in one zip archive (182.2k).

vars­fromjob­name – Ex­tract vari­ables from the name of the file

The pack­age al­lows the user to ex­tract in­for­ma­tion from the job name, pro­vided that the name has been struc­tured ap­pro­pri­ately: the pack­age ex­pects the file name to con­sist of a set of words sep­a­rated by hy­phens.

Home pagehttps://github.com/UweZiegen­hagen/VarsFromJob­name
Li­cense The Project Public Li­cense
Main­tainerUwe Ziegen­hagen
Con­tained inTeX Live as vars­fromjob­name
MiKTeX as vars­fromjob­name
Topics sup­port for keep­ing track of doc­u­ment de­vel­op­ment
Guest Book Sitemap Contact Contact Author