summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/stex/workaddress/workaddress.sty
blob: ef90ccbb509655a756f04f0e55835f61a32e1ca9 (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
%%
%% This is file `workaddress.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% workaddress.dtx  (with options: `package')
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{workaddress}[2016/04/06 v0.4 WorkAddress]
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{sref}}
\ProcessOptions
\RequirePackage{sref}
\addmetakey*{wa@person}{id}
\addmetakey*{wa@person}{birthdate}
\addmetakey*{wa@person}{email}
\addmetakey*{wa@person}{url}
\addmetakey*{wa@person}{affiliation}
\addmetakey*{wa@person}{personaltitle}
\addmetakey*{wa@person}{academictitle}
\addmetakey*{wa@person}{department}
\addmetakey*{wa@person}{workaddress}
\addmetakey*{wa@person}{privaddress}
\addmetakey*{wa@person}{worktel}
\addmetakey*{wa@person}{privtel}
\addmetakey*{wa@person}{workfax}
\addmetakey*{wa@person}{privfax}
\addmetakey*{wa@person}{worktelfax}
\addmetakey*{wa@person}{privtelfax}
\def\wa@def#1#2#3#4{\expandafter\xdef\csname wa@#1@#2@#3\endcsname{#4}}
\def\wa@ref@test#1#2#3{%
  \@ifundefined{wa@#1@#2@#3}{%
    \PackageError{workaddress}{reference to undefined #3 of #1 #2}%
    {you must define a #1 with #2=#3\MessageBreak%
     via the macro \protect\WA#1, before you can use it!}
  }{}%
}%
\def\wa@ref#1#2#3{%
  \wa@ref@test{#1}{#2}{#3}%
  \csname wa@#1@#2@#3\endcsname%
}%
\let\wa@persons=\relax
\newcommand\WAperson[2][]{%
  \metasetkeys{wa@person}{#1}%
  \ifx\wa@person@id\@empty%
    \@latex@warning{key 'id' undefined in WAperson}%
  \else%
    \wa@def{person}\wa@person@id{id}{\wa@person@id}% redundant, but useful for checking
    \wa@def{person}\wa@person@id{name}{#2}
    \wa@def{person}\wa@person@id{email}{\wa@person@email}
    \wa@def{person}\wa@person@id{birthdate}{\wa@person@birthdate}
    \wa@def{person}\wa@person@id{url}{\wa@person@url}
    \wa@def{person}\wa@person@id{affiliation}{\wa@person@affiliation}
    \wa@def{person}\wa@person@id{workaddress}{\wa@person@workaddress}
    \wa@def{person}\wa@person@id{privaddress}{\wa@person@privaddress}
    \wa@def{person}\wa@person@id{personaltitle}{\wa@person@personaltitle}
    \wa@def{person}\wa@person@id{academictitle}{\wa@person@academictitle}
    \wa@def{person}\wa@person@id{department}{\wa@person@department}
    \wa@def{person}\wa@person@id{workaddress}{\wa@person@workaddress}
    \wa@def{person}\wa@person@id{privaddress}{\wa@person@privaddress}
    \wa@def{person}\wa@person@id{worktel}{\wa@person@worktel}
    \wa@def{person}\wa@person@id{privtel}{\wa@person@privtel}
    \wa@def{person}\wa@person@id{workfax}{\wa@person@workfax}
    \wa@def{person}\wa@person@id{privfax}{\wa@person@privfax}
    \wa@def{person}\wa@person@id{worktelfax}{\wa@person@worktelfax}
    \wa@def{person}\wa@person@id{privtelfax}{\wa@person@privtelfax}
    \@ifundefined{wa@persons}{%
      \xdef\wa@persons{\wa@person@id}%
    }{%
      \xdef\wa@persons{\wa@persons,\wa@person@id}%
    }%
  \fi%
}%
\newcommand\DCMperson[2][]{%
  \WAperson[#1]{#2}%
  \PackageWarning{workaddress}{\protect\DCMperson\space is deprecated, use \protect\WAperson\space instead}
}%
\addmetakey*{wa@institution}{id}
\addmetakey*{wa@institution}{shortname}
\addmetakey*{wa@institution}{acronym}
\addmetakey*{wa@institution}{url}
\addmetakey*{wa@institution}{partof}
\addmetakey*{wa@institution}{countryshort}
\addmetakey*{wa@institution}{logo}
\addmetakey*{wa@institution}{streetaddress}
\addmetakey*{wa@institution}{townzip}
\addmetakey*{wa@institution}{type}
\addmetakey*{wa@institution}{country}
\let\wa@institutions=\relax
\newcommand\WAinstitution[2][]{%
  \metasetkeys{wa@institution}{#1}%
  \ifx\wa@institution@id\@empty%
    \@latex@warning{key 'id' undefined in WAinstitution}%
  \else%
    \wa@def{institution}\wa@institution@id{id}{\wa@institution@id}% redundant, but useful for checking
    \wa@def{institution}\wa@institution@id{name}{#2}
    \wa@def{institution}\wa@institution@id{shortname}{\wa@institution@shortname}
    \wa@def{institution}\wa@institution@id{acronym}{\wa@institution@acronym}
    \wa@def{institution}\wa@institution@id{url}{\wa@institution@url}
    \wa@def{institution}\wa@institution@id{partof}{\wa@institution@partof}
    \wa@def{institution}\wa@institution@id{countryshort}{\wa@institution@countryshort}
    \wa@def{institution}\wa@institution@id{logo}{\wa@institution@logo}
    \wa@def{institution}\wa@institution@id{townzip}{\wa@institution@townzip}
    \wa@def{institution}\wa@institution@id{streetaddress}{\wa@institution@streetaddress}
    \wa@def{institution}\wa@institution@id{country}{\wa@institution@country}
    \wa@def{institution}\wa@institution@id{type}{\wa@institution@type}
    \@ifundefined{wa@institutions}{%
      \xdef\wa@institutions{\wa@institution@id}%
    }{%
      \xdef\wa@institutions{\wa@institutions,\wa@institution@id}%
    }%
  \fi%
}%
\newcommand\DCMinstitution[2][]{%
  \WAinstitution[#1]{#2}%
  \PackageWarning{workaddress}{\protect\DCMinstitution\space is deprecated, use \protect\WAinstitution\space instead}%
}%
\addmetakey[false]{WAauthorblock}{dept}[true]
\addmetakey[false]{WAauthorblock}{aff}[true]
\addmetakey[false]{WAauthorblock}{url}[true]
\def\@true{true}
\newcounter{authors}
\newcommand\WAauthorblock[2][]{%
  \metasetkeys{WAauthorblock}{#1}
  {\let\tabularnewline\relax
   \@for\@I:=#2\do{\stepcounter{authors}}
   \def\@authors{}%
   \def\@affs{}%
   \def\@depts{}%
   \def\@urls{}%
   \@for\@I:=#2\do{%
     \xdef\@authors{\@authors&\wa@ref{person}\@I{name}}
     \xdef\@@dept{\wa@ref{person}\@I{department}}
     \xdef\@shortname{\csname wa@institution@\@@dept @shortname\endcsname}
     \xdef\@dept{\ifx\@shortname\@empty\wa@ref{institution}\@@dept{name}\else\@shortname\fi}
     \xdef\@depts{\@depts&\@dept}
     \xdef\@@aff{\wa@ref{person}\@I{affiliation}}
     \xdef\@shortname{\csname wa@institution@\@@aff @shortname\endcsname}
     \xdef\@aff{\ifx\@shortname\@empty\wa@ref{institution}\@@aff{name}\else\@shortname\fi}
     \xdef\@affs{\@affs&\@aff}
     \xdef\@urls{\@urls&\wa@ref{person}\@I{url}}
   }%
   \message{\theauthors authors: \@authors}%
  }%
  \begin{tabular}[t]{l*{\theauthors}{c}}
    \@authors\\
    \ifx\WAauthorblock@dept\@true\@depts\\\fi
    \ifx\WAauthorblock@aff\@true\@affs\\\fi
    \ifx\WAauthorblock@url\@true\@urls\\\fi
  \end{tabular}
}%
\newcommand\wapname[1]{\wa@ref{person}{#1}{name}}
\newcommand\waptname[1]{\wa@ref{person}{#1}{personaltitle} \wa@ref{person}{#1}{name}}
\newcommand\wa@institution@logo[2][]{%
  \IfFileExists{\wa@ref{institution}{#2}{logo}}{%
    \includegraphics{\wa@ref{institution}{#2}{logo}}%
  }{%
    \fbox{#2 logo}\message{still need logo for #2}%
  }%
}%
\endinput
%%
%% End of file `workaddress.sty'.