LaTeX-proposal/base/pdata.sty

146 lines
7.6 KiB
Plaintext
Raw Normal View History

2014-02-15 12:01:14 +01:00
%%
%% This is file `pdata.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% proposal.dtx (with options: `pdata')
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
2020-08-24 11:49:25 +02:00
\ProvidesPackage{pdata}[2020/08/21 v1.7 Project Data]
2014-02-15 12:01:14 +01:00
\RequirePackage{eurosym}
\newif\if@sites\@sitesfalse\let\prop@gen@sites=\relax%
\newcounter{@site}%
\define@key{prop@gen}{site}{\@sitestrue\@dmp{site=#1}%
\stepcounter{@site}\pdata@def{site}{#1}{number}{\the@site}%
\define@key{prop@gen}{#1name}{\pdata@def{site}{#1}{name}{##1}}
\define@key{prop@gen}{#1acronym}{\pdata@def{site}{#1}{acronym}{##1}}
\define@key{prop@gen}{#1country}{\pdata@def{site}{#1}{country}{##1}}
\define@key{prop@gen}{#1countryshort}{\pdata@def{site}{#1}{countryshort}{##1}}
\define@key{prop@gen}{#1streetaddress}{\pdata@def{site}{#1}{streetaddress}{##1}}
\define@key{prop@gen}{#1townzip}{\pdata@def{site}{#1}{townzip}{##1}}
\define@key{prop@gen}{#1url}{\pdata@def{site}{#1}{url}{##1}}
\define@key{prop@gen}{#1logo}{\pdata@def{site}{#1}{logo}{##1}}
\define@key{prop@gen}{#1type}{\pdata@def{site}{#1}{type}{##1}}
2014-02-15 12:01:14 +01:00
\@ifundefined{prop@gen@sites}{\xdef\prop@gen@sites{#1}}{\xdef\prop@gen@sites{\prop@gen@sites,#1}}%
\define@key{prop@gen}{#1RM}{\pdata@def{site}{#1}{intendedRM}{##1}}%
2016-09-28 17:05:53 +02:00
\if@RAM\define@key{prop@gen}{#1RAM}{\pdata@def{site}{#1}{intendedRAM}{##1}}\fi
2014-02-15 12:01:14 +01:00
\define@key{workpackage}{#1RM}{\pdata@def\wp@id{#1}{RM}{##1}}%
2016-09-28 17:05:53 +02:00
\if@RAM\define@key{workpackage}{#1RAM}{\pdata@def\wp@id{#1}{RAM}{##1}}\fi
\define@key{task}{#1RM}{\pdata@def{\wp@id @\task@id}{#1}{RM}{##1}}%
\if@RAM\define@key{task}{#1RAM}{\pdata@def{\wp@id @\task@id}{#1}{RAM}{##1}}\fi
\define@key{prop@gen}{#1shortname}{\pdata@def{site}{#1}{shortname}{##1}}
\define@key{prop@gen}{#1employed}{{\let\tabularnewline\relax\let\hline\relax\let%
2014-02-15 12:01:14 +01:00
\@ifundefined{prop@gen@employed@lines}%
{\xdef\prop@gen@employed@lines{\pdataref{site}{#1}{shortname} & ##1\tabularnewline\hline}}%
{\xdef\prop@gen@employed@lines{\prop@gen@employed@lines\ \pdataref{site}{#1}{shortname} & ##1\tabularnewline\hline}}}}}
2014-02-15 12:01:14 +01:00
\define@key{prop@gen}{RM}{\@dmp{RM=#1}\if@sites%
\PackageWarning{Do not use the RM key in the presence of sites}\else%
\pdata@def{all}{intended}{RM}{#1}\fi}
\define@key{prop@gen}{RAM}{\@dmp{RAM=#1}\if@sites%
\PackageWarning{Do not use the RAM key in the presence of sites}\else%
\pdata@def{all}{intended}{RAM}{#1}\fi}
\define@key{prop@gen}{PI}{\@dmp{PI=#1}%
\define@key{prop@gen}{#1name}{\pdata@def{PI}{#1}{name}{##1}}%
\define@key{prop@gen}{#1title}{\pdata@def{PI}{#1}{title}{##1}}%
\define@key{prop@gen}{#1affiliation}{\pdata@def{PI}{#1}{affiliation}{##1}}%
\define@key{prop@gen}{#1dept}{\pdata@def{PI}{#1}{dept}{##1}}%
2014-02-15 12:01:14 +01:00
\@ifundefined{prop@gen@PIs}{\xdef\prop@gen@PIs{#1}}{\xdef\prop@gen@PIs{\prop@gen@PIs,#1}}}
\define@key{prop@gen}{pubspage}{\@ifundefined{prop@gen@pubspages}%
{\xdef\prop@gen@pubspages{#1}}{\xdef\prop@gen@pubspages{\prop@gen@pubspages,#1}}}
\define@key{prop@gen}{importfrom}{\message{importing proposal data from #1.pdata}\readpdata{#1}}
\define@key{prop@gen}{instrument}{\def\prop@gen@instrument{#1}%
\pdata@def{prop}{gen}{instrument}{#1}\@dmp{inst=#1}}
\define@key{prop@gen}{title}{\def\prop@gen@title{#1}%
\pdata@def{prop}{gen}{title}{#1}}
\define@key{prop@gen}{acronym}{\gdef\prop@gen@acronym{#1}%
\pdata@def{prop}{gen}{acronym}{#1}\@dmp{acro=#1}}
\define@key{prop@gen}{acrolong}{\def\prop@gen@acrolong{#1}%
\pdata@def{prop}{gen}{acrolong}{#1}}
\define@key{prop@gen}{proposalnumber}{\def\prop@gen@proposalnumber{#1}%
\pdata@def{prop}{gen}{proposalnumber}{#1}}
2014-02-15 12:01:14 +01:00
\define@key{prop@gen}{discipline}{\def\prop@gen@discipline{#1}%
\pdata@def{prop}{gen}{discipline}{#1}}
\define@key{prop@gen}{areas}{\def\prop@gen@areas{#1}%
\pdata@def{prop}{gen}{areas}{#1}}
\define@key{prop@gen}{start}{\def\prop@gen@start{#1}%
\pdata@def{prop}{gen}{start}{#1}}
\define@key{prop@gen}{months}{\def\prop@gen@months{#1}%
\pdata@def{prop}{gen}{months}{#1}}
\define@key{prop@gen}{since}{\def\prop@gen@since{#1}%
\pdata@def{prop}{gen}{since}{#1}}
\define@key{prop@gen}{totalduration}{\def\prop@gen@totalduration{#1}%
\pdata@def{prop}{gen}{totalduration}{#1}}
\define@key{prop@gen}{fundsuntil}{\def\prop@gen@fundsuntil{#1}%
\pdata@def{prop}{gen}{fundsuntil}{#1}}
\define@key{prop@gen}{topdownPM}[true]{\def\prop@gen@topdownPM{#1}}
\define@key{prop@gen}{botupPM}[true]{\def\prop@gen@botupPM{#1}}
\define@key{prop@gen}{keywords}{\def\prop@gen@keywords{#1}}
2014-10-27 17:49:59 +01:00
\newcommand\prop@gen@acro@default{ACRONYM}
\def\prop@gen@acro{\prop@gen@acro@default}
\newcommand\prop@gen@months@default{???months???}
\def\prop@gen@months{\prop@gen@months@default}
\newcommand\prop@gen@title@default{???Proposal Title???}
\def\prop@gen@title{\prop@gen@title@default}
\newcommand\prop@gen@instrument@default{??? Instrument ???}
\def\prop@gen@instrument{\prop@gen@instrument@default}
2014-02-15 12:01:14 +01:00
\newcommand\prop@tl[2]{\xdef\tab@line{}
\@for\tl@ext:={#1}\do{\xdef\tab@line{\tab@line&#2}}
\tab@line}
\def\prop@gen@compactht{false}
\define@key{prop@gen}{compactht}[true]{\def\prop@gen@compactht{#1}}
\newif\ifwork@areas\work@areastrue
\DeclareOption{noworkareas}{\work@areasfalse}
\ProcessOptions
\RequirePackage{xspace}
\newwrite\pdata@out
\newcommand\pdata@open[1]{\immediate\openout\pdata@out=#1.pdata}
\newcommand\pdata@close{\closeout\pdata@out}
\newcommand\readpdata[1]{\IfFileExists{./#1.pdata}
{\message{proposal: Reading Project Data}\makeatletter\input{./#1.pdata}\makeatother}
2014-02-15 12:01:14 +01:00
{proposal: No Project Data found, (forward) references may be compromized}}
\newcommand\pdata@target[3]{\hypertarget{#1@#2@target}{#3}}
\newcommand\pdata@def[4]{%\@pdata@def{#1}{#2}{#3}{#4}%
\protected@write\pdata@out{}{\string\@pdata@def{#1}{#2}{#3}{#4}}}
\newcommand\@pdata@def[4]{\expandafter\gdef\csname #1@#2@#3\endcsname{#4}}
\newcommand\pdataref[3]{\@ifundefined{#1@#2@#3}%
{\protect\G@refundefinedtrue\@latex@warning{#3 for #1 #2 undefined}??}%
{\csname #1@#2@#3\endcsname}}%
\newcommand\pdataref@aux[3]{\@ifundefined{#1@#2@#3}{??}{\csname #1@#2@#3\endcsname}}%
\newcommand\pdataref@num[3]{\@ifundefined{#1@#2@#3}{0}{\csname #1@#2@#3\endcsname}}%
\newcommand\pdataref@safe[3]{\@ifundefined{#1@#2@#3}{}{\csname #1@#2@#3\endcsname}}%
\newcommand\pdatarefFB[4]{\@ifundefined{#1@#2@#3}%
{\@ifundefined{#1@#2@#4}%
{\protect\G@refundefinedtrue\@latex@warning{both #3 and its fallback #4 undefined for #1 #2}??}%
{\csname #1@#2@#4\endcsname}}
{\csname #1@#2@#3\endcsname}}
2014-02-15 12:01:14 +01:00
\newcommand\pdataRef[3]{\@ifundefined{#1@#2@#3}%
{\protect\G@refundefinedtrue\@latex@warning{#3 for #1 #2 undefined}??}%
{\hyperlink{#1@#2@target}{\csname #1@#2@#3\endcsname}}}
\newcommand\pdataRefFB[4]{\@ifundefined{#1@#2@#3}%
{\@ifundefined{#1@#2@#4}%
{\protect\G@refundefinedtrue\@latex@warning{both #3 and its fallback #4 undefined for #1 #2}??}%
{\hyperlink{#1@#2@target}{\csname #1@#2@#4\endcsname}}}
{\hyperlink{#1@#2@target}{\csname #1@#2@#3\endcsname}}}
2014-02-15 12:01:14 +01:00
\newcommand\prop@count[1]{\ifcase #1 zero\or one\or two\or three\or four\or five\or six\or seven \or
eight\or nine\or ten\or eleven \or twelve\else#1\fi}
\newcommand\pdatacount[2]{\prop@count{\pdataref@num{#1}{#2}{count}}}
\newcommand\pn{\pdataref{prop}{gen}{acronym}\xspace}
\newcommand\pnlong{\pdataref{prop}{gen}{acrolong}\xspace}
\newcommand\WPref[1]{\pdataRef{wp}{#1}{label}}
\newcommand\WPtref[1]{\WPref{#1}: \pdataRefFB{wp}{#1}{short}{title}}
2014-02-15 12:01:14 +01:00
\ifwork@areas
\newcommand\WAref[1]{\pdataRef{wa}{#1}{label}}
\newcommand\WAtref[1]{\WAref{#1}: \pdataRefFB{wa}{#1}{short}{title}}
2014-02-15 12:01:14 +01:00
\fi
\newcommand{\signatures}[1]{\section{#1}
\qquad\number\day. \number\month. \number\year\\[6ex]
\strut\qquad Date\hfill\@for\@p:=\prop@gen@PIs\do{%
\pdataref{PI}\@p{title}~\pdataref{PI}\@p{name}\hfill}}
\def\@dmp#1{\ifkeys\marginpar{\small #1}\fi}
2014-02-15 12:01:14 +01:00
\renewcommand\euro{\officialeuro\xspace}
2014-02-15 12:01:14 +01:00
\endinput
%%
%% End of file `pdata.sty'.