% \iffalse meta-comment
% A class for preparing FP7 proposals for collaborative projects
%
% Copyright (c) 2011 Michael Kohlhase, all rights reserved
%
% This file is distributed under the terms of the LaTeX Project Public
% License from CTAN archives in directory  macros/latex/base/lppl.txt.
% Either version 1.0 or, at your option, any later version.
%
% The development version of this file can be found at
% https://github.com/KWARC/LaTeX-proposal
% \fi
% 
% \iffalse
%<cls|pdata|reporting>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<cls>\ProvidesClass{euproposal}[2016/12/15 v1.5 EU Proposal]
%<pdata>\ProvidesPackage{eupdata}[2016/12/15 v1.5 EU Project Data]
%<reporting>\ProvidesPackage{eureporting}[2016/12/15 v1.5 EU Project Reporting]
%<*driver>
\documentclass[twoside]{ltxdoc}
\DoNotIndex{\def,\long,\edef,\xdef,\gdef,\let,\global}
\DoNotIndex{\begin,\AtEndDocument,\newcommand,\newcounter,\stepcounter}
\DoNotIndex{\immediate,\openout,\closeout,\message,\typeout}
\DoNotIndex{\section,\scshape,\arabic}
\EnableCrossrefs
%\CodelineIndex
%\OnlyDescription
\RecordChanges
\usepackage{textcomp,url,paralist,a4wide,xspace}
\usepackage[show]{ed}
\usepackage[maxbibnames=6,hyperref=auto,style=alphabetic,backend=bibtex]{biblatex}
\addbibresource{../lib/proposal.bib}
\usepackage[bookmarks=true,linkcolor=blue,
 citecolor=blue,urlcolor=blue,colorlinks=true,
 breaklinks=true, bookmarksopen=true]{hyperref}
\makeindex
\newcommand\subversion{\textsc{Subversion}\xspace}
\begin{document}
\DocInput{euproposal.dtx}
\end{document}
%</driver>
% \fi
% 
%\iffalse\CheckSum{639}\fi
% 
% \changes{v0.1}{2007/05/07}{used in the SciML proposal}
% \changes{v0.2}{2007/05/09}{First Version with Documentation}
% \changes{v0.3}{2007/06/04}{staff effort table finally works, released}
% \changes{v0.3a}{2008/01/18}{error corrections and more documentation}
% \changes{v1.3}{2011/05/18}{basing this on proposal.cls}
% \changes{v1.4}{2012/01/18}{various tweaks for the Jan 2012 proposal deadline}
% \changes{v1.4}{2015/01/14}{lots of tweaks}
% 
% \GetFileInfo{euproposal.cls}
% 
% \MakeShortVerb{\|}
% \title{Preparing FP7 EU Proposals and Reports in {\LaTeX} with \texttt{euproposal.cls}}
%    \author{Michael Kohlhase\\
%      Computer Science, Jacobs University Bremen\\
%      \url{http://kwarc.info/kohlhase}}
% \maketitle
%
% \begin{abstract}
%   The |euproposal| class supports many of the specific elements of a Framework 7
%   Proposal. It is optimized towards collaborative projects. The package comes with an
%   extensive example (a fake EU proposal) that shows all elements in action. 
% \end{abstract}
% 
% \tableofcontents\newpage
%
% \section{Introduction}\label{sec:intro}
%
%   Writing grant proposals is a collaborative effort that requires the integration of
%   contributions from many individuals. The use of an ASCII-based format like {\LaTeX}
%   allows to coordinate the process via a source code control system like
%   \subversion, allowing the proposal writing team to concentrate on the contents
%   rather than the mechanics of wrangling with text fragments and revisions. 
% 
%   The |euproposal| class extends the |proposal| class~\cite{Kohlhase:pplp:svn} and
%   supports many of the specific elements of Part B of a Framework 7 Proposal. The
%   package documentation is still preliminary, fragmented and incomplete and only dwells
%   on the particulars of DFG proposals, so we treat~\cite{Kohlhase:pplp:svn} as a
%   prerequisite. Please consult the example proposal |propB.tex|, which comes with the
%   package and shows the usage of the class in action. It is intended as a template for
%   your proposal, but please bear in mind that the EU guidelines may change from call to
%   call, if in doubt, please consult the FP7 guide for proposers.\ednote{say something
%   about the proposers guide.}
%
%   The |eureporting| class supports most of the specific elements of the project reports
%   to the EC. The example report |dfg/report.tex| is intended as a template for your
%   final report\ednote{say something about reporting}.
%
%   The |euproposal| and |eureporting| classes and the |eupdata| package are distributed
%   under the terms of the LaTeX Project Public License from CTAN archives in directory
%   macros/latex/base/lppl.txt.  Either version 1.0 or, at your option, any later
%   version. The CTAN archive always contains the latest stable version, the development
%   version can be found at \url{https://github.com/KWARC/LaTeX-proposal}. For bug reports
%   please use the sTeX TRAC at \url{https://github.com/KWARC/LaTeX-proposal/issues}.
%   
% \section{The User Interface}\label{sec:user-interface}
% 
% In this section we will describe the functionality offered by the |euproposal| class
% along the lines of the macros and environments the class provides. Much of the
% functionality can better be understood by studying the functional example |proposal.tex|
% (and its dependents) that comes with the |euproposal| package in conjunction with the
% proposer's EU proposer's guidelines (we have included it as |***| for convenience into
% the package distribution).\ednote{MK@MK do that and talk about reporting as well.}
% 
% \subsection{Package Options}\label{sec:user:options}
%
% As usual in {\LaTeX}, the package is loaded by
% |\documentclass[|\meta{options}|]{euproposal}|, where |[|\meta{options}|]| is optional
% and gives a comma separated list of options specified in~\cite{Kohlhase:pplp:svn}.  Some
% versions EU proposals want non-standard numbering schemes (e.g. starting with
% \textbf{B...} since we are writing Part B.), this can be reached by giving the |propB|
% option.
% 
% \subsection{Proposal Metadata and Title page}\label{sec:user:metadata}
% 
% The metadata of the proposal is specified in the \DescribeEnv{proposal}|proposal|
% environment, which also generates the title page and the first section of the proposal
% as well as the last pages of the proposal with the signatures, enclosures, and
% references. The |proposal| environment should contain all the mandatory parts of the
% proposal text. The |proposal| environment uses the following EU-specific keys to
% specify metadata.
% \begin{compactitem}
% \item \DescribeMacro{callname}|callname| specifies the call the proposal addresses. It is
%   usually a string of the form |ICT Call 1|, \DescribeMacro{callid}|callid| is the
%   corresponding identifier, usually a string of the form |FP7-???-200?-?|. An overview
%   over open calls can be found at \url{http://cordis.europa.eu/fp7/dc/index.cfm}
% \item The \DescribeMacro{challenge}|challenge|, \DescribeMacro{objective}|objective|,
%   and \DescribeMacro{outcome}|outcome| keys specifies the specific parts in the call
%   this proposal addresses. These are specified in the ``call fiche'' that can be
%   obtained from the URL above. All of these have an identifier, which can be specified
%   via the \DescribeMacro{challengeid}|challengeid|,
%   \DescribeMacro{objectiveid}|objectiveid|, and \DescribeMacro{outcomeid}|outcomeid|
%   keys.\ednote{MK@MK: the outcomeid should key should be a list key, I am not
%   implementing this right now, since it comes more natural when we change the class to
%   metakeys support.}
% \item \DescribeMacro{topicsaddressed}|topicsaddressed| allows to enter free-form text
%   instead of specifying the |challenge*|, |objective*|, and |outcome*| keys.
% \item The \DescribeMacro{coordinator}|coordinator| key gives the identifier of the
%   proposal coordinator. The |euproposal| package uses the |workaddress| package for
%   representation of personal metadata, see~\cite{Kohlhase:workaddress:ctan} for details.
% \item The \DescribeMacro{coordinatorsite}|coordinatorsite| key gives the identifier of
%   the coordinating site (for the table). 
% \item If given, the \DescribeMacro{iconrowheight}|iconrowheight| key instructs the
%   |euproposal| class to make a line with the logos of the participants at the bottom of
%   the title page, and specify their heights; |1.5cm| is often a good value.
% \end{compactitem}
% 
% \subsection{Work Packages and Work Areas}\label{sec:user:wpwa}
% 
% \DescribeMacro{type} The |type| key specifies the activity type of the work package:
% |RTD| = Research and technological development (including any activities to prepare for
% the dissemination and/or exploitation of project results, and coordination activities);
% |DEM| = Demonstration; |MGT| = Management of the consortium; |OTHER| = Other specific
% activities, if applicable in this call.
%
% \subsection{Milestones and Deliverables}\label{sec:user:deliverables}
% 
% |euproposal.cls| adds the \DescribeMacro{verif}|verif| key to \DescribeMacro{\milestone}
% for specifying a means of verification that the milestone has been successful.
% 
% With this, we can generate the milestone table that is required in many EU
% proposals. This can simply be done via the
% \DescribeMacro{\milestonetable}|\milestonetable| macro. It takes a keyword argument with
% the keys \DescribeMacro{caption}|caption| for specifying a different caption, and the
% widths \DescribeMacro{wname}|wname|, \DescribeMacro{wdeliv}|wdeliv|, and
% \DescribeMacro{wverif}|wverif| that can be used to specify different widths for the
% name/deliverables/verification columns in the milestone table.
% 
% \subsection{Risks}\label{sec:user:risks}
% In some EU proposals (e.g. FET), we need to identify risks and contingency and specify
% mitigation plans for them. In the |euproposal| we use two environments to mark them up.
% 
% \DescribeMacro{risk}|\begin{risk}{|\meta{title}|}{|\meta{prob}|}{|\meta{grav}|}|\ldots|\end{risk}|
% makes a paragraph no a risk \meta{title} with gravity \meta{grav} and probability
% \meta{prob}, where the body of the environment contains a description of the risk. The
% \DescribeMacro{riskcont}|riskcont| is a variant, where \meta{title} names a risk and the
% body is a description of the contingency plan.
% 
% \subsection{Relevant Papers}\label{sec:user:papers}
% 
% Sometimes we want to list the relevant papers in the site descriptions.  We use the
% |biblatex| package to automate this. We only need to use
% \DescribeMacro{\keypubs}|\keypubs[|\meta{keys}|]{|\meta{refs}|}|, where \meta{keys} that
% specify what papers are selected and \meta{refs} is a comma-separated list of bibtex
% keys from the bibTeX database used in the proposal.
% 
% The papers listed in |\keypubs| are put into a special bib\LaTeX category
% \DescribeMacro{featured}|featured|, and can thus be excluded from the general
% bibliography by adding |notcategory=featured| to the final |\printbibliography|.
% 
%
% \begin{newpart}{MK@MK: This is new, and only partially implemented}
% \subsection{Reporting Infrastructure}\label{sec:user:report}
% 
% The |eureporting| class gives an infrastructure for writing final reports of completed
% projects (see the file |finalreport.tex| in the package distribution). The
% \DescribeEnv{report}|report| environment has functionality analogous to the |proposal|
% environment. It takes the same metadata keys --- making it easy to generate by
% copy/paste from the proposal --- but adds the keys \DescribeMacro{key}|key| can be used
% to specify the reference key (something like \texttt{KO 2428 47-11}) given to the
% project by EU. Note that in the case of multiple proposers, you can use multiple
% instances of |key| to specify more than one reference key.
% \end{newpart}
% 
% \subsection{The Grant Agreement}\label{sec:user:grantagreement}
% 
% EU Proposals reuse large parts of the proposal in the grant agreement -- a part of the
% contract that describes the work and research the consortium has agreed to undertake. We
% can directly can directly generate the the grant agreement from the proposal by
% subsetting and adding some special source files. The |euproposal| class takes the option
% |grantagreement| for this, if this option is given, then a grant agreement is
% generated. This is most simply done by an options trick: We use a macro |\classoptions|
% in the class options in the preamble of the main proposal file |proposal.tex|, e.g. 
% \begin{verbatim}
% \providecommand{\classoptions}{keys}
% \documentclass[noworkareas,deliverables,\classoptions]{proposal}
% ... 
% \end{verbatim}
% and then we can just make a new file |grantagreement.tex| of the form 
% \begin{verbatim}
% \newcommand{\classoptions}{submit,grantagreement}
% \input{proposal.tex}
% \end{verbatim}
% that amounts to running |proposal.tex| with different options.
% 
% \section{Limitations and Enhancements}\label{sec:limitations}
% 
% The |euproposal| is relatively early in its development, and many enhancements are
% conceivable. We will list them here.
% \begin{enumerate}
% \item none reported yet. 
% \end{enumerate}
% If you have other enhancements to propose or feel you can alleviate some limitation,
% please feel free to contact the author. 
%
% \StopEventually{\newpage\PrintIndex\newpage\PrintChanges\newpage\printbibliography}\newpage
%
% \section{The Implementation}\label{sec:implementation}
%
% In this section we describe the implementation of the functionality of the |euproposal|
% and |eureporting| classes and the |eupdata| package. 
%
% \subsection{Package Options and Format Initialization}\label{sec:impl:options}
% 
% We first set up the options for the package. 
% 
%    \begin{macrocode}
%<*cls>
\newif\ifpartB\partBfalse
\DeclareOption{partB}{\partBtrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{proposal}}
%</cls>
%<reporting>\DeclareOption*{\PassOptionsToClass{\CurrentOption}{reporting}}
%<cls|reporting>\ProcessOptions
%    \end{macrocode}
%
%    Then we load the packages we make use of
% 
%    \begin{macrocode}
%<cls>\ifpartB\LoadClass[report,noRAM]{proposal}\else\LoadClass[noRAM]{proposal}\fi
%<reporting>\LoadClass[report,noRAM]{reporting}
%<*cls|reporting>
\RequirePackage{longtable}
\RequirePackage{eurosym}
\RequirePackage{wrapfig}
\RequirePackage{eupdata}
%    \end{macrocode}
% we want to change the numbering of figures and tables
%    \begin{macrocode}
\RequirePackage{chngcntr}
\counterwithin{figure}{subsection}
\counterwithin{table}{subsection}
%</cls|reporting>
%    \end{macrocode}
%    
% \subsection{Proposal Metadata and Title Page}\label{sec:impl:metadata}
%  
% We extend the metadata keys from the |proposal| class.
%    \begin{macrocode}
%<*pdata>
\define@key{prop@gen}{coordinator}{\def\prop@gen@coordinator{#1}\pdata@def{prop}{gen}{coordinator}{#1}}
\define@key{prop@gen}{coordinatorsite}{\def\prop@gen@coordinatorsite{#1}\pdata@def{prop}{gen}{coordinator}{#1}}
\def\prop@gen@challenge{??}\def\prop@gen@challengeid{??}
\define@key{prop@gen}{challenge}{\def\prop@gen@challenge{#1}\pdata@def{prop}{gen}{challenge}{#1}}
\define@key{prop@gen}{challengeid}{\def\prop@gen@challengeid{#1}\pdata@def{prop}{gen}{challengeid}{#1}}
\def\prop@gen@objective{??}\def\prop@gen@objectiveid{??}
\define@key{prop@gen}{objective}{\def\prop@gen@objective{#1}\pdata@def{prop}{gen}{objective}{#1}}
\define@key{prop@gen}{objectiveid}{\def\prop@gen@objectiveid{#1}\pdata@def{prop}{gen}{objectiveid}{#1}}
\def\prop@gen@outcome{??}\def\prop@gen@outcomeid{??}
\define@key{prop@gen}{outcome}{\def\prop@gen@outcome{#1}\pdata@def{prop}{gen}{outcome}{#1}}
\define@key{prop@gen}{outcomeid}{\def\prop@gen@outcomeid{#1}\pdata@def{prop}{gen}{outcomeid}{#1}}
\define@key{prop@gen}{callname}{\def\prop@gen@callname{#1}\pdata@def{prop}{gen}{callname}{#1}}
\define@key{prop@gen}{callid}{\def\prop@gen@callid{#1}\pdata@def{prop}{gen}{callid}{#1}}
\define@key{prop@gen}{iconrowheight}{\def\prop@gen@iconrowheight{#1}}
\define@key{prop@gen}{topicsaddressed}{\def\prop@gen@topicsaddressed{#1}}
%</pdata>
%    \end{macrocode}
%
% and now the ones for the final report 
%    \begin{macrocode}
%<*reporting>
\define@key{prop@gen}{reportperiod}{\def\prop@gen@reportperiod{#1}}
\define@key{prop@gen}{key}{\@dmp{key=#1}%
\@ifundefined{prop@gen@keys}{\xdef\prop@gen@keys{#1}}{\xdef\prop@gen@keys{\prop@gen@keys,#1}}}
\define@key{prop@gen}{projpapers}{\def\prop@gen@projpapers{#1}}
%</reporting>
%    \end{macrocode}
% 
% and the default values, these will be used, if the author does not specify something
% better.
%
% If the |propB| option is given, we need to redefine some of the internal counters and
% table of contents mechanisms to adapt to the fact that the proposal text is just Part B.
%
%    \begin{macrocode}
%<*cls>
\ifpartB
\def\thepart{\Alph{part}}
\setcounter{part}{2}
\def\thechapter{\thepart.\arabic{chapter}}
\def\numberline#1{\hb@xt@\@tempdima{#1\hfil} }
\fi
%    \end{macrocode}
% 
% \begin{macro}{\prop@sites@table}
%    \begin{macrocode}
\newcommand\prop@sites@table{\def\@@table{}
{\let\tabularnewline\relax\let\hline\relax
\@for\@I:=\prop@gen@sites\do{\xdef\@@table{\@@table\pdataref{site}\@I{number}}
\xdef\@@table{\@@table&\@nameuse{wa@institution@\@I @name}
\ifx\@I\prop@gen@coordinatorsite (coordinator)\fi}
\xdef\@@table{\@@table&\@nameuse{wa@institution@\@I @acronym}}
\xdef\@@table{\@@table&\@nameuse{wa@institution@\@I @countryshort}\tabularnewline\hline}}}
\begin{tabular}{|l|p{8cm}|l|l|}\hline%|
\# & Participant organisation name & Short name &  Country\\\hline\hline
\@@table
\end{tabular}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{environment}{prop@proposal}
%    \begin{macrocode}
\renewenvironment{prop@proposal}
{\ifgrantagreement\else
  \thispagestyle{empty}\begin{center}
  {\Large \prop@gen@instrument}\\[.2cm]
  {\Large\textbf\prop@gen@callname}\\[.4cm]
  {\LARGE \prop@gen@callid}\\[.8cm]
  {\huge\textbf\prop@gen@title}\\[.4cm]
  \ifx\prop@gen@acronym\@empty\else{\LARGE Acronym: {\prop@gen@acronym}}\\[2cm]\fi
\end{center}
%{\large\prop@gen@instrument}\\
{\large\textbf{Date of Preparation: \today}}
% \ifsubmit\else\if@svninfo\if@gitinfo\\
% {\large\textbf{Revision}: 
% \if@svninfo\svnInfoRevision\fi\if@gitinfo\gitAbbrevHash\fi
%  of 
% \if@svninfo\svnInfoDate\fi\if@gitinfo\gitAuthorDate\fi}
% \fi\fi\fi
\\[1em]
\begin{large}
 \begin{description}
  % \item[Work program topics addressed by \pn:]
  %   \@ifundefined{prop@gen@topicsaddressed}
  %   {\textbf{Challenge \prop@gen@challengeid}: \prop@gen@challenge,
  %   \textbf{Objective \prop@gen@objectiveid}: \prop@gen@objective,
  %   \textbf{target outcome \prop@gen@outcomeid}) \prop@gen@outcome.
  %   {\prop@gen@topicsaddressed}\\[1em]
  \item[Coordinator:] \wa@ref3{person}\prop@gen@coordinator{name}
  \item[e-mail:] \wa@ref3{person}\prop@gen@coordinator{email}
  \item[tel/fax:] \wa@ref3{person}\prop@gen@coordinator{worktelfax}
    \@ifundefined{prop@gen@keywords}{}{\item[Keywords:]  \prop@gen@keywords}
  \end{description}
\end{large}
\vspace*{1em}
\begin{center}
\prop@sites@table\vfill
\@ifundefined{prop@gen@iconrowheight}{}
{\@for\@site:=\prop@gen@sites\do{\wa@institution@logo[height=\prop@gen@iconrowheight]\@site\qquad}}
\end{center}
\newpage
\fi% ifgrantagreement
\setcounter{tocdepth}{2}\setcounter{part}{2}}
{\newpage\printbibliography[heading=warnpubs]}
%    \end{macrocode}
% \end{environment}
% 
%    \begin{macrocode}
\def\prop@gen@instrument{Proposal Instrument (e.g. IP)}
%    \end{macrocode}
%
% \subsection{Site Descriptions}\label{sec:sitedesc}
% \ednote {this functionality should probably be refactored into proposal.dtx}
%
% \begin{environment}{sitedescription}
%   \ednote{document this above} |\begin{sitedescritpion}[|\meta{opt}|]{\meta{site}}|
%     marks up the description for the site \meta{site}. It looks up the relevant metadata
%     from the respective |\WAinstitution| declarations.  The options argument \meta{opt}
%     is a key-value list for the keys \DescribeMacro{logo}|logo| (add the logo from
%     |\WAinstitution| to the site description), \DescribeMacro{width}|width|,
%     \DescribeMacro{height}|height| (intended dimensions of the logo), \ednote{more?}.
%    \begin{macrocode}
\define@key{site@desc}{box}[true]{\def\site@desc@box{#1}%
\pdata@def{sitedesc}{\@site}{box}{#1}}
\define@key{site@desc}{logo}[true]{\def\site@desc@logo{#1}%
\pdata@def{sitedesc}{\@site}{logo}{#1}}
\define@key{site@desc}{width}{\def\site@desc@width{#1}%
\pdata@def{sitedesc}{\@site}{width}{#1}\@dmp{wd=#1}}
\define@key{site@desc}{height}{\def\site@desc@height{#1}%
\pdata@def{sitedesc}{\@site}{height}{#1}\@dmp{ht=#1}}
\newenvironment{sitedescription}[2][]%
{\def\c@site{#2}% remember the site ID
\newcounter{site@#2@PM} % for the site PM
\def\site@desc@box{false}% not box unless requested
\def\site@desc@logo{false}% not logo unless requested
\def\site@desc@height{1.3cm}% default height
\def\site@desc@width{5cm}% default width
\setkeys{site@desc}{#1}% read the keys to overwrite the defaults
\ifx\@site@desc@box\@true% if we want a logo
\begin{wrapfigure}{r}{\site@desc@width}\vspace{-2.5ex}%
\begin{tabular}{|p{\site@desc@width}|}\hline\vspace{1mm}%
\ifx\@site@desc@logo\@true% if we want a logo
\wa@institution@logo[height=\site@desc@width]{#2}\\[1ex]%
\fi% end logo
\textbf{\wa@ref3{institution}{#2}{type}.\hfill \wa@ref3{institution}{#2}{country}}\\%
\small\wa@ref3{institution}{#2}{streetaddress}, \wa@ref3{institution}{#2}{townzip}\\\hline%
\end{tabular}\vspace{-2.5ex}%
\end{wrapfigure}%
\fi% end box
\pdata@target{site}{#2}%
{\subsubsection{\wa@ref3{institution}{#2}{acronym}: % space here
{\textsc{\wa@ref3{institution}{#2}{name}}  (\wa@ref3{institution}{#2}{countryshort})}}}%
\small%
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                    {0.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
                                    {\normalfont\normalsize\bfseries}}}
{\pdata@def{site}{\c@site}{reqPM}{\csname thesite@\c@site @PM\endcsname}}
%    \end{macrocode}
% \end{environment}
% 
% \begin{environment}{participant}
%   \ednote{document this above} |\begin{picv}[|\meta{PM}|]{\meta{name}}| marks up the CV
%     and metadata about a principal investigator of a site (it can only be use inside a
%     |sitedescription| environment). The first argument \meta{PM} specifies the
%     involvement in person months: a fair estimation this PI will spend on this specific
%     project over its whole duration.
%    \begin{macrocode}
\define@key{site@part}{type}{\def\site@part@type{#1}\@dmp{type=#1}}
\define@key{site@part}{PM}{\def\site@part@PM{#1}\@dmp{PM=#1}}
\define@key{site@part}{salary}{\def\site@part@salary{#1}}%\@dmp{\euro=#1}}
\define@key{site@part}{gender}{\def\site@part@gender{#1}}%\@dmp{\euro=#1}}
\newenvironment{participant}[2][]%
{\def\site@part@type{}\def\site@part@PM{}\def\site@part@salary{}\def\site@part@gender{}%
\setkeys{site@part}{#1}%
\ifx\site@part@PM\@empty\else\addtocounter{site@\c@site @PM}{\site@part@PM}\fi%
\paragraph*{#2\ %
(\ifx\site@part@type\@empty\else\site@part@type\fi%
\ifx\site@part@gender\@empty\else, \site@part@gender\fi%
\ifx\site@part@PM\@empty\else, \site@part@PM~PM\fi%
)}%
\ignorespaces}
{\par\medskip}
%    \end{macrocode}
% \end{environment}
% 
% \subsection{Work Packages, Work Areas, and Deliverables}\label{sec::impl:wpwa}
%
% \begin{environment}{wp*}
%    \begin{macrocode}
\newmdenv[frametitle=Objectives]{wpobjectives}
\newmdenv[frametitle=Description]{wpdescription}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{workpackage}
%    
%    \begin{macrocode}
\renewenvironment{workpackage}[1][]
{\begin{work@package}[#1]\medskip\wpheadertable%
\addcontentsline{toc}{subsubsection}{\wp@label\wp@num: \pdataref{wp}\wp@id{title}}}
{\end{work@package}}
%    \end{macrocode}
% \end{environment}
% 
% \begin{macro}{\wpheadertable}
%   We redefine the macro that computes the default work package header table, since there
%   are more sites in a EU proposal, we do this in a tabular form as asked for in the
%   template. We use the internal counter |@sites@po| (sites plus one) for convenience.
%    \begin{macrocode}
\newcounter{@sitespo}\newcounter{@sitespt}
\renewcommand\wpheadertable{%
\wp@sites@efforts@lines%
\setcounter{@sitespo}{\thewp@sites@num}\addtocounter{@sitespo}{1}%
\par\noindent\begin{tabular}{|l|*{\thewp@sites@num}{c|}c|}\hline%
\multicolumn{\the@sitespo}{|l|}{\textbf{\wp@mk@title{\wp@num}: }%
\textsf{\pdata@target{wp}{\wp@id}{\pdataref{wp}\wp@id{title}}}}
&\textbf{Start: }\pdataref{wp}\wp@id{start}\\\hline%
\wp@sites@line\\\hline%
\wp@efforts@line\\\hline%
\end{tabular}\smallskip\par\noindent\ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Milestones and Deliverables}\label{sec:impl:deliverables}
%
% \begin{environment}{wpdelivs}
%   We make the deliverables boxed in EU proposals, this is simple with |mdframed.sty|.
%    \begin{macrocode}
\surroundwithmdframed{wpdelivs}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\milestone}
%    \begin{macrocode}
\define@key{milestone}{verif}{\gdef\mile@verif{#1}\pdata@def{mile}\mile@id{verif}{#1}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{milestonetable}
% here we do the work. 
%    \begin{macrocode}
\define@key{mst}{caption}{\gdef\mst@caption{#1}}
\define@key{mst}{wname}{\gdef\mst@wname{#1}}
\define@key{mst}{wdeliv}{\gdef\mst@wdeliv{#1}}
\define@key{mst}{wverif}{\gdef\mst@wverif{#1}}
\newcommand\milestonetable[1][]{%
\def\mst@caption{Milestones, Deliverables, and Verification}%
\def\mst@wname{2.5cm}\def\mst@wdeliv{7cm}\def\mst@wverif{4cm}
\setkeys{mst}{#1}%
{\gdef\mst@lines{}%initialize
\let\tabularnewline\relax\let\hline\relax% so they
\let\textbf\relax\let\emph\relax% do not bother us
\edef\@@miles{\pdataref{all}{mile}{ids}}
\@for\@I:=\@@miles\do{
\edef\@delivs{\pdataref@safe{mile}{\@I}{delivs}}%
\def\@@delivs{}
\@for\@J:=\@delivs\do{\xdef\@@delivs{\@@delivs\ \pdataref{deliv}\@J{label}}}
\def\@@line{
\textbf{\pdataref{mile}\@I{label}}&
\emph{\pdataref{mile}{\@I}{title}} &
\@@delivs&
\pdataref{mile}\@I{month} &
\pdataref{mile}\@I{verif}}
\xdef\mst@lines{\mst@lines\@@line\tabularnewline\hline}}}
\begin{table}[ht]
\begin{tabular}{|l|p{\mst@wname}|p{\mst@wdeliv}|l|p{\mst@wverif}|}\hline
\#&\textbf{\miles@legend@name}
&\textbf{\miles@legend@involved}
&\textbf{\miles@legend@mo}
&\textbf{\miles@legend@verif}\\\hline\hline
\mst@lines
\end{tabular}
\caption{\mst@caption}\label{tab:milestonetable}
\end{table}
\footnotetext\miles@legend@footnote}
%    \end{macrocode}
% now the multilinguality support 
%    \begin{macrocode}
\newcommand\miles@legend@name{Name}
\newcommand\miles@legend@mo{Mo}
\newcommand\miles@legend@verif{Means of Verif.}
\newcommand\miles@legend@involved{WPs\footnotemark/Deliverables involved}
\newcommand\miles@legend@footnote{The work package number is the first number in the deliverable number.}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\prop@milesfor}
%    the due date is the first argument to facilitate sorting
%    \begin{macrocode}
\newcommand\prop@milesfor[1]{\edef\@delivs{\pdataref@safe{mile}{#1}{delivs}}%
\let\m@sep=\relax\def\new@sep{,\ }%
\@for\@I:=\@delivs\do{\m@sep\pdataRef{deliv}\@I{label}\let\m@sep=\new@sep}}
%    \end{macrocode}
% \end{macro}
% 
% \subsection{Risks}\label{sec:impl:risks}
% 
% \begin{environment}{risk}
%    \begin{macrocode}
\newenvironment{risk}[3]
{\paragraph{Risk: #1}\hfill\emph{probability}: #2, \emph{gravity}: #3\par\noindent\ignorespaces}
{}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{riskcont}
%    \begin{macrocode}
\newenvironment{riskcont}[3]
{\begin{risk}{#1}{#2}{#3}\textbf{Contingency:} }
{\end{risk}}
%    \end{macrocode}
% \end{environment}
%
% \subsection{Relevant Papers}\label{sec:impl:papers}
% 
% \begin{macro}{\keypubs}
%    \begin{macrocode}
\newcommand\keypubs[2][]{%
\paragraph{Key publications relevant to the project}%
{\prop@paperlist[#1]{#2}}}
%</cls>
%    \end{macrocode}
% \end{macro}
%
% \Finale
\endinput
% LocalWords:  iffalse cls euproposal euproposal.dtx tt maketitle newpage wpwa eudata dfg
% LocalWords:  tableofcontents ednote euproposal DescribeEnv compactitem impl eureporting
% LocalWords:  longtable eurosym pdata thepart setcounter env vfill qquad NeedsTeXFormat
% LocalWords:  thechapter newcommand tabularnewline hline xdef pdataref nameuse SciML gen
% LocalWords:  countryshort rpoposal clange wrapfig wrapfigure vspace bfseries eupdata wd
% LocalWords:  startsection normalfont normalsize baselinestretch callname hb newpart wp
% LocalWords:  countryshort rpoposal clange wrapfig renewenvironment worktelfax prop@gen
% LocalWords:  tocdepth wpobjectives newenvironment noindent boxedminipage fbox warnpubs
% LocalWords:  textwidth textbf wpdescription sitedescription pgfdeclareimage projpapers
% LocalWords:  wrapfigure vspace pgfuseimage streetaddress townzip textsc xt wa maxnames
% LocalWords:  renewcommand startsection normalfont normalsize bfseries wptitle sitedesc
% LocalWords:  workpackage subsubsection wpheadertable newcounter sitespo hfil if@svninfo
% LocalWords:  newcounter sitespt addtocounter textsf smallskip ignorespaces pn setkeys
% LocalWords:  cellcolor lightgray keypubs paperlist callname callid callid ifx csname
% LocalWords:  challengeid challengeid objectiveid objectiveid outcomeid hfill if@gitinfo
% LocalWords:  outcomeid metakeys workaddress numberline tempdima ifsubmit iconrowheight
% LocalWords:  proposal.dtx texttt paperslist workaddress.dtx topicsaddressed thesite
%  LocalWords:  topicsaddressed iconrowheight finalreport.tex printbibliography endcsname
%  LocalWords:  reportperiod organisation thispagestyle gitAbbrevHash sitedescritpion
%  LocalWords:  WAinstitution picv medskip newmdenv frametitle wpdelivs mdframed.sty emph
%  LocalWords:  surroundwithmdframed emph riskcont prob grav ldots endinput

% Local Variables:
% mode: doctex
% TeX-master: t
% End:
