| 1 | # VarsFromJobname |
| 2 | |
| 3 | Sources for my varsfromjobname LaTeX package, available also from CTAN: |
| 4 | |
| 5 | [https://www.ctan.org/tex-archive/macros/latex/contrib/varsfromjobname](https://www.ctan.org/tex-archive/macros/latex/contrib/varsfromjobname "CTAN varsfromjobname") |
| 6 | |
| 7 | # Credits |
| 8 | |
| 9 | varsfromjobname.sty is based on code by supplied by Friedrich Vosberg, Enrico Gregorio and Markus Kohm, help from Rolf Niepraschk, Sven Naumann, Ulrich Schwarz and Andreas Mathias was greatly appreciated. |
| 10 | |
| 11 | # What does this package do? |
| 12 | |
| 13 | Using `varsfromjobname.sty` one can easily extract information from the filename, if it follows a certain form. |
| 14 | |
| 15 | The standard LaTeX command `\jobname` returns the name of the LaTeX (master) file. If the filename consists of tokens separated by hyphen we can easily extract certain tokens that can be used _inside_ the document. |
| 16 | |
| 17 | The package expects the filename to be of the form |
| 18 | `one-two-three-four-five-six-seven-eight-nine.tex` and offers the following commands: |
| 19 | |
| 20 | * `\getfromjobname{param}`, with `param` in the range of 1 to n (a highlevel |
| 21 | interface to the following commands) |
| 22 | * `\getonefromjobname` |
| 23 | * `\gettwofromjobname` |
| 24 | * `\getthreefromjobname` |
| 25 | * `\getfourfromjobname` |
| 26 | * `\getfivefromjobname` |
| 27 | * `\getsixfromjobname` |
| 28 | * `\getsevenfromjobname` |
| 29 | * `\geteightfromjobname` |
| 30 | * `\getninefromjobname` |
| 31 | |
| 32 | # Why can it be useful? |
| 33 | |
| 34 | |
| 35 | You can use this package for example to define the date of the document in the filename, personally I use it e.g. for `scrlttr2` letters. |
| 36 | |
| 37 | # References |
| 38 | |
| 39 | * [https://tex.stackexchange.com/questions/212169/qr-code-from-jobname/212171#212171](https://tex.stackexchange.com/questions/212169/qr-code-from-jobname/212171#212171 "QR-code from jobname") |
| 40 | |
| 41 | Remark: [egreg](https://tex.stackexchange.com/users/4427/egreg "egreg") gave an improved version of the code written with expl3 which also overcomes the limitation of nine parameters. |
| 42 | |
| 43 | * [https://tex.stackexchange.com/questions/116755/timestamp-in-document-pdf-name/116805#116805](https://tex.stackexchange.com/questions/116755/timestamp-in-document-pdf-name/116805#116805 "Timestamp in document / pdf name") |
| 44 | |
| 45 | * [https://tex.stackexchange.com/questions/645185/splitting-the-jobname-by-hyphens-in-expl3-syntax "Splitting the \jobname by hyphens in expl3 syntax"] |
| 46 | |
| 47 | |
| 48 | #License |
| 49 | |
| 50 | Licensed under LaTeX Project Public License (LPPL), as of today this is LPPL 1.3c. In case newer version of LPPL is published, those shall apply. |
| 51 | |
| 52 | # Change History |
| 53 | |
| 54 | - Version 0.5, as of January 11th 2009: Initial version published |
| 55 | |
| 56 | - Version 1.0, published May 2017: |
| 57 | - Added various commands which extract necessary information also from included documents |
| 58 | - Modified code as suggested by egreg |
| 59 | |
| 60 | - Version 1.1, published August 2025: |
| 61 | - Switched to expl3 syntax, allowing more than nine tokens |
| 62 | |
| 63 | |
| 64 | 2025-08-03, Uwe Ziegenhagen |