LaTeX-proposal/etc/workaddress.sty

137 lines
6.2 KiB
Plaintext
Raw Normal View History

2014-02-15 12:01:14 +01:00
%%
%% 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}[2012/01/18 v0.4 WorkAddress]
\DeclareOption{showmeta}{\PassOptionsToPackage{\CurrentOption}{metakeys}}
\ProcessOptions
\RequirePackage{sref}
\RequirePackage{pgf}
\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][]{%
\pgfdeclareimage[#1]{logo}{\wa@ref{institution}{#2}{logo}}
\IfFileExists{\wa@ref{institution}{#2}{logo}}%
{\pgfuseimage{logo}}
{\fbox{#2 logo}\message{still need logo for #2}}}
\endinput
%%
%% End of file `workaddress.sty'.