summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/varsfromjobname/varsfromjobname.sty
blob: c2e731f515142268dbfadd9de2465deef951924d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
%begin of varsfromjobname.sty
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{varsfromjobname}[2008/05/12 v. 0.4 extracts tokens from jobname (UZ)]
\RequirePackage{ifthen} 

% Author: Uwe Ziegenhagen
% based on code supplied by Friedrich Vosberg and Markus Kohm
% help by Rolf Niepraschk and Sven Naumann, Ulrich Schwarz 
% and Andreas Mathias was greatly appreciated
% see posting <3983639.NRU96H2Y1Y@ID-107054.user.dfncis.de>
% requires the filename to be of the following form
% itemone-itemtwo-itemthree- ... -itemnine.tex

\makeatletter

\newcommand*{\getonefromjobname}{%
  \expandafter\@getonefromfilename\jobname--------\@nil%
}

\newcommand*{\gettwofromjobname}{%
  \expandafter\@gettwofromfilename\jobname--------\@nil%
}

\newcommand*{\getthreefromjobname}{%
  \expandafter\@getthreefromfilename\jobname--------\@nil%
}

\newcommand*{\getfourfromjobname}{%
  \expandafter\@getfourfromfilename\jobname--------\@nil%
}

\newcommand*{\getfivefromjobname}{%
  \expandafter\@getfivefromfilename\jobname--------\@nil%
}

\newcommand*{\getsixfromjobname}{%
  \expandafter\@getsixfromfilename\jobname--------\@nil%
}

\newcommand*{\getsevenfromjobname}{%
  \expandafter\@getsevenfromfilename\jobname--------\@nil%
}

\newcommand*{\geteightfromjobname}{%
  \expandafter\@geteightfromfilename\jobname--------\@nil%
}

\newcommand*{\getninefromjobname}{%
  \expandafter\@getninefromfilename\jobname\@nil%
}

\newcommand*\@getonefromfilename{}
\def\@getonefromfilename#1-#2-#3-#4-#5-#6-#7-#8-#9\@nil{%
#1%
}

\newcommand*\@gettwofromfilename{}
\def\@gettwofromfilename#1-#2-#3-#4-#5-#6-#7-#8-#9\@nil{%
#2%
}

\newcommand*\@getthreefromfilename{}
\def\@getthreefromfilename#1-#2-#3-#4-#5-#6-#7-#8-#9\@nil{%
#3%
}

\newcommand*\@getfourfromfilename{}
\def\@getfourfromfilename#1-#2-#3-#4-#5-#6-#7-#8-#9\@nil{%
#4%
}

\newcommand*\@getfivefromfilename{}
\def\@getfivefromfilename#1-#2-#3-#4-#5-#6-#7-#8-#9\@nil{%
#5%
}


\newcommand*\@getsixfromfilename{}
\def\@getsixfromfilename#1-#2-#3-#4-#5-#6-#7-#8-#9\@nil{%
#6%
}


\newcommand*\@getsevenfromfilename{}
\def\@getsevenfromfilename#1-#2-#3-#4-#5-#6-#7-#8-#9\@nil{%
#7%
}

\newcommand*\@geteightfromfilename{}
\def\@geteightfromfilename#1-#2-#3-#4-#5-#6-#7-#8-#9\@nil{%
#8%
}

\newcommand*\@getninefromfilename{}
\def\@getninefromfilename#1-#2-#3-#4-#5-#6-#7-#8-#9\@nil{%
#9%
}

\newcommand{\getfromjobname}[1]{
\ifthenelse{\equal{#1}{1}}{\getonefromjobname}{}
\ifthenelse{\equal{#1}{2}}{\gettwofromjobname}{}
\ifthenelse{\equal{#1}{3}}{\getthreefromjobname}{}
\ifthenelse{\equal{#1}{4}}{\getfourfromjobname}{}
\ifthenelse{\equal{#1}{5}}{\getfivefromjobname}{}
\ifthenelse{\equal{#1}{6}}{\getsixfromjobname}{}
\ifthenelse{\equal{#1}{7}}{\getsevenfromjobname}{}
\ifthenelse{\equal{#1}{8}}{\geteightfromjobname}{}
\ifthenelse{\equal{#1}{9}}{\getninefromjobname}{}
}

\makeatother
% end of jobdate.sty