% varsfromjobname-expl3.sty \RequirePackage{expl3} \RequirePackage{currfile} \ProvidesExplPackage {varsfromjobname} {2025/08/03} {1.1} {Extract tokens from jobname or currfilebase using LaTeX3} \ExplSyntaxOn \NewExpandableDocumentCommand{\getfromjobname}{m} { \seq_item:Nn \g_varsfromjobname_main_seq { #1 } } \seq_new:N \g_varsfromjobname_main_seq \seq_gset_split:NnV \g_varsfromjobname_main_seq { - } \c_sys_jobname_str \NewExpandableDocumentCommand{\getonefromjobname}{} { \getfromjobname { 1 } } \NewExpandableDocumentCommand{\gettwofromjobname}{} { \getfromjobname { 2 } } \NewExpandableDocumentCommand{\getthreefromjobname}{} { \getfromjobname { 3 } } \NewExpandableDocumentCommand{\getfourfromjobname}{} { \getfromjobname { 4 } } \NewExpandableDocumentCommand{\getfivefromjobname}{} { \getfromjobname { 5 } } \NewExpandableDocumentCommand{\getsixfromjobname}{} { \getfromjobname { 6 } } \NewExpandableDocumentCommand{\getsevenfromjobname}{} { \getfromjobname { 7 } } \NewExpandableDocumentCommand{\geteightfromjobname}{} { \getfromjobname { 8 } } \NewExpandableDocumentCommand{\getninefromjobname}{} { \getfromjobname { 9 } } %currfile syntax % Local sequence for currfile parsing \seq_new:N \l_varsfromjobname_currfile_seq % Split currfilebase \cs_new:Nn \varsfromjobname_split_currfile: { \tl_set:Nx \l_tmpa_tl { \currfilebase } \seq_set_split:NnV \l_varsfromjobname_currfile_seq { - } \l_tmpa_tl } % Base extractor \NewExpandableDocumentCommand{\getfromcurrfilename}{m} { \varsfromjobname_split_currfile: \seq_item:Nn \l_varsfromjobname_currfile_seq { #1 } } % Convenience aliases \NewExpandableDocumentCommand{\getonefromcurrfilename}{} { \getfromcurrfilename{1} } \NewExpandableDocumentCommand{\gettwofromcurrfilename}{} { \getfromcurrfilename{2} } \NewExpandableDocumentCommand{\getthreefromcurrfilename}{}{ \getfromcurrfilename{3} } \NewExpandableDocumentCommand{\getfourfromcurrfilename}{} { \getfromcurrfilename{4} } \NewExpandableDocumentCommand{\getfivefromcurrfilename}{} { \getfromcurrfilename{5} } \NewExpandableDocumentCommand{\getsixfromcurrfilename}{} { \getfromcurrfilename{6} } \NewExpandableDocumentCommand{\getsevenfromcurrfilename}{}{ \getfromcurrfilename{7} } \NewExpandableDocumentCommand{\geteightfromcurrfilename}{}{ \getfromcurrfilename{8} } \NewExpandableDocumentCommand{\getninefromcurrfilename}{} { \getfromcurrfilename{9} } \ExplSyntaxOff