summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/euproposal/euproposal.dtx
blob: ab22506b7fbb1b6e43a01acf34d7c13135b1475e (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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
% \iffalse meta-comment
% A class for preparing FP7 proposals for collaborative projects
%
% Copyright (c) 2007 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
% $HeadURL: https://svn.kwarc.info/repos/kwarc/doc/macros/euproposal/euproposal.dtx $
% \fi
% 
% \iffalse
%<cls>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<cls>\ProvidesClass{euproposal}[2007/06/04 v0.3 EU Proposal]
%<*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,float,a4wide}
\usepackage[show]{ed}
\usepackage[fancyhdr,today,draft]{svninfo}
\pagestyle{fancyplain}\fancyhead[RE,LO]{\leftmark}\fancyhead[LE,RO]{\thepage}
\makeindex
\floatstyle{boxed}
\newfloat{exfig}{thp}{lop}
\floatname{exfig}{Example}
\def\subversion{\sc{Subversion}}
\begin{document}
\svnInfo $Id: euproposal.dtx 13984 2007-11-04 14:50:45Z kohlhase $
\svnKeyword $HeadURL: https://svn.kwarc.info/repos/kwarc/doc/macros/euproposal/euproposal.dtx $
\DocInput{euproposal.dtx}
\end{document}
%</driver>
% \fi
% 
%\iffalse\CheckSum{181}\fi
% 
% \changes{v0.3}{2007/06/04}{staff effort table finally works}
% \changes{v0.2}{2007/05/09}{First Version with Documentation}
% \changes{v0.1}{2007/05/07}{used in the SciML proposal}
% 
% \GetFileInfo{euproposal.cls}
% 
% \MakeShortVerb{\|}
% \title{Preparing FP7 Proposals in {\LaTeX} with 
%   {\tt{eurpoposal.cls}}\thanks{Version {\fileversion} 
%     (last revised {\filedate})}} 
%    \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}
%
% \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
%   {\sc{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 supports many of the specific elements of Part B of a Framework
%   7 Proposal. It comes with an example proposal |euproposal-propB.tex|, which shows the
%   usage of the class in action, it is intended as a template for your proposal. 
% 
% \section{The User Interface}\label{sec:user-interface}
% 
% \subsection{Package Options}\label{sec: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.  Currently the |euproposal| package only
% takes three options |submit|, |public|, and |eudraft| where |submit| is the default
% case, so that |\documentclass{euproposal}|, is equivalent to
% |\documentclass[submit]{euproposal}|.\ednote{continue}
%
% \subsection{Proposal Metadata and Title page}\label{sec:metadata}
% 
% The metadata of the proposal can be specified in the {\LaTeX} preamble using the macros
% described below. All of these take one argument: the value. A typical preamble is given
% in Figure~\ref{fig:preamble}.
% \begin{exfig}
%   \begin{verbatim}
% \documentclass[11pt,eudraft]{euproposal}
%
% \def\ipower{{\sc{iPoWr}}}
% \ProposalAcronym\ipower
% \ProposalTitle{{\underline{I}ntellitent} {\underline{P}r\underline{o}sal} 
%                {\underline{Wr}iting}}
% \ProposalCall{ICT Call 1: FP7-???-200?-?}
% \ProposalInstrument{Large-scale Integrating Project (IP) Proposal}
% \ProposalTopics{???-200?.?.? Intelligent Proposal Writing}
% \ProposalCoordinatorName{Prof. Dr. Michael Kohlhase}
% \ProposalCoordinatorEmail{m.kohlhase@jacobs-university.de}
% \ProposalCoordinatorTelFax{(+49) 421 200-3140/-493140}

% \ProposalCoordinator{JACU}{Jacobs University Bremen}{D}
% \ProposalPartner{EFO}{European Future Office}{NL}
% \ProposalPartner{BAR}{Universit\`e de BAR}{F}
% \ProposalPartner{BAZ}{BAZ International Ltd}{UK}
% \end{verbatim}
%   \caption{A typical proposal preamble}\label{fig:preamble} 
% \end{exfig}
%
% \DescribeMacro{\Proposal*} The |ProposalAcronym| is used to specify the acronym, this
% will appear in the headings and the title page.  |ProposalTitle| specifies the title of
% the proposal, and |ProposalCall| is used to identify the call the proposal addresses. It
% is usuall a string of the form |ICT Call 1: FP7-???-200?-?|. An overview over open calls
% can be found at \url{http://cordis.europa.eu/fp7/dc/index.cfm}. |ProposalInstrument| It
% is either ``Large-scale Integrating Project (IP) Proposal'', or\ednote{find out the
%   others} |ProposalTopics| specifies the specific objectives in the call this proposal
% addresses. These are specified in the ``call fiche'' that can be obtained from the URL
% above. They usually have a form like |???-200?.?.? Intelligent Proposal Writing|.
% Finally, |ProposalCoordinatorName|, |ProposalCoordinatorEmail|, and
% |ProposalCoordinatorTelFax| are used to specify the contact details of the project
% coordinator. 
% 
% \DescribeEnv{titlepageabstract} The metadata is used to assemble the title page of the
% proposal, using the abstract which occupies the body of the |titlepageabstract|
% environment.\ednote{can we count letters in the abstract and put out a warning if it is
%   too long?} 
% 
% \DescribeMacro{\svnInfo}\DescribeMacro{\svnKeyword} If we are using {\subversion} for
% collaborating on the proposal, we should add the two lines immediately below the
% |\begin{document}| (they must be after). The |$ID| and |$HeadURL| keywords are expanded
%   by {\subversion} whenever the document is updated or committed, if the relevant
%   properties are set. To set the properties use |svn propset svn:keywords "URL Id"| on
%   the command line or the appropriate clicks in your subversion client. The information
%   will be displayed in the footer line (if the |eudraft| option is set). All dependent
%   files in the proposal can have their own |svninfo| declarations, leading to per-file
%   information in the footer line. 
% 
% Finally, the last two lines set up the table of contents and the 
% 
% \begin{exfig}
% \begin{verbatim}
% \begin{document}
% \svnInfo $Id: euproposal.dtx 13984 2007-11-04 14:50:45Z kohlhase $
% \svnKeyword $HeadURL: https://svn.kwarc.info/repos/kwarc/doc/macros/euproposal/euproposal.dtx $
% \begin{titlepageabstract}
%   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
%   {\sc{Subversion}}, allowing the proposal writing team to concentrate on the contents
%   rather than the mechanics of wrangling with text fragments and revisions.
% \end{titlepageabstract}
% \setcounter{tocdepth}{1}{\small\tableofcontents}
% \end{verbatim}
% \caption{Typical Front Matter of a Proposal}\label{fig:frontmatter}
% \end{exfig}
%
% \subsection{Work Packages and Work Groups}
% 
% \DescribeEnv{workplan}
% 
% The |workplan| environment groups the work package and work group descriptions and
% handles the accounting. In particular, the environment writes the file
% {\meta{proposal}.delivs} file which is used to generate the delivrables
% table.\ednote{say something about sorting}
% 
% \DescribeEnv{workpackage}\DescribeEnv{workgroup}
% The |workpakcage| and |workgroup| environments are closely related, so we will describe
% them together. 
%
% \DescribeMacro{id} The |id| key is used to specify a label for crossreferencing the work
% package or work group, it must be document-unique.
%
% \DescribeMacro{title}\DescribeMacro{short} The |title| and |short| keys are used for the
% work package/group title. The short title is used in tables and should not be longer
% than 15 characters.
%
% \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.
% 
% \DescribeMacro{\meta{partner}} For each partner, the |euproposal| package generates a
% key that is identical to the short name of the partner. This can be used to specify the
% person months that the partner spends on this work package (the value for work groups is
% automatically computed (remember to run {\LaTeX} twice for this)).
% 
% \DescribeMacro{lead} The |lead| key specifies the work package or work group lead, the
% value of this feature should be the short name of the respective partner.
%
% \DescribeMacro{start}\DescribeMacro{duration} The |start| and |duration| keys are used
% to specify the start month and duration (in months) of the work package
%
% \StopEventually{\newpage\PrintIndex\newpage\PrintChanges\ednotemessage}
%
% \section{The Implementation} 
%
% We first set up the options for the package. 
% 
% \subsection{Package Options}\label{impl:options}
% 
%<*cls>
%    \begin{macrocode}
\newif\ifsubmit\submittrue
\newif\ifpublic\publicfalse
\DeclareOption{eudraft}{\submitfalse\PassOptionsToPackage{draft}{svninfo}}
\DeclareOption{submit}{\submittrue\PassOptionsToPackage{hide}{ed}}
\DeclareOption{public}{\publictrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions
%    \end{macrocode}
% 
%    Then we load the packages we make use of
% 
%    \begin{macrocode}
\LoadClass[a4paper]{report}
\RequirePackage{textcomp}
\RequirePackage{amssymb}
\RequirePackage{url}
\RequirePackage{lscape}
\RequirePackage{longtable}
\RequirePackage{graphicx}
\RequirePackage{calc}
\RequirePackage{colortbl}
\RequirePackage{xcolor}
\RequirePackage[show]{ed}
\RequirePackage[today,fancyhdr]{svninfo}
\RequirePackage{keyval}
\RequirePackage{array}
\RequirePackage{eurosym}
\RequirePackage{hyperref}
%    \end{macrocode}
%    
%    And we set up the appearance of the proposal. We use the |\part| mechanism to show
%    that we are in part B of the proposal.
% 
%    \begin{macrocode}
\def\thepart{\Alph{part}}
\setcounter{part}{2}
\def\thechapter{\thepart.\arabic{chapter}}
\def\tableofcontents{%
    \chapter*{\contentsname
        \@mkboth{\MakeUppercase{\contentsname}}%
                {\MakeUppercase{\contentsname}}}%
    \@starttoc{toc}}
%    \end{macrocode}
%
%    \begin{macrocode}
\newenvironment{titlepageabstract}
{\begin{center}
  {\LARGE \eu@instrument}\\[.2cm]
  {\large \eu@call}\\[.4cm]
  {\LARGE\bf\eu@title}\\[.3cm]
  {\LARGE Acronym: {\eu@acro}}\\[.2cm]
\end{center}
{\large\bf{Date of Preparation: \today}}\\[1em]
\PartnerTable\\[.5cm]
\begin{large}
  \begin{description}
  \item[Work program topics  addressed:] \eu@topics
  \item[Coordinator:] \euc@name
  \item[e-mail:] {\url{\euc@email}}
  \item[tel/fax:] \euc@telfax
  \item [Proposal Abstract:]\small\sf}
{\end{description}\end{large}\newpage}
%
% \subsection{Proposal Metadata}
%  
% we define the metadata declaration macros
%    \begin{macrocode}
\def\ProposalAcronym#1{\def\eu@acro{#1}}
\def\ProposalTitle#1{\def\eu@title{#1}}
\def\ProposalCall#1{\def\eu@call{#1}}
\def\ProposalTopics#1{\def\eu@topics{#1}}
\def\ProposalInstrument#1{\def\eu@instrument{#1}}
\def\ProposalCoordinatorName#1{\def\euc@name{#1}}
\def\ProposalCoordinatorEmail#1{\def\euc@email{#1}}
\def\ProposalCoordinatorTelFax#1{\def\euc@telfax{#1}}
%    \end{macrocode}
% and the default values
%    \begin{macrocode}
\def\eu@acro{ACRONYM} 
\def\eu@title{Proposal Title} 
\def\eu@call{ICT Call ?: FP7-???-200?-?}
\def\eu@instrument{Proposal Instrument (e.g. IP)} 
\def\eu@topics{???-200?.?.? Topic1, ???-200?.?.? Topic2} 
\def\euc@name{Dr. Great Coordinatorn}
\def\euc@email{g.coordinator@jacobs-university.de}
\def\euc@telfax{(+??) ??? ???? ???/-???}
%    \end{macrocode}
%
%    \begin{macrocode}
\fancyhead[RE,LO]{\eu@acro}\fancyhead[LE,RO]{page~\thepage~of~\thelastpage}
\pagestyle{fancyplain}
%    \end{macrocode}
%    
% we want numbered subsubsections
%    \begin{macrocode}
\setcounter{secnumdepth}{3}
%    \end{macrocode}
%    
%    \begin{macrocode}
\AtEndDocument{%
  \clearpage
  \count@\c@page
  \advance\count@\m@ne
  \edef\@tempa{\the\count@}%
  \ifx\@tempa\thelastpage
  \else
    \ClassWarningNoLine{euproposal}{Last page changed: Rerun LaTeX}%
  \fi
  \immediate\write\@auxout{%
    \gdef\string\thelastpage{\the\count@}}}
\def\thelastpage{??}
%    \end{macrocode}
%
% \subsection{Work Packages and Work Groups}
%    
% \begin{macro}{\eu@write@...}
%    This macro writes an |\eu@def| commands to the current aux and delivrables file. 
%    \begin{macrocode}
\def\eu@write@aux#1#2#3#4{\protected@write\@auxout{}{\string\eu@def{#1}{#2}{#3}{#4}}}
\def\eu@write@delivs#1#2#3#4{\protected@write\@auxout{}{\string\eu@def{#1}{#2}{#3}{#4}}}
%    \end{macrocode}
% \end{macro}
% We first define keys for  work groups. 
%    \begin{macrocode}
\define@key{wg}{id}{\def\wg@id{#1}}
\define@key{wg}{title}{\def\wg@title{#1}}
\define@key{wg}{lead}{\def\wg@lead{#1}}
\define@key{wg}{short}{\def\wg@short{#1}}
%    \end{macrocode}
% work packages have similar ones. 
%    \begin{macrocode}
\define@key{wp}{id}{\def\wp@id{#1}}
\define@key{wp}{duration}{\def\wp@duration{#1}}
\define@key{wp}{start}{\def\wp@start{#1}}
\define@key{wp}{title}{\def\wp@title{#1}}
\define@key{wp}{type}{\def\wp@type{#1}}
\define@key{wp}{lead}{\def\wp@lead{#1}}
\define@key{wp}{short}{\def\wp@short{#1}}
%    \end{macrocode}
%    Then we introduce the partner declarations; first we initialize the partner counter
%    and some accumulator macros for the partners table, and the first two lines in the
%    WP/WG descriptions.
%    \begin{macrocode}
\newcounter{partner}
\def\wpg@partners{}\def\wp@pms{}\def\wg@pms{}\def\eu@partner@table{}
%    \end{macrocode}
%    The next macro is an internal one that can be specialized for the coordinator
%    \begin{macrocode}
\def\proposal@partner#1#2#3{% short, long, nationality
\stepcounter{partner}
\newcounter{wg@#1@effort}[wg]
\newcounter{total@#1@effort}
\eu@write@aux{partner}{#1}{number}{\thepartner}
\eu@write@aux{partner}{#1}{short}{#1}
\eu@write@aux{partner}{#1}{long}{#2}
\eu@write@aux{partner}{#1}{nationality}{#3}
\define@key{wp}{#1}{\expandafter\def\csname wp@#1\endcsname{##1}}
\g@addto@macro\eu@partner@table{\euref{partner}{#1}{number} & {\euref{partner}{#1}{short}} & #2 & #3\\\hline}}
%    \end{macrocode}
%    With this, the declarations for the partners are very simple. The one for the
%    coordinator initializes the relevant lists
%    \begin{macrocode}
\def\ProposalCoordinator#1#2#3{\proposal@partner{#1}{#2 (coordinator)}{#3}
\gdef\eu@partners{#1}
\g@addto@macro\wpg@partners{\euref{partner}{#1}{number}: \euRef{partner}{#1}{short}}
\g@addto@macro\wp@pms{\wp@pm{#1}}\g@addto@macro\wg@pms{\wg@pm{#1}}}
%    \end{macrocode}
%    while the one for the partners adds commas.
%    \begin{macrocode}
\def\ProposalPartner#1#2#3{\proposal@partner{#1}{#2}{#3}
\g@addto@macro\eu@partners{,#1}
\g@addto@macro\wpg@partners{&\euref{partner}{#1}{number}: \euRef{partner}{#1}{short}}
\g@addto@macro\wp@pms{&\wp@pm{#1}}\g@addto@macro\wg@pms{&\wg@pm{#1}}}
%    \end{macrocode}
%    One of the side effects is that we can generate the partner table from the material
%    accumulated in the |\eu@partners| macro.
%    \begin{macrocode}
\def\PartnerTable{\begin{tabular}{|l|l|p{11cm}|l|}\hline
\# & Abbr. & Name &  Country\\\hline\hline
\eu@partner@table
\end{tabular}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\wg@label#1{WG {#1}}
\def\wp@label#1{WP {#1}}
\def\wg@mk@title#1{Work Group {#1}}
\def\wp@mk@title#1{Work Package {#1}}
%    \end{macrocode}
% 
%    \begin{macrocode}
\newcounter{wg}
\newcounter{wp}[wg]
\newcounter{deliv}[wp]
\newcounter{wpgno}
%    \end{macrocode}
% The next macro sets up the counters for the effort tables and writes the efforts to the
% aux file 
%    \begin{macrocode}
\def\wp@efforts{\@for\@I:=\eu@partners\do{
    \def\@effort{\@ifundefined{wp@\@I}{0}{\csname wp@\@I\endcsname}}
  \addtocounter{wg@\@I @effort}{\@effort}
  \addtocounter{total@\@I @effort}{\@effort}
  \eu@write@aux{\wp@id}{\@I}{effort}{\@effort}}}
%    \end{macrocode}
% write the workpackage/group-specific metadata to the aux file
%    \begin{macrocode}
\def\wpg@write@md#1{%
\eu@write@aux{#1}{\csname #1@id\endcsname}{label}{\csname #1@label\endcsname\thewg}
\eu@write@aux{#1}{\csname #1@id\endcsname}{number}{\csname the#1\endcsname}
\eu@write@aux{#1}{\csname #1@id\endcsname}{title}{\csname #1@title\endcsname}
\eu@write@aux{#1}{\csname #1@id\endcsname}{lead}{\csname #1@lead\endcsname}
\eu@write@aux{#1}{\csname #1@id\endcsname}{short}{\csname #1@short\endcsname}}
%    \end{macrocode}
% write the workpackage-specific metadata to the aux file
%    \begin{macrocode}
\def\wp@write@md{%
\eu@write@aux{wp}{\wp@id}{duration}{\wp@duration}
\eu@write@aux{wp}{\wp@id}{start}{\wp@start}
\eu@write@aux{wp}{\wp@id}{type}{\wp@type}}
%    \end{macrocode}
% show the line with all the efforts in the work package
%    \begin{macrocode}
\def\wpg@efforts@line#1{\renewcommand{\tabcolsep}{.2em}
  \begin{tabular}{|*{\thepartner}{c|}}
    \wpg@partners\\\hline
    \csname #1@pms\endcsname\end{tabular}}
%    \end{macrocode}
% update the list of the work packages and groups for the staff efforts table
%    \begin{macrocode}
\def\update@wps#1{\@ifundefined{wg@wps}{\xdef\wg@wps{#1}}{\xdef\wg@wps{\wg@wps,#1}}}
\def\update@wgs#1{\@ifundefined{eu@wgs}{\xdef\eu@wgs{#1}}{\xdef\eu@wgs{\eu@wgs,#1}}}
%    \end{macrocode}
% with these it is now relatively simple to define the interface macros
% \begin{environment}{wpd}
%    \begin{macrocode}
\newenvironment{wpd}[1][]
{\setkeys{wp}{#1}\stepcounter{wp}\stepcounter{wpgno}
\wpg@write@md{wp}\wp@write@md\wp@efforts\update@wps{\wp@id}
\xdef\wp@nums{\wp@nums &\thewg.\thewp}
\begin{center}
\begin{tabular}{||p{\textwidth-15pt}||}\hline\hline
  {\large\textbf\wp@mk@title{\thewg.\thewp}}: {\eu@target{wp}{\wp@id}{\wp@title}}\\\hline
  \wpg@efforts@line{wp}\\\hline}
{\end{tabular}\end{center}}
%    \end{macrocode}
%  \end{environment}
%  the environment for work groups is even simpler, since we have less to do 
% \begin{environment}{wgd}
%    \begin{macrocode}
\newenvironment{wgd}[1][]
{\begin{center}
\begin{tabular}{||p{\textwidth-15pt}||}\hline\hline
  {\large\textbf\wg@mk@title\thewg}: {\eu@target{wg}{\wg@id}{\wg@title}}\\\hline
  \wpg@efforts@line{wg}\\\hline}
{\end{tabular}\end{center}}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{wgd}
%    \begin{macrocode}
\newenvironment{workgroup}[1][]
{\setkeys{wg}{#1}\stepcounter{wg}\stepcounter{wpgno}\wpg@write@md{wg}\def\wp@nums{}
\let\wg@wps=\relax\update@wgs{\wg@id}\def\wp@nums{}
\eu@write@aux{wg}{\wg@id}{num}{\thewg}}
{\eu@write@aux{wg}{\wg@id}{wps}{\wg@wps}
 \eu@write@aux{wg}{\wg@id}{wpnums}{\wp@nums}
 \@for\@I:=\eu@partners\do{
    \eu@write@aux{\wg@id}{\@I}{effort}{\csname thewg@\@I @effort\endcsname}}}
%    \end{macrocode}
% \end{environment}
% The following macro displays the effort of a partner
%    \begin{macrocode}
\def\p@pm#1{\@ifundefined{wp@#1}{}{\csname wp@#1\endcsname}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\wpg@gray#1{\def\@test{#1}\ifx\@test\wpg@lead\cellcolor{lightgray}{#1}\else{#1}\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\wp@pm#1{\wpg@gray{\p@pm{#1}}}
\def\wg@pm#1{\wpg@gray{\euref{\wg@id}{#1}{effort}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\wpg@pa#1{\wpg@gray{\euRef{partner}{#1}{short}}}
%    \end{macrocode}
%
% \subsection{Hyperinking} 
%
% \begin{macro}{\eu@target}
%    
%    \begin{macrocode}
\def\eu@target#1#2#3{\hypertarget{#1@#2@target}{#3}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\eu@def}
%    
%    \begin{macrocode}
\def\eu@def#1#2#3#4{\expandafter\gdef\csname #1@#2@#3\endcsname{#4}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\euref}
%    
%    \begin{macrocode}
\def\euref#1#2#3{\@ifundefined{#1@#2@#3}%
{\protect\G@refundefinedtrue\@latex@warning{#3 for #1 #2 undefined}??}%
{\csname #1@#2@#3\endcsname}}%
\def\euref@aux#1#2#3{\@ifundefined{#1@#2@#3}{??}{\csname #1@#2@#3\endcsname}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\euref}
%    
%    \begin{macrocode}
\def\euRef#1#2#3{\@ifundefined{#1@#2@#3}%
{\protect\G@refundefinedtrue\@latex@warning{#3 for #1 #2 undefined}??}%
{\hyperlink{#1@#2@target}{\csname #1@#2@#3\endcsname}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\eu@lead}
%    
%    \begin{macrocode}
\def\eu@lead#1{\@ifundefined{wp@#1@lead}%
{\protect\G@refundefinedtrue\@latex@warning{lead for WP #1 undefined}??}%
{\edef\@partner{\csname wp@#1@lead\endcsname}\euRef{partner}{\@partner}{short}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\wpline}
%    
%    \begin{macrocode}
\def\wpline#1{\euRef{wp}{#1}{label} & 
              \euref{wp}{#1}{title} & 
              \eu@lead{#1} & 
              \euref{wp}{#1}{start} & 
              \euref{wp}{#1}{duration} &
              \euref{wp}{#1}{type} \\\hline} 
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\wgline}
%    
%    \begin{macrocode}
\def\wgline#1{\cellcolor{lightgray}{\euRef{wg}{#1}{label}} & 
  \multicolumn{5}{c|}{\cellcolor{lightgray}{\euref{wg}{#1}{title}}}  \\\hline} 
%    \end{macrocode}
% \end{macro}
% 
% \begin{environment}{wptable}
%    
%    \begin{macrocode}
\newenvironment{wptable}{\begin{footnotesize}\begin{tabular}{|c|l|l|l|l|l|}\hline
  \textbf{WG/WP}&
  \textbf{Title}& 
  \textbf{Lead}&
  \textbf{Start}&
  \textbf{Dur.}& 
  \textbf{Type}\\\hline\hline}
{\end{tabular}\end{footnotesize}}
%    \end{macrocode}
% \end{environment}
% 
% \begin{macro}{\wpobjectives}
%    
%    \begin{macrocode}
\def\wpobjectives{\textbf{Objectives:} }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\wpdescription}
%    
%    \begin{macrocode}
\def\wpdescription{\textbf{Description of Work:} }
%    \end{macrocode}
% \end{macro}
% \begin{environment}{wpdelivs}
%    
%    \begin{macrocode}
\newenvironment{wpdelivs}{\vspace*{-1em}\begin{description}}
{\end{description}}
%    \end{macrocode}
% \end{environment}
% 
% \begin{macro}{\wgdelivs}
%    
%    \begin{macrocode}
\newenvironment{wgdelivs}{\setcounter{deliv}{0}\vspace*{-1em}\begin{description}}
{\end{description}}
%    \end{macrocode}
% \end{macro}
% The next macro is generally useful to put a comment at the end of the line, possibly
% making a new one if there is not enough space.
% \begin{macro}{\lec}
%    \begin{macrocode}
\def\lec#1{\strut\hfil\strut\null\nobreak\hfill\hbox{$\leadsto$#1}\par}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\wpdeliv}
%    We first define the keys
%    \begin{macrocode}
\define@key{deliv}{id}{\def\deliv@id{#1}}
\define@key{deliv}{due}{\def\deliv@due{#1}}
\define@key{deliv}{dissem}{\def\deliv@dissem{#1}}
\define@key{deliv}{type}{\def\deliv@type{#1}}
\define@key{deliv}{miles}{\def\deliv@miles{#1}}
%    \end{macrocode}
%    The |\wpdeliv| macro cycles over the due dates and generates the relevant entries
%    into the delivrables file\ednote{also generate the makefile} 
%    \begin{macrocode}
\newcommand{\wpg@deliv}[3]{% keys, title, type
\let\deliv@miles=\relax% clean state
\def\@type{#3}\def\@wp{wp}% set up ifx
\def\wpg@id{\csname #3@id\endcsname}
\setkeys{deliv}{#1}\stepcounter{deliv}% set state
\ifx\@type\@wp\def\current@label{D\thewg.\thewp.\thedeliv}
\else\def\current@label{D\thewg.\thedeliv}\fi
\eu@write@aux{deliv}{\wpg@id\deliv@id}{label}{\current@label}
\eu@write@aux{deliv}{\wpg@id\deliv@id}{title}{#2}
\@ifundefined{deliv@due}{}{%
\@for\@I:=\deliv@due\do{\protected@write\wpg@delivs{}{\string\delivrable% 
{\@I}% due date
{\current@label}% label
{\@ifundefined{deliv@id}{\protect\G@refundefinedtrue\@latex@warning{key 'id' for Deliv #1
      undefined}??}{\wpg@id:\deliv@id}}% id
{\@ifundefined{deliv@dissem}{\protect\G@refundefinedtrue\@latex@warning{key 'dissem' for
      Deliv #1 undefined}??}{\deliv@dissem}}% dissemination level
{\@ifundefined{deliv@type}{\protect\G@refundefinedtrue\@latex@warning{key 'type' for Deliv
      #1 undefined}??}{\deliv@type}}% type
{#2}}}}%
\item[\current@label: (Month \deliv@due)]\eu@target{deliv}{\wpg@id\deliv@id}{#2}
\@ifundefined{deliv@miles}{}{% print the milestones and update their delivrables
\let\m@sep=\relax% do not print the separator the first time round
\lec{\@for\@I:=\deliv@miles\do{% Iterate over the milestones mentioned
\m@sep\euRef{mile}{\@I}{label}% print the milestone reference
\let\m@sep=,}}%set the separator for the next times
\def\d@sep{,}
 \@for\@I:=\deliv@miles\do{% Iterate over the milestones mentioned
 \expandafter\ifx\csname\@I delivs\endcsname\relax% Check that the miles@delivs is empty
  {\expandafter\xdef\csname\@I delivs\endcsname{\wpg@id\deliv@id}}% if so, skip the separator
   \else\expandafter\xdef\csname\@I delivs\endcsname{\csname\@I delivs\endcsname\d@sep\wpg@id\deliv@id}\fi%if not add it
}
}}
%    \end{macrocode}
%    \ednote{in the last three lines, I would like to extend all the milestones it
%      references by this delivrable, but somehow it does not work yet (leads to a
%      circular definition of <mile>@delivs)}
% \end{macro}
%
% Now, we only need to instantiate
% 
% \begin{macro}{\wgdeliv}
%    \begin{macrocode}
\newcommand{\wgdeliv}[2][]{\wpg@deliv{#1}{#2}{wg}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\wpdeliv}
%    \begin{macrocode}
\newcommand{\wpdeliv}[2][]{\wpg@deliv{#1}{#2}{wp}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{environment}{workplan}
%    the macros above should actually only be defined in the |workplan|
%    environment\ednote{use the envisioned two-stop refactoring to make the actual
%    definitions short enough to put into the environment}
%    \begin{macrocode}
\newwrite\wpg@delivs
\newenvironment{workplan}%
{\immediate\openout\wpg@delivs=\jobname.delivs\setcounter{wg}{-1}}%
{\closeout\wpg@delivs%
\@for\@I:=\mile@stones\do{\eu@write@aux{mile}{\@I}{delivs}{\csname\@I delivs\endcsname}}
\@for\@I:=\eu@partners\do{
    \eu@write@aux{eu}{\@I}{totaleffort}{\csname thetotal@\@I @effort\endcsname}}
\eu@write@aux{eu}{workplan}{wgs}{\eu@wgs}}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\milestone}
%    \begin{macrocode}
%    create a new milestone, initialize its delivrables accumulator macro, set up
%    hyperlinking, and extend the milestones list. 
\newcounter{milestone}
\def\milestone#1{\stepcounter{milestone}
\eu@write@aux{mile}{#1}{label}{M\themilestone}
\eu@target{mile}{#1}{M\themilestone}
\@ifundefined{mile@stones}{\gdef\mile@stones{#1}}{\g@addto@macro\mile@stones{,#1}}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\milesfor}
%    the due date is the first argument to facilitate sorting
%    \begin{macrocode}
\def\milesfor#1{\edef\@delivs{\euref{mile}{#1}{delivs}}
\let\m@sep=\relax
\@for\@I:=\@delivs\do{\m@sep\ \euRef{deliv}{\@I}{label}\let\m@sep=,}}
%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\Ed@note}
%    the due date is the first argument to facilitate sorting
%    \begin{macrocode}
\newcommand{\delivrable}[6]{#2&#1&#6&#4&#5\\\hline}%due,label,id,title,type,level
%    \end{macrocode}
% \end{macro}
% 
% \begin{environment}{delivrables}
%    
%    \begin{macrocode}
\newenvironment{delivrables}[1]{\begin{longtable}{|l|l|p{#1}|l|l|}\hline
\#&due&title&dissem& type\\\hline\hline}{\\\hline\end{longtable}}
%    \end{macrocode}
% \end{environment}
% 
% \begin{macro}{\inputdelivs}
%    
%    \begin{macrocode}
\newcommand{\inputdelivs}[1]{\begin{delivrables}{#1}
\IfFileExists{\jobname.delivrables}%
{\input{\jobname.delivrables}}%
{\input{\jobname.delivs}}
\end{delivrables}}
%    \end{macrocode}
% \end{macro}
% 
% \section{The Staff Effort Table}\label{impl:staffefforttable}
%
% \begin{macro}{\staffefforttable}
%    
%    \begin{macrocode}
\def\zero@blank#1{\edef\@test{#1}\def\@zero{0}\ifx\@test\@zero\else#1\fi}
\def\staffefforttable{%
\edef\@wgs{\euref@aux{eu}{workplan}{wgs}}\message{wgs: \@wgs}
{\gdef\staff@efforts{}\def\@zero{0}% initialize
 \let\tabularnewline\relax\let\hline\relax% so they do not bother us
 \@for\@I:=\eu@partners\do{%iterate over partners for the lines
   \xdef\@line{\euref@aux{partner}{\@I}{number}& \euref@aux{partner}{\@I}{short}}% first two columns
   \@for\@J:=\@wgs\do{%iterate over the work groups
     \edef\@wps{\euref@aux{wg}{\@J}{wps}}\message{wps of \@J: \@wps}% define the list of work packages
     \edef\@wgeffort{\euref@aux{\@J}{\@I}{effort}}\message{wgeffort: \@wgeffort}% 
     \@for\@K:=\@wps\do{% iterate over wps
       \edef\@wpeffort{\euref@aux\@K\@I{effort}}
       \xdef\@line{\@line&\ifx\@wpeffort\@zero\else\@wpeffort\fi}}
     \xdef\@line{\@line&\ifx\@wgeffort\@zero\else\@wgeffort\fi}}
   \message{line: \@line}
    \xdef\staff@efforts{\staff@efforts\@line&
      \euref@aux{eu}{\@I}{totaleffort}\tabularnewline\hline}}
  \gdef\wpg@nums{} %initialize
  \@for\@I:=\@wgs\do{%iterate over the work groups
    \xdef\wpg@nums{\wpg@nums\euref@aux{wg}{\@I}{wpnums}&T\euref@aux{wg}{\@I}{num}}}}
\message{wpgnums: \wpg@nums}
\begin{tabular}{|l|l|*{\thewpgno}{c|}l|}\hline
\# & Short \wpg@nums & Total \\\hline
\staff@efforts
\end{tabular}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{environment}{partnerdesc}
%    
%    \begin{macrocode}
\newenvironment{partnerdesc}[1]{%number, short, long, 
\eu@target{partner}{#1}{}
\section*{\euref{partner}{#1}{number}. #1: {\sc \euref{partner}{#1}{long}}  (\euref{partner}{#1}{nationality})}}
{}
%    \end{macrocode}
% \end{environment}
% 
% \begin{macro}{\act}
%    for the activity table
%    \begin{macrocode}
\def\act#1#2{\multicolumn{#1}{l|}{\cellcolor{lightgray}{#2}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\pause}
%    for the activity table
%    \begin{macrocode}
\def\pause#1{\multicolumn{#1}{l|}{}}
%    \end{macrocode}
% \end{macro}
%</cls>
% \Finale
\endinput

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