Debian Codegraph @

texmf-dist/source/latex/pgfgantt/pgfgantt.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2024 by Wolfgang Esser-Skala
4 %
5 % This work may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either version 1.3c
7 % of this license or (at your option) any later version.
8 % The latest version of this license is in
9 % https://www.latex-project.org/lppl.txt
10 % and version 1.3c or later is part of all distributions of LaTeX
11 % version 2008/05/04 or later.
12 %
13 % \fi
14 %
15 % \iffalse
16 %<pgfgantt>\ProvidesPackage{pgfgantt}[2024/06/19 v5.0a Draw Gantt diagrams with TikZ]
17 %<pgfgantt>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
18 %
19 %<*driver>
20 \documentclass[captions=tableheading,cleardoublepage=empty]{scrartcl}
21 \usepackage[ngerman,english]{babel}
22 \addto\extrasenglish{\extrasngerman}
23 \usepackage[utf8]{inputenc}
24 \usepackage[T1]{fontenc}
25 \usepackage[hdivide={2cm,*,5cm}]{geometry}
26 \usepackage{url}
27 \usepackage[dvipsnames]{xcolor}
28 \usepackage{listings}
29 \usepackage{array,booktabs}
30 \lstset{
31 language=[AlLaTeX]TeX,
32 basicstyle=\ttfamily,
33 texcsstyle=*\color{RoyalBlue},
34 keywordstyle=\color{Maroon},
35 commentstyle=\itshape\color{black!50},
36 columns=fullflexible,
37 keepspaces=true,
38 backgroundcolor=\color{black!5},
39 tabsize=2,
40 gobble=2,
41 frame=tlrb,
42 framesep=.25em,
43 xleftmargin=.25em,
44 xrightmargin=.25em,
45 rulecolor=\color{white},
46 alsoletter={*},
47 morekeywords={ganttchart,tikzpicture,tabular},
48 moretexcs={
49 ganttalignnewline,gantttitle,gantttitlelist,gantttitlecalendar,
50 gantttitlecalendar*,ganttbar,ganttlink,ganttlinkedgroup,
51 ganttlinkedbar,ganttmilestone,ganttlinkedmilestone,ganttgroup,
52 ganttset,ganttnewline,textcolor,foreach,draw,
53 pgfcalendarweekdayshortname,usetikzlibrary,
54 color,rotatebox,definecolor,sfdefault,mddefault,bfdefault,fcolorbox,
55 newganttlinktype,newganttlinktypealias,setganttlinklabel,
56 ganttsetstartanchor,ganttsetendanchor,xLeft,xRight,yUpper,yLower,
57 ganttlinklabel,ganttvalueof,pgfcalendarweekdayname,pgfcalendarweekdayletter,
58 pgfcalendarmonthshortname,currentweek,startyear,startmonth,startday,x,y,
59 pgfcalendarweekday,pgfcalendarmonth,newgantttimeslotformat,pgfcalendardatetojulian,
60 newganttchartelement,newganttchartelement*,gantt,ganttlinked,ganttfoobar,ganttlinkedfoobar,ganttvrule
61 },
62 escapeinside=`',
63 escapebegin=\begin{rmfamily},
64 escapeend=\end{rmfamily},
65 emph={list},
66 emphstyle=\color{black},
67 }
68 \lstnewenvironment{texcode}[1][]{\lstset{basicstyle=\small\ttfamily,#1}}{}
69 \usepackage{doc}
70 \setlength\MacroIndent{0pt}
71 \setlength\MacroTopsep\parskip
72 \setlength\MacrocodeTopsep\medskipamount
73 \def\MacroFont{\small\ttfamily}
74 \def\theCodelineNo{\sffamily\scriptsize\color{black!50}\arabic{CodelineNo}}
75 \setcounter{IndexColumns}{2}
76 \def\pack#1{\textsf{#1}}
77 \def\main#1{\textit{#1}}
78 \def\usage#1{\textbf{#1}}
79 \def\opt#1{\textcolor{OliveGreen}{\texttt{#1}}}
80 \providecommand\marg[1]{{\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
81 \providecommand\oarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}}
82 \def\PrintDescribeMacro#1{\strut\MacroFont\color{RoyalBlue}\string#1}
83 \def\PrintDescribeEnv#1{\strut\MacroFont\color{Maroon}#1}
84 \def\PrintDescribeOpt#1{\strut\MacroFont\color{OliveGreen}#1}
85 \def\PrintMacroName#1{\strut\MacroFont\color{RoyalBlue}\string#1}
86 \def\PrintEnvName#1{\strut\MacroFont\color{Maroon}#1}
87 \def\PrintOptName#1{\strut\MacroFont\color{OliveGreen}#1}
88 \def\PrintIntMacroName#1{\strut\MacroFont\string#1}
89
90 \makeatletter
91 \def\page@wrindex#1{\if@filesw
92 \immediate\write\@indexfile
93 {\string\indexentry{#1}%
94 {\thepage}}\fi}
95
96 \def\SpecialUsageIndex#1{\@bsphack
97 {\let\special@index\page@wrindex\SpecialIndex@{#1}{\encapchar usage}}%
98 \@esphack}
99 \def\SpecialEnvIndex#1{\@bsphack\page@wrindex{%
100 #1\actualchar
101 {\string\ttfamily\space#1}
102 (environment)%
103 \encapchar usage}%
104 \page@wrindex{environments:\levelchar#1\actualchar{%
105 \string\ttfamily\space#1}\encapchar
106 usage}\@esphack}
107 \def\SpecialOptIndex#1{\@bsphack\page@wrindex{%
108 #1\actualchar
109 {\string\ttfamily\space#1}
110 (option)%
111 \encapchar usage}%
112 \page@wrindex{options:\levelchar#1\actualchar{%
113 \string\ttfamily\space#1}\encapchar
114 usage}\@esphack}
115 \def\SpecialMainOptIndex#1{\@bsphack\special@index{%
116 #1\actualchar
117 {\string\ttfamily\space#1}
118 (option)%
119 \encapchar main}%
120 \special@index{options:\levelchar#1\actualchar{%
121 \string\ttfamily\space#1}\encapchar
122 main}\@esphack}
123
124 \def\DescribeOpt{\Describe@Opt}
125 \def\Describe@Macro#1{\endgroup
126 \marginpar{\rlap{\raggedright\PrintDescribeMacro{#1}}}%
127 \SpecialUsageIndex{#1}\@esphack\ignorespaces}
128 \def\Describe@Env#1{\endgroup
129 \marginpar{\rlap{\raggedright\PrintDescribeEnv{#1}}}%
130 \SpecialEnvIndex{#1}\@esphack\ignorespaces}
131 \def\Describe@Opt#1{\SpecialOptIndex{#1}\ignorespaces}
132
133 \def\macro{\begingroup
134 \catcode`\\12
135 \MakePrivateLetters \m@cro@ 1}
136 \def\environment{\begingroup
137 \catcode`\\12
138 \MakePrivateLetters \m@cro@ 2}
139 \def\option{\begingroup
140 \catcode`\\12
141 \MakePrivateLetters \m@cro@ 3}
142 \def\intmacro{\begingroup
143 \catcode`\\12
144 \MakePrivateLetters \m@cro@ 4}
145 \long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist
146 \edef\saved@macroname{\string#2}%
147 \def\makelabel##1{\rlap{\hskip5pt\hskip\textwidth\hskip\marginparsep##1}}%
148 \if@inlabel
149 \let\@tempa\@empty \count@\macro@cnt
150 \loop \ifnum\count@>\z@
151 \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat
152 \edef\makelabel##1{\rlap{\hskip5pt\hskip\textwidth\hskip\marginparsep\vtop to\baselineskip
153 {\@tempa\hbox{##1}\vss}}}%
154 \advance \macro@cnt \@ne
155 \else \macro@cnt\@ne \fi
156 \edef\@tempa{\noexpand\item[%
157 \ifcase #1\or%
158 \noexpand\PrintMacroName
159 \or
160 \noexpand\PrintEnvName
161 \or
162 \noexpand\PrintOptName
163 \or
164 \noexpand\PrintIntMacroName
165 \fi
166 {\string#2}]}%
167 \@tempa
168 \global\advance\c@CodelineNo\@ne
169 \ifcase #1\or%
170 \SpecialMainIndex{#2}\nobreak
171 \DoNotIndex{#2}%
172 \or
173 \SpecialMainEnvIndex{#2}\nobreak
174 \or
175 \SpecialMainOptIndex{#2}\nobreak
176 \or
177 \SpecialMainIndex{#2}\nobreak
178 \DoNotIndex{#2}%
179 \fi
180 \global\advance\c@CodelineNo\m@ne
181 \ignorespaces}
182 \let\endoption\endmacro
183 \let\endintmacro\endmacro
184 \makeatother
185
186 \AtBeginDocument{\lstMakeShortInline|}
187
188 \usepackage[
189 hyperfootnotes=false,
190 bookmarksnumbered,%
191 bookmarksopen,%
192 bookmarksopenlevel=1,%
193 breaklinks,%
194 linktocpage,%
195 pdfborder={0 0 0},%
196 pdfhighlight=/N%
197 ]{hyperref}%
198
199 \makeatletter
200 \newsavebox\keybox
201 \newcommand\keyline[4][=]{%
202 \savebox\keybox{\texttt{\textcolor{OliveGreen!50}{/pgfgantt/}\textcolor{OliveGreen}{#2}\space#1}#3}%
203 \noindent\DescribeOpt{#2}\usebox\keybox%
204 \settowidth\@tempdimb{\texttt{#4}}%
205 \@tempdima=\textwidth\relax%
206 \advance\@tempdima by-\wd\keybox\relax%
207 \advance\@tempdima by-5mm\relax%
208 \ifdim\@tempdima<\@tempdimb\relax\\\fi%
209 \hspace*{\fill}\texttt{#4}%
210 \par\noindent\ignorespaces%
211 }
212 \makeatother
213 \newenvironment{key}[4][=]{%
214 \bigskip%
215 \keyline[#1]{#2}{#3}{#4}%
216 }{}
217 \def\TikZ{Ti\textit{k}Z}
218 \DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
219
220 \usepackage{pgfgantt}
221
222 \usetikzlibrary{shadows,shadings,decorations.pathmorphing,shapes.misc}
223
224 \EnableCrossrefs
225 \CodelineIndex
226 \IndexPrologue{\clearpage\section{Index}\markboth{Index}{Index}Bold numbers refer to the page where the corresponding entry is described; italic numbers refer to the code line of the definition; upright numbers refer to the code lines where the entry is used.}
227
228 \setkomafont{title}{\rmfamily\bfseries}
229 \addtokomafont{sectioning}{\rmfamily}
230 \normalmarginpar
231 \pdfpageattr{/Group <</S /Transparency /I true /CS /DeviceRGB>>}
232
233 \begin{document}
234 \DocInput{pgfgantt.dtx}
235 \end{document}
236 %</driver>
237 % \fi
238 %
239 % \GetFileInfo{pgfgantt.sty}
240 %
241 % \DoNotIndex{\@auxout,\@empty,\@firstoftwo,\@ifundefined,\@namedef,\@nameuse,\@tempa,\@tempb,\@tempc,\@tempcnta,\@tempcntb,\@tempdima,\advance,\anchor,\backgroundpath,\begin,\begingroup,\bfseries,\breakforeach,\clip,\csname,\def,\divide,\draw,\edef,\else,\end,\endcsname,\endgroup,\expandafter,\fi,\foreach,\global,\i,\ifcase,\ifdate,\ifdim,\ifnum,\ifx,\inheritanchor,\inheritanchorborder,\inheritbackgroundpath,\inheritsavedanchors,\itshape,\kernel@ifnextchar,\let,\multiply,\newcommand,\newcount,\newenvironment,\newif,\node,\normalcolor,\normalfont,\normalsize,\northeast,\outernortheast,\PackageError,\PackageWarning,\path,\pgf@process,\pgf@x,\pgf@y,\pgf@xa,\pgf@xb,\pgf@xc,\pgf@ya,\pgf@yb,\pgf@yc,\pgfcalendar,\pgfcalendarbeginjulian,\pgfcalendarcurrentday,\pgfcalendarcurrentjulian,\pgfcalendarcurrentmonth,\pgfcalendarcurrentweekday,\pgfcalendarcurrentyear,\pgfcalendardatetojulian,\pgfcalendarendiso,\pgfcalendarifdateday,\pgfcalendarifdatemonth,\pgfcalendarifdateyear,\pgfcalendarjuliantodate,\pgfcalendarmatchestrue,\pgfdeclareshape,\pgfextractx,\pgfkeys,\pgfkeyscurrentname,\pgfkeyssetvalue,\pgfkeysvalueof,\pgfmathparse,\pgfmathprintnumber,\pgfmathresult,\pgfmathsetlength,\pgfmathsetmacro,\pgfpathclose,\pgfpathlineto,\pgfpathmoveto,\pgfpoint,\pgfpointadd,\pgfpointanchor,\pgfpointdiff,\pgfpointscale,\pgfqkeys,\protected@write,\relax,\RequirePackage,\savedanchor,\scriptsize,\setcounter,\small,\southwest,\stepcounter,\string,\strut,\t,\the,\tikz@align@newline,\usetikzlibrary,\value,\x,\xdef}
242 %
243 %
244 % \title{Drawing Gantt Charts in \LaTeX\\with \TikZ}
245 % \subtitle{The \texttt{pgfgantt} Package}
246 % \author{\texorpdfstring{Wolfgang Esser-Skala\thanks{Computational Systems Biology Group, Department of Biosciences and Medical Biology, University of Salzburg, Austria; \texttt{[email protected]}}}{Wolfgang Esser-Skala}}
247 % \date{\fileversion\\\filedate}
248 % \maketitle
249 %
250 % \begin{abstract}
251 % The \pack{pgfgantt} package provides the |ganttchart| environment, which draws a Gantt chart within a \TikZ\ picture. The user may add various elements to the chart, for example, titles, bars, groups, milestones and different links between these elements. The appearance of the chart elements is highly customizable, and even new chart elements may be defined.
252 % \end{abstract}
253 %
254 % \clearpage\tableofcontents
255 %
256 % \clearpage\section{Introduction}
257 %
258 % The \pack{pgfgantt} package allows you to draw Gantt charts in \LaTeX. Thus, you can describe simple project schedules without having to include images produced by external programs. Similar to Martin Kumm's \pack{gantt} package\footnote{\url{https://www.martin-kumm.de/tex_gantt_package.php}} (which inspired \pack{pgfgantt}'s fundamental aspects), \pack{pgfgantt} bases upon \textsc{pgf} and its \TikZ\ frontend\footnote{\url{https://ctan.org/pkg/pgf/}}. Besides, it provides a comprehensive (and portable) alternative to \pack{pst-gantt}\footnote{\url{https://ctan.org/pkg/pst-gantt/}}.
259 %
260 % \paragraph{Requirements} \pack{pgfgantt} requires a \textit{current} \textsc{pgf} installation. Note that the version number must at least be 2.10, dated October 25th, 2010. Furthermore, \pack{pgfgantt}~\fileversion\ and above is not fully downwards compatible.
261 %
262 % \paragraph{Suggestions} Please report any suggestions and improvements at the project's GitHub page (\url{https://github.com/skafdasschaf/latex-pgfgantt}).
263 %
264 % \paragraph{Acknowledgements} I would like to thank the following people for their ideas concerning new features:
265 % Christian Buhtz,
266 % Rapha\"el Clifford (University of Bristol),
267 % Jakob D\o llner M\o nster (Technical University of Denmark),
268 % Holger Karl (Universität Paderborn),
269 % Tristan Miller (Technische Universität Darmstadt),
270 % Scott Pakin (Los Alamos National Laboratory),
271 % Petr Po\v s\'ik (Czech Technical University in Prague),
272 % Una Smith,
273 % Sascha Yousefi (Universität Freiburg),
274 % and Callum Webb.
275 %
276 %
277 % \clearpage\section{User Guide}
278 %
279 % \subsection{Overview}
280 %
281 % To load the package, simply put
282 % \begin{texcode}
283 % \usepackage{pgfgantt}
284 % \end{texcode}
285 % into the document preamble.
286 %
287 % Compare the following code, which demonstrates some commands provided by \pack{pgfgantt}, to the output it produces:
288 %
289 % \begin{texcode}
290 % \begin{ganttchart}{1}{12}
291 % \gantttitle{2011}{12} \\
292 % \gantttitlelist{1,...,12}{1} \\
293 % \ganttgroup{Group 1}{1}{7} \\
294 % \ganttbar{Task 1}{1}{2} \\
295 % \ganttlinkedbar{Task 2}{3}{7} \ganttnewline
296 % \ganttmilestone{Milestone}{7} \ganttnewline
297 % \ganttbar{Final Task}{8}{12}
298 % \ganttlink{elem2}{elem3}
299 % \ganttlink{elem3}{elem4}
300 % \end{ganttchart}
301 % \end{texcode}
302 % \begin{center}
303 % \begin{ganttchart}{1}{12}
304 % \gantttitle{2011}{12} \\
305 % \gantttitlelist{1,...,12}{1} \\
306 % \ganttgroup{Group 1}{1}{7} \\
307 % \ganttbar{Task 1}{1}{2} \\
308 % \ganttlinkedbar{Task 2}{3}{7} \ganttnewline
309 % \ganttmilestone{Milestone}{7} \ganttnewline
310 % \ganttbar{Final Task}{8}{12}
311 % \ganttlink{elem2}{elem3}
312 % \ganttlink{elem3}{elem4}
313 % \end{ganttchart}
314 % \end{center}
315 %
316 %
317 % \subsection{Specifying Keys}
318 %
319 % \textit{Keys} (sometimes called \textit{options}) modify the output from \pack{pgfgantt}'s commands. You may specify a key in two ways: (1) Pass it to the optional argument present in each command, e.\,g.
320 % \begin{texcode}
321 % \ganttbar[bar height=.6]{Task 1}{1}{2}
322 % \end{texcode}
323 % This locally changes a key for the element(s) drawn by that command. (2) Alternatively, specify a key by the \DescribeMacro{\ganttset}|\ganttset|\marg{key=value list} macro, which sets its keys within the current \TeX\ group:
324 % \begin{texcode}
325 % \ganttset{bar height=.6}
326 % \end{texcode}
327 % Since \pack{pgfgantt} uses the \pack{pgfkeys} package for key management, all its keys reside in the |/pgfgantt/| path. However, if you set your keys by one of the methods explained above, this path is automatically prepended to each key.
328 %
329 % \subsection{The Canvas}
330 %
331 % Let us have a look at the basic anatomy of a Gantt chart and define some common terms. Each \textit{chart} consists of several \textit{lines}, which may contain one or more \textit{title elements} (at the top) or \textit{chart elements} (such as bars, groups and milestones). From left to right, the chart is divided into an integer number of \textit{time slots} that represent the basic $x$-unit.
332 %
333 % The \DescribeEnv{ganttchart}|ganttchart| environment draws a single Gantt chart:
334 % \begin{texcode}
335 % \begin{ganttchart}`\oarg{options}\marg{start tss}\marg{end tss}'
336 % `$\cdots$'
337 % \end{ganttchart}
338 % \end{texcode}
339 % The environment has one optional argument, which specifies the \meta{options} for the chart, and two mandatory arguments, which indicate the start and end time slot specifier. Although you will often put a |ganttchart| into a |tikzpicture| environment, you may actually use this environment on its own. \pack{pgfgantt} checks whether a chart is surrounded by a |tikzpicture| and adds this environment if necessary.
340 %
341 % \begin{key}{time slot format}{\meta{format}}{simple}
342 % Sets the \meta{format} of time slot specifiers. A \textbf{time slot specifier} (abbreviated ``tss'') denotes a certain time slot along the horizontal axis. \pack{pgfgantt} defines a range of formats:
343 % \begin{itemize}
344 % \item \texttt{simple} -- positive integers (the single format used by \pack{pgfgantt} prior to v4.0). See also the \opt{time slot format/start date} key below.\\
345 % \textit{Examples:} \texttt{1}, \texttt{3}, \texttt{24}
346 % \item \texttt{isodate} -- dates in ISO-standard format (\texttt{yyyy-mm-dd}). In this format and any other, you may omit the leading zero if month or day are less than 10.\\
347 % \textit{Examples:} \texttt{2013-03-14}, \texttt{2013-5-1}
348 % \item \texttt{isodate-yearmonth} -- ISO-standard dates without days (\texttt{yyyy-mm}). Such dates are automatically converted to the first day of the respective month.\\
349 % \textit{Examples:} \texttt{2013-03}, \texttt{2013-5}
350 % \item \texttt{isodate-year} -- year only (\texttt{yyyy}). Such dates are automatically converted to the first day of January.\\
351 % \textit{Examples:} \texttt{2013}, \texttt{2014}
352 % \item \texttt{little-endian} -- Gregorian little-endian, i.\,e. day--month--year (the common German date format). Valid day/month and month/year separators are the hyphen (\texttt{-}), slash (\texttt{/}) and period (\texttt{.}). If you enter a two-digit year (for example, \texttt{13} instead of \texttt{2013}), it will be completed according to the value of \opt{time slot format/base century} (see below).\\
353 % \textit{Examples:} \texttt{14-03-2013}, \texttt{14/03/13}, \texttt{14.3.2013}
354 % \item \texttt{middle-endian} -- middle-endian, i.\,e. month--day--year (the common US date format). For valid separators and automatic year completion, see \textit{little-endian}.\\
355 % \textit{Examples:} \texttt{03-14-2013}, \texttt{03/14/13}, \texttt{3.14.2013}
356 % \item \texttt{big-endian} -- Gregorian big-endian, i.\,e. year--month--day (the ISO"=standard order). For valid separators and automatic year completion, see \textit{little-endian}.\\
357 % \textit{Examples:} \texttt{2013-03-14}, \texttt{13/03/14}, \texttt{2013.3.14}
358 % \end{itemize}
359 % \end{key}
360 %
361 % \noindent Two subkeys of \opt{time slot format} let you configure \pack{pgfgantt}'s behavior regarding automatic completion of abbreviated dates:
362 %
363 % \begin{key}{time slot format/base century}{\meta{year}}{2000}
364 % Sets the century for auto-completion of two-digit years (used by the time slot formats \texttt{little-endian}, \texttt{middle-endian} and \texttt{big-endian}). Consequently, default settings convert a year like \texttt{13} to \texttt{2013}.
365 % \end{key}
366 %
367 % \begin{key}{time slot format/start date}{\meta{ISO-standard date}}{2000-01-01}
368 % Numbers denoting time slots in the \texttt{simple} format are internally converted to a date, where \texttt{1} is converted to \meta{ISO-standard date}, \texttt{2} to $\meta{ISO-standard date} + 1$ etc.
369 % \end{key}
370 %
371 % \bigskip\noindent Advanced users may add their own time slot \DescribeMacro{\newgantttimeslotformat}formats:
372 % \begin{texcode}
373 % \newgantttimeslotformat`\marg{name}\marg{converter code}'
374 % \end{texcode}
375 % Defines a new time slot format called \meta{name}. The \meta{converter code} must convert the time slot specifier stored in |#1| to its corresponding Julian day number (see section~57 of the \TikZ\ manual) and assign this number to the count register |#2|. The \meta{converter code} is executed within a \TeX\ group, so you may use temporary macros like |\@tempa|, counts like |\@tempcnta| etc.
376 %
377 % For example, we would like to create a format called \texttt{stardate}, where dates are given as ``\meta{year}\texttt{.}\meta{day of year}''. Thus, we will enter 24th February 2259 as ``\texttt{2259.55}''. To this end, we write the following code:
378 % \par\bigskip\noindent
379 % \begin{texcode}[numbers=left]
380 % \newgantttimeslotformat{stardate}{%
381 % \def\decomposestardate##1.##2\relax{%
382 % \def\stardateyear{##1}\def\stardateday{##2}%
383 % }%
384 % \decomposestardate#1\relax%
385 % \pgfcalendardatetojulian{\stardateyear-01-01}{#2}%
386 % \advance#2 by-1\relax%
387 % \advance#2 by\stardateday\relax%
388 % }
389 %
390 % \begin{ganttchart}[
391 % hgrid,
392 % vgrid,
393 % time slot format=stardate
394 % ]{2259.55}{2259.67}
395 % \gantttitlecalendar{year, month=name, day} \\
396 % \end{ganttchart}
397 % \end{texcode}
398 % \begin{center}
399 % \newgantttimeslotformat{stardate}{%
400 % \def\decomposestardate##1.##2\relax{%
401 % \def\stardateyear{##1}\def\stardateday{##2}%
402 % }%
403 % \decomposestardate#1\relax%
404 % \pgfcalendardatetojulian{\stardateyear-01-01}{#2}%
405 % \advance#2 by-1\relax%
406 % \advance#2 by\stardateday\relax%
407 % }
408 %
409 % \begin{ganttchart}[
410 % hgrid,
411 % vgrid,
412 % time slot format=stardate
413 % ]{2259.55}{2259.67}
414 % \gantttitlecalendar{year, month=name, day} \\
415 % \end{ganttchart}
416 % \end{center}
417 %
418 % \noindent The macro |\decomposestardate| (lines 2--4) has two delimited arguments: The first one is delimited by a period and the second one by |\relax|. The call in line 5 decomposes the tss stored in |#1| and saves the day in |\stardateday| and the year in |\stardateyear|. |\pgfcalendardatetojulian| (section~57.1.1 of the \TikZ\ manual) calculates the Julian date of the first day of |\stardateyear| and stores it in |#2| (line 6). We then subtract 1 from |#2| (line 7) and add the |\stardateday| (line 8).
419 %
420 % \begin{key}[./style=]{canvas}{\meta{style}}{shape=rectangle, draw, fill=white}
421 % The \opt{canvas} key changes the appearance of the canvas. \meta{style} is a list of \TikZ\ keys suitable for the \meta{options} of a \TikZ\ node (such as |shape=rectangle|, |fill| or |draw|; see chapter~16 of the \TikZ\ manual). By default, the canvas is a white rectangle with a black frame.
422 % \par\bigskip\noindent
423 % \begin{texcode}
424 % \begin{tikzpicture} % optional
425 % \begin{ganttchart}[
426 % canvas/.style=%
427 % {shape=chamfered rectangle, fill=yellow!25,
428 % draw=blue, dashed, very thick}
429 % ]{1}{6}
430 % \gantttitle{Title}{6} \\
431 % \ganttbar{}{1}{2} \\
432 % \ganttbar{}{3}{6}
433 % \end{ganttchart}
434 % \end{tikzpicture} % optional
435 % \end{texcode}
436 % \begin{center}
437 % \begin{ganttchart}[
438 % canvas/.style=%
439 % {shape=chamfered rectangle, fill=yellow!25,
440 % draw=blue, dashed, very thick}
441 % ]{1}{6}
442 % \gantttitle{Title}{6} \\
443 % \ganttbar{}{1}{2} \\
444 % \ganttbar{}{3}{6}
445 % \end{ganttchart}
446 % \end{center}
447 % \end{key}
448 %
449 % \begin{key}{x unit}{\meta{dimension}}{.5cm}
450 % \keyline{y unit title}{\meta{dimension}}{1cm}
451 % \keyline{y unit chart}{\meta{dimension}}{1cm}
452 % These keys specify the width of a time slot and the height of title or chart lines, respectively. Typically, the $x/y$-dimension ratio approximates $1:2$, and the line height is equal over the whole chart. Other dimensions are well possible, but you might have to change several spacing-related keys in order to obtain a pleasing chart.
453 % \par\bigskip\noindent
454 % \begin{texcode}
455 % \begin{ganttchart}[
456 % x unit=1cm,
457 % y unit title=.6cm,
458 % y unit chart=1.5cm
459 % ]{1}{6}
460 % \gantttitle{Title 1}{6} \\
461 % \gantttitle{Title 2}{6} \\
462 % \ganttbar{}{1}{3} \\
463 % \ganttbar{}{4}{6}
464 % \end{ganttchart}
465 % \end{texcode}
466 % \begin{center}
467 % \begin{ganttchart}[
468 % x unit=1cm,
469 % y unit title=.6cm,
470 % y unit chart=1.5cm
471 % ]{1}{6}
472 % \gantttitle{Title 1}{6} \\
473 % \gantttitle{Title 2}{6} \\
474 % \ganttbar{}{1}{3} \\
475 % \ganttbar{}{4}{6}
476 % \end{ganttchart}
477 % \end{center}
478 % \end{key}
479 %
480 % \begin{key}[]{expand chart}{\texttt{[=none}\space\textbar\space\meta{dimension}\texttt{]}}{none}
481 % If the value of this key differs from |none|, the Gantt chart will expand horizontally to \meta{dimension}. Use this key to produce charts that automatically expand to the text width. Two \LaTeX\ runs are required to calculate the correct size of the chart.
482 % \par\bigskip\noindent
483 % \begin{texcode}
484 % \begin{ganttchart}[
485 % expand chart=\textwidth
486 % ]{1}{6}
487 % \gantttitle{Title}{6} \\
488 % \ganttbar{Bar 1}{1}{3} \\
489 % \ganttbar{}{4}{6}
490 % \end{ganttchart}
491 % \end{texcode}
492 % \begin{center}
493 % \begin{ganttchart}[
494 % expand chart=\textwidth
495 % ]{1}{6}
496 % \gantttitle{Title}{6} \\
497 % \ganttbar{Bar 1}{1}{3} \\
498 % \ganttbar{}{4}{6}
499 % \end{ganttchart}
500 % \end{center}
501 % \end{key}
502 % \begin{key}[]{hgrid}{\texttt{[=false}\space\textbar\space\texttt{true}\space\textbar\space\meta{style list}\texttt{]}}{false}
503 % \keyline[/.style=]{hgrid style}{\meta{style}}{dotted}
504 % \keyline[]{vgrid}{\texttt{[=false}\space\textbar\space\texttt{true}\space\textbar\space\meta{style list}\texttt{]}}{false}
505 % \opt{hgrid} draws a horizontal grid which starts immediately below the last title element. The key can be specified in four different ways: Firstly, \opt{hgrid}|=false| eliminates the horizontal grid. You may omit this declaration, since it is the default. Secondly, both \opt{hgrid} and \opt{hgrid}|=true| activate the horizontal grid, which is then drawn in the default style |dotted|. Finally, \opt{hgrid}|=|\meta{style list} draws the horizontal grid in the given \meta{style list} (see below).
506 %
507 % \opt{hgrid style} changes the style of single horizontal grid lines that are drawn with |\ganttnewline[grid]| (see section~\ref{ssc:LineBreaks}).
508 %
509 % The \opt{vgrid} key governs the vertical grid; otherwise, use it exactly like \opt{hgrid}.
510 %
511 % \textit{Style lists} allow you to draw the grid lines in different styles. Each style list consists of several \textit{style list items} separated by a comma. A style list item has the general syntax |*{|\meta{n}|}{|\meta{style}|}| and orders the package to repeat the \meta{style} \meta{n}-times. (This syntax is reminiscent of column specifications in a |tabular| environment.) Thus, the list |*2{red}, *1{green}, *{10}{blue, dashed}| instructs \pack{pgfgantt} to draw first two red vertical grid lines, then a green one and finally ten dashed blue lines. If any grid lines remain to be drawn at the end of the list, the package starts again at the beginning of the list.
512 % \par\bigskip\noindent
513 % \begin{texcode}
514 % \begin{ganttchart}[
515 % hgrid=true,
516 % vgrid={*2{red}, *1{green}, *{10}{blue, dashed}}
517 % ]{1}{20}
518 % \gantttitle{Title 1}{20} \\
519 % \ganttbar{}{1}{8} \\
520 % \ganttbar{}{9}{20}
521 % \end{ganttchart}
522 % \end{texcode}
523 % \begin{center}
524 % \begin{ganttchart}[
525 % hgrid=true,
526 % vgrid={*2{red}, *1{green}, *{10}{blue, dashed}}
527 % ]{1}{20}
528 % \gantttitle{Title 1}{20} \\
529 % \ganttbar{}{1}{8} \\
530 % \ganttbar{}{9}{20}
531 % \end{ganttchart}
532 % \end{center}
533 %
534 % In most situations, you can omit the multiplier |*1|. Hence, the following style lists are equal:\\
535 % |{*1{red}, *1{blue, dashed}}|\\
536 % |{{red}, {blue, dashed}}|\\
537 % |{red, {blue, dashed}}|\\
538 % However, if you wish to use a single style comprising two or more keys for all grid lines, e.\,g. |red, dotted|, you \textit{must} retain the multiplier (i.\,e., |{*1{red, dotted}}|).
539 %
540 % \par\bigskip\noindent
541 % \begin{minipage}[t]{.45\textwidth}
542 % \begin{texcode}
543 % % wrong code
544 %
545 % \begin{ganttchart}[
546 % hgrid=true,
547 % vgrid={{red, dotted}}
548 % ]{1}{6}
549 % \gantttitle{Title 1}{6} \\
550 % \ganttbar{}{1}{3} \\
551 % \ganttbar{}{4}{6}
552 % \end{ganttchart}
553 % \end{texcode}
554 % \end{minipage}\hfill
555 % \begin{minipage}[t]{.45\textwidth}
556 % \begin{texcode}
557 % % correct code
558 %
559 % \begin{ganttchart}[
560 % hgrid=true,
561 % vgrid={*1{red, dotted}}
562 % ]{1}{6}
563 % \gantttitle{Title 1}{6} \\
564 % \ganttbar{}{1}{3} \\
565 % \ganttbar{}{4}{6}
566 % \end{ganttchart}
567 % \end{texcode}
568 % \end{minipage}
569 %
570 % \begin{center}
571 % \begin{ganttchart}[
572 % hgrid=true,
573 % vgrid={{red, dotted}}
574 % ]{1}{6}
575 % \gantttitle{Title 1}{6} \\
576 % \ganttbar{}{1}{3} \\
577 % \ganttbar{}{4}{6}
578 % \end{ganttchart}
579 % \hspace{1cm}
580 % \begin{ganttchart}[
581 % hgrid=true,
582 % vgrid={*1{red, dotted}}
583 % ]{1}{6}
584 % \gantttitle{Title 1}{6} \\
585 % \ganttbar{}{1}{3} \\
586 % \ganttbar{}{4}{6}
587 % \end{ganttchart}
588 % \end{center}
589 %
590 %
591 % In a chart with many time slots, drawing vertical grid lines between all of them will lead to a confusing appearance. In such a case, you can pass an appropriate \meta{style list} to |vgrid| in order to draw every second grid line, for example.
592 % \par\bigskip\noindent
593 % \begin{texcode}
594 % \begin{ganttchart}[vgrid={draw=none, dotted}]{1}{12}
595 % \gantttitlelist{1,...,12}{1} \\
596 % \ganttbar{}{1}{4} \\
597 % \ganttbar{}{5}{11}
598 % \end{ganttchart}
599 % \end{texcode}
600 % \begin{center}
601 % \begin{ganttchart}[vgrid={draw=none, dotted}]{1}{12}
602 % \gantttitlelist{1,...,12}{1} \\
603 % \ganttbar{}{1}{4} \\
604 % \ganttbar{}{5}{11}
605 % \end{ganttchart}
606 % \end{center}
607 % \end{key}
608 %
609 % \begin{key}{today}{\meta{tss}}{none}
610 % \keyline{today offset}{\meta{number}}{1}
611 % \keyline[/.style=]{today rule}{\meta{style}}{dashed, line width=1pt}
612 % \keyline{today label}{\meta{text}}{TODAY}
613 % \keyline{today label font}{\meta{font commands}}{\string\normalfont}
614 % \keyline[/.style=]{today label node}{\meta{style}}{anchor=north, font=\string\ganttvalueof\{today label font\}}
615 % Sometimes, you may wish to indicate the current day, month or the like on a Gantt chart. In order to do so, pass an integer value to the \opt{today} key, which draws a vertical rule at the corresponding \meta{tss}. \opt{today offset} determines the exact $y$-coordinate in the time slot and should lie between 0.0 (left border) and 1.0 (right border). The today rule appears in the \meta{style} denoted by \opt{today rule}. The node that contains the \meta{text} given by \opt{today label} appears below the rule. It is formatted by \opt{today label font} and \opt{today label node}.
616 % \par\bigskip\noindent
617 % \begin{minipage}[t]{.42\textwidth}
618 % \begin{texcode}
619 % \begin{ganttchart}[
620 % vgrid,
621 % today=2
622 % ]{1}{6}
623 % \gantttitle{Title}{6} \\
624 % \ganttbar{}{1}{3} \\
625 % \ganttbar{}{4}{6}
626 % \end{ganttchart}
627 % \end{texcode}
628 % \end{minipage}\hfill
629 % \begin{minipage}[t]{.56\textwidth}
630 % \begin{texcode}
631 % \begin{ganttchart}[
632 % vgrid,
633 % time slot format=isodate,
634 % today=2013-05-03,
635 % today offset=.5,
636 % today label=Current Week,
637 % today label node/.append style=%
638 % {anchor=north west},
639 % today label font=\itshape\color{red},
640 % today rule/.style=%
641 % {draw=blue, ultra thick}
642 % ]{2013-05-01}{2013-05-06}
643 % \gantttitle{Title}{6} \\
644 % \ganttbar{}{2013-05-01}{2013-05-03} \\
645 % \ganttbar{}{2013-05-04}{2013-05-06}
646 % \end{ganttchart}
647 % \end{texcode}
648 % \end{minipage}
649 %
650 % \begin{center}
651 % \begin{ganttchart}[
652 % vgrid,
653 % today=2
654 % ]{1}{6}
655 % \gantttitle{Title}{6} \\
656 % \ganttbar{}{1}{3} \\
657 % \ganttbar{}{4}{6}
658 % \end{ganttchart}
659 % \hspace{1cm}
660 % \begin{ganttchart}[
661 % vgrid,
662 % time slot format=isodate,
663 % today=2013-05-03,
664 % today offset=.5,
665 % today label=Current Week,
666 % today label node/.append style=%
667 % {anchor=north west},
668 % today label font=\itshape\color{red},
669 % today rule/.style=%
670 % {draw=blue, ultra thick}
671 % ]{2013-05-01}{2013-05-06}
672 % \gantttitle{Title}{6} \\
673 % \ganttbar{}{2013-05-01}{2013-05-03} \\
674 % \ganttbar{}{2013-05-04}{2013-05-06}
675 % \end{ganttchart}
676 % \end{center}
677 % \end{key}
678 %
679 %
680 % \subsection{Line Breaks between Chart Elements}
681 % \label{ssc:LineBreaks}
682 %
683 % \pack{pgfgantt} does not automatically begin a new line after finishing a \DescribeMacro{\ganttnewline}chart element. Instead, you must insert an explicit line break with |\ganttnewline|.
684 %
685 % \begin{key}{newline shortcut}{\meta{boolean}}{true}
686 % If true, \DescribeMacro{\\}|\\| is defined as a shortcut for |\ganttnewline| within a |ganttchart| environment, so that the syntax is reminiscent of \LaTeX's |tabular| enviroment.
687 % \par\bigskip\noindent
688 % \begin{texcode}
689 % \begin{ganttchart}[hgrid, vgrid]{1}{6}
690 % \gantttitle{Title 1}{3}
691 % \gantttitle{Title 2}{3} \\
692 % \ganttbar{}{1}{3} \ganttnewline
693 % \ganttbar{}{2}{3}
694 % \ganttbar{}{5}{6}
695 % \end{ganttchart}
696 % \end{texcode}
697 % \begin{center}
698 % \begin{ganttchart}[hgrid, vgrid]{1}{6}
699 % \gantttitle{Title 1}{3}
700 % \gantttitle{Title 2}{3} \\
701 % \ganttbar{}{1}{3} \ganttnewline
702 % \ganttbar{}{2}{3}
703 % \ganttbar{}{5}{6}
704 % \end{ganttchart}
705 % \end{center}
706 % \end{key}
707 %
708 % However, enabling this shortcut prevents you from entering multi-line node text (see section~16.4.3 of the \TikZ\ manual). Thus, \pack{pgfgantt} provides the macro \DescribeMacro{\ganttalignnewline}|\ganttalignnewline| for breaking lines in the node text.
709 % \par\bigskip\noindent
710 % \begin{minipage}[t]{.5\textwidth}
711 % \begin{texcode}
712 % \begin{ganttchart}[
713 % hgrid,
714 % vgrid,
715 % newline shortcut=false,
716 % bar label node/.append style=%
717 % {align=left}
718 % ]{1}{6}
719 % \gantttitle{Title}{6} \ganttnewline
720 % \ganttbar{%
721 % This is a\\
722 % multi-line text.%
723 % }{1}{3}
724 % \end{ganttchart}
725 % \end{texcode}
726 % \end{minipage}\hfill
727 % \begin{minipage}[t]{.48\textwidth}
728 % \begin{texcode}
729 % \begin{ganttchart}[
730 % hgrid,
731 % vgrid,
732 % newline shortcut=true,
733 % bar label node/.append style=%
734 % {align=left}
735 % ]{1}{6}
736 % \gantttitle{Title}{6} \\
737 % \ganttbar{%
738 % This is a\ganttalignnewline
739 % multi-line text.%
740 % }{1}{3}
741 % \end{ganttchart}
742 % \end{texcode}
743 % \end{minipage}
744 % \begin{center}
745 % \begin{ganttchart}[
746 % hgrid,
747 % vgrid,
748 % newline shortcut=false,
749 % bar label node/.append style=%
750 % {align=left}
751 % ]{1}{6}
752 % \gantttitle{Title}{6} \ganttnewline
753 % \ganttbar%
754 % {This is a\\
755 % multi-line text.%
756 % }{1}{3}
757 % \end{ganttchart}
758 % \end{center}
759 %
760 % Even if you prefer a canvas without a horizontal grid, you may nevertheless want to separate certain lines by a grid rule. For this purpose, specify the optional argument |[grid]| for |\ganttnewline| (or |\\|), which draws a grid rule in \opt{hgrid style} between the current and the new line. Alternatively, directly give the desired style as optional argument.
761 % \par\bigskip\noindent
762 % \begin{texcode}
763 % \begin{ganttchart}[hgrid style/.style=red]{1}{12}
764 % \gantttitle{Title}{12} \\
765 % \ganttbar{}{1}{3} \ganttnewline[thick, blue]
766 % \ganttbar{}{4}{5} \\
767 % \ganttbar{}{6}{10} \\[grid]
768 % \ganttbar{}{11}{12}
769 % \end{ganttchart}
770 % \end{texcode}
771 % \begin{center}
772 % \begin{ganttchart}[hgrid style/.style=red]{1}{12}
773 % \gantttitle{Title}{12} \\
774 % \ganttbar{}{1}{3} \ganttnewline[thick, blue]
775 % \ganttbar{}{4}{5} \\
776 % \ganttbar{}{6}{10} \\[grid]
777 % \ganttbar{}{11}{12}
778 % \end{ganttchart}
779 % \end{center}
780 %
781 %
782 % \subsection{Titles}
783 %
784 % A \textit{title} (comprising one or more lines) at the top of a Gantt chart usually indicates the period of time covered by that chart. For example, the first line could span twelve time slots and display the current year, while the second line could contain twelve elements, each of which corresponds to one month. For these purposes, \pack{pgfgantt} implements several titling commands.
785 %
786 % \DescribeMacro{\gantttitle}|\gantttitle| draws a single title element:
787 % \begin{texcode}
788 % \gantttitle`\oarg{options}\marg{label}\marg{number of time slots}'
789 % \end{texcode}
790 % The \meta{label} appears in the title element, which covers the \meta{number of time slots} starting from the right end of the last title element (or from the beginning of the line, if the title element is the first element in this line). Mostly, you will employ |\gantttitle| for titles that span several time slots.
791 % \par\bigskip\noindent
792 % \begin{texcode}
793 % \begin{ganttchart}[hgrid, vgrid]{1}{12}
794 % \gantttitle{2011}{12} \\
795 % \ganttbar{}{1}{4}
796 % \ganttbar{}{6}{11}
797 % \end{ganttchart}
798 % \end{texcode}
799 % \begin{center}
800 % \begin{ganttchart}[hgrid, vgrid]{1}{12}
801 % \gantttitle{2011}{12} \\
802 % \ganttbar{}{1}{4}
803 % \ganttbar{}{6}{11}
804 % \end{ganttchart}
805 % \end{center}
806 %
807 % Whenever you want to draw a larger number of title elements that are equal in size and follow a common enumeration scheme, the \DescribeMacro{\gantttitlelist}|\gantttitlelist| macro provides a fast solution:
808 % \begin{texcode}
809 % \gantttitlelist`\oarg{options}\marg{pgffor list}\marg{length of each element}'
810 % \end{texcode}
811 % This macro generates one title element for each element of the \meta{pgffor list}. The second mandatory argument specifies the \meta{length of each element}. Refer to section~56 of the \TikZ\ manual for the detailed syntax for the \meta{pgffor list}.
812 %
813 % A simple application is to draw twelve title elements that contain the numbers from 1 to 12. The \meta{pgffor list} is |1,...,12|.
814 % \par\bigskip\noindent
815 % \begin{texcode}
816 % \begin{ganttchart}[hgrid, vgrid]{1}{12}
817 % \gantttitlelist{1,...,12}{1} \\
818 % \ganttbar{}{1}{3}
819 % \ganttbar{}{5}{12}
820 % \end{ganttchart}
821 % \end{texcode}
822 % \begin{center}
823 % \begin{ganttchart}[hgrid, vgrid]{1}{12}
824 % \gantttitlelist{1,...,12}{1} \\
825 % \ganttbar{}{1}{3}
826 % \ganttbar{}{5}{12}
827 % \end{ganttchart}
828 % \end{center}
829 % Note that we would have obtained the same result if we had written
830 % \begin{texcode}
831 % \gantttitle{1}{1} \gantttitle{2}{1} `\dots' \gantttitle{12}{1} \\
832 % \end{texcode}
833 %
834 % As an advanced example, we will draw seven title elements containing the names of the weekdays (``Mon'' to ``Sun''). To this end, we introduce an additional key:
835 %
836 % \begin{key}{title list options}{\meta{pgffor options}}{var=\string\x, evaluate=\string\x}
837 % Changes the \meta{pgffor options} of the |\foreach| command called by |\gantttitlelist| (see section~56 of the \TikZ\ manual). The macro that yields the labels to be printed by |\gantttitlelist| must be called |\x|.
838 % \par\bigskip\noindent\shorthandoff{"}
839 % \begin{texcode}
840 % \begin{ganttchart}[hgrid, vgrid, x unit=1cm]{1}{7}
841 % \gantttitlelist[
842 % title list options=%
843 % {var=\y, evaluate=\y as \x%
844 % using "\pgfcalendarweekdayshortname{\y}"}
845 % ]{0,...,6}{1} \\
846 % \ganttbar{}{1}{4}
847 % \ganttbar{}{6}{7}
848 % \end{ganttchart}
849 % \end{texcode}
850 % \begin{center}
851 % \begin{ganttchart}[hgrid, vgrid, x unit=1cm]{1}{7}
852 % \gantttitlelist[
853 % title list options=%
854 % {var=\y, evaluate=\y as \x%
855 % using "\pgfcalendarweekdayshortname{\y}"}
856 % ]{0,...,6}{1} \\
857 % \ganttbar{}{1}{4}
858 % \ganttbar{}{6}{7}
859 % \end{ganttchart}
860 % \end{center}\shorthandon{"}
861 % \end{key}
862 %
863 % \bigskip While you actually may build any chart title with the two commands described previously, \DescribeMacro{\gantttitlecalendar}|\gantttitlecalendar| saves a lot of time when you wish to create elaborate calendars:
864 % \begin{texcode}
865 % \gantttitlecalendar`\oarg{options}\marg{calendar lines}'
866 % \end{texcode}
867 % Prints a title calendar that spans the whole chart and contains one or more \meta{calendar lines}. The starred \DescribeMacro{\gantttitlecalendar*}form of the macro prints a calendar from \meta{start tss} to \meta{end tss}:
868 % \begin{texcode}
869 % \gantttitlecalendar*`\oarg{options}\marg{start tss}\marg{end tss}\marg{calendar lines}'
870 % \end{texcode}
871 % \meta{calendar lines} is a comma-separated list of line types:
872 % \begin{center}
873 % \begin{tabular}{*3l}
874 % \toprule
875 % \itshape Line type & \meta{output format} & \itshape Example output \\
876 % \midrule
877 % \texttt{decade} & n/a & 2000s, 2010s, \dots \\[1ex]
878 % \texttt{year} & n/a & 2012, 2013, \dots \\[1ex]
879 % \texttt{month [=}\meta{output format}\texttt{]} & (none) & 01, 02, \dots, 12 \\
880 % & \texttt{name} & January, February, \dots \\
881 % & \texttt{shortname} & Jan, Feb, \dots \\[1ex]
882 % \texttt{week [=}\meta{number}\texttt{]} & n/a & Week 1, Week 2, \dots \\[1ex]
883 % \texttt{weekday [=}\meta{output format}\texttt{]} & (none) & 0, 1, \dots, 6 \\
884 % & \texttt{name} & Monday, Tuesday, \dots \\
885 % & \texttt{shortname} & Mon, Tue, \dots \\[1ex]
886 % \texttt{day} & n/a & 01, 02, \dots, 31 \\
887 % \bottomrule
888 % \end{tabular}
889 % \end{center}
890 %
891 % The \meta{number} for the \texttt{week} line type is the number of the first week in the calendar.
892 % \par\bigskip\noindent
893 % \begin{texcode}
894 % \begin{ganttchart}[
895 % hgrid,
896 % vgrid,
897 % x unit=4mm,
898 % time slot format=isodate
899 % ]{2012-12-25}{2013-02-01}
900 % \gantttitlecalendar{year, month, day, week=3, weekday} \\
901 % \ganttbar{}{2013-01-14}{2013-01-17}
902 % \end{ganttchart}
903 % \end{texcode}
904 % \begin{center}
905 % \begin{ganttchart}[
906 % hgrid,
907 % vgrid,
908 % x unit=4mm,
909 % time slot format=isodate
910 % ]{2012-12-25}{2013-02-01}
911 % \gantttitlecalendar{year, month, day, week=3, weekday} \\
912 % \ganttbar{}{2013-01-14}{2013-01-17}
913 % \end{ganttchart}\hspace*{-51.4pt}
914 % \end{center}
915 %
916 % You can easily add new output formats for \texttt{month} and \texttt{weekday}. The predefined ones use the macros described in section~57.1.3 of the \TikZ\ manual. For example, |weekday=name| calls |\pgfcalendarweekdayname|. Thus, new macros called |\pgfcalendarmonth|\textcolor{RoyalBlue}{\meta{output format}} or |\pgfcalendarweekday|\textcolor{RoyalBlue}{\meta{output format}} will provide additional \meta{output format}s for |month| and |weekday|, respectively.
917 %
918 % A weekday output format called |letter|, which displays a weekday as single letter, might be implemented as follows:
919 % \par\bigskip\noindent
920 % \begin{texcode}
921 % \def\pgfcalendarweekdayletter#1{%
922 % \ifcase#1M\or T\or W\or T\or F\or S\or S\fi%
923 % }
924 %
925 % \begin{ganttchart}[
926 % hgrid,
927 % vgrid,
928 % x unit=18mm,
929 % time slot format=little-endian
930 % ]{7.1.2013}{13.1.2013}
931 % \gantttitlecalendar*{7.1.2013}{13.1.2013}{
932 % month, month=name, month=shortname, weekday,
933 % weekday=name, weekday=shortname, weekday=letter
934 % }
935 % \end{ganttchart}
936 % \end{texcode}
937 % \begin{center}
938 % \def\pgfcalendarweekdayletter#1{%
939 % \ifcase#1M\or T\or W\or T\or F\or S\or S\fi%
940 % }
941 %
942 % \begin{ganttchart}[
943 % hgrid,
944 % vgrid,
945 % x unit=18mm,
946 % time slot format=little-endian
947 % ]{7.1.2013}{13.1.2013}
948 % \gantttitlecalendar*{7.1.2013}{13.1.2013}{
949 % month, month=name, month=shortname, weekday,
950 % weekday=name, weekday=shortname, weekday=letter
951 % }
952 % \end{ganttchart}
953 % \end{center}
954 %
955 % \begin{key}{calendar week text}{\meta{format}}{Week\string~\string\currentweek}
956 % Changes the text displayed in a week title element. In \meta{format}, four additional macros are available: \DescribeMacro{\currentweek}|\currentweek| is the current week number; \DescribeMacro{\startyear}|\startyear|, \DescribeMacro{\startmonth}|\startmonth| and \DescribeMacro{\startday}|\startday| expand to the year, month and day of the current week's Monday.
957 % \par\bigskip\noindent
958 % \begin{texcode}
959 % \ganttset{%
960 % calendar week text={%
961 % \pgfcalendarmonthshortname{\startmonth}~\startday, \startyear%
962 % }%
963 % }
964 % \begin{ganttchart}[
965 % hgrid,
966 % vgrid,
967 % x unit=4mm,
968 % time slot format=isodate
969 % ]{2012-12-24}{2013-01-20}
970 % \gantttitlecalendar{year, week, day} \\
971 % \ganttbar{}{2013-01-10}{2013-01-17}
972 % \end{ganttchart}
973 % \end{texcode}
974 % \begin{center}
975 % \ganttset{%
976 % calendar week text={%
977 % \pgfcalendarmonthshortname{\startmonth}~\startday, \startyear%
978 % }%
979 % }
980 % \begin{ganttchart}[
981 % hgrid,
982 % vgrid,
983 % x unit=4mm,
984 % time slot format=isodate
985 % ]{2012-12-24}{2013-01-20}
986 % \gantttitlecalendar{year, week, day} \\
987 % \ganttbar{}{2013-01-10}{2013-01-17}
988 % \end{ganttchart}
989 % \end{center}
990 % \end{key}
991 %
992 % \begin{key}{time slot unit}{\texttt{day}\space\textbar\space\texttt{month}\space\textbar\space\texttt{year}}{day}
993 % By default, one \textit{calendar day} is one time slot wide. With \opt{time slot unit}\texttt{=month}, one \textit{month} corresponds to one time slot. Consequently, in such calendars only |year| and |month| are sensible line types for |\gantttitlecalendar|, and the time slot format \texttt{isodate-yearmonth} is especially suited.
994 % \par\bigskip\noindent
995 % \begin{texcode}
996 % \begin{ganttchart}[
997 % hgrid,
998 % vgrid,
999 % time slot format=isodate-yearmonth,
1000 % time slot unit=month
1001 % ]{2012-03}{2014-1}
1002 % \gantttitlecalendar{year, month} \\
1003 % \ganttbar{}{2012-05}{2013-01}
1004 % \end{ganttchart}
1005 % \end{texcode}
1006 % \begin{center}
1007 % \begin{ganttchart}[
1008 % hgrid,
1009 % vgrid,
1010 % time slot format=isodate-yearmonth,
1011 % time slot unit=month
1012 % ]{2012-03}{2014-1}
1013 % \gantttitlecalendar{year, month} \\
1014 % \ganttbar{}{2012-05}{2013-01}
1015 % \end{ganttchart}
1016 % \end{center}
1017 %
1018 % With \opt{time slot unit}\texttt{=year}, one \textit{year} corresponds to one time slot. Consequently, in such calendars only |decade| and |year| are sensible line types for |\gantttitlecalendar|, and the time slot format \texttt{isodate-year} is especially suited.
1019 % \par\bigskip\noindent
1020 % \begin{texcode}
1021 % \begin{ganttchart}[
1022 % hgrid,
1023 % vgrid,
1024 % x unit=7.5mm,
1025 % time slot format=isodate-year,
1026 % time slot unit=year
1027 % ]{2007}{2020}
1028 % \gantttitlecalendar{decade, year} \\
1029 % \ganttbar{}{2008}{2018}
1030 % \end{ganttchart}
1031 % \end{texcode}
1032 % \begin{center}
1033 % \begin{ganttchart}[
1034 % hgrid,
1035 % vgrid,
1036 % x unit=7.5mm,
1037 % time slot format=isodate-year,
1038 % time slot unit=year
1039 % ]{2007}{2020}
1040 % \gantttitlecalendar{decade, year} \\
1041 % \ganttbar{}{2008}{2018}
1042 % \end{ganttchart}
1043 % \end{center}
1044 % \end{key}
1045 %
1046 %
1047 % \begin{key}[/.style=]{title}{\meta{style}}{shape=rectangle, inner sep=0pt, draw, fill=white}
1048 % Sets the appearance of a title element.
1049 % \par\bigskip\noindent
1050 % \begin{texcode}
1051 % \usetikzlibrary{shadows}
1052 % \usetikzlibrary{shadings}
1053 % `$\cdots$'
1054 % \begin{ganttchart}[
1055 % vgrid,
1056 % canvas/.style={draw=none},
1057 % title/.append style=%
1058 % {fill=blue!20, rounded corners=2mm, drop shadow}
1059 % ]{1}{7}
1060 % \gantttitle{First week}{7} \\
1061 % \gantttitlelist[
1062 % title/.style={draw=none, inner color=red}
1063 % ]{1,...,7}{1} \\
1064 % \ganttbar{}{1}{2}
1065 % \ganttbar{}{4}{7}
1066 % \end{ganttchart}
1067 % \end{texcode}
1068 % \begin{center}
1069 % \begin{ganttchart}[
1070 % vgrid,
1071 % canvas/.style={draw=none},
1072 % title/.append style=%
1073 % {fill=blue!20, rounded corners=2mm, drop shadow}
1074 % ]{1}{7}
1075 % \gantttitle{First week}{7} \\
1076 % \gantttitlelist[
1077 % title/.style={draw=none, inner color=red}
1078 % ]{1,...,7}{1} \\
1079 % \ganttbar{}{1}{2}
1080 % \ganttbar{}{4}{7}
1081 % \end{ganttchart}
1082 % \end{center}
1083 % \end{key}
1084 %
1085 % \begin{key}{title label font}{\meta{font commands}}{\string\small}
1086 % \keyline[/.style=]{title label node}{\meta{options}}{anchor=center, font=\string\ganttvalueof\{title label font\}}
1087 % \keyline{title label text}{\meta{text}}{\string\strut\#1}
1088 % The \meta{font commands} and \meta{options} are applied to the title label node, which is positioned at the center of each title element. \meta{text} should contain a single parameter token (|#1|), which is replaced by the first mandatory argument of |\gantttitle|. The |\strut| in the standard value ensures equal vertical spacing of the labels.
1089 % \par\bigskip\noindent
1090 % \begin{texcode}
1091 % \begin{ganttchart}[
1092 % vgrid,
1093 % hgrid,
1094 % title label font=\LARGE\color{violet},
1095 % title label node/.append style={anchor=west},
1096 % title label text=<#1>
1097 % ]{1}{6}
1098 % \gantttitle{2011}{6} \\
1099 % \ganttbar{}{1}{2}
1100 % \ganttbar{}{4}{6}
1101 % \end{ganttchart}
1102 % \end{texcode}
1103 % \begin{center}
1104 % \begin{ganttchart}[
1105 % vgrid,
1106 % hgrid,
1107 % title label font=\LARGE\color{violet},
1108 % title label node/.append style={anchor=west},
1109 % title label text=<#1>
1110 % ]{1}{6}
1111 % \gantttitle{2011}{6} \\
1112 % \ganttbar{}{1}{2}
1113 % \ganttbar{}{4}{6}
1114 % \end{ganttchart}
1115 % \end{center}
1116 % \end{key}
1117 %
1118 % \begin{key}{title left shift}{\meta{factor}}{0}
1119 % \keyline{title right shift}{\meta{factor}}{0}
1120 % \keyline{title top shift}{\meta{factor}}{0}
1121 % \keyline{title height}{\meta{factor}}{0.6}
1122 % The first three keys shift the coordinates of a title element's borders (or rather of its corners), while \opt{title height} changes its height. By default, the left upper corner of a title element coincides with the origin of the start time slot; its right lower corner touches the right border of the end time slot 0.6~units below the upper line border:
1123 %
1124 % \begin{center}
1125 % \begin{tikzpicture}[x=.5cm, y=1cm]
1126 % \begin{ganttchart}[vgrid, hgrid]{1}{6}
1127 % \gantttitle{2011}{6} \\
1128 % \ganttbar{}{1}{2}
1129 % \ganttbar{}{4}{6}
1130 % \end{ganttchart}
1131 % \small
1132 % \draw[blue, line width=1.5pt, dashed] (0,0) rectangle (1,-1);
1133 % \draw[teal, line width=1.5pt, dashed] (5,0) rectangle (6,-1);
1134 % \fill[red] (0,0) circle (1.5pt) node[above left] {start: $(0, 0)$};
1135 % \fill[black!75] (6,-1) circle (1.5pt) node[below right] {$(6, 1)$};
1136 % \fill[red] (6,-0.6) circle (1.5pt) node[right] {$(6, 0+0.6)$: stop};
1137 % \draw[-latex,blue] (.2,.6) node[above=-4pt] {Start time slot (1)} -- (.5,-.5);
1138 % \draw[-latex,teal] (6.2,.1) node[above=-4pt] {End time slot (6)} -- (5.5,-.5);
1139 % \end{tikzpicture}
1140 % \end{center}
1141 % The figure below shows a Gantt chart with two lines and one (large) time slot and indicates the distances modified by these keys.
1142 % \begin{center}
1143 % \begin{tikzpicture}[x=7cm, y=2cm]
1144 % \begin{ganttchart}[x unit=7cm, y unit title=2cm, title/.append style={line width=1.5pt,fill=yellow!10},title left shift=.2,title right shift=-.3,title top shift=.25, title height=.5]{1}{1}
1145 % \gantttitle{}{1} \\
1146 % \end{ganttchart}
1147 % \small
1148 % \draw[densely dashed] (0,-1) -- (1,-1);
1149 % \draw[dashed,cyan,line width=1pt] (0,0) rectangle (1,-.6);
1150 % \draw[cyan,-latex] (.8,.5) node[right,align=left] {Title element\\with standard values} -- (.75,0);
1151 % \fill (0,0) circle (1.5pt) node[left] {$(0,0)$};
1152 % \fill (0,-1) circle (1.5pt) node[left] {$(0,1)$};
1153 % \fill (1,0) circle (1.5pt) node[right] {$(1,0)$};
1154 % \fill (1,-1) circle (1.5pt) node[right] {$(1,1)$};
1155 % \draw[-latex,line width=1pt,blue]
1156 % (0, -.5) node[align=right,left] {\texttt{title left shift}\\(here: \texttt{0.2})} -- (.2,-.5);
1157 % \draw[latex-,line width=1pt,blue]
1158 % (.7, -.5) -- (1,-.5) node[align=left,right] {\texttt{title right shift}\\(here: \texttt{-0.3})};
1159 % \draw[-latex,line width=1pt,red]
1160 % (.45, 0) node[align=left,above] {\texttt{title top shift}\\(here: \texttt{0.25})} -- (.45,-.25);
1161 % \draw[-latex,line width=1pt,red]
1162 % (.6, -.25) -- (.6,-.75) node[align=left,below] {\texttt{title height}\\(here: \texttt{0.5})};
1163 % \end{tikzpicture}
1164 % \end{center}
1165 % For example, you might devise a layout where the title element does not touch the borders of the start and end time slot.
1166 % \par\bigskip\noindent
1167 % \begin{texcode}
1168 % \begin{ganttchart}[
1169 % vgrid,
1170 % title/.style={fill=teal, draw=none},
1171 % title label font=\color{white}\bfseries,
1172 % title left shift=.1,
1173 % title right shift=-.1,
1174 % title top shift=.05,
1175 % title height=.75
1176 % ]{1}{7}
1177 % \gantttitle{Title}{7} \\
1178 % \ganttbar{}{1}{2}
1179 % \ganttbar{}{4}{7}
1180 % \end{ganttchart}
1181 % \end{texcode}
1182 % \begin{center}
1183 % \begin{ganttchart}[
1184 % vgrid,
1185 % title/.style={fill=teal, draw=none},
1186 % title label font=\color{white}\bfseries,
1187 % title left shift=.1,
1188 % title right shift=-.1,
1189 % title top shift=.05,
1190 % title height=.75
1191 % ]{1}{7}
1192 % \gantttitle{Title}{7} \\
1193 % \ganttbar{}{1}{2}
1194 % \ganttbar{}{4}{7}
1195 % \end{ganttchart}
1196 % \end{center}
1197 % \end{key}
1198 %
1199 % \begin{key}{include title in canvas}{\meta{boolean}}{true}
1200 % The canvas normally comprises all lines of the chart. However, you may wish that your title elements only consist of text lacking any frame or background. In this case, the canvas probably should exclude all lines containing title elements, which you achieve by \opt{include title in canvas}|=false|.
1201 % \par\bigskip\noindent
1202 % \begin{texcode}
1203 % \begin{ganttchart}[
1204 % hgrid={*1{draw=red, thick}},
1205 % vgrid,
1206 % y unit title=.5cm,
1207 % title/.style={draw=none, fill=none},
1208 % include title in canvas=false
1209 % ]{1}{7}
1210 % \gantttitlelist{1,...,7}{1} \\
1211 % \ganttbar{}{1}{3} \\
1212 % \ganttbar{}{4}{7}
1213 % \end{ganttchart}
1214 % \end{texcode}
1215 % \begin{center}
1216 % \begin{ganttchart}[
1217 % hgrid={*1{draw=red, thick}},
1218 % vgrid,
1219 % y unit title=.5cm,
1220 % title/.style={draw=none, fill=none},
1221 % include title in canvas=false
1222 % ]{1}{7}
1223 % \gantttitlelist{1,...,7}{1} \\
1224 % \ganttbar{}{1}{3} \\
1225 % \ganttbar{}{4}{7}
1226 % \end{ganttchart}
1227 % \end{center}
1228 % \end{key}
1229 %
1230 %
1231 % \subsection{Vertical rules}
1232 %
1233 % A \textit{vertical rule} indicates an important date like a deadline. Such rules represent a generalization of the today rule and are drawn by the \DescribeMacro{\ganttvrule}|\ganttvrule| macro:
1234 % \begin{texcode}
1235 % \ganttvrule`\oarg{options}\marg{label}\marg{tss}'
1236 % \end{texcode}
1237 % This macro draws a \meta{label}ed vertical rule at the given \meta{tss}.
1238 %
1239 % \begin{key}{vrule offset}{\meta{number}}{1}
1240 % \keyline[/.style=]{vrule}{\meta{style}}{dashed, line width=1pt}
1241 % \keyline{vrule label font}{\meta{font commands}}{\string\normalfont}
1242 % \keyline[/.style=]{vrule label node}{\meta{style}}{anchor=north, font=\string\ganttvalueof\{vrule label font\}}
1243 % \opt{vrule offset} determines the exact $y$-coordinate in the time slot and should lie between 0.0 (left border) and 1.0 (right border). The vertical rule appears in the \meta{style} denoted by \opt{vrule}. The label is formatted by \opt{vrule label font} and \opt{vrule label node}.
1244 % \par\bigskip\noindent
1245 % \begin{texcode}
1246 % \begin{ganttchart}[
1247 % vgrid,
1248 % hgrid,
1249 % vrule/.style={very thick, blue},
1250 % vrule label font=\bfseries
1251 % ]{1}{8}
1252 % \gantttitle{2018}{8} \\
1253 % \ganttbar{}{1}{2} \\
1254 % \ganttbar{}{4}{8}
1255 % \ganttvrule{day x}{2}
1256 % \ganttvrule[
1257 % vrule/.append style={red, thin},
1258 % vrule offset=.2,
1259 % vrule label node/.append style={anchor=north west}
1260 % ]{day z}{6}
1261 % \end{ganttchart}
1262 % \end{texcode}
1263 % \begin{center}
1264 % \begin{ganttchart}[
1265 % vgrid,
1266 % hgrid,
1267 % vrule/.style={very thick, blue},
1268 % vrule label font=\bfseries
1269 % ]{1}{8}
1270 % \gantttitle{2018}{8} \\
1271 % \ganttbar{}{1}{2} \\
1272 % \ganttbar{}{4}{8}
1273 % \ganttvrule{day x}{2}
1274 % \ganttvrule[
1275 % vrule/.append style={red, thin},
1276 % vrule offset=.2,
1277 % vrule label node/.append style={anchor=north west}
1278 % ]{day z}{6}
1279 % \end{ganttchart}
1280 % \end{center}
1281 % \end{key}
1282 %
1283 %
1284 % \subsection{Predefined Chart Elements}
1285 %
1286 % \pack{pgfgantt} predefines three chart elements:
1287 % \begin{enumerate}
1288 % \item \DescribeMacro{\ganttbar}\textit{Bars} indicate the duration of a task or one of its parts.
1289 % \begin{texcode}
1290 % \ganttbar`\oarg{options}\marg{label}\marg{start tss}\marg{end tss}'
1291 % \end{texcode}
1292 % \item \DescribeMacro{\ganttgroup}\textit{Groups} combine several subtasks (represented by bars) into a single task.
1293 % \begin{texcode}
1294 % \ganttgroup`\oarg{options}\marg{label}\marg{start tss}\marg{end tss}'
1295 % \end{texcode}
1296 % \item \DescribeMacro{\ganttmilestone}\textit{Milestones} signify that an important task has been completed or that a crucial goal has been reached.
1297 % \begin{texcode}
1298 % \ganttmilestone`\oarg{options}\marg{label}\marg{tss}'
1299 % \end{texcode}
1300 % \end{enumerate}
1301 % Each of these macros draws a \meta{label}ed chart element from the \meta{start tss} to the \meta{end tss} (or at the given \meta{tss} in case of |\ganttmilestone|).
1302 %
1303 % \par\bigskip\noindent
1304 % \begin{texcode}
1305 % \begin{ganttchart}[vgrid, hgrid]{1}{12}
1306 % \gantttitle{Title}{12} \\
1307 % \ganttgroup{Group 1}{1}{10} \\
1308 % \ganttbar{Task 1}{1}{3} \\
1309 % \ganttbar{Task 2}{4}{10} \\
1310 % \ganttmilestone{Milestone 1}{11}
1311 % \end{ganttchart}
1312 % \end{texcode}
1313 % \begin{center}
1314 % \begin{ganttchart}[vgrid, hgrid]{1}{12}
1315 % \gantttitle{Title}{12} \\
1316 % \ganttgroup{Group 1}{1}{10} \\
1317 % \ganttbar{Task 1}{1}{3} \\
1318 % \ganttbar{Task 2}{4}{10} \\
1319 % \ganttmilestone{Milestone 1}{11}
1320 % \end{ganttchart}
1321 % \end{center}
1322 %
1323 % For \DescribeMacro{\ganttlinkedbar}each predefined chart element, there is also a macro that additionally draws a link \DescribeMacro{\ganttlinkedgroup}from the previous element. Otherwise, these macros work exactly like the standard \DescribeMacro{\ganttlinkedmilestone}versions:
1324 % \begin{texcode}
1325 % \ganttlinkedbar`\oarg{options}\marg{label}\marg{start tss}\marg{end tss}'
1326 % \ganttlinkedgroup`\oarg{options}\marg{label}\marg{start tss}\marg{end tss}'
1327 % \ganttlinkedmilestone`\oarg{options}\marg{label}\marg{tss}'
1328 % \end{texcode}
1329 % In the following example, the code on the left is equivalent to the code on the right.
1330 % \par\bigskip\noindent
1331 % \begin{minipage}[t]{.49\textwidth}
1332 % \begin{texcode}
1333 % % Short version
1334 %
1335 % \begin{ganttchart}[
1336 % vgrid,
1337 % hgrid
1338 % ]{1}{12}
1339 % \gantttitle{Title}{12} \\
1340 % \ganttbar{Task 1}{1}{4} \\
1341 % \ganttlinkedbar{Task 2}{5}{6} \\
1342 % \ganttlinkedmilestone{M 1}{6} \\
1343 % \ganttlinkedbar{Task 3}{7}{11}
1344 % \end{ganttchart}
1345 % \end{texcode}
1346 % \end{minipage}\hfill
1347 % \begin{minipage}[t]{.47\textwidth}
1348 % \begin{texcode}
1349 % % Long version
1350 %
1351 % \begin{ganttchart}[
1352 % vgrid,
1353 % hgrid
1354 % ]{1}{12}
1355 % \gantttitle{Title}{12} \\
1356 % \ganttbar{Task 1}{1}{4} \\
1357 % \ganttbar{Task 2}{5}{6} \\
1358 % \ganttmilestone{M 1}{6} \\
1359 % \ganttbar{Task 3}{7}{11}
1360 % \ganttlink{elem0}{elem1}
1361 % \ganttlink{elem1}{elem2}
1362 % \ganttlink{elem2}{elem3}
1363 % \end{ganttchart}
1364 % \end{texcode}
1365 % \end{minipage}
1366 %
1367 % \begin{center}
1368 % \begin{ganttchart}[
1369 % vgrid,
1370 % hgrid
1371 % ]{1}{12}
1372 % \gantttitle{Title}{12} \\
1373 % \ganttbar{Task 1}{1}{4} \\
1374 % \ganttlinkedbar{Task 2}{5}{6} \\
1375 % \ganttlinkedmilestone{M 1}{6} \\
1376 % \ganttlinkedbar{Task 3}{7}{11}
1377 % \end{ganttchart}
1378 % \end{center}
1379 %
1380 % \begin{key}{chart element start border}{\texttt{left}\space\textbar\space\texttt{right}}{left}
1381 % Determines which border of the start time slot a chart element touches. \texttt{left} is the behavior usually expected, while \texttt{right} strictly interprets the start time slot as an $x$-coordinate.
1382 % \par\bigskip\noindent
1383 % \begin{texcode}
1384 % \begin{ganttchart}[vgrid, hgrid, chart element start border=right]{1}{12}
1385 % \gantttitle{Title}{12} \\
1386 % \ganttgroup{Group 1}{0}{10} \\
1387 % \ganttbar{Task 1}{0}{3} \\
1388 % \ganttbar{Task 2}{3}{10} \\
1389 % \ganttmilestone{Milestone 1}{11}
1390 % \end{ganttchart}
1391 % \end{texcode}
1392 % \begin{center}
1393 % \begin{ganttchart}[vgrid, hgrid, chart element start border=right]{1}{12}
1394 % \gantttitle{Title}{12} \\
1395 % \ganttgroup{Group 1}{0}{10} \\
1396 % \ganttbar{Task 1}{0}{3} \\
1397 % \ganttbar{Task 2}{3}{10} \\
1398 % \ganttmilestone{Milestone 1}{11}
1399 % \end{ganttchart}
1400 % \end{center}
1401 % \end{key}
1402 %
1403 %
1404 % \subsubsection{Options: Chart Element Appearance}
1405 %
1406 % The following options are similar for all predefined (and user-defined) chart elements:
1407 %
1408 % \begin{key}[/.style=]{bar}{\meta{style}}{shape=ganttbar, inner sep=0pt, draw, fill=white}
1409 % \keyline[/.style=]{group}{\meta{style}}{shape=ganttgroup, inner sep=0pt, fill=black}
1410 % \keyline[/.style=]{milestone}{\meta{style}}{shape=ganttmilestone, inner sep=0pt, draw, fill=black}
1411 % Determines the appearance of the chart element. The shapes \texttt{ganttbar}, \texttt{ganttgroup} and \texttt{ganttmilestone} are described below.
1412 % \par\bigskip\noindent
1413 % \begin{texcode}
1414 % \begin{ganttchart}[
1415 % vgrid,
1416 % hgrid,
1417 % bar/.append style={fill=red!50},
1418 % group/.append style={draw=black, fill=green!50},
1419 % milestone/.append style={fill=orange, rounded corners=3pt}
1420 % ]{1}{12}
1421 % \gantttitle{Title}{12} \\
1422 % \ganttgroup{Group 1}{1}{10} \\
1423 % \ganttbar{Task 1}{1}{3} \\
1424 % \ganttbar[
1425 % bar/.append style={shape=ellipse, fill=yellow, dashed}
1426 % ]{Task 2}{4}{10} \\
1427 % \ganttmilestone{Milestone 1}{11}
1428 % \end{ganttchart}
1429 % \end{texcode}
1430 % \begin{center}
1431 % \begin{ganttchart}[
1432 % vgrid,
1433 % hgrid,
1434 % bar/.append style={fill=red!50},
1435 % group/.append style={draw=black, fill=green!50},
1436 % milestone/.append style={fill=orange, rounded corners=3pt}
1437 % ]{1}{12}
1438 % \gantttitle{Title}{12} \\
1439 % \ganttgroup{Group 1}{1}{10} \\
1440 % \ganttbar{Task 1}{1}{3} \\
1441 % \ganttbar[
1442 % bar/.append style={shape=ellipse, fill=yellow, dashed}
1443 % ]{Task 2}{4}{10} \\
1444 % \ganttmilestone{Milestone 1}{11}
1445 % \end{ganttchart}
1446 % \end{center}
1447 % \end{key}
1448 %
1449 %
1450 % \subsubsection{Options: Label Formatting}
1451 %
1452 % \begin{key}{bar label text}{\meta{text}}{\string\strut\#1}
1453 % \keyline{group label text}{\meta{text}}{\string\strut\#1}
1454 % \keyline{milestone label text}{\meta{text}}{\string\strut\#1}
1455 % \keyline{bar label font}{\meta{font commands}}{\string\normalsize}
1456 % \keyline{group label font}{\meta{font commands}}{\string\bfseries}
1457 % \keyline{milestone label font}{\meta{font commands}}{\string\itshape}
1458 % \keyline[./style=]{bar label node}{\meta{options}}{anchor=east, font=\string\ganttvalueof\{bar label font\}}
1459 % \keyline[./style=]{group label node}{\meta{options}}{anchor=east, font=\string\ganttvalueof\{group label font\}}
1460 % \keyline[./style=]{milestone label node}{\meta{options}}{anchor=east, font=\string\ganttvalueof\{milestone label font\}}
1461 % The \opt{\dots\ label text} keys configure the label \meta{text} next to each chart element. Each of these keys should contain a single parameter token (|#1|), which is replaced by the first mandatory argument of |\ganttbar| etc. The |\strut| in the standard value ensures equal vertical spacing of the labels. The \meta{font commands} of \opt{\dots\ label font} and the \meta{options} of \opt{\dots\ label node} are applied to the label node at the left border of the chart (see \opt{inline} below).
1462 % \par\bigskip\noindent
1463 % \begin{texcode}
1464 % \begin{ganttchart}[
1465 % vgrid,
1466 % hgrid,
1467 % bar label font=\Large,
1468 % bar label text={--#1$\rightarrow$},
1469 % group label font=\color{orange},
1470 % group label text={+#1+},
1471 % milestone label font=\color{magenta},
1472 % milestone label node/.append style={rotate=30},
1473 % milestone label text={#1 !!!}
1474 % ]{1}{12}
1475 % \gantttitle{Title}{12} \\
1476 % \ganttgroup{Group 1}{1}{10} \\
1477 % \ganttbar{Task 1}{1}{3} \\
1478 % \ganttbar{Task 2}{4}{10} \\
1479 % \ganttmilestone{Milestone 1}{11}
1480 % \end{ganttchart}
1481 % \end{texcode}
1482 % \begin{center}
1483 % \begin{ganttchart}[
1484 % vgrid,
1485 % hgrid,
1486 % bar label font=\Large,
1487 % bar label text={--#1$\rightarrow$},
1488 % group label font=\color{orange},
1489 % group label text={+#1+},
1490 % milestone label font=\color{magenta},
1491 % milestone label node/.append style={rotate=30},
1492 % milestone label text={#1 !!!}
1493 % ]{1}{12}
1494 % \gantttitle{Title}{12} \\
1495 % \ganttgroup{Group 1}{1}{10} \\
1496 % \ganttbar{Task 1}{1}{3} \\
1497 % \ganttbar{Task 2}{4}{10} \\
1498 % \ganttmilestone{Milestone 1}{11}
1499 % \end{ganttchart}
1500 % \end{center}
1501 % \end{key}
1502 %
1503 % \begin{key}{inline}{\meta{boolean}}{false}
1504 % \keyline{bar inline label anchor}{\meta{anchor}}{center}
1505 % \keyline{group inline label anchor}{\meta{anchor}}{center}
1506 % \keyline{milestone inline label anchor}{\meta{anchor}}{center}
1507 % \keyline[/.style=]{bar inline label node}{\meta{options}}{anchor=center, font=\string\ganttvalueof\{bar label font\}}
1508 % \keyline[/.style=]{group inline label node}{\meta{options}}{anchor=south, font=\string\ganttvalueof\{group label font\}}
1509 % \keyline[/.style=]{milestone inline label node}{\meta{options}}{anchor=south, font=\string\ganttvalueof\{milestone label font\}}
1510 % If two or more chart elements appear in a single line, their labels will overlap at the left border of the chart. Thus, you can place the label adjacent to a chart element by setting the boolean key \opt{inline} to |true|. This key instructs the package to draw the label node at the \opt{\dots\ inline label anchor} of the respective chart element and apply the \meta{options} given by \opt{\dots\ inline label node}.
1511 % \par\bigskip\noindent
1512 % \begin{texcode}
1513 % \begin{ganttchart}[
1514 % vgrid,
1515 % hgrid,
1516 % inline,
1517 % milestone inline label node/.append style={left=5mm}
1518 % ]{1}{12}
1519 % \gantttitle{Title}{12} \\
1520 % \ganttgroup{Group 1}{1}{10} \\
1521 % \ganttbar{Task 1}{1}{3} \\
1522 % \ganttbar{Task 2}{4}{10} \\
1523 % \ganttmilestone{Milestone 1}{11}
1524 % \end{ganttchart}
1525 % \end{texcode}
1526 % \begin{center}
1527 % \begin{ganttchart}[
1528 % vgrid,
1529 % hgrid,
1530 % inline,
1531 % milestone inline label node/.append style={left=5mm}
1532 % ]{1}{12}
1533 % \gantttitle{Title}{12} \\
1534 % \ganttgroup{Group 1}{1}{10} \\
1535 % \ganttbar{Task 1}{1}{3} \\
1536 % \ganttbar{Task 2}{4}{10} \\
1537 % \ganttmilestone{Milestone 1}{11}
1538 % \end{ganttchart}
1539 % \end{center}
1540 % \end{key}
1541 %
1542 %
1543 % \subsubsection{Options: Chart Element Positioning}
1544 %
1545 % \begin{key}{bar left shift}{\meta{factor}}{0}
1546 % \keyline{bar right shift}{\meta{factor}}{0}
1547 % \keyline{bar top shift}{\meta{factor}}{.3}
1548 % \keyline{bar height}{\meta{factor}}{.4}
1549 % \keyline{group left shift}{\meta{factor}}{-.1}
1550 % \keyline{group right shift}{\meta{factor}}{.1}
1551 % \keyline{group top shift}{\meta{factor}}{.4}
1552 % \keyline{group height}{\meta{factor}}{.2}
1553 % \keyline{milestone left shift}{\meta{factor}}{.6}
1554 % \keyline{milestone right shift}{\meta{factor}}{.4}
1555 % \keyline{milestone top shift}{\meta{factor}}{.3}
1556 % \keyline{milestone height}{\meta{factor}}{.4}
1557 % Shift the coordinates of a chart element's borders (\opt{\dots\ shift}) and change its height (\opt{\dots\ height}).
1558 %
1559 % \begin{center}
1560 % \begin{tikzpicture}[x=.5cm, y=1cm]
1561 % \begin{ganttchart}[vgrid, hgrid]{1}{8}
1562 % \gantttitle{Title}{8} \\
1563 % \ganttbar{}{2}{7} \\ \\
1564 % \ganttgroup{}{2}{6} \\ \\
1565 % \ganttmilestone{}{4}
1566 % \end{ganttchart}
1567 % \small
1568 % \draw[blue, line width=1.5pt, dashed] (1,-1) rectangle (2,-2);
1569 % \draw[blue, line width=1.5pt, dashed] (1,-3) rectangle (2,-4);
1570 % \draw[blue!50!teal, line width=1.5pt, dashed] (3,-5) rectangle (4,-6);
1571 % \draw[teal, line width=1.5pt, dashed] (6,-1) rectangle (7,-2);
1572 % \draw[teal, line width=1.5pt, dashed] (5,-3) rectangle (6,-4);
1573 % \fill[black!75] (1,-1) circle (1.5pt) node[above left] {$(1, 1)$};
1574 % \fill[black!75] (7,-2) circle (1.5pt) node[below right] {$(7, 2)$};
1575 % \fill[black!75] (1,-3) circle (1.5pt) node[above left] {$(1, 3)$};
1576 % \fill[black!75] (6,-4) circle (1.5pt) node[below right] {$(6, 4)$};
1577 % \fill[black!75] (3,-5) circle (1.5pt) node[above left] {$(3, 5)$};
1578 % \fill[black!75] (4,-6) circle (1.5pt) node[below right] {$(4, 6)$};
1579 % \fill[red] (1,-1.3) circle (1.5pt) node[left] {start: $(1+0, 1+0.3)$};
1580 % \fill[red] (7,-1.7) circle (1.5pt) node[right] {$(7+0, 1+0.3+0.4)$: stop};
1581 % \fill[red] (.9,-3.4) circle (1.5pt) node[left] {start: $(1-0.1, 3+0.4)$};
1582 % \fill[red] (6.1,-3.6) circle (1.5pt) node[right] {$(6+0.1, 3+0.4+0.2)$: stop};
1583 % \fill[red] (3.6,-5.3) circle (1.5pt) node[left] {start: $(3+0.6, 5+0.3)$};
1584 % \fill[red] (4.4,-5.7) circle (1.5pt) node[right] {$(4+0.4, 5+0.3+0.4)$: stop};
1585 % \draw[-latex,blue] (.2,.2) node[above=-4pt] {Start time slot (2)} -- (1.5,-1.3);
1586 % \draw[-latex,blue] (-3,-4) node[below=-4pt] {Start time slot (2)} -- (1,-3.8);
1587 % \draw[-latex,blue!50!teal] (-.5,-5.9) node[left] {Time slot (4)} -- (3,-5.8);
1588 % \draw[-latex,teal] (7.2,.1) node[above=-4pt] {End time slot (7)} -- (6.5,-1.3);
1589 % \draw[-latex,teal] (8,-4.2) node[right] {End time slot (6)} -- (6,-3.8);
1590 % \end{tikzpicture}
1591 % \end{center}
1592 %
1593 % The three following figures illustrate the distances modified by these keys. The first figure shows a Gantt chart with a bar, two lines and one time slot.
1594 % \begin{center}
1595 % \begin{tikzpicture}[x=8cm, y=2cm]
1596 % \begin{ganttchart}[
1597 % x unit=8cm,
1598 % y unit chart=2cm,
1599 % bar left shift=.2,
1600 % bar right shift=-.3,
1601 % bar top shift=.25,
1602 % bar height=.5,
1603 % bar/.append style={line width=1.5pt, fill=yellow!10}
1604 % ]{1}{1}
1605 % \ganttbar[]{}{1}{1} \\
1606 % \end{ganttchart}
1607 % \small
1608 % \draw[densely dashed] (0,-1) -- (1,-1);
1609 % \draw[dashed,cyan,line width=1pt] (0,-.3) rectangle (1,-.7);
1610 % \draw[cyan,-latex] (.8,.5) node[right,align=left] {Bar with standard values} -- (.75,-.3);
1611 % \fill (0,0) circle (1.5pt) node[left] {$(0,0)$};
1612 % \fill (0,-1) circle (1.5pt) node[left] {$(0,1)$};
1613 % \fill (1,0) circle (1.5pt) node[right] {$(1,0)$};
1614 % \fill (1,-1) circle (1.5pt) node[right] {$(1,1)$};
1615 % \draw[-latex,line width=1pt,blue]
1616 % (0, -.5) node[align=right,left] {\texttt{bar left shift}\\(here: \texttt{0.2})} -- (.2,-.5);
1617 % \draw[latex-,line width=1pt,blue]
1618 % (.7, -.5) -- (1,-.5) node[align=left,right] {\texttt{bar right shift}\\(here: \texttt{-0.3})};
1619 % \draw[-latex,line width=1pt,red]
1620 % (.45, 0) node[align=left,above] {\texttt{bar top shift}\\(here: \texttt{0.25})} -- (.45,-.25);
1621 % \draw[-latex,line width=1pt,red]
1622 % (.6, -.25) -- (.6,-.75) node[align=left,below] {\texttt{bar height}\\(here: \texttt{0.5})};
1623 % \end{tikzpicture}
1624 % \end{center}
1625 % The second one shows a Gantt chart with a group, two lines and one time slot.
1626 % \begin{center}
1627 % \begin{tikzpicture}[x=7cm, y=2cm]
1628 % \begin{ganttchart}[
1629 % x unit=7cm,
1630 % y unit chart=2cm,
1631 % group left shift=.2,
1632 % group right shift=-.3,
1633 % group top shift=.25,
1634 % group height=.3,
1635 % group peaks width=.1,
1636 % group peaks height=.2,
1637 % group/.append style={draw=black, line width=1.5pt, fill=yellow!10}
1638 % ]{1}{1}
1639 % \ganttgroup{}{1}{1} \\
1640 % \end{ganttchart}
1641 % \small
1642 % \draw[densely dashed] (0,-1) -- (1,-1);
1643 % \draw[dashed,cyan,line width=1pt] (-.1,-.4) rectangle (1.1,-.6);
1644 % \draw[cyan,-latex] (.8,.5) node[right,align=left] {Group with standard values\\(without peaks)} -- (.75,-.4);
1645 % \fill (0,0) circle (1.5pt) node[left] {$(0,0)$};
1646 % \fill (0,-1) circle (1.5pt) node[left] {$(0,1)$};
1647 % \fill (1,0) circle (1.5pt) node[right] {$(1,0)$};
1648 % \fill (1,-1) circle (1.5pt) node[right] {$(1,1)$};
1649 % \draw[-latex,line width=1pt,blue]
1650 % (0, -.5) node[align=right,left] {\texttt{group left shift}\\(here: \texttt{0.2})} -- (.2,-.5);
1651 % \draw[latex-,line width=1pt,blue]
1652 % (.7, -.5) -- (1,-.5) node[align=left,right] {\texttt{group right shift}\\(here: \texttt{-0.3})};
1653 % \draw[-latex,line width=1pt,red]
1654 % (.45, 0) node[align=left,above] {\texttt{group top shift}\\(here: \texttt{0.25})} -- (.45,-.25);
1655 % \draw[-latex,line width=1pt,red]
1656 % (.55, -.25) -- (.55,-.55) node[align=left,below left=0pt and -10pt] {\texttt{group height}\\(here: \texttt{0.3})};
1657 % \end{tikzpicture}
1658 % \end{center}
1659 % The third one shows a Gantt chart with a milestone, two lines and two time slots.
1660 % \begin{center}
1661 % \begin{tikzpicture}[x=4cm, y=2cm]
1662 % \begin{ganttchart}[
1663 % x unit=4cm,
1664 % y unit chart=2cm,
1665 % milestone left shift=.2,
1666 % milestone right shift=-.4,
1667 % milestone top shift=.15,
1668 % milestone height=.7,
1669 % milestone/.append style={draw=black, line width=1.5pt, fill=yellow!10}
1670 % ]{1}{2}
1671 % \ganttmilestone{}{1} \\
1672 % \end{ganttchart}
1673 % \small
1674 % \draw [densely dashed] (0,-1) -- (2,-1);
1675 % \draw [densely dashed] (1,0) -- (1,-2);
1676 % \draw [dashed, cyan, line width=1pt] (1,-.3) -- (1.4, -0.5) -- (1, -0.7) -- (0.6, -0.5) --cycle;
1677 % \draw [cyan,-latex] (1.2,.3)
1678 % node [above left=0pt and -5pt] {Milestone with standard values}
1679 % -- (1.25,-.4);
1680 % \draw [dashdotted] (.2, -.15) -- (1.5, -.15);
1681 % \fill (0,0) circle (1.5pt) node[left] {$(0,0)$};
1682 % \fill (0,-1) circle (1.5pt) node[left] {$(0,1)$};
1683 % \fill (1,0) circle (1.5pt) node[above] {$(1,0)$};
1684 % \fill (1,-1) circle (1.5pt) node[below right] {$(1,1)$};
1685 % \fill (2,0) circle (1.5pt) node[above right] {$(2,0)$};
1686 % \fill (2,-1) circle (1.5pt) node[right] {$(2,1)$};
1687 % \draw [-latex, line width=1pt, blue] (0, -.5)
1688 % node [align=right, left] {\texttt{milestone left shift}\\(here: \texttt{0.2})}
1689 % -- (.2,-.5);
1690 % \draw [latex-, line width=1pt, blue] (0.6, -.5) -- (1,-.5)
1691 % node [align=left, right] {\texttt{milestone right shift}\\(here: \texttt{-0.4})};
1692 % \draw [-latex, line width=1pt, red] (1.5, 0)
1693 % node [align=left, above right=0pt and -5pt] {\texttt{milestone top shift}\\(here: \texttt{0.15})}
1694 % -- (1.5,-.15);
1695 % \draw [-latex, line width=1pt, red] (.4, -.15)
1696 % node [align=right, above] {\texttt{milestone height}\\(here: \texttt{0.7})}
1697 % -- (.4,-.85);
1698 % \end{tikzpicture}
1699 % \end{center}
1700 %
1701 % \begin{key}{group right peak tip position}{\meta{fraction}}{0.5}
1702 % \keyline{group right peak width}{\meta{factor}}{0.4}
1703 % \keyline{group right peak height}{\meta{factor}}{0.1}
1704 % \keyline{group left peak tip position}{\meta{fraction}}{0.5}
1705 % \keyline{group left peak width}{\meta{factor}}{0.4}
1706 % \keyline{group left peak height}{\meta{factor}}{0.1}
1707 % \keyline{group peaks tip position}{\meta{fraction}}{\textrm{(none)}}
1708 % \keyline{group peaks width}{\meta{factor}}{\textrm{(none)}}
1709 % \keyline{group peaks height}{\meta{factor}}{\textrm{(none)}}
1710 % Change the appearance of the peaks at both ends of a group. By default, both the left and right peak are 0.4~units wide and 0.1~units high, their tips lie between the peak sides. The \opt{group peaks \dots} keys set the dimensions for both peaks simultaneously. The figure below exemplifies the keys that apply to the left peak.
1711 %
1712 % \begin{center}
1713 % \begin{tikzpicture}[x=8cm, y=2cm]
1714 % \small
1715 % \draw (0,0) rectangle (1,-1.3);
1716 % \draw [line width=1.5pt, dashed] (.5,-.2) -- (.7,-.2);
1717 % \draw [line width=1.5pt, solid] (.5,-.2) -- (.2,-.2) -- (.2,-.5) -- (.3,-.8) -- (.4,-.5) -- (.5,-.5);
1718 % \draw [line width=1.5pt, dashed] (.5,-.5) -- (.7,-.5);
1719 % \draw [densely dashed] (.2,-.5) -- (.2,-1.3);
1720 % \draw [densely dashed] (.3,-.8) -- (.3,-1.3);
1721 % \draw [densely dashed] (.3,-.8) -- (1,-.8);
1722 % \fill (0,0) circle (1.5pt) node [left] {$(0,0)$};
1723 % \fill (0,-1) circle (1.5pt) node [left] {$(0,1)$};
1724 % \fill (1,0) circle (1.5pt) node [right] {$(1,0)$};
1725 % \fill (1,-1) circle (1.5pt) node [right] {$(1,1)$};
1726 % \draw [-latex, line width=1pt, blue] (.2, -.5)
1727 % node [left] {\texttt{width}}
1728 % -- (.4,-.5);
1729 % \draw [-latex, line width=1pt, teal] (.2, -.9) -- (.3,-.9)
1730 % node [below, align=left] {\texttt{tip position}\\(as fraction of \texttt{width})};
1731 % \draw [-latex, line width=1pt, red] (.5, -.5)
1732 % node [below right] {\texttt{height}} -- (.5,-.8);
1733 % \end{tikzpicture}
1734 % \end{center}
1735 % \end{key}
1736 %
1737 % For example, you might devise the following layout: Bars are small and rounded; they do not touch the borders of their start and end time slots. Groups stay within the start and end time slot, and the peaks are more acute.
1738 % \par\bigskip\noindent
1739 % \begin{texcode}
1740 % \begin{ganttchart}[
1741 % vgrid,
1742 % bar/.append style={fill=red, rounded corners=3pt},
1743 % bar left shift=.15,
1744 % bar right shift=-.15,
1745 % bar top shift=.4,
1746 % bar height=.2,
1747 % group left shift=0,
1748 % group right shift=0,
1749 % group peaks tip position=0,
1750 % group peaks height=.4
1751 % ]{1}{7}
1752 % \gantttitle{Title}{7} \\
1753 % \ganttgroup{Group 1}{1}{7} \\
1754 % \ganttbar{Task 1}{1}{2} \\
1755 % \ganttbar{Task 2}{3}{7}
1756 % \end{ganttchart}
1757 % \end{texcode}
1758 % \begin{center}
1759 % \begin{ganttchart}[
1760 % vgrid,
1761 % bar/.append style={fill=red, rounded corners=3pt},
1762 % bar left shift=.15,
1763 % bar right shift=-.15,
1764 % bar top shift=.4,
1765 % bar height=.2,
1766 % group left shift=0,
1767 % group right shift=0,
1768 % group peaks tip position=0,
1769 % group peaks height=.4
1770 % ]{1}{7}
1771 % \gantttitle{Title}{7} \\
1772 % \ganttgroup{Group 1}{1}{7} \\
1773 % \ganttbar{Task 1}{1}{2} \\
1774 % \ganttbar{Task 2}{3}{7}
1775 % \end{ganttchart}
1776 % \end{center}
1777 % \end{key}
1778 %
1779 %
1780 % \subsubsection{Options: Progress}
1781 %
1782 % The \textit{progress} of a chart element illustrates the extent to which this element has been completed.
1783 %
1784 % \begin{key}{progress}{\texttt{none}\space\textbar\space\texttt{today}\space\textbar\space\meta{number}}{none}
1785 % Indicates that a chart element is \meta{number} percent complete. The value \texttt{none} turns progress calculations off.
1786 % \par\bigskip\noindent
1787 % \begin{texcode}
1788 % \begin{ganttchart}[vgrid, hgrid]{1}{12}
1789 % \gantttitle{Title}{12} \\
1790 % \ganttgroup[progress=45]{Group 1}{1}{12} \\
1791 % \ganttbar[progress=100]{Subtask 1}{1}{3} \\
1792 % \ganttbar[progress=37]{Subtask 2}{4}{8} \\
1793 % \ganttbar[progress=none]{Subtask 3}{9}{12}
1794 % \end{ganttchart}
1795 % \end{texcode}
1796 % \begin{center}
1797 % \begin{ganttchart}[vgrid, hgrid]{1}{12}
1798 % \gantttitle{Title}{12} \\
1799 % \ganttgroup[progress=45]{Group 1}{1}{12} \\
1800 % \ganttbar[progress=100]{Subtask 1}{1}{3} \\
1801 % \ganttbar[progress=37]{Subtask 2}{4}{8} \\
1802 % \ganttbar[progress=none]{Subtask 3}{9}{12}
1803 % \end{ganttchart}
1804 % \end{center}
1805 % The value \texttt{today} instructs \pack{pgfgantt} to calculate progress according to the value of the \opt{today} key. Thus, if the current date $T$ is earlier than the start date $S$ of a chart element, its progress is 0\,\%; if the current date is later than the end date $E$ of a chart element, its progress is 100\,\%; otherwise, its progress $P$ is calculated according to
1806 % \begin{equation}
1807 % P = \frac{T - S}{E - S} \times 100\,\%
1808 % \end{equation}
1809 % \par\noindent
1810 % \begin{texcode}
1811 % \begin{ganttchart}[
1812 % vgrid,
1813 % hgrid,
1814 % time slot format=little-endian,
1815 % progress=today,
1816 % today=4.5.13
1817 % ]{1.5.13}{12.5.13}
1818 % \gantttitle{Title}{12} \\
1819 % \ganttgroup{Group 1}{1.5.13}{12.5.13} \\
1820 % \ganttbar{Subtask 1}{1.5.13}{3.5.13} \\
1821 % \ganttbar{Subtask 2}{4.5.13}{8.5.13} \\
1822 % \ganttbar{Subtask 3}{9.5.13}{12.5.13}
1823 % \end{ganttchart}
1824 % \end{texcode}
1825 % \begin{center}
1826 % \begin{ganttchart}[
1827 % vgrid,
1828 % hgrid,
1829 % time slot format=little-endian,
1830 % progress=today,
1831 % today=4.5.13
1832 % ]{1.5.13}{12.5.13}
1833 % \gantttitle{Title}{12} \\
1834 % \ganttgroup{Group 1}{1.5.13}{12.5.13} \\
1835 % \ganttbar{Subtask 1}{1.5.13}{3.5.13} \\
1836 % \ganttbar{Subtask 2}{4.5.13}{8.5.13} \\
1837 % \ganttbar{Subtask 3}{9.5.13}{12.5.13}
1838 % \end{ganttchart}
1839 % \end{center}
1840 % \end{key}
1841 %
1842 % \begin{key}[/.style=]{bar incomplete}{\meta{style}}{/pgfgantt/bar, fill=black!25}
1843 % \keyline[/.style=]{group incomplete}{\meta{style}}{/pgfgantt/group, fill=black!25}
1844 % \keyline[/.style=]{milestone incomplete}{\meta{style}}{/pgfgantt/milestone, fill=black!25}
1845 % If $P$ is the progress of a chart element, $P\,\%$ of its area (starting from the left) appear in the basic style (i.\,e., \opt{bar}, \opt{group}, \dots), while the remainder is drawn in style \opt{bar incomplete}, \opt{group incomplete} etc.
1846 % \par\bigskip\noindent
1847 % \begin{texcode}
1848 % \begin{ganttchart}[
1849 % vgrid,
1850 % hgrid,
1851 % time slot format=isodate,
1852 % today=2013-04-06,
1853 % progress=today,
1854 % bar/.append style={fill=green},
1855 % bar incomplete/.append style={fill=red},
1856 % group incomplete/.append style={draw=black,fill=none}
1857 % ]{2013-04-01}{2013-04-12}
1858 % \gantttitle{Title}{12} \\
1859 % \ganttgroup{Group 1}{2013-04-01}{2013-04-12} \\
1860 % \ganttbar{Subtask 1}{2013-04-01}{2013-04-03} \\
1861 % \ganttbar{Subtask 2}{2013-04-04}{2013-04-08} \\
1862 % \ganttbar{Subtask 3}{2013-04-09}{2013-04-12}
1863 % \end{ganttchart}
1864 % \end{texcode}
1865 % \begin{center}
1866 % \begin{ganttchart}[
1867 % vgrid,
1868 % hgrid,
1869 % time slot format=isodate,
1870 % today=2013-04-06,
1871 % progress=today,
1872 % bar/.append style={fill=green},
1873 % bar incomplete/.append style={fill=red},
1874 % group incomplete/.append style={draw=black,fill=none}
1875 % ]{2013-04-01}{2013-04-12}
1876 % \gantttitle{Title}{12} \\
1877 % \ganttgroup{Group 1}{2013-04-01}{2013-04-12} \\
1878 % \ganttbar{Subtask 1}{2013-04-01}{2013-04-03} \\
1879 % \ganttbar{Subtask 2}{2013-04-04}{2013-04-08} \\
1880 % \ganttbar{Subtask 3}{2013-04-09}{2013-04-12}
1881 % \end{ganttchart}
1882 % \end{center}
1883 % \end{key}
1884 %
1885 % \begin{key}{progress label text}{\meta{text}}{\string\pgfmathprintnumber[precision=0, verbatim]\{\#1\}\string\% complete}
1886 % \keyline{bar progress label anchor}{\meta{anchor}}{east}
1887 % \keyline{bar progress label font}{\meta{font commands}}{\string\scriptsize}
1888 % \keyline[/.style=]{bar progress label node}{\meta{options}}{anchor=west, font=\string\ganttvalueof\{bar progress label font\}}
1889 % \keyline{group progress label anchor}{\meta{anchor}}{east}
1890 % \keyline{group progress label font}{\meta{font commands}}{\string\scriptsize}
1891 % \keyline[/.style=]{group progress label node}{\meta{options}}{anchor=west, font=\string\ganttvalueof\{group progress label font\}}
1892 % \keyline{milestone progress label anchor}{\meta{anchor}}{center}
1893 % \keyline{milestone progress label font}{\meta{font commands}}{\string\scriptsize}
1894 % \keyline[/.style=]{milestone progress label node}{\meta{options}}{anchor=west, font=\string\ganttvalueof\{milestone progress label font\}}
1895 % The \opt{progress label text} key sets the \meta{text} that appears beside each progress element in order to indicate its completeness. This key may contain a single parameter token (|#1|), which is replaced by the (possibly calculated) value of \opt{progress}. The progress label node is drawn at the \opt{\dots\ progress label anchor} of the respective chart element, with the \meta{font commands} given by \opt{\dots\ progress label font} and the \meta{options} given by \opt{\dots\ progress label node}.
1896 % \par\bigskip\noindent
1897 % \begin{texcode}
1898 % \begin{ganttchart}[
1899 % vgrid,
1900 % hgrid,
1901 % bar/.append style={fill=green},
1902 % bar incomplete/.append style={fill=red},
1903 % progress=today,
1904 % today=6,
1905 % group progress label node/.append style={below=3pt}
1906 % ]{1}{12}
1907 % \gantttitle{Title}{12} \\
1908 % \ganttgroup{Group 1}{1}{10} \\
1909 % \ganttbar[
1910 % bar progress label font=\color{green!25!black}\sffamily
1911 % ]{Subtask 1}{1}{3} \\
1912 % \ganttbar[
1913 % progress label text={$\displaystyle\frac{#1}{100}$}
1914 % ]{Subtask 2}{5}{12}
1915 % \end{ganttchart}
1916 % \end{texcode}
1917 % \begin{center}
1918 % \begin{ganttchart}[
1919 % vgrid,
1920 % hgrid,
1921 % bar/.append style={fill=green},
1922 % bar incomplete/.append style={fill=red},
1923 % progress=today,
1924 % today=6,
1925 % group progress label node/.append style={below=3pt}
1926 % ]{1}{12}
1927 % \gantttitle{Title}{12} \\
1928 % \ganttgroup{Group 1}{1}{10} \\
1929 % \ganttbar[
1930 % bar progress label font=\color{green!25!black}\sffamily
1931 % ]{Subtask 1}{1}{3} \\
1932 % \ganttbar[
1933 % progress label text={$\displaystyle\frac{#1}{100}$}
1934 % ]{Subtask 2}{5}{12}
1935 % \end{ganttchart}
1936 % \end{center}
1937 % \end{key}
1938 %
1939 %
1940 % \subsubsection{New Node Shapes}
1941 % \label{sss:NewNodeShapes}
1942 %
1943 % \pack{pgfgantt} defines three new node shapes:
1944 %
1945 % \bigskip\noindent
1946 % (1) The \texttt{ganttbar} node shape derives from shape \texttt{rectangle} (section~48.2 of the \TikZ\ manual). It provides four additional anchors: \texttt{on top}, \texttt{on bottom}, \texttt{on left} and \texttt{on right}. The \meta{fraction} set by the following keys indicates a position between the left and right (for \texttt{on top} and \texttt{on bottom}) or upper and lower border (for \texttt{on left} and \texttt{on right}), similarly to the \opt{/tikz/pos} key.
1947 %
1948 % \begin{key}{on top fraction}{\meta{fraction}}{0.5}
1949 % \keyline{on bottom fraction}{\meta{fraction}}{0.5}
1950 % \keyline{on left fraction}{\meta{fraction}}{0.5}
1951 % \keyline{on right fraction}{\meta{fraction}}{0.5}
1952 % In the following figures, \opt{on top/bottom fraction} is 0.7, whereas \opt{on left/right fraction} is 0.1.
1953 % \begin{center}
1954 % \begin{tikzpicture}
1955 % \ganttset{
1956 % on top fraction=.7,
1957 % on bottom fraction=.7,
1958 % on left fraction=.1,
1959 % on right fraction=.1
1960 % }
1961 % \node[
1962 % name=s,
1963 % shape=ganttbar,
1964 % color=black!30,
1965 % draw,
1966 % fill=yellow!30,
1967 % line width=.3cm,
1968 % inner xsep=2.5cm,
1969 % inner ysep=0.5cm,
1970 % font=\Huge
1971 % ] {ganttbar\vrule width 1pt height 2cm};
1972 % \foreach \anchor/\placement in
1973 % {north west/above left, north/above, north east/above right,
1974 % west/left, center/above, east/right,
1975 % mid west/right, mid/above, mid east/left,
1976 % base west/left, base/below, base east/right,
1977 % south west/below left, south/below, south east/below right,
1978 % text/below, 10/right, 130/above}
1979 % \draw [shift=(s.\anchor)] plot [mark=x] coordinates{(0, 0)}
1980 % node [\placement] {\scriptsize\texttt{(s.\anchor)}};
1981 % \foreach \anchor/\placement in
1982 % {on top/above, on bottom/below, on left/left, on right/right}
1983 % \draw [color=red,shift=(s.\anchor)] plot [mark=x] coordinates{(0, 0)}
1984 % node [\placement] {\scriptsize\texttt{(s.\anchor)}};
1985 % \end{tikzpicture}
1986 % \end{center}
1987 % \end{key}
1988 %
1989 % \bigskip\noindent
1990 % (2) The \texttt{ganttgroup} node shape also derives from shape \texttt{rectangle}. It provides the additional anchors \texttt{on top}, \texttt{on bottom}, \texttt{on left}, \texttt{on right} (same as above), \texttt{left peak} and \texttt{right peak}.
1991 % \begin{center}
1992 % \begin{tikzpicture}
1993 % \ganttset{
1994 % group peaks tip position=.5,
1995 % group peaks width=4,
1996 % group peaks height=1,
1997 % on top fraction=.7,
1998 % on bottom fraction=.7,
1999 % on left fraction=.1,
2000 % on right fraction=.1
2001 % }
2002 % \node[
2003 % name=s,
2004 % shape=ganttgroup,
2005 % color=black!30,
2006 % draw,
2007 % fill=yellow!30,
2008 % line width=.3cm,
2009 % inner xsep=2.5cm,
2010 % inner ysep=0.5cm,
2011 % font=\Huge
2012 % ] {ganttgroup\vrule width 1pt height 2cm};
2013 % \foreach \anchor/\placement in
2014 % {north west/above left, north/above, north east/above right,
2015 % west/left, center/above, east/right,
2016 % mid west/right, mid/above, mid east/left,
2017 % base west/left, base/below, base east/right,
2018 % south west/below left, south/below, south east/below right,
2019 % text/below, 10/right, 130/above}
2020 % \draw [shift=(s.\anchor)] plot [mark=x] coordinates{(0, 0)}
2021 % node [\placement] {\scriptsize\texttt{(s.\anchor)}};
2022 % \foreach \anchor/\placement in
2023 % {on top/above, on bottom/below, on left/left, on right/right,
2024 % left peak/below, right peak/below}
2025 % \draw [color=red,shift=(s.\anchor)] plot [mark=x] coordinates{(0, 0)}
2026 % node [\placement] {\scriptsize\texttt{(s.\anchor)}};
2027 % \end{tikzpicture}
2028 % \end{center}
2029 %
2030 % \bigskip\noindent
2031 % (3) The \texttt{ganttmilestone} node shape derives from shape \texttt{diamond} (section~48.3 of the \TikZ\ manual), but does not consider any aspect ratio. It provides the additional anchors \texttt{on top}, \texttt{on bottom}, \texttt{on left} and \texttt{on right} (same as above).
2032 % \begin{center}
2033 % \begin{tikzpicture}
2034 % \ganttset{
2035 % on top fraction=.7,
2036 % on bottom fraction=.7,
2037 % on left fraction=.1,
2038 % on right fraction=.1
2039 % }
2040 % \node[
2041 % name=s,
2042 % shape=ganttmilestone,
2043 % color=black!30,
2044 % draw,
2045 % fill=yellow!30,
2046 % line width=.3cm,
2047 % inner sep=0.5cm,
2048 % font=\Huge
2049 % ] {ganttmilestone\vrule width 1pt height 1cm};
2050 % \foreach \anchor/\placement in
2051 % {north west/above left, north/above, north east/above right,
2052 % west/left, center/above, east/right, mid/above, base/below,
2053 % south west/below left, south/below, south east/below right,
2054 % text/left, 10/right, 130/above}
2055 % \draw [shift=(s.\anchor)] plot [mark=x] coordinates{(0, 0)}
2056 % node [\placement] {\scriptsize\texttt{(s.\anchor)}};
2057 % \foreach \anchor/\placement in
2058 % {on top/above, on bottom/below, on left/left, on right/right}
2059 % \draw [color=red,shift=(s.\anchor)] plot [mark=x] coordinates{(0, 0)}
2060 % node [\placement] {\scriptsize\texttt{(s.\anchor)}};
2061 % \end{tikzpicture}
2062 % \end{center}
2063 %
2064 %
2065 % \subsection{Defining Custom Chart Elements}
2066 %
2067 % You may define completely new chart elements with
2068 % \begin{texcode}
2069 % \newganttchartelement`\marg{name}\marg{new default key values}'
2070 % \newganttchartelement*`\marg{name}\marg{new default key values}'
2071 % \end{texcode}
2072 % \DescribeMacro{\newganttchartelement}|\newganttchartelement| (unstarred) defines a new chart element |\gantt|\textcolor{RoyalBlue}{\meta{name}} and the corresponding |\ganttlinked|\textcolor{RoyalBlue}{\meta{name}}. These chart element macros take one optional argument \meta{options} and \textit{three} mandatory arguments \meta{label}, \meta{start tss} and \meta{end tss} (like |\ganttbar|).
2073 %
2074 % Chart element macros defined by the starred form, \DescribeMacro{\newganttchartelement*}|\newganttchartelement*|, take the same single optional argument, but \textit{two} mandatory arguments \meta{label} and \meta{tss} (like |\ganttmilestone|).
2075 %
2076 % For each new chart element, |\newganttchartelement| also introduces a set of nine value-storing keys and five style keys and assigns default values to them:
2077 % \begin{center}
2078 % \begin{tabular}{l >{\ttfamily}l}
2079 % \toprule
2080 % \itshape Key & \rmfamily\itshape Default value \\
2081 % \midrule
2082 % \multicolumn{2}{l}{\bfseries Style keys} \\
2083 % \meta{name} & shape=rectangle, inner sep=0pt, draw, fill=white \\
2084 % \meta{name}\texttt{ incomplete} & /pgfgantt/\textrm{\meta{name}}, fill=black!25 \\
2085 % \meta{name}\texttt{ label node} & anchor=east, font=\string\ganttvalueof\{\textrm{\meta{name}} label font\} \\
2086 % \meta{name}\texttt{ inline label node} & anchor=center, font=\string\ganttvalueof\{\textrm{\meta{name}} label font\} \\
2087 % \meta{name}\texttt{ progress label node} & anchor=west, font=\string\ganttvalueof\{\textrm{\meta{name}} progress label font\} \\
2088 % \midrule
2089 % \multicolumn{2}{l}{\bfseries Value-storing keys} \\
2090 % \meta{name}\texttt{ label font} & \string\normalsize \\
2091 % \meta{name}\texttt{ inline label anchor} & center \\
2092 % \meta{name}\texttt{ progress label anchor} & east \\
2093 % \meta{name}\texttt{ progress label font} & \string\scriptsize \\
2094 % \meta{name}\texttt{ left shift} & 0 \\
2095 % \meta{name}\texttt{ right shift} & 0 \\
2096 % \meta{name}\texttt{ top shift} & .3 \\
2097 % \meta{name}\texttt{ height} & .4 \\
2098 % \meta{name}\texttt{ label text} & \string\strut\#1 \\
2099 % \bottomrule
2100 % \end{tabular}\hspace*{-120pt}
2101 % \end{center}
2102 % Consequently, a new chart element will look like the standard |\ganttbar| unless you introduce some \meta{new default key values}.
2103 %
2104 % Let us define a new chart element called ``foobar'', which is basically a fancy-colored and -shaped bar:
2105 % \par\bigskip\noindent
2106 % \begin{texcode}
2107 % \definecolor{foobarblue}{RGB}{0,153,255}
2108 % \definecolor{foobaryellow}{RGB}{234,187,0}
2109 %
2110 % \newganttchartelement{foobar}{
2111 % foobar/.style={
2112 % shape=rounded rectangle,
2113 % inner sep=0pt,
2114 % draw=foobarblue!50!black,
2115 % very thick,
2116 % top color=white,
2117 % bottom color=foobarblue!50
2118 % },
2119 % foobar incomplete/.style={
2120 % /pgfgantt/foobar,
2121 % draw=foobaryellow,
2122 % bottom color=foobaryellow!50
2123 % },
2124 % foobar label font=\slshape,
2125 % foobar left shift=-.1,
2126 % foobar right shift=.1
2127 % }
2128 %
2129 % \begin{ganttchart}[
2130 % vgrid,
2131 % progress=today,
2132 % progress label text=\relax,
2133 % today=6
2134 % ]{1}{12}
2135 % \gantttitlecalendar{day} \\[grid]
2136 % \ganttfoobar{Foobar 1}{1}{2} \\
2137 % \ganttfoobar{Foobar 2}{3}{7} \\
2138 % \ganttlinkedfoobar{Foobar 3}{9}{12}
2139 % \end{ganttchart}
2140 % \end{texcode}
2141 % \begin{center}
2142 % \definecolor{foobarblue}{RGB}{0,153,255}
2143 % \definecolor{foobaryellow}{RGB}{234,187,0}
2144 %
2145 % \newganttchartelement{foobar}{
2146 % foobar/.style={
2147 % shape=rounded rectangle,
2148 % inner sep=0pt,
2149 % draw=foobarblue!50!black,
2150 % very thick,
2151 % top color=white,
2152 % bottom color=foobarblue!50
2153 % },
2154 % foobar incomplete/.style={
2155 % /pgfgantt/foobar,
2156 % draw=foobaryellow,
2157 % bottom color=foobaryellow!50
2158 % },
2159 % foobar label font=\slshape,
2160 % foobar left shift=-.1,
2161 % foobar right shift=.1
2162 % }
2163 %
2164 % \begin{ganttchart}[
2165 % vgrid,
2166 % progress=today,
2167 % progress label text=\relax,
2168 % today=6
2169 % ]{1}{12}
2170 % \gantttitlecalendar{day} \\[grid]
2171 % \ganttfoobar{Foobar 1}{1}{2} \\
2172 % \ganttfoobar{Foobar 2}{3}{7} \\
2173 % \ganttlinkedfoobar{Foobar 3}{9}{12}
2174 % \end{ganttchart}
2175 % \end{center}
2176 %
2177 %
2178 % \subsection{Links}
2179 % \label{ssc:Links}
2180 %
2181 % So far, we have drawn charts whose elements were quite independent of each other. However, relations or \textit{links} between these elements frequently appear on real Gantt charts. For example, a task may only start if a previous one has been completed, or finishing a task may constitute a milestone.
2182 % \begin{texcode}
2183 % \ganttlink`\oarg{options}\marg{start element name}\marg{end element name}'
2184 % \end{texcode}
2185 %
2186 % \begin{key}{name}{\meta{name}}{\textrm{(empty)}}
2187 % The \DescribeMacro{\ganttlink}|\ganttlink| macro connects two elements, which are specified by their \meta{name}s. By default, chart elements are named automatically: The first one receives the name \texttt{elem0}, the second one is called \texttt{elem1} and so on. However, the \opt{name} key allows you to assign a name to each chart element.
2188 % \par\bigskip\noindent
2189 % \begin{minipage}[t]{.44\textwidth}
2190 % \begin{texcode}
2191 % \begin{ganttchart}[
2192 % vgrid,
2193 % hgrid
2194 % ]{1}{12}
2195 % \gantttitle{Title}{12} \\
2196 % \ganttbar{Task 1}{1}{4} \\
2197 % \ganttbar{Task 2}{5}{7} \\
2198 % \ganttbar{Task 3}{10}{12}
2199 % \ganttlink{elem0}{elem1}
2200 % \ganttlink{elem1}{elem2}
2201 % \end{ganttchart}
2202 % \end{texcode}
2203 % \end{minipage}\hfill
2204 % \begin{minipage}[t]{.44\textwidth}
2205 % \begin{texcode}
2206 % \begin{ganttchart}[
2207 % vgrid,
2208 % hgrid
2209 % ]{1}{12}
2210 % \gantttitle{Title}{12} \\
2211 % \ganttbar[name=b1]%
2212 % {Task 1}{1}{4} \\
2213 % \ganttbar[name=b2]%
2214 % {Task 2}{5}{7} \\
2215 % \ganttbar[name=xyz]%
2216 % {Task 3}{10}{12}
2217 % \ganttlink{b1}{b2}
2218 % \ganttlink{b2}{xyz}
2219 % \end{ganttchart}
2220 % \end{texcode}
2221 % \end{minipage}
2222 % \begin{center}
2223 % \begin{ganttchart}[
2224 % vgrid,
2225 % hgrid
2226 % ]{1}{12}
2227 % \gantttitle{Title}{12} \\
2228 % \ganttbar[name=b1]%
2229 % {Task 1}{1}{4} \\
2230 % \ganttbar[name=b2]%
2231 % {Task 2}{5}{7} \\
2232 % \ganttbar[name=xyz]%
2233 % {Task 3}{10}{12}
2234 % \ganttlink{b1}{b2}
2235 % \ganttlink{b2}{xyz}
2236 % \end{ganttchart}
2237 % \end{center}
2238 % \end{key}
2239 %
2240 % \begin{key}[/.style=]{link}{\meta{style}}{-latex, rounded corners=1pt}
2241 % Sets the appearance of the link.
2242 % \par\bigskip\noindent
2243 % \begin{texcode}
2244 % \begin{ganttchart}[
2245 % vgrid,
2246 % hgrid,
2247 % link/.style={[-to, line width=1pt, blue}
2248 % ]{1}{7}
2249 % \gantttitle{Title}{7} \\
2250 % \ganttbar{Task 1}{1}{4} \\
2251 % \ganttbar{Task 2}{5}{7}
2252 % \ganttlink{elem0}{elem1}
2253 % \end{ganttchart}
2254 % \end{texcode}
2255 % \begin{center}
2256 % \begin{ganttchart}[
2257 % vgrid,
2258 % hgrid,
2259 % link/.style={[-to, line width=1pt, blue}
2260 % ]{1}{7}
2261 % \gantttitle{Title}{7} \\
2262 % \ganttbar{Task 1}{1}{4} \\
2263 % \ganttbar{Task 2}{5}{7}
2264 % \ganttlink{elem0}{elem1}
2265 % \end{ganttchart}
2266 % \end{center}
2267 % \end{key}
2268 %
2269 % \begin{key}{link type}{\meta{type}}{auto}
2270 % Link types fall into several categories:
2271 % \begin{enumerate}\parskip0pt
2272 % \item \textit{Automatic links} are arrow-like. As you can see from the examples above, they consist of three segments (two horizontal, one vertical) if their start and end time slots are sufficiently separated. Otherwise, they comprise five segments (three horizontal, two vertical). Three keys further modify the appearance of automatic links:
2273 %
2274 % \begin{key}{link mid}{\meta{factor}}{0.5}
2275 % Changes the position of the single vertical segment (in three-part links) or of the middle horizontal segment (in five-part links). By default, these segments are horizontally centered between the left and the right vertical segment, or vertically centered between the upper and the lower horizontal segment, respectively.\par\bigskip
2276 % \keyline{link bulge}{\meta{factor}}{0.4}
2277 % In five-part links, the upper and lower vertical segments are shifted along the $x$-axis by $+$\meta{factor} and $-$\meta{factor}, respectively.\par\bigskip
2278 % \keyline{link tolerance}{\meta{factor}}{0.6}
2279 % Decides whether \pack{pgfgantt} draws a five- or a three-part link. If the true $x$-coordinates of the link start and end differ by at least \meta{factor} (this is the case for the second link in the example below), the package draws a five-part link.
2280 % \par\bigskip\noindent
2281 % \begin{texcode}
2282 % \begin{ganttchart}[vgrid, hgrid, link mid=.25, link bulge=1.3]{1}{12}
2283 % \gantttitle{Title}{12} \\
2284 % \ganttbar{Task 1}{1}{4} \\
2285 % \ganttbar{Task 2}{5}{7} \\
2286 % \ganttbar{Task 3}{10}{12}
2287 % \ganttlink{elem0}{elem1}
2288 % \ganttlink[link mid=.8]{elem1}{elem2}
2289 % \end{ganttchart}
2290 % \end{texcode}
2291 % \begin{center}
2292 % \begin{ganttchart}[vgrid, hgrid, link mid=.25, link bulge=1.3]{1}{12}
2293 % \gantttitle{Title}{12} \\
2294 % \ganttbar{Task 1}{1}{4} \\
2295 % \ganttbar{Task 2}{5}{7} \\
2296 % \ganttbar{Task 3}{10}{12}
2297 % \ganttlink{elem0}{elem1}
2298 % \ganttlink[link mid=.8]{elem1}{elem2}
2299 % \end{ganttchart}
2300 % \end{center}
2301 % \end{key}
2302 %
2303 % \item \textit{Straight links} are only meant for connecting two bars in order to establish start-to-finish relations (\texttt{s-f}), start-to-start relations (\texttt{s-s}) etc. Their \meta{type} identifiers are reminiscent of the syntax for specifying arrow tips in \TikZ: Each identifier is composed of two letters separated by a hyphen.
2304 % \par\bigskip\noindent
2305 % \begin{texcode}
2306 % \begin{ganttchart}[
2307 % vgrid,
2308 % hgrid,
2309 % link/.style={-latex, draw=red, fill=red}
2310 % ]{1}{12}
2311 % \gantttitle{Title}{12} \\
2312 % \ganttbar{Task 1}{2}{3} \\
2313 % \ganttbar{Task 2}{2}{5} \\
2314 % \ganttbar{Task 3}{6}{11} \\
2315 % \ganttbar{Task 4}{8}{11}
2316 % \ganttlink[link type=s-s]{elem0}{elem1}
2317 % \ganttlink[link type=f-s]{elem1}{elem2}
2318 % \ganttlink[link type=f-f]{elem2}{elem3}
2319 % \end{ganttchart}
2320 % \end{texcode}
2321 % \begin{center}
2322 % \begin{ganttchart}[
2323 % vgrid,
2324 % hgrid,
2325 % link/.style={-latex, draw=red, fill=red}
2326 % ]{1}{12}
2327 % \gantttitle{Title}{12} \\
2328 % \ganttbar{Task 1}{2}{3} \\
2329 % \ganttbar{Task 2}{2}{5} \\
2330 % \ganttbar{Task 3}{6}{11} \\
2331 % \ganttbar{Task 4}{8}{11}
2332 % \ganttlink[link type=s-s]{elem0}{elem1}
2333 % \ganttlink[link type=f-s]{elem1}{elem2}
2334 % \ganttlink[link type=f-f]{elem2}{elem3}
2335 % \end{ganttchart}
2336 % \end{center}
2337 %
2338 % \item \textit{Custom links} allow you to define completely new link types. Strictly speaking, automatic and straight links are predefined custom links whose code supports the keys mentioned above (section~\ref{ssc:ImplLinks} presents the \TikZ\ code of these links).\par
2339 % For instance, \pack{pgfgantt} provides one additional link type, \texttt{dr} (short for ``down-right''). This type is convenient for connecting inline-labeled bars if the label of the start bar protrudes from its right border.
2340 % \par\bigskip\noindent
2341 % \begin{texcode}
2342 % \begin{ganttchart}[
2343 % vgrid,
2344 % hgrid,
2345 % inline,
2346 % link/.style={->, ultra thick}
2347 % ]{1}{15}
2348 % \gantttitle{Title}{15} \\
2349 % \ganttbar{A really long label}{1}{3}
2350 % \ganttbar{Another really long label}{10}{12} \\
2351 % \ganttbar{Task 3}{4}{6}
2352 % \ganttbar{Task 4}{13}{15}
2353 % \ganttlink[link/.append style=red]{elem0}{elem2}
2354 % \ganttlink[link/.append style=green, link type=dr]{elem1}{elem3}
2355 % \end{ganttchart}
2356 % \end{texcode}
2357 % \begin{center}
2358 % \begin{ganttchart}[
2359 % vgrid,
2360 % hgrid,
2361 % inline,
2362 % link/.style={->, ultra thick}
2363 % ]{1}{15}
2364 % \gantttitle{Title}{15} \\
2365 % \ganttbar{A really long label}{1}{3}
2366 % \ganttbar{Another really long label}{10}{12} \\
2367 % \ganttbar{Task 3}{4}{6}
2368 % \ganttbar{Task 4}{13}{15}
2369 % \ganttlink[link/.append style=red]{elem0}{elem2}
2370 % \ganttlink[link/.append style=green, link type=dr]{elem1}{elem3}
2371 % \end{ganttchart}
2372 % \end{center}
2373 %
2374 % The following macro creates new link types:
2375 % \begin{texcode}
2376 % \newganttlinktype`\marg{type}\marg{TikZ code}'
2377 % \end{texcode}
2378 % \DescribeMacro{\newganttlinktype}It defines a new link \meta{type} which is drawn by the given \meta{TikZ code}. When you write this code, you do not have to know the final absolute coordinates of each link type instance. On the contrary, several commands that are only available in the second argument of |\newganttlinktype| help you to design generic link types:
2379 % \begin{itemize}
2380 % \item First, you have to choose the border points of the chart elements the link will connect. For this purpose, \DescribeMacro{\ganttsetstartanchor}|\ganttsetstartanchor{|\meta{anchor}|}| and \DescribeMacro{\ganttsetendanchor}|\ganttsetendanchor{|\meta{anchor}|}| select an \meta{anchor} of the start and end element, respectively. See the figures in section~\ref{sss:NewNodeShapes} for possible \meta{anchor}s of the default chart element shapes. You may specify a certain \meta{fraction} for anchors like \texttt{on top} by |\ganttsetstartanchor{on top=|\meta{fraction}|}|.
2381 %
2382 % \pack{pgfgantt} sets the default anchors to |\ganttsetstartanchor{east}| and |\ganttsetendanchor{west}|, so you even may omit these two commands.
2383 % \item The two macro pairs \DescribeMacro{\xLeft}|\xLeft|/\DescribeMacro{\yUpper}|\yUpper| and \DescribeMacro{\xRight}|\xRight|/\DescribeMacro{\yLower}|\yLower| provide the $x$- and $y$-coordinates of the link start and end points, respectively.
2384 % \begin{center}\makeatletter
2385 % \begin{ganttchart}[vgrid, hgrid, x unit=.9cm, y unit chart=2cm, link/.style={draw=black!30, ultra thick, ->, rounded corners=5pt}]{1}{12}
2386 % \gantttitle{Title}{12} \\
2387 % \ganttbar[inline]{Task 1}{2}{4} \\
2388 % \ganttbar[inline]{Task 2}{7}{9}
2389 % \ganttlink{elem0}{elem1}
2390 % \fill [red!10!blue] (elem0.east) circle [radius=1.5pt] node [above right] {(\texttt{\string\xLeft}, \texttt{\string\yUpper})};
2391 % \fill [red!90!blue] (elem1.west) circle [radius=1.5pt] node [below left] {(\texttt{\string\xRight}, \texttt{\string\yLower})};
2392 % \end{ganttchart}
2393 % \end{center}
2394 % \item \DescribeMacro{\ganttlinklabel}|\ganttlinklabel| contains the label that you may assign to each link type via |\setganttlinklabel| or the \opt{link label} key (see below).
2395 % \item You can access any values stored in the package's \meta{key}s with the macro \DescribeMacro{\ganttvalueof}|\ganttvalueof|\marg{key}.
2396 % \item Remember that you can use the style \opt{/pgfgantt/link} to ensure a uniform appearance of all your link types.
2397 % \end{itemize}
2398 % \end{enumerate}
2399 % \end{key}
2400 %
2401 % \begin{texcode}
2402 % \newganttlinktypealias`\marg{new type}\marg{existing type}'
2403 % \end{texcode}
2404 % \DescribeMacro{\newganttlinktypealias}|\newganttlinktypealias| lets a \meta{new type} equal an \meta{existing type}, also copying any label that has been set for the \meta{existing type}.
2405 % \par\bigskip
2406 % \begin{texcode}
2407 % \setganttlinklabel`\marg{type}\marg{label}'
2408 % \end{texcode}
2409 % \DescribeMacro{\setganttlinklabel}|\setganttlinklabel| sets a \meta{label} for the given link \meta{type}. In the following example, note how \texttt{sta-to-sta} and \texttt{s-s} share a common label, while we change the label of \texttt{fin-to-fin}.
2410 % \par\bigskip\noindent
2411 % \begin{texcode}
2412 % \newganttlinktypealias{sta-to-sta}{s-s}
2413 % \newganttlinktypealias{fin-to-fin}{f-f}
2414 % \setganttlinklabel{fin-to-fin}{f2f}
2415 %
2416 % \begin{ganttchart}[vgrid, hgrid]{1}{12}
2417 % \gantttitle{Title}{12} \\
2418 % \ganttbar{Task 1}{2}{3} \\
2419 % \ganttbar{Task 2}{2}{8} \\
2420 % \ganttbar{Task 3}{6}{8}
2421 % \ganttlink[link type=sta-to-sta]{elem0}{elem1}
2422 % \ganttlink[link type=fin-to-fin]{elem1}{elem2}
2423 % \end{ganttchart}
2424 % \end{texcode}
2425 % \begin{center}
2426 % \newganttlinktypealias{sta-to-sta}{s-s}
2427 % \newganttlinktypealias{fin-to-fin}{f-f}
2428 % \setganttlinklabel{fin-to-fin}{f2f}
2429 %
2430 % \begin{ganttchart}[vgrid, hgrid]{1}{12}
2431 % \gantttitle{Title}{12} \\
2432 % \ganttbar{Task 1}{2}{3} \\
2433 % \ganttbar{Task 2}{2}{8} \\
2434 % \ganttbar{Task 3}{6}{8}
2435 % \ganttlink[link type=sta-to-sta]{elem0}{elem1}
2436 % \ganttlink[link type=fin-to-fin]{elem1}{elem2}
2437 % \end{ganttchart}
2438 % \end{center}
2439 % \par\bigskip Let's put it all together and devise two new link types. Firstly, \texttt{zigzag} connects the lower right corner of the start element and the upper left corner of the end element with a thick, cyan line decorated by a zigzag pattern.
2440 % \par\bigskip\noindent
2441 % \begin{texcode}
2442 % \usetikzlibrary{decorations.pathmorphing}
2443 %
2444 % \newganttlinktype{zigzag}{
2445 % \ganttsetstartanchor{on right=1}
2446 % \ganttsetendanchor{on left=0}
2447 % \draw [decoration=zigzag, decorate, thick, cyan]
2448 % (\xLeft, \yUpper) --
2449 % (\xRight, \yLower);
2450 % }
2451 %
2452 % \begin{ganttchart}[vgrid, hgrid]{1}{12}
2453 % \gantttitle{Title}{12} \\
2454 % \ganttbar{Task 1}{2}{3} \\
2455 % \ganttbar{Task 2}{7}{12}
2456 % \ganttlink[link type=zigzag]{elem0}{elem1}
2457 % \end{ganttchart}
2458 % \end{texcode}
2459 % \begin{center}
2460 % \newganttlinktype{zigzag}{
2461 % \ganttsetstartanchor{on right=1}
2462 % \ganttsetendanchor{on left=0}
2463 % \draw [decoration=zigzag, decorate, thick, cyan]
2464 % (\xLeft, \yUpper) --
2465 % (\xRight, \yLower);
2466 % }
2467 % \begin{ganttchart}[vgrid, hgrid]{1}{12}
2468 % \gantttitle{Title}{12} \\
2469 % \ganttbar{Task 1}{2}{3} \\
2470 % \ganttbar{Task 2}{7}{12}
2471 % \ganttlink[link type=zigzag]{elem0}{elem1}
2472 % \end{ganttchart}
2473 % \end{center}
2474 % Secondly, \texttt{drur} (short for down-right-up-right) draws a labelled arrow in the default style \opt{link}. The link starts at the bottom of the first element and connects to the left border of the second one. In addition, the known keys \opt{link mid} and \opt{link bulge} decide where the line going up is positioned and how far the first line going right is below the start coordinate, respectively.
2475 % \par\bigskip\noindent
2476 % \begin{texcode}
2477 % \newganttlinktype{drur}{
2478 % \ganttsetstartanchor{on bottom=0.75}
2479 % \ganttsetendanchor{on left}
2480 % \draw [/pgfgantt/link]
2481 % % first segment (down)
2482 % (\xLeft, \yUpper) --
2483 % % second segment (right)
2484 % (\xLeft, \yUpper -
2485 % \ganttvalueof{link bulge} * \ganttvalueof{y unit chart}) --
2486 % % link label
2487 % node [pos=.5, /pgfgantt/link label anchor] {\ganttlinklabel}
2488 % % third segment (up)
2489 % ($(\xLeft,
2490 % \yUpper -
2491 % \ganttvalueof{link bulge} * \ganttvalueof{y unit chart})!%
2492 % \ganttvalueof{link mid}!%
2493 % (\xRight,
2494 % \yUpper -
2495 % \ganttvalueof{link bulge} * \ganttvalueof{y unit chart})$) --
2496 % % last segment (right again)
2497 % ($(\xLeft, \yLower)!%
2498 % \ganttvalueof{link mid}!%
2499 % (\xRight, \yLower)$) --
2500 % (\xRight, \yLower);
2501 % }
2502 % \setganttlinklabel{drur}{a fancy link}
2503 %
2504 % \begin{ganttchart}[
2505 % vgrid,
2506 % hgrid,
2507 % link/.style={thick, ->, green!50!black, rounded corners=2mm},
2508 % link label anchor/.style=below,
2509 % link mid=.7, link bulge=.6
2510 % ]{1}12}
2511 % \gantttitle{Title}{12} \\
2512 % \ganttbar[inline]{Task 1}{2}{4}
2513 % \ganttbar[inline]{Task 2}{8}{11} \\
2514 % \ganttlink[link type=drur]{elem0}{elem1}
2515 % \end{ganttchart}
2516 % \end{texcode}
2517 % \begin{center}
2518 % \newganttlinktype{drur}{
2519 % \ganttsetstartanchor{on bottom=0.75}
2520 % \ganttsetendanchor{on left}
2521 % \draw [/pgfgantt/link]
2522 % (\xLeft, \yUpper) --
2523 % (\xLeft, \yUpper -
2524 % \ganttvalueof{link bulge} * \ganttvalueof{y unit chart}) --
2525 % node [pos=.5, /pgfgantt/link label anchor] {\ganttlinklabel}
2526 % ($(\xLeft,
2527 % \yUpper -
2528 % \ganttvalueof{link bulge} * \ganttvalueof{y unit chart})!%
2529 % \ganttvalueof{link mid}!%
2530 % (\xRight,
2531 % \yUpper -
2532 % \ganttvalueof{link bulge} * \ganttvalueof{y unit chart})$) --
2533 % ($(\xLeft, \yLower)!%
2534 % \ganttvalueof{link mid}!%
2535 % (\xRight, \yLower)$) --
2536 % (\xRight, \yLower);
2537 % }
2538 % \setganttlinklabel{drur}{a fancy link}
2539 %
2540 % \begin{ganttchart}[
2541 % vgrid,
2542 % hgrid,
2543 % link/.style={thick, ->, green!50!black, rounded corners=2mm},
2544 % link label anchor/.style=below,
2545 % link mid=.7, link bulge=.6
2546 % ]{1}{12}
2547 % \gantttitle{Title}{12} \\
2548 % \ganttbar[inline]{Task 1}{2}{4}
2549 % \ganttbar[inline]{Task 2}{8}{11} \\
2550 % \ganttlink[link type=drur]{elem0}{elem1}
2551 % \end{ganttchart}
2552 % \end{center}
2553 % (Please remove the comments if you copy the code above -- they will confuse \TikZ\ and generate tons of errors.)
2554 %
2555 % \begin{key}{link label}{\meta{label}}{\textrm{(empty)}}
2556 % \keyline{link label font}{\meta{font commands}}{\string\scriptsize\string\itshape}
2557 % \keyline[/.style=]{link label node}{\meta{options}}{anchor=west, font=\string\ganttvalueof\{link label font\}}
2558 % The \opt{link label} key locally overrides any label specified by |\setganttlinklabel|. The \meta{font commands} and \meta{options} are applied to the link label node. By default, the label appears to the right of the straight link's center.
2559 % \par\bigskip\noindent
2560 % \begin{texcode}
2561 % \begin{ganttchart}[
2562 % vgrid,
2563 % hgrid,
2564 % link label font=\small\bfseries\color{purple}
2565 % ]{1}{12}
2566 % \gantttitle{Title}{12} \\
2567 % \ganttbar{Task 1}{2}{3} \\
2568 % \ganttbar{Task 2}{2}{5} \\
2569 % \ganttbar{Task 3}{6}{11} \\
2570 % \ganttbar{Task 4}{8}{11} \\
2571 % \ganttbar{Task 5}{4}{7}
2572 % \ganttlink[link type=s-s]{elem0}{elem1}
2573 % \ganttlink[link type=f-s, link label={f$\to$s}]{elem1}{elem2}
2574 % \ganttlink[
2575 % link type=f-f,
2576 % link label node/.append style={anchor=east}
2577 % ]{elem2}{elem3}
2578 % \ganttlink[
2579 % link type=s-f,
2580 % link label node/.append style={anchor=base}
2581 % ]{elem3}{elem4}
2582 % \end{ganttchart}
2583 % \end{texcode}
2584 % \begin{center}
2585 % \begin{ganttchart}[
2586 % vgrid,
2587 % hgrid,
2588 % link label font=\small\bfseries\color{purple}
2589 % ]{1}{12}
2590 % \gantttitle{Title}{12} \\
2591 % \ganttbar{Task 1}{2}{3} \\
2592 % \ganttbar{Task 2}{2}{5} \\
2593 % \ganttbar{Task 3}{6}{11} \\
2594 % \ganttbar{Task 4}{8}{11} \\
2595 % \ganttbar{Task 5}{4}{7}
2596 % \ganttlink[link type=s-s]{elem0}{elem1}
2597 % \ganttlink[link type=f-s, link label={f$\to$s}]{elem1}{elem2}
2598 % \ganttlink[
2599 % link type=f-f,
2600 % link label node/.append style={anchor=east}
2601 % ]{elem2}{elem3}
2602 % \ganttlink[
2603 % link type=s-f,
2604 % link label node/.append style={anchor=base}
2605 % ]{elem3}{elem4}
2606 % \end{ganttchart}
2607 % \end{center}
2608 % \end{key}
2609 %
2610 %
2611 % \subsection{Style Examples}
2612 %
2613 % The first example plays around with colors and notably uses equal $x$- and $y$-vectors.
2614 % \par\bigskip\noindent
2615 % \begin{texcode}
2616 % \begin{ganttchart}[
2617 % y unit title=0.4cm,
2618 % y unit chart=0.5cm,
2619 % vgrid,
2620 % time slot format=isodate-yearmonth,
2621 % time slot unit=month,
2622 % title/.append style={draw=none, fill=RoyalBlue!50!black},
2623 % title label font=\sffamily\bfseries\color{white},
2624 % title label node/.append style={below=-1.6ex},
2625 % title left shift=.05,
2626 % title right shift=-.05,
2627 % title height=1,
2628 % bar/.append style={draw=none, fill=OliveGreen!75},
2629 % bar height=.6,
2630 % bar label font=\normalsize\color{black!50},
2631 % group right shift=0,
2632 % group top shift=.6,
2633 % group height=.3,
2634 % group peaks height=.2,
2635 % bar incomplete/.append style={fill=Maroon}
2636 % ]{2010-09}{2011-12}
2637 % \gantttitlecalendar{year} \\
2638 % \ganttbar[
2639 % progress=100,
2640 % bar progress label font=\small\color{OliveGreen!75},
2641 % bar progress label node/.append style={right=4pt},
2642 % bar label font=\normalsize\color{OliveGreen},
2643 % name=pp
2644 % ]{Preliminary Project}{2010-09}{2010-12} \\
2645 % \ganttset{progress label text={}, link/.style={black, -to}}
2646 % \ganttgroup{Objective 1}{2011-01}{2011-12} \\
2647 % \ganttbar[progress=4, name=T1A]{Task A}{2011-01}{2011-06} \\
2648 % \ganttlinkedbar[progress=0]{Task B}{2011-07}{2011-12} \\
2649 % \ganttgroup{Objective 2}{2011-01}{2011-12} \\
2650 % \ganttbar[progress=15, name=T2A]{Task A}{2011-01}{2011-09} \\
2651 % \ganttlinkedbar[progress=0]{Task B}{2011-10}{2011-12} \\
2652 % \ganttgroup{Objective 3}{2011-05}{2011-08} \\
2653 % \ganttbar[progress=0]{Task A}{2011-05}{2011-08}
2654 % \ganttset{link/.style={OliveGreen}}
2655 % \ganttlink[link mid=.4]{pp}{T1A}
2656 % \ganttlink[link mid=.159]{pp}{T2A}
2657 % \end{ganttchart}
2658 % \end{texcode}
2659 % \begin{center}
2660 % \begin{ganttchart}[
2661 % y unit title=0.4cm,
2662 % y unit chart=0.5cm,
2663 % vgrid,
2664 % time slot format=isodate-yearmonth,
2665 % time slot unit=month,
2666 % title/.append style={draw=none, fill=RoyalBlue!50!black},
2667 % title label font=\sffamily\bfseries\color{white},
2668 % title label node/.append style={below=-1.6ex},
2669 % title left shift=.05,
2670 % title right shift=-.05,
2671 % title height=1,
2672 % bar/.append style={draw=none, fill=OliveGreen!75},
2673 % bar height=.6,
2674 % bar label font=\normalsize\color{black!50},
2675 % group right shift=0,
2676 % group top shift=.6,
2677 % group height=.3,
2678 % group peaks height=.2,
2679 % bar incomplete/.append style={fill=Maroon}
2680 % ]{2010-09}{2011-12}
2681 % \gantttitlecalendar{year} \\
2682 % \ganttbar[
2683 % progress=100,
2684 % bar progress label font=\small\color{OliveGreen!75},
2685 % bar progress label node/.append style={right=4pt},
2686 % bar label font=\normalsize\color{OliveGreen},
2687 % name=pp
2688 % ]{Preliminary Project}{2010-09}{2010-12} \\
2689 % \ganttset{progress label text={}, link/.style={black, -to}}
2690 % \ganttgroup{Objective 1}{2011-01}{2011-12} \\
2691 % \ganttbar[progress=4, name=T1A]{Task A}{2011-01}{2011-06} \\
2692 % \ganttlinkedbar[progress=0]{Task B}{2011-07}{2011-12} \\
2693 % \ganttgroup{Objective 2}{2011-01}{2011-12} \\
2694 % \ganttbar[progress=15, name=T2A]{Task A}{2011-01}{2011-09} \\
2695 % \ganttlinkedbar[progress=0]{Task B}{2011-10}{2011-12} \\
2696 % \ganttgroup{Objective 3}{2011-05}{2011-08} \\
2697 % \ganttbar[progress=0]{Task A}{2011-05}{2011-08}
2698 % \ganttset{link/.style={OliveGreen}}
2699 % \ganttlink[link mid=.4]{pp}{T1A}
2700 % \ganttlink[link mid=.159]{pp}{T2A}
2701 % \end{ganttchart}
2702 % \end{center}
2703 %
2704 % \bigskip
2705 % The second example demonstrates that \pack{pgfgantt} is really flexible: Even an appearance quite different from the standard layout is possible. (More precisely, the code below tries to reproduce the Gantt chart from the English Wikipedia site, see \url{https://en.wikipedia.org/wiki/Gantt_chart}.)
2706 % \par\bigskip\noindent
2707 % \begin{texcode}
2708 % \definecolor{barblue}{RGB}{153,204,254}
2709 % \definecolor{groupblue}{RGB}{51,102,254}
2710 % \definecolor{linkred}{RGB}{165,0,33}
2711 % \renewcommand\sfdefault{phv}
2712 % \renewcommand\mddefault{mc}
2713 % \renewcommand\bfdefault{bc}
2714 % \setganttlinklabel{s-s}{START-TO-START}
2715 % \setganttlinklabel{f-s}{FINISH-TO-START}
2716 % \setganttlinklabel{f-f}{FINISH-TO-FINISH}
2717 % \sffamily
2718 % \begin{ganttchart}[
2719 % canvas/.append style={fill=none, draw=black!5, line width=.75pt},
2720 % hgrid style/.style={draw=black!5, line width=.75pt},
2721 % vgrid={*1{draw=black!5, line width=.75pt}},
2722 % today=7,
2723 % today rule/.style={
2724 % draw=black!64,
2725 % dash pattern=on 3.5pt off 4.5pt,
2726 % line width=1.5pt
2727 % },
2728 % today label font=\small\bfseries,
2729 % title/.style={draw=none, fill=none},
2730 % title label font=\bfseries\footnotesize,
2731 % title label node/.append style={below=7pt},
2732 % include title in canvas=false,
2733 % bar label font=\mdseries\small\color{black!70},
2734 % bar label node/.append style={left=2cm},
2735 % bar/.append style={draw=none, fill=black!63},
2736 % bar incomplete/.append style={fill=barblue},
2737 % bar progress label font=\mdseries\footnotesize\color{black!70},
2738 % group incomplete/.append style={fill=groupblue},
2739 % group left shift=0,
2740 % group right shift=0,
2741 % group height=.5,
2742 % group peaks tip position=0,
2743 % group label node/.append style={left=.6cm},
2744 % group progress label font=\bfseries\small,
2745 % link/.style={-latex, line width=1.5pt, linkred},
2746 % link label font=\scriptsize\bfseries,
2747 % link label node/.append style={below left=-2pt and 0pt}
2748 % ]{1}{13}
2749 % \gantttitle[
2750 % title label node/.append style={below left=7pt and -3pt}
2751 % ]{WEEKS:\quad1}{1}
2752 % \gantttitlelist{2,...,13}{1} \\
2753 % \ganttgroup[progress=57]{WBS 1 Summary Element 1}{1}{10} \\
2754 % \ganttbar[
2755 % progress=75,
2756 % name=WBS1A
2757 % ]{\textbf{WBS 1.1} Activity A}{1}{8} \\
2758 % \ganttbar[
2759 % progress=67,
2760 % name=WBS1B
2761 % ]{\textbf{WBS 1.2} Activity B}{1}{3} \\
2762 % \ganttbar[
2763 % progress=50,
2764 % name=WBS1C
2765 % ]{\textbf{WBS 1.3} Activity C}{4}{10} \\
2766 % \ganttbar[
2767 % progress=0,
2768 % name=WBS1D
2769 % ]{\textbf{WBS 1.4} Activity D}{4}{10} \\[grid]
2770 % \ganttgroup[progress=0]{WBS 2 Summary Element 2}{4}{10} \\
2771 % \ganttbar[progress=0]{\textbf{WBS 2.1} Activity E}{4}{5} \\
2772 % \ganttbar[progress=0]{\textbf{WBS 2.2} Activity F}{6}{8} \\
2773 % \ganttbar[progress=0]{\textbf{WBS 2.3} Activity G}{9}{10}
2774 % \ganttlink[link type=s-s]{WBS1A}{WBS1B}
2775 % \ganttlink[link type=f-s]{WBS1B}{WBS1C}
2776 % \ganttlink[
2777 % link type=f-f,
2778 % link label node/.append style=left
2779 % ]{WBS1C}{WBS1D}
2780 % \end{ganttchart}
2781 % \end{texcode}
2782 % \begin{center}
2783 % \definecolor{barblue}{RGB}{153,204,254}
2784 % \definecolor{groupblue}{RGB}{51,102,254}
2785 % \definecolor{linkred}{RGB}{165,0,33}
2786 % \renewcommand\sfdefault{phv}
2787 % \renewcommand\mddefault{mc}
2788 % \renewcommand\bfdefault{bc}
2789 % \setganttlinklabel{s-s}{START-TO-START}
2790 % \setganttlinklabel{f-s}{FINISH-TO-START}
2791 % \setganttlinklabel{f-f}{FINISH-TO-FINISH}
2792 % \sffamily
2793 % \begin{ganttchart}[
2794 % canvas/.append style={fill=none, draw=black!5, line width=.75pt},
2795 % hgrid style/.style={draw=black!5, line width=.75pt},
2796 % vgrid={*1{draw=black!5, line width=.75pt}},
2797 % today=7,
2798 % today rule/.style={
2799 % draw=black!64,
2800 % dash pattern=on 3.5pt off 4.5pt,
2801 % line width=1.5pt
2802 % },
2803 % today label font=\small\bfseries,
2804 % title/.style={draw=none, fill=none},
2805 % title label font=\bfseries\footnotesize,
2806 % title label node/.append style={below=7pt},
2807 % include title in canvas=false,
2808 % bar label font=\mdseries\small\color{black!70},
2809 % bar label node/.append style={left=2cm},
2810 % bar/.append style={draw=none, fill=black!63},
2811 % bar incomplete/.append style={fill=barblue},
2812 % bar progress label font=\mdseries\footnotesize\color{black!70},
2813 % group incomplete/.append style={fill=groupblue},
2814 % group left shift=0,
2815 % group right shift=0,
2816 % group height=.5,
2817 % group peaks tip position=0,
2818 % group label node/.append style={left=.6cm},
2819 % group progress label font=\bfseries\small,
2820 % link/.style={-latex, line width=1.5pt, linkred},
2821 % link label font=\scriptsize\bfseries,
2822 % link label node/.append style={below left=-2pt and 0pt}
2823 % ]{1}{13}
2824 % \gantttitle[
2825 % title label node/.append style={below left=7pt and -3pt}
2826 % ]{WEEKS:\quad1}{1}
2827 % \gantttitlelist{2,...,13}{1} \\
2828 % \ganttgroup[progress=57]{WBS 1 Summary Element 1}{1}{10} \\
2829 % \ganttbar[
2830 % progress=75,
2831 % name=WBS1A
2832 % ]{\textbf{WBS 1.1} Activity A}{1}{8} \\
2833 % \ganttbar[
2834 % progress=67,
2835 % name=WBS1B
2836 % ]{\textbf{WBS 1.2} Activity B}{1}{3} \\
2837 % \ganttbar[
2838 % progress=50,
2839 % name=WBS1C
2840 % ]{\textbf{WBS 1.3} Activity C}{4}{10} \\
2841 % \ganttbar[
2842 % progress=0,
2843 % name=WBS1D
2844 % ]{\textbf{WBS 1.4} Activity D}{4}{10} \\[grid]
2845 % \ganttgroup[progress=0]{WBS 2 Summary Element 2}{4}{10} \\
2846 % \ganttbar[progress=0]{\textbf{WBS 2.1} Activity E}{4}{5} \\
2847 % \ganttbar[progress=0]{\textbf{WBS 2.2} Activity F}{6}{8} \\
2848 % \ganttbar[progress=0]{\textbf{WBS 2.3} Activity G}{9}{10}
2849 % \ganttlink[link type=s-s]{WBS1A}{WBS1B}
2850 % \ganttlink[link type=f-s]{WBS1B}{WBS1C}
2851 % \ganttlink[
2852 % link type=f-f,
2853 % link label node/.append style=left
2854 % ]{WBS1C}{WBS1D}
2855 % \end{ganttchart}
2856 % \end{center}
2857 %
2858 %
2859 % \StopEventually{\PrintIndex}
2860 % \lstDeleteShortInline|
2861 % \MakeShortVerb{\|}
2862 % \clearpage\section{Implementation}
2863 %
2864 %
2865 % \subsection{Packages}
2866 %
2867 % \pack{pgfgantt} is modest in terms of dependencies: It only requires the \TikZ\ and \pack{pgfcalendar} packages.
2868 %
2869 % \iffalse
2870 %<*pgfgantt>
2871 % \fi
2872 % \begin{macrocode}
2873 \RequirePackage{tikz}
2874 \usetikzlibrary{%
2875 arrows, backgrounds, calc,%
2876 patterns, positioning, shapes.geometric%
2877 }
2878 \RequirePackage{pgfcalendar}
2879
2880 % \end{macrocode}
2881 %
2882 %
2883 % \subsection{Macros for Key and Error Management}
2884 %
2885 % \begin{intmacro}{\@gtt@ifstar}
2886 % |\@gtt@ifstar| reimplements the \LaTeXe\ kernel's |\@ifstar| macro.
2887 % This makes it robust to \pack{amsgen}'s reimplementation of
2888 % |\@ifstar|.
2889 % \begin{macrocode}
2890 \def\@gtt@ifstar#1{\kernel@ifnextchar*{\@firstoftwo{#1}}}
2891 % \end{macrocode}
2892 % \end{intmacro}
2893 %
2894 % \begin{macro}{\ganttset}
2895 % |\ganttset| changes the current key path to |/pgfgantt/| and then executes the keys in its mandatory argument.
2896 % \begin{macrocode}
2897 \def\ganttset#1{\pgfqkeys{/pgfgantt}{#1}}
2898 % \end{macrocode}
2899 % \end{macro}
2900 % \begin{intmacro}{\@gtt@keydef}
2901 % The following auxiliary macros save us some code when we devise keys later on. |\@gtt@keydef|\marg{key}\marg{initial value} declares the key |/pgfgantt/|\meta{key} and stores its \meta{initial value}.
2902 % \begin{macrocode}
2903 \def\@gtt@keydef#1#2{%
2904 \pgfkeyssetvalue{/pgfgantt/#1}{#2}%
2905 }
2906 % \end{macrocode}
2907 % \end{intmacro}
2908 % \begin{macro}{\ganttvalueof}
2909 % |\ganttvalueof|\marg{key} retrieves the value stored by a \meta{key}. Link type authors should be able to use this macro in their code; thus, it lacks any |@|s.
2910 % \begin{macrocode}
2911 \def\ganttvalueof#1{%
2912 \pgfkeysvalueof{/pgfgantt/#1}%
2913 }
2914 % \end{macrocode}
2915 % \end{macro}
2916 % \begin{intmacro}{\@gtt@stylekeydef}
2917 % |\@gtt@stylekeydef|\marg{key}\marg{initial style} declares a style \meta{key} with an \meta{initial style}.
2918 % \begin{macrocode}
2919 \def\@gtt@stylekeydef#1#2{%
2920 \pgfkeys{/pgfgantt/#1/.style={#2}}%
2921 }
2922 % \end{macrocode}
2923 % \end{intmacro}
2924 % \begin{intmacro}{\@gtt@PackageError}
2925 % \begin{intmacro}{\@gtt@PackageWarning}
2926 % |\@gtt@PackageError|\marg{message} and |\@gtt@PackageWarning|\marg{message} issue a package error or warning \meta{message}, respectively.
2927 % \begin{macrocode}
2928 \def\@gtt@PackageError#1{%
2929 \PackageError{pgfgantt}{#1}{}%
2930 }
2931 \def\@gtt@PackageWarning#1{%
2932 \PackageWarning{pgfgantt}{#1}%
2933 }
2934
2935 % \end{macrocode}
2936 % \end{intmacro}
2937 % \end{intmacro}
2938 %
2939 %
2940 % \subsection{The Horizontal and Vertical Grid}
2941 %
2942 % \begin{intmacro}{\gtt@currentline}
2943 % \begin{intmacro}{\gtt@lasttitleline}
2944 % \begin{intmacro}{\gtt@currgrid}
2945 % \begin{intmacro}{\gtt@chartwidth}
2946 % The count register |\gtt@currentline| holds the current line; it starts from 0 and decreases. |\gtt@lasttitleline| equals the line of the title element drawn last. |\gtt@currgrid| is the index of the current grid line drawn. |\gtt@chartwidth| equals the number of time slots.
2947 % \begin{macrocode}
2948 \newcount\gtt@currentline
2949 \newcount\gtt@lasttitleline
2950 \newcount\gtt@currgrid
2951 \newcount\gtt@chartwidth
2952 % \end{macrocode}
2953 % \end{intmacro}
2954 % \end{intmacro}
2955 % \end{intmacro}
2956 % \end{intmacro}
2957 % \begin{option}{hgrid}
2958 % \begin{option}{hgrid style}
2959 % \begin{intmacro}{\ifgtt@hgrid}
2960 % \begin{intmacro}{\gtt@hgridstyle}
2961 % \opt{hgrid} checks whether its value is false and sets the boolean |\ifgtt@hgrid| accordingly. If the value is true or missing, horizontal grid lines appear dotted.
2962 % \begin{macrocode}
2963 \@gtt@stylekeydef{hgrid style}{dotted}
2964 \newif\ifgtt@hgrid
2965 \ganttset{%
2966 hgrid/.code={%
2967 \def\@tempa{#1}%
2968 \def\@tempb{false}%
2969 \ifx\@tempa\@tempb%
2970 \gtt@hgridfalse%
2971 \else%
2972 \gtt@hgridtrue%
2973 \def\@tempb{true}%
2974 \ifx\@tempa\@tempb%
2975 \def\gtt@hgridstyle{dotted}%
2976 \else%
2977 \def\gtt@hgridstyle{#1}%
2978 \fi%
2979 \fi%
2980 },%
2981 hgrid/.default=dotted
2982 }
2983
2984 % \end{macrocode}
2985 % \end{intmacro}
2986 % \end{intmacro}
2987 % \end{option}
2988 % \end{option}
2989 % \begin{intmacro}{\gtt@hgrid@do}
2990 % The |\gtt@hgrid@do| macro decomposes the style list for the horizontal grid into its comma-separated items. Each item is analyzed (see below) only if some grid lines are still left to draw. Note the ``elegant'' quadruple |\expandafter| construction, which enables tail recursion.
2991 % \begin{macrocode}
2992 \def\gtt@hgrid@do#1,{%
2993 \ifx\relax#1\else
2994 \ifnum\gtt@currgrid<\gtt@currentline\else%
2995 \gtt@hgrid@analyze#1\relax%
2996 \expandafter\expandafter\expandafter\gtt@hgrid@do%
2997 \expandafter\fi%
2998 \fi%
2999 }
3000
3001 % \end{macrocode}
3002 % \end{intmacro}
3003 % \begin{intmacro}{\gtt@hgrid@analyze}
3004 % In the absence of a star as the first token in a style list item, |\gtt@hgrid@analyze| adds the multiplier |1| to the input stream.
3005 % \begin{macrocode}
3006 \def\gtt@hgrid@analyze{%
3007 \@gtt@ifstar{\gtt@hgrid@draw}{\gtt@hgrid@draw1}%
3008 }
3009
3010 % \end{macrocode}
3011 % \end{intmacro}
3012 % \begin{intmacro}{\gtt@hgrid@draw}
3013 % |\gtt@hgrid@draw| draws as many grid lines as required by the multiplier. It increases |\gtt@currgrid| after each line drawn and breaks the loop as soon as all grid rules have been drawn.
3014 % \begin{macrocode}
3015 \def\gtt@hgrid@draw#1#2\relax{%
3016 \foreach \i in {1,...,#1} {%
3017 \pgfmathsetmacro\y@upper{%
3018 \gtt@lasttitleline * \ganttvalueof{y unit title} +%
3019 (\gtt@currgrid - \gtt@lasttitleline)%
3020 * \ganttvalueof{y unit chart}%
3021 }%
3022 \draw [#2]
3023 (0pt, \y@upper pt) --
3024 (\gtt@chartwidth * \ganttvalueof{x unit}, \y@upper pt);%
3025 \global\advance\gtt@currgrid by-1\relax%
3026 \ifnum\gtt@currgrid<\gtt@currentline\breakforeach\fi%
3027 }%
3028 }
3029
3030 % \end{macrocode}
3031 % \end{intmacro}
3032 % \begin{option}{vgrid}
3033 % \begin{intmacro}{\ifgtt@vgrid}
3034 % \begin{intmacro}{\gtt@vgridstyle}
3035 % \begin{intmacro}{\gtt@vgrid@do}
3036 % \begin{intmacro}{\gtt@vgrid@analyze}
3037 % \begin{intmacro}{\gtt@vgrid@draw}
3038 % Analogously, we declare options and macros for printing the vertical grid.
3039 % \begin{macrocode}
3040 \newif\ifgtt@vgrid
3041 \ganttset{%
3042 vgrid/.code={%
3043 \def\@tempa{#1}%
3044 \def\@tempb{false}%
3045 \ifx\@tempa\@tempb%
3046 \gtt@vgridfalse%
3047 \else%
3048 \gtt@vgridtrue%
3049 \def\@tempb{true}%
3050 \ifx\@tempa\@tempb%
3051 \def\gtt@vgridstyle{dotted}%
3052 \else%
3053 \def\gtt@vgridstyle{#1}%
3054 \fi%
3055 \fi%
3056 },%
3057 vgrid/.default=dotted
3058 }
3059
3060 \def\gtt@vgrid@do#1,{%
3061 \ifx\relax#1\else%
3062 \ifnum\gtt@currgrid>\gtt@chartwidth\else%
3063 \gtt@vgrid@analyze#1\relax%
3064 \expandafter\expandafter\expandafter\gtt@vgrid@do%
3065 \expandafter\fi%
3066 \fi%
3067 }
3068
3069 \def\gtt@vgrid@analyze{%
3070 \@gtt@ifstar{\gtt@vgrid@draw}{\gtt@vgrid@draw1}%
3071 }
3072
3073 \def\gtt@vgrid@draw#1#2\relax{%
3074 \foreach \i in {1,...,#1} {%
3075 \draw [#2]
3076 (\gtt@currgrid * \ganttvalueof{x unit}, \y@upper pt) --%
3077 (\gtt@currgrid * \ganttvalueof{x unit}, \y@lower pt);%
3078 \global\advance\gtt@currgrid by1\relax%
3079 \ifnum\gtt@currgrid>\gtt@chartwidth\breakforeach\fi%
3080 }%
3081 }
3082
3083 % \end{macrocode}
3084 % \end{intmacro}
3085 % \end{intmacro}
3086 % \end{intmacro}
3087 % \end{intmacro}
3088 % \end{intmacro}
3089 % \end{option}
3090 %
3091 %
3092 % \subsection{Time Slot Formats}
3093 %
3094 % \begin{intmacro}{\gtt@smugglecount}
3095 % |\gtt@smugglecount|\marg{count} smuggles the local value of a count register over the end of a \TeX\ group.
3096 % \begin{macrocode}
3097 \def\gtt@smugglecount#1\endgroup{%
3098 \edef\@tempa{\the#1}%
3099 \expandafter\endgroup\expandafter#1\expandafter=\@tempa%
3100 }
3101
3102 % \end{macrocode}
3103 % \end{intmacro}
3104 % \begin{intmacro}{\gtt@juliantotimeslot}
3105 % |\gtt@juliantotimeslot|\marg{count 1}\marg{count 2} converts the Julian date stored in \meta{count 1} to a time slot and stores the latter in \meta{count 2}. This macro is called after the start of Gantt chart. Thus, |\gtt@startyear|, |\gtt@startmonth| and |\gtt@startjulian| (see section~\ref{ssc:ImplMain}) have already been initialized. Depending on the value of \opt{time slot unit}, one time slot corresponds to one |day|, one |month| or one |year|.
3106 % \begin{macrocode}
3107 \newcommand\gtt@juliantotimeslot[2]{%
3108 \begingroup%
3109 \@tempcnta=#1\relax%
3110 \ifgtt@timeslotunit@day%
3111 \advance\@tempcnta by-\gtt@startjulian\relax%
3112 \advance\@tempcnta by1\relax%
3113 \fi%
3114 \ifgtt@timeslotunit@month%
3115 \pgfcalendarjuliantodate{\@tempcnta}{\@tempa}{\@tempb}{\@tempc}%
3116 \@tempcnta=\@tempa\relax%
3117 \advance\@tempcnta by-\gtt@startyear\relax%
3118 \multiply\@tempcnta by12\relax%
3119 \advance\@tempcnta by\@tempb\relax%
3120 \advance\@tempcnta by-\gtt@startmonth\relax%
3121 \advance\@tempcnta by1\relax%
3122 \fi%
3123 \ifgtt@timeslotunit@year%
3124 \pgfcalendarjuliantodate{\@tempcnta}{\@tempa}{\@tempb}{\@tempc}%
3125 \@tempcnta=\@tempa\relax%
3126 \advance\@tempcnta by-\gtt@startyear\relax%
3127 \advance\@tempcnta by1\relax%
3128 \fi%
3129 #2=\@tempcnta\relax%
3130 \gtt@smugglecount#2%
3131 \endgroup%
3132 }
3133
3134 % \end{macrocode}
3135 % \end{intmacro}
3136 % \begin{macro}{\newgantttimeslotformat}
3137 % |\newgantttimeslotformat|\marg{name}\marg{code} defines the macro\\|\gtt@tsstojulian@|\meta{name}\marg{tss}\marg{count}. This macro executes \meta{code} (within a group), which should convert \meta{tss} to a Julian date and store the date in \meta{count}.
3138 % \begin{macrocode}
3139 \newcommand\newgantttimeslotformat[2]{%
3140 \expandafter\def\csname gtt@tsstojulian@#1\endcsname##1##2{%
3141 \begingroup#2\gtt@smugglecount##2\endgroup%
3142 }%
3143 }
3144
3145 % \end{macrocode}
3146 % \end{macro}
3147 % The predefined time slot formats |simple|, |isodate|, |isodate-yearmonth| and |isodate-year| are straight forward.
3148 % \begin{macrocode}
3149 \newgantttimeslotformat{simple}{%
3150 #2=#1\relax%
3151 \advance#2 by\gtt@tsf@startjulian\relax%
3152 \advance#2 by-1\relax%
3153 }
3154
3155 \newgantttimeslotformat{isodate}{%
3156 \pgfcalendardatetojulian{#1}{#2}%
3157 }
3158
3159 \newgantttimeslotformat{isodate-yearmonth}{%
3160 \pgfcalendardatetojulian{#1-01}{#2}%
3161 }
3162
3163 \newgantttimeslotformat{isodate-year}{%
3164 \pgfcalendardatetojulian{#1-01-01}{#2}%
3165 }
3166
3167 % \end{macrocode}
3168 % \begin{intmacro}{\gtt@tsf@getdmy}
3169 % |\gtt@tsf@getdmy|\marg{date} decomposes a \meta{date} |day|[|sep|]|month|[|sep|]|year| (with [|sep|] representing a period, hyphen or slash) into |day|, |month| and |year| and stores these numbers in |\local@day|, |\local@month| and |\local@year|, respectively.
3170 % \begin{macrocode}
3171 \newcommand\gtt@tsf@getdmy[1]{%
3172 \edef\local@firstarg{#1}%
3173 \def\local@decompose##1.##2.##3\relax{%
3174 \def\local@day{##1}\def\local@month{##2}\def\local@year{##3}%
3175 }%
3176 \expandafter\local@decompose\local@firstarg..\relax%
3177 \ifx\local@month\@empty%
3178 \def\local@decompose##1/##2/##3\relax{%
3179 \def\local@day{##1}\def\local@month{##2}\def\local@year{##3}%
3180 }%
3181 \expandafter\local@decompose\local@firstarg//\relax%
3182 \ifx\local@month\@empty%
3183 \def\local@decompose##1-##2-##3\relax{%
3184 \def\local@day{##1}\def\local@month{##2}\def\local@year{##3}%
3185 }%
3186 \expandafter\local@decompose\local@firstarg--\relax%
3187 \ifx\local@month\@empty%
3188 \@gtt@PackageError{Illegal time slot specifier `#1'.}%
3189 \else%
3190 \def\local@decompose##1--{\def\local@year{##1}}%
3191 \expandafter\local@decompose\local@year%
3192 \fi%
3193 \else%
3194 \def\local@decompose##1//{\def\local@year{##1}}%
3195 \expandafter\local@decompose\local@year%
3196 \fi%
3197 \else%
3198 \def\local@decompose##1..{\def\local@year{##1}}%
3199 \expandafter\local@decompose\local@year%
3200 \fi%
3201 }
3202
3203 % \end{macrocode}
3204 % \end{intmacro}
3205 % Time slot formats |little-endian|, |big-endian| and |middle-endian| only differ in their call of |\pgfcalendardatetojulian|. If the year (stored in |\local@year| or |\local@day|) lacks a century (e.\,g., 13 instead of 2013), it is completed according to the value of \opt{time slot format/base century}.
3206 % \begin{macrocode}
3207 \newgantttimeslotformat{little-endian}{%
3208 \gtt@tsf@getdmy{#1}%
3209 \ifnum\local@year<100\relax%
3210 \edef\local@year{\gtt@tsf@basecentury\local@year}%
3211 \fi%
3212 \pgfcalendardatetojulian{\local@year-\local@month-\local@day}{#2}%
3213 }
3214
3215 \newgantttimeslotformat{big-endian}{%
3216 \gtt@tsf@getdmy{#1}%
3217 \ifnum\local@day<100\relax%
3218 \edef\local@day{\gtt@tsf@basecentury\local@day}%
3219 \fi%
3220 \pgfcalendardatetojulian{\local@day-\local@month-\local@year}{#2}%
3221 }
3222
3223 \newgantttimeslotformat{middle-endian}{%
3224 \gtt@tsf@getdmy{#1}%
3225 \ifnum\local@year<100\relax%
3226 \edef\local@year{\gtt@tsf@basecentury\local@year}%
3227 \fi%
3228 \pgfcalendardatetojulian{\local@year-\local@day-\local@month}{#2}%
3229 }
3230
3231 % \end{macrocode}
3232 % \begin{option}{time slot format}
3233 % \begin{intmacro}{\gtt@tsstojulian}
3234 % The key \opt{time slot format}|=|\meta{name} checks whether the format \meta{name} exists and then defines the macro |\gtt@tsstojulian| to be equivalent to\\|\gtt@tsstojulian@|\meta{name}.
3235 % \begin{macrocode}
3236 \ganttset{%
3237 time slot format/.code={%
3238 \@ifundefined{gtt@tsstojulian@#1}{%
3239 \@gtt@PackageError{%
3240 Time slot format `#1' undefined.%
3241 }%
3242 }{}%
3243 \expandafter\let\expandafter\gtt@tsstojulian%
3244 \csname gtt@tsstojulian@#1\endcsname%
3245 },%
3246 time slot format=simple,%
3247 % \end{macrocode}
3248 % \end{intmacro}
3249 % \end{option}
3250 % \begin{option}{time slot format/base century}
3251 % \begin{intmacro}{\gtt@tsf@basecentury}
3252 % \opt{time slot format/base century}|=|\meta{year} extracts the century from the four-digit \meta{year} (e.\,g., 20 from 2000) and stores it in |\gtt@tsf@basecentury|.
3253 % \begin{macrocode}
3254 time slot format/base century/.code={%
3255 \begingroup%
3256 \@tempcnta=#1\relax%
3257 \divide\@tempcnta by100\relax%
3258 \xdef\gtt@tsf@basecentury{\the\@tempcnta}%
3259 \endgroup%
3260 },%
3261 time slot format/base century=2000,%
3262 % \end{macrocode}
3263 % \end{intmacro}
3264 % \end{option}
3265 % \begin{option}{time slot format/start date}
3266 % \begin{intmacro}{\gtt@tsf@startjulian}
3267 % \opt{time slot format/start date}|=|\meta{isodate} stores the Julian date corresponding to \meta{isodate} in |\gtt@tsf@startjulian|.
3268 % \begin{macrocode}
3269 time slot format/start date/.code={%
3270 \begingroup%
3271 \pgfcalendardatetojulian{#1}{\@tempcnta}%
3272 \xdef\gtt@tsf@startjulian{\the\@tempcnta}%
3273 \endgroup%
3274 },%
3275 time slot format/start date=2000-01-01%
3276 }
3277
3278 % \end{macrocode}
3279 % \end{intmacro}
3280 % \end{option}
3281 %
3282 %
3283 % \subsection{The Main Environment}
3284 % \label{ssc:ImplMain}
3285 %
3286 % \begin{option}{x unit}
3287 % \begin{option}{y unit title}
3288 % \begin{option}{y unit chart}
3289 % Keys that store the basis vectors of the chart.
3290 % \begin{macrocode}
3291 \@gtt@keydef{x unit}{.5cm}
3292 \@gtt@keydef{y unit title}{1cm}
3293 \@gtt@keydef{y unit chart}{1cm}
3294 % \end{macrocode}
3295 % \end{option}
3296 % \end{option}
3297 % \end{option}
3298 % \begin{option}{canvas}
3299 % \begin{option}{expand chart}
3300 % \begin{option}{today}
3301 % \begin{option}{today offset}
3302 % \begin{option}{today rule}
3303 % \begin{option}{today label}
3304 % \begin{option}{today label font}
3305 % \begin{option}{today label node}
3306 % Keys related to the canvas and the today rule.
3307 % \begin{macrocode}
3308 \@gtt@stylekeydef{canvas}{shape=rectangle, draw, fill=white}
3309 \@gtt@keydef{expand chart}{none}
3310 \@gtt@keydef{today}{none}
3311 \@gtt@keydef{today offset}{1}
3312 \@gtt@stylekeydef{today rule}{dashed, line width=1pt}
3313 \@gtt@keydef{today label}{TODAY}
3314 \@gtt@keydef{today label font}{\normalfont}
3315 \@gtt@stylekeydef{today label node}{%
3316 anchor=north, font=\ganttvalueof{today label font}%
3317 }
3318 % \end{macrocode}
3319 % \end{option}
3320 % \end{option}
3321 % \end{option}
3322 % \end{option}
3323 % \end{option}
3324 % \end{option}
3325 % \end{option}
3326 % \end{option}
3327 % \begin{intmacro}{\ifgtt@newlineshortcut}
3328 % \begin{option}{newline shortcut}
3329 % Boolean key that determines if |\\| is equivalent to |\ganttnewline|.
3330 % \begin{macrocode}
3331 \newif\ifgtt@newlineshortcut
3332 \ganttset{%
3333 newline shortcut/.is if=gtt@newlineshortcut,%
3334 newline shortcut=true%
3335 }
3336
3337 % \end{macrocode}
3338 % \end{option}
3339 % \end{intmacro}
3340 % \begin{intmacro}{\ifgtt@tikzpicture}
3341 % \begin{intmacro}{\ifgtt@intitle}
3342 % \begin{intmacro}{\gtt@lasttitleslot}
3343 % \begin{intmacro}{\gtt@elementid}
3344 % \begin{intmacro}{\gtt@today@slot}
3345 % \begin{intmacro}{\gtt@startjulian}
3346 % \begin{intmacro}{\gtt@endjulian}
3347 % \begin{intmacro}{\gtt@chartid}
3348 % The boolean |\ifgtt@tikzpicture| is true if a Gantt chart appears within a \TikZ\ picture. |\ifgtt@intitle| is true at the start of a |ganttchart| environment and set to false as soon as the first non-title element is encountered. |\gtt@lasttitleslot| corresponds to the $x$-coordinate of its right border. |\gtt@elementid| enumerates the automatic names of chart elements. |\gtt@today@slot| is the time slot of the today rule. |\gtt@startjulian| and |\gtt@endjulian| contain the Julian dates corresponding to the first and last time slot, respectively. |\gtt@chartid| assigns a consecutive number to each chart.
3349 % \begin{macrocode}
3350 \newif\ifgtt@tikzpicture
3351 \newif\ifgtt@intitle
3352 \newcount\gtt@lasttitleslot
3353 \newcount\gtt@elementid
3354 \newcount\gtt@today@slot
3355 \newcount\gtt@startjulian
3356 \newcount\gtt@endjulian
3357 \newcount\gtt@chartid
3358 % \end{macrocode}
3359 % \end{intmacro}
3360 % \end{intmacro}
3361 % \end{intmacro}
3362 % \end{intmacro}
3363 % \end{intmacro}
3364 % \end{intmacro}
3365 % \end{intmacro}
3366 % \end{intmacro}
3367 % \begin{intmacro}{\gtt@chartextrasize}
3368 % Each |ganttchart| environment writes a |\gtt@chartextrasize|\marg{chart id}\marg{extra size} macro to the auxililary file. This macro stores its second argument in a macro of the form |\@gtt@chart@|\meta{chart id}|@extrasize|. The \meta{extra size} is the size of the chart's bounding box less the size of the canvas, calculated as \opt{x unit} times the number of time slots.
3369 % \begin{macrocode}
3370 \def\gtt@chartextrasize#1#2{%
3371 \global\@namedef{@gtt@chart@#1@extrasize}{#2}%
3372 }
3373 % \end{macrocode}
3374 % \end{intmacro}
3375 % \begin{environment}{ganttchart}
3376 % At the beginning of a |ganttchart| environment, the keys in its optional argument are executed. Initialize the macros and counts that contain start dates, end dates, the chart width, \dots
3377 % \begin{macrocode}
3378 \newenvironment{ganttchart}[3][]{%
3379 \ganttset{#1}%
3380 \gtt@tsstojulian{#2}{\gtt@startjulian}%
3381 \global\gtt@startjulian=\gtt@startjulian\relax%
3382 \gtt@tsstojulian{#3}{\gtt@endjulian}%
3383 \global\gtt@endjulian=\gtt@endjulian\relax%
3384 \pgfcalendarjuliantodate{\gtt@startjulian}%
3385 {\gtt@startyear}{\gtt@startmonth}{\@tempa}%
3386 \xdef\gtt@startyear{\gtt@startyear}%
3387 \xdef\gtt@startmonth{\gtt@startmonth}%
3388 \gtt@juliantotimeslot{\gtt@endjulian}{\gtt@chartwidth}
3389 \global\gtt@chartwidth=\gtt@chartwidth\relax%
3390 % \end{macrocode}
3391 % \dots\ the time slot of the today rule, \dots.
3392 % \begin{macrocode}
3393 \def\@tempa{none}%
3394 \edef\@tempb{\ganttvalueof{today}}%
3395 \ifx\@tempa\@tempb\else%
3396 \gtt@tsstojulian{\ganttvalueof{today}}{\gtt@today@slot}
3397 \gtt@juliantotimeslot{\gtt@today@slot}{\gtt@today@slot}%
3398 \fi%
3399 % \end{macrocode}
3400 % \dots\ the current element number, and information for drawing actions.
3401 % \begin{macrocode}
3402 \global\gtt@elementid=0\relax%
3403 \global\gtt@currentline=0\relax%
3404 \global\gtt@lasttitleline=0\relax%
3405 \global\gtt@lasttitleslot=0\relax%
3406 % \end{macrocode}
3407 % \begin{intmacro}{\gtt@expanded@xunit}
3408 % If \opt{expand chart} contains a value different from |none|, scale the chart so that its $x$-extent equals this value. To this end, use the information stored in the auxiliary file. |\gtt@expanded@xunit| will contain the new value for \opt{x unit}.
3409 % \begin{macrocode}
3410 \def\@tempa{none}%
3411 \edef\@tempb{\ganttvalueof{expand chart}}%
3412 \ifx\@tempa\@tempb\else%
3413 \@ifundefined{@gtt@chart@\the\gtt@chartid @extrasize}{%
3414 \@gtt@PackageWarning{Gantt chart expansion may have changed.
3415 Rerun to get expansion right}%
3416 }{%
3417 \pgfmathparse{(\ganttvalueof{expand chart}%
3418 - \@nameuse{@gtt@chart@\the\gtt@chartid @extrasize})%
3419 / \gtt@chartwidth}%
3420 \edef\gtt@expanded@xunit{\pgfmathresult pt}%
3421 \ganttset{x unit=\gtt@expanded@xunit}%
3422 }%
3423 \fi%
3424 % \end{macrocode}
3425 % \end{intmacro}
3426 % \begin{macro}{\\}
3427 % \begin{macro}{\ganttalignnewline}
3428 % If a |ganttchart| appears outside of a |tikzpicture|, we implicitly start this environment. ``Within a |tikzpicture|'' means that |\useasboundingbox| is defined. Since we expect a chart to start with at least one title element, |\ifgtt@intitle| is true. If \opt{newline shortcut} is true, make the control symbol |\\| equivalent to |\ganttnewline|. In any case, |\ganttalignnewline| is defined.
3429 % \begin{macrocode}
3430 \@ifundefined{useasboundingbox}%
3431 {\gtt@tikzpicturefalse\begin{tikzpicture}}%
3432 {\gtt@tikzpicturetrue}%
3433 \gtt@intitletrue%
3434 \ifgtt@newlineshortcut%
3435 \let\\\ganttnewline%
3436 \fi%
3437 \let\ganttalignnewline\tikz@align@newline%
3438 }{
3439 % \end{macrocode}
3440 % \end{macro}
3441 % \end{macro}
3442 % \begin{intmacro}{\y@upper}
3443 % \begin{intmacro}{\y@lower}
3444 % \begin{intmacro}{\y@mid}
3445 % \begin{intmacro}{\y@size}
3446 % \begin{intmacro}{\x@size}
3447 % After the contents of the environment have been drawn, we add the canvas to the background layer. \pack{pgfgantt} saves $x$- and $y$-coordinates in local internal macros called |\x@left|, |\x@right|, |\x@mid|, |\x@size|, |\y@upper|, |\y@lower|, |\y@mid| and |\y@size|.
3448 % \begin{macrocode}
3449 \begin{scope}[on background layer]%
3450 \ifgtt@includetitle%
3451 \def\y@upper{0}%
3452 \else%
3453 \pgfmathsetmacro\y@upper{%
3454 \gtt@lasttitleline * \ganttvalueof{y unit title}%
3455 }%
3456 \fi%
3457 \pgfmathsetmacro\y@lower{%
3458 \gtt@lasttitleline * \ganttvalueof{y unit title}%
3459 + (\gtt@currentline - \gtt@lasttitleline - 1)%
3460 * \ganttvalueof{y unit chart}%
3461 }%
3462 \pgfmathsetmacro\y@mid{%
3463 (\y@upper + \y@lower) / 2%
3464 }%
3465 \pgfmathsetmacro\y@size{%
3466 abs(\y@lower - \y@upper)%
3467 }%
3468 \pgfmathsetmacro\x@size{%
3469 \gtt@chartwidth * \ganttvalueof{x unit}%
3470 }%
3471 \node [/pgfgantt/canvas, minimum width=\x@size pt,
3472 minimum height=\y@size pt]
3473 at (\x@size pt / 2, \y@mid pt) {};%
3474 % \end{macrocode}
3475 % \end{intmacro}
3476 % \end{intmacro}
3477 % \end{intmacro}
3478 % \end{intmacro}
3479 % \end{intmacro}
3480 % The contents of the vertical grid style list are evaluated at most |\gtt@chartwidth|-times, but the loop breaks as soon as all grid lines have been drawn.
3481 % \begin{macrocode}
3482 \pgfmathsetmacro\y@upper{%
3483 \gtt@lasttitleline * \ganttvalueof{y unit title}%
3484 }%
3485 \ifgtt@vgrid
3486 \gtt@currgrid=1\relax%
3487 \global\advance\gtt@chartwidth by-1\relax%
3488 \foreach \x in {1,...,\gtt@chartwidth} {%
3489 \expandafter\gtt@vgrid@do\gtt@vgridstyle,\relax,%
3490 \ifnum\gtt@currgrid>\gtt@chartwidth\relax\breakforeach\fi%
3491 }%
3492 \global\advance\gtt@chartwidth by1\relax%
3493 \fi%
3494 % \end{macrocode}
3495 % Now, we draw the horizontal grid. If we exclude the title from the canvas, we omit the uppermost horizontal grid line since it would coincide with the canvas border.
3496 % \begin{macrocode}
3497 \ifgtt@hgrid%
3498 \gtt@currgrid=\gtt@lasttitleline\relax%
3499 \ifgtt@includetitle\else%
3500 \advance\gtt@currgrid by-1\relax
3501 \fi%
3502 \edef\@tempa{\the\gtt@currgrid}%
3503 \foreach \t in {\@tempa,...,\gtt@currentline} {%
3504 \expandafter\gtt@hgrid@do\gtt@hgridstyle,\relax,%
3505 \ifnum\gtt@currgrid<\gtt@currentline\relax\breakforeach\fi%
3506 }%
3507 \fi%
3508 % \end{macrocode}
3509 % \begin{intmacro}{\x@mid}
3510 % The last task of |ganttchart| is to apply the |today| key if its value differs from |none|.
3511 % \begin{macrocode}
3512 \def\@tempa{none}%
3513 \edef\@tempb{\ganttvalueof{today}}%
3514 \ifx\@tempa\@tempb\else%
3515 \pgfmathsetmacro\x@mid{%
3516 (\gtt@today@slot - 1 + \ganttvalueof{today offset})%
3517 * \ganttvalueof{x unit}%
3518 }%
3519 \draw [/pgfgantt/today rule]
3520 (\x@mid pt, \y@upper pt) -- (\x@mid pt, \y@lower pt)
3521 node [/pgfgantt/today label node] {\ganttvalueof{today label}};%
3522 \fi%
3523 \end{scope}%
3524 % \end{macrocode}
3525 % \end{intmacro}
3526 % Store the $x$-extent of the bounding box in |\@tempdima|. Calculate the size by which the bounding box exceeds the ``raw'' canvas size. Write this information to the auxiliary file.
3527 % \begin{macrocode}
3528 \pgfextractx{\@tempdima}{%
3529 \pgfpointdiff{\pgfpointanchor{current bounding box}{south west}}%
3530 {\pgfpointanchor{current bounding box}{north east}}%
3531 }%
3532 \pgfmathparse{\@tempdima -\ganttvalueof{x unit} * \gtt@chartwidth}%
3533 \protected@write\@auxout{}{%
3534 \string\gtt@chartextrasize{\the\gtt@chartid}{\pgfmathresult pt}}%
3535 % \end{macrocode}
3536 % Increase the chart counter.
3537 % \begin{macrocode}
3538 \global\advance\gtt@chartid by1\relax%
3539 % \end{macrocode}
3540 % At the end of a |ganttchart|, we also close the |tikzpicture| if we started it implicitly.
3541 % \begin{macrocode}
3542 \ifgtt@tikzpicture\else\end{tikzpicture}\fi%
3543 }
3544
3545 % \end{macrocode}
3546 % \end{environment}
3547 %
3548 %
3549 % \subsection{Starting a New Line}
3550 %
3551 % \begin{macro}{\ganttnewline}
3552 % \begin{intmacro}{\local@drawarg}
3553 % Unless the optional argument of |\ganttnewline| is empty, this macro adds a horizontal grid rule between the current and the new line. The style of this line, which is stored in |\local@drawarg|, is either |hgrid style| or the style specified in the optional argument. Anyway, |\ganttnewline| decreases |\gtt@currentline| and, if we are still in the title, |\gtt@lasttitleline|. Since the new line starts at time slot zero, |\gtt@lasttitleslot| is reset.
3554 % \begin{macrocode}
3555 \newcommand\ganttnewline[1][]{%
3556 \begingroup%
3557 \def\local@drawarg{#1}%
3558 \def\@tempa{grid}%
3559 \ifx\local@drawarg\@empty\else%
3560 \ifx\local@drawarg\@tempa%
3561 \def\local@drawarg{/pgfgantt/hgrid style}%
3562 \fi%
3563 \pgfmathsetmacro\y@upper{%
3564 \gtt@lasttitleline * \ganttvalueof{y unit title}%
3565 + (\gtt@currentline - \gtt@lasttitleline - 1)%
3566 * \ganttvalueof{y unit chart}%
3567 }
3568 \expandafter\draw\expandafter[\local@drawarg]
3569 (0pt, \y@upper pt) --
3570 (\gtt@chartwidth * \ganttvalueof{x unit}, \y@upper pt);%
3571 \fi%
3572 \global\advance\gtt@currentline by-1\relax%
3573 \ifgtt@intitle\global\advance\gtt@lasttitleline by-1\relax\fi%
3574 \global\gtt@lasttitleslot=0\relax%
3575 \endgroup%
3576 }
3577
3578 % \end{macrocode}
3579 % \end{intmacro}
3580 % \end{macro}
3581 %
3582 %
3583 % \subsection{Vertical rules}
3584 %
3585 % \begin{option}{vrule offset}
3586 % \begin{option}{vrule}
3587 % \begin{option}{vrule label font}
3588 % \begin{option}{vrule label node}
3589 % Keys related to the vertical rules.
3590 % \begin{macrocode}
3591 \@gtt@keydef{vrule offset}{1}
3592 \@gtt@stylekeydef{vrule}{dashed, line width=1pt}
3593 \@gtt@keydef{vrule label font}{\normalfont}
3594 \@gtt@stylekeydef{vrule label node}{%
3595 anchor=north, font=\ganttvalueof{vrule label font}%
3596 }
3597
3598 % \end{macrocode}
3599 % \end{option}
3600 % \end{option}
3601 % \end{option}
3602 % \end{option}
3603 % \begin{intmacro}{\gtt@vrule@slot}
3604 % A count for storing the vrule time slot.
3605 % \begin{macrocode}
3606 \newcount\gtt@vrule@slot
3607
3608 % \end{macrocode}
3609 % \end{intmacro}
3610 % \begin{macro}{\ganttvrule}
3611 % Calculate the coordinates for the vertical rule and draw it.
3612 % \begin{macrocode}
3613 \newcommand\ganttvrule[3][]{%
3614 \begingroup
3615 \ganttset{#1}
3616 \gtt@tsstojulian{#3}{\gtt@vrule@slot}%
3617 \gtt@juliantotimeslot{\gtt@vrule@slot}{\gtt@vrule@slot}%
3618 \pgfmathsetmacro\y@upper{%
3619 \gtt@lasttitleline * \ganttvalueof{y unit title}%
3620 }%
3621 \pgfmathsetmacro\y@lower{%
3622 \gtt@lasttitleline * \ganttvalueof{y unit title}%
3623 + (\gtt@currentline - \gtt@lasttitleline - 1)%
3624 * \ganttvalueof{y unit chart}%
3625 }%
3626 \pgfmathsetmacro\x@mid{%
3627 (\gtt@vrule@slot - 1 + \ganttvalueof{vrule offset})%
3628 * \ganttvalueof{x unit}%
3629 }%
3630 \draw [/pgfgantt/vrule]
3631 (\x@mid pt, \y@upper pt) -- (\x@mid pt, \y@lower pt)
3632 node [/pgfgantt/vrule label node] {#2};%
3633 \endgroup
3634 }
3635
3636 % \end{macrocode}
3637 % \end{macro}
3638 %
3639 %
3640 % \subsection{Titles}
3641 %
3642 % \begin{option}{title}
3643 % \begin{option}{title label font}
3644 % \begin{option}{title label node}
3645 % \begin{option}{title label text}
3646 % \begin{intmacro}{\gtt@titlelabeltext}
3647 % \begin{option}{title list options}
3648 % \begin{intmacro}{\gtt@titlelistoptions}
3649 % \begin{option}{title left shift}
3650 % \begin{option}{title right shift}
3651 % \begin{option}{title top shift}
3652 % \begin{option}{title height}
3653 % \begin{option}{include title in canvas}
3654 % \begin{intmacro}{\ifgtt@includetitle}
3655 % Keys that influence title elements. The parameter token |#1| in the value of \opt{title label text} is replaced by the argument of |\gtt@titlelabeltext|. Note that |\@gtt@keydef| cannot define \opt{title list options}, since |\@gtt@titlelistoptions| is expanded after a |\foreach| statement, where |\ganttvalueof| will not work.
3656 % \begin{macrocode}
3657 \@gtt@stylekeydef{title}{shape=rectangle, inner sep=0pt, draw, fill=white}
3658 \@gtt@keydef{title label font}{\small}
3659 \@gtt@stylekeydef{title label node}{%
3660 anchor=center, font=\ganttvalueof{title label font}%
3661 }
3662 \ganttset{%
3663 title label text/.code={%
3664 \def\gtt@titlelabeltext##1{#1}%
3665 },%
3666 title label text=\strut#1,%
3667 title list options/.code={%
3668 \def\gtt@titlelistoptions{[#1]}%
3669 },%
3670 title list options={var=\x, evaluate=\x}%
3671 }
3672 \@gtt@keydef{title left shift}{0}
3673 \@gtt@keydef{title right shift}{0}
3674 \@gtt@keydef{title top shift}{0}
3675 \@gtt@keydef{title height}{.6}
3676 \newif\ifgtt@includetitle
3677 \ganttset{%
3678 include title in canvas/.is if=gtt@includetitle,%
3679 include title in canvas
3680 }
3681 % \end{macrocode}
3682 % \end{intmacro}
3683 % \end{option}
3684 % \end{option}
3685 % \end{option}
3686 % \end{option}
3687 % \end{option}
3688 % \end{intmacro}
3689 % \end{option}
3690 % \end{intmacro}
3691 % \end{option}
3692 % \end{option}
3693 % \end{option}
3694 % \end{option}
3695 % \begin{option}{calendar week text}
3696 % \begin{option}{time slot unit}
3697 % \begin{intmacro}{\ifgtt@timeslotunit@day}
3698 % \begin{intmacro}{\ifgtt@timeslotunit@month}
3699 % \begin{intmacro}{\ifgtt@timeslotunit@year}
3700 % Keys for title calendars.
3701 % \begin{macrocode}
3702 \@gtt@keydef{calendar week text}{Week~\currentweek}
3703 \newif\ifgtt@timeslotunit@day
3704 \newif\ifgtt@timeslotunit@month
3705 \newif\ifgtt@timeslotunit@year
3706 \ganttset{%
3707 time slot unit/.is choice,
3708 time slot unit/day/.code={%
3709 \gtt@timeslotunit@daytrue%
3710 \gtt@timeslotunit@monthfalse%
3711 \gtt@timeslotunit@yearfalse%
3712 },%
3713 time slot unit/month/.code={%
3714 \gtt@timeslotunit@dayfalse%
3715 \gtt@timeslotunit@monthtrue%
3716 \gtt@timeslotunit@yearfalse%
3717 },%
3718 time slot unit/year/.code={%
3719 \gtt@timeslotunit@dayfalse%
3720 \gtt@timeslotunit@monthfalse%
3721 \gtt@timeslotunit@yeartrue%
3722 },%
3723 time slot unit=day
3724 }
3725
3726 % \end{macrocode}
3727 % \end{intmacro}
3728 % \end{intmacro}
3729 % \end{intmacro}
3730 % \end{option}
3731 % \end{option}
3732 % \begin{macro}{\gantttitle}
3733 % \begin{intmacro}{\x@left}
3734 % \begin{intmacro}{\x@right}
3735 % |\gantttitle| draws a title element (i.\,e., a rectangle with a single node at its center). For reasons that will become clear below, the element essentially starts at the $x$-coordinate stored in |\gtt@lasttitleslot|. This count is updated at the end of the macro.
3736 % \begin{macrocode}
3737 \newcommand\gantttitle[3][]{%
3738 \begingroup%
3739 \ganttset{#1}%
3740 \pgfmathsetmacro\x@left{%
3741 (\gtt@lasttitleslot + \ganttvalueof{title left shift})%
3742 * \ganttvalueof{x unit}%
3743 }%
3744 \pgfmathsetmacro\x@right{%
3745 (\gtt@lasttitleslot + #3 + \ganttvalueof{title right shift})%
3746 * \ganttvalueof{x unit}%
3747 }%
3748 \pgfmathsetmacro\x@mid{%
3749 (\x@left + \x@right) / 2%
3750 }%
3751 \pgfmathsetmacro\x@size{%
3752 \x@right - \x@left%
3753 }%
3754 \pgfmathsetmacro\y@upper{%
3755 (\gtt@currentline - \ganttvalueof{title top shift})%
3756 * \ganttvalueof{y unit title}%
3757 }%
3758 \pgfmathsetmacro\y@lower{%
3759 (\gtt@currentline - \ganttvalueof{title top shift}%
3760 - \ganttvalueof{title height}) * \ganttvalueof{y unit title}%
3761 }%
3762 \pgfmathsetmacro\y@mid{%
3763 (\y@upper + \y@lower) / 2%
3764 }%
3765 \pgfmathsetmacro\y@size{%
3766 \y@upper - \y@lower%
3767 }%
3768 \path (\x@mid pt, \y@mid pt)
3769 node [/pgfgantt/title, minimum width=\x@size pt,
3770 minimum height=\y@size pt] {}
3771 node [/pgfgantt/title label node] {\gtt@titlelabeltext{#2}};%
3772 \global\advance\gtt@lasttitleslot by#3\relax%
3773 \endgroup%
3774 }
3775
3776 % \end{macrocode}
3777 % \end{intmacro}
3778 % \end{intmacro}
3779 % \end{macro}
3780 % \begin{macro}{\gantttitlelist}
3781 % |\gantttitlelist| generates title elements by repeatedly calling |\gantttitle|. Since the latter always starts after the last time slot occupied by the previous element, |\gantttitlelist| does not have to calculate the respective $x$-coordinates explicitly.
3782 % \begin{macrocode}
3783 \newcommand\gantttitlelist[3][]{%
3784 \begingroup%
3785 \ganttset{#1}%
3786 \expandafter\foreach\gtt@titlelistoptions in {#2} {\gantttitle{\x}{#3}}%
3787 \endgroup%
3788 }
3789
3790 % \end{macrocode}
3791 % \end{macro}
3792 % \begin{intmacro}{\ifgtt@titlecalendarstar}
3793 % \begin{macro}{\gantttitlecalendar}
3794 % \begin{macro}{\gantttitlecalendar*}
3795 % |\gantttitlecalendar| checks whether it is invoked in the starred or nonstarred form, sets |\ifgtt@titlecalendarstar| accordingly and then starts a command relaying chain.
3796 % \begin{macrocode}
3797 \newif\ifgtt@titlecalendarstar
3798 \newcommand\gantttitlecalendar{%
3799 \@gtt@ifstar%
3800 {\gtt@titlecalendarstartrue\@gantttitlecalendar}%
3801 {\gtt@titlecalendarstarfalse\@gantttitlecalendar}%
3802 }
3803
3804 % \end{macrocode}
3805 % \end{macro}
3806 % \end{macro}
3807 % \end{intmacro}
3808 % \begin{intmacro}{\@gantttitlecalendar}
3809 % The first command in the relaying chain, |\@gantttitlecalendar|\oarg{options}, processes the \meta{options}. If it was executed by the starred form of |\gantttitlecalendar|, it calls the second command in the chain. Otherwise, it directly calls the third command in the chain.
3810 % \begin{macrocode}
3811 \newcommand\@gantttitlecalendar[1][]{
3812 \begingroup%
3813 \ganttset{#1}%
3814 \ifgtt@titlecalendarstar%
3815 \expandafter\@@gantttitlecalendar%
3816 \else%
3817 \expandafter\@@@gantttitlecalendar\expandafter%
3818 {\expandafter\gtt@startjulian\expandafter}\expandafter%
3819 {\expandafter\gtt@endjulian\expandafter}%
3820 \fi%
3821 }
3822
3823 % \end{macrocode}
3824 % \end{intmacro}
3825 % \begin{intmacro}{\@@gantttitlecalendar}
3826 % The second command in the relaying chain,\\|\@@gantttitlecalendar|\marg{start tss}\marg{end tss},\\reads two mandatory arguments from the input stream and converts them to Julian dates. Finally, it calls the third command in the chain.
3827 % \begin{macrocode}
3828 \newcommand\@@gantttitlecalendar[2]{
3829 \gtt@tsstojulian{#1}{\@tempcnta}%
3830 \gtt@tsstojulian{#2}{\@tempcntb}%
3831 \@@@gantttitlecalendar{\@tempcnta}{\@tempcntb}%
3832 }
3833
3834 % \end{macrocode}
3835 % \end{intmacro}
3836 % \begin{intmacro}{\@@@gantttitlecalendar}
3837 % \begin{intmacro}{\gtt@calendar@startdate}
3838 % \begin{intmacro}{\gtt@calendar@enddate}
3839 % The third and last command in the relaying chain, |\@@@gantttitlecalendar|\marg{start Julian}\marg{end Julian}\marg{calendar lines}, stores the start and end ISO-standard dates of the calendar in |\gtt@calendar@startdate| and |\gtt@calendar@enddate|, respectively. Then, it executes the keys in \meta{calendar lines}, which reside in path |/pgfgantt/calendar|.
3840 % \begin{macrocode}
3841 \newcommand\@@@gantttitlecalendar[3]{%
3842 \pgfcalendarjuliantodate{#1}{\@tempa}{\@tempb}{\@tempc}%
3843 \edef\gtt@calendar@startdate{\@tempa-\@tempb-\@tempc}%
3844 \pgfcalendarjuliantodate{#2}{\@tempa}{\@tempb}{\@tempc}%
3845 \edef\gtt@calendar@enddate{\@tempa-\@tempb-\@tempc}%
3846 \gtt@calendar@eolfalse%
3847 \pgfqkeys{/pgfgantt/calendar}{#3}%
3848 \endgroup%
3849 }
3850 % \end{macrocode}
3851 % \end{intmacro}
3852 % \end{intmacro}
3853 % \end{intmacro}
3854 % \begin{intmacro}{\ifgtt@calendar@eol}
3855 % \begin{intmacro}{\gtt@calendar@slots}
3856 % \begin{intmacro}{\gtt@calendar@weeknumber}
3857 % \begin{intmacro}{\gtt@calendar@startofweek}
3858 % Booleans and counts for drawing title calendars: |\ifgtt@calendar@eol| is true if |\ganttcalendar| should start a new calendar line. |\gtt@calendar@slots| is the number of time slots a calendar element will cover. |\gtt@calendar@weeknumber| is the current week number in a calendar line of type |week|. |\gtt@calendar@startofweek| is the Julian date of the Monday in the current week.
3859 % \begin{macrocode}
3860 \newif\ifgtt@calendar@eol
3861 \newcount\gtt@calendar@slots
3862 \newcount\gtt@calendar@weeknumber
3863 \newcount\gtt@calendar@startofweek
3864 % \end{macrocode}
3865 % \end{intmacro}
3866 % \end{intmacro}
3867 % \end{intmacro}
3868 % \end{intmacro}
3869 % \begin{intmacro}{\@gtt@getfourthdigit}
3870 % \begin{intmacro}{\@gtt@getdecade}
3871 % |\@gtt@getfourthdigit| returns the fourth digit of a year, while |\@gtt@getdecade| returns the first three digits of a year.
3872 % \begin{macrocode}
3873 \def\@gtt@getfourthdigit#1#2#3#4{#4}
3874 \def\@gtt@getdecade#1#2#3#4{#1#2#3}
3875 % \end{macrocode}
3876 % \end{intmacro}
3877 % \end{intmacro}
3878 % We define a new check for |\pgfcalendarifdate| as described in the |pgfcalendar| manual: |end of decade=|\meta{date} returns true if a date marks the end of a decade as defined by \meta{date}. For instance, if \meta{date} is |2009-12-31|, then the conditional will be true for the dates |1999-12-31|, |2009-12-31|, |2019-12-31| and so on.
3879 % \begin{macrocode}
3880 \pgfkeys{%
3881 /pgf/calendar/end of decade/.code={
3882 \begingroup
3883 \pgfcalendardatetojulian{#1}{\@tempcnta}
3884 \pgfcalendarjuliantodate{\@tempcnta}{\@tempa}{\@tempb}{\@tempc}
3885 \edef\endofdecade{\expandafter\@gtt@getfourthdigit\@tempa}
3886 \edef\querydecade{\expandafter\@gtt@getfourthdigit\pgfcalendarifdateyear}
3887 \ifnum\endofdecade=\querydecade\relax%
3888 \ifnum\pgfcalendarifdatemonth=\@tempb\relax%
3889 \ifnum\pgfcalendarifdateday=\@tempc\relax%
3890 \global\pgfcalendarmatchestrue%
3891 \fi%
3892 \fi%
3893 \fi%
3894 \endgroup
3895 }%
3896 }
3897 % \end{macrocode}
3898
3899 % For each \meta{line type}, we define a corresponding key |/pgfgantt/calendar/|\meta{line type}. This key performs the necessary calculations and draws one or several |\gantttitle|s. Line type |decade| draws decades.
3900 % \begin{macrocode}
3901 \ganttset{%
3902 calendar/decade/.code={%
3903 \ifgtt@calendar@eol\ganttnewline\fi%
3904 \begingroup%
3905 \gtt@calendar@slots=1\relax%
3906 \ifgtt@timeslotunit@year%
3907 \pgfcalendar{}{\gtt@calendar@startdate}{\gtt@calendar@enddate}{%
3908 \ifdate{end of decade=2009-12-31}{%
3909 \gantttitle{%
3910 \expandafter\@gtt@getdecade\pgfcalendarcurrentyear%
3911 0s%
3912 }{\the\gtt@calendar@slots}%
3913 \gtt@calendar@slots=0\relax%
3914 }{
3915 \ifdate{equals=01-01}{%
3916 \ifnum\pgfcalendarcurrentjulian>\pgfcalendarbeginjulian\relax%
3917 \advance\gtt@calendar@slots by1\relax%
3918 \fi
3919 }{}%
3920 }%
3921 \ifdate{equals=\pgfcalendarendiso}{%
3922 \ifnum\gtt@calendar@slots=0\relax\else%
3923 \gantttitle{%
3924 \expandafter\@gtt@getdecade\pgfcalendarcurrentyear%
3925 0s%
3926 }{\the\gtt@calendar@slots}%
3927 \fi%
3928 }{}%
3929 }%
3930 \fi%
3931 \endgroup%
3932 \gtt@calendar@eoltrue%
3933 },%
3934 % \end{macrocode}
3935 % Line type |year| draws years.
3936 % \begin{macrocode}
3937 calendar/year/.code={%
3938 \ifgtt@calendar@eol\ganttnewline\fi%
3939 \begingroup%
3940 \gtt@calendar@slots=1\relax%
3941 \ifgtt@timeslotunit@year%
3942 \pgfcalendar{}{\gtt@calendar@startdate}{\gtt@calendar@enddate}{%
3943 \ifdate{equals=12-31}{%
3944 \gantttitle{\pgfcalendarcurrentyear}{1}%
3945 \gtt@calendar@slots=1\relax%
3946 }{
3947 \advance\gtt@calendar@slots by1\relax%
3948 }%
3949 \ifdate{equals=\pgfcalendarendiso}{%
3950 \ifnum\gtt@calendar@slots=1\relax\else%
3951 \gantttitle{\pgfcalendarcurrentyear}{1}%
3952 \fi%
3953 }{}%
3954 }%
3955 \fi%
3956 \ifgtt@timeslotunit@month%
3957 \pgfcalendar{}{\gtt@calendar@startdate}{\gtt@calendar@enddate}{%
3958 \ifdate{equals=12-31}{%
3959 \gantttitle{\pgfcalendarcurrentyear}{\the\gtt@calendar@slots}%
3960 \gtt@calendar@slots=1\relax%
3961 }{%
3962 \ifdate{end of month=1}{%
3963 \advance\gtt@calendar@slots by1\relax%
3964 }{}%
3965 }%
3966 \ifdate{equals=\pgfcalendarendiso}{%
3967 \ifdate{end of month=1}{%
3968 \advance\gtt@calendar@slots by-1\relax%
3969 }{}%
3970 \ifdate{equals=12-31}{}{%
3971 \gantttitle{\pgfcalendarcurrentyear}{\the\gtt@calendar@slots}%
3972 }%
3973 }{}%
3974 }%
3975 \fi%
3976 \ifgtt@timeslotunit@day%
3977 \pgfcalendar{}{\gtt@calendar@startdate}{\gtt@calendar@enddate}{%
3978 \ifdate{equals=12-31}{%
3979 \gantttitle{\pgfcalendarcurrentyear}{\the\gtt@calendar@slots}%
3980 \gtt@calendar@slots=1\relax%
3981 }{%
3982 \advance\gtt@calendar@slots by1\relax%
3983 }%
3984 \ifdate{equals=\pgfcalendarendiso}{%
3985 \ifnum\gtt@calendar@slots=1\relax\else%
3986 \advance\gtt@calendar@slots by-1\relax%
3987 \gantttitle{\pgfcalendarcurrentyear}{\the\gtt@calendar@slots}%
3988 \fi%
3989 }{}%
3990 }%
3991 \fi%
3992 \endgroup%
3993 \gtt@calendar@eoltrue%
3994 },%
3995 % \end{macrocode}
3996 % Line type |month|=\meta{format} draws months. Internally, a month is represented by a number between 1 (January) and 12 (December). However, when the title element is drawn, this number is fed to the macro |\pgfcalendarmonth|\meta{format} and possibly converted.
3997 % \begin{macrocode}
3998 calendar/month/.code={%
3999 \ifgtt@calendar@eol\ganttnewline\fi%
4000 \begingroup%
4001 \gtt@calendar@slots=1\relax%
4002 \pgfcalendar{}{\gtt@calendar@startdate}{\gtt@calendar@enddate}{%
4003 \ifdate{end of month=1}{%
4004 \gantttitle{%
4005 \csname pgfcalendarmonth#1\endcsname{\pgfcalendarcurrentmonth}%
4006 }{%
4007 \ifgtt@timeslotunit@month1\fi%
4008 \ifgtt@timeslotunit@day\the\gtt@calendar@slots\fi%
4009 }%
4010 \gtt@calendar@slots=1\relax%
4011 }{%
4012 \advance\gtt@calendar@slots by1\relax%
4013 }%
4014 \ifdate{equals=\pgfcalendarendiso}{%
4015 \ifnum\gtt@calendar@slots=1\relax\else%
4016 \advance\gtt@calendar@slots by-1\relax%
4017 \gantttitle{%
4018 \csname pgfcalendarmonth#1\endcsname{\pgfcalendarcurrentmonth}%
4019 }{%
4020 \ifgtt@timeslotunit@month1\fi%
4021 \ifgtt@timeslotunit@day\the\gtt@calendar@slots\fi%
4022 }%
4023 \fi%
4024 }{}%
4025 }%
4026 \endgroup%
4027 \gtt@calendar@eoltrue%
4028 },%
4029 % \end{macrocode}
4030 % \begin{macro}{\startyear}
4031 % \begin{macro}{\startmonth}
4032 % \begin{macro}{\startday}
4033 % \begin{macro}{\currentweek}
4034 % Line type |week|=\meta{number} draws weeks. The first week receives \meta{number}, which is also saved in |\currentweek|. This key also defines the macros |\startyear|, |\startmonth| and |\startday|, which store the year, month and day of the current week's Monday. These four macros can be used in the value of \opt{calendar week text}.
4035 % \begin{macrocode}
4036 calendar/week/.code={%
4037 \ifgtt@calendar@eol\ganttnewline\fi%
4038 \begingroup%
4039 \gtt@calendar@slots=1\relax%
4040 \gtt@calendar@weeknumber=#1\relax%
4041 \pgfcalendar{}{\gtt@calendar@startdate}{\gtt@calendar@enddate}{%
4042 \ifdate{Sunday}{%
4043 \gtt@calendar@startofweek=\pgfcalendarcurrentjulian\relax%
4044 \advance\gtt@calendar@startofweek by1\relax%
4045 \advance\gtt@calendar@startofweek by-\gtt@calendar@slots\relax%
4046 \pgfcalendarjuliantodate{\gtt@calendar@startofweek}%
4047 {\startyear}{\startmonth}{\startday}%
4048 \def\currentweek{\the\gtt@calendar@weeknumber}%
4049 \gantttitle{%
4050 \ganttvalueof{calendar week text}%
4051 }{%
4052 \the\gtt@calendar@slots%
4053 }%
4054 \gtt@calendar@slots=1\relax%
4055 \advance\gtt@calendar@weeknumber by1\relax%
4056 }{%
4057 \advance\gtt@calendar@slots by1%
4058 }%
4059 \ifdate{equals=\pgfcalendarendiso}{%
4060 \ifnum\gtt@calendar@slots=1\relax\else%
4061 \advance\gtt@calendar@slots by-1\relax%
4062 \gtt@calendar@startofweek=\pgfcalendarcurrentjulian\relax%
4063 \advance\gtt@calendar@startofweek by1\relax%
4064 \advance\gtt@calendar@startofweek by-\gtt@calendar@slots\relax%
4065 \pgfcalendarjuliantodate{\gtt@calendar@startofweek}%
4066 {\startyear}{\startmonth}{\startday}%
4067 \def\currentweek{\the\gtt@calendar@weeknumber}%
4068 \gantttitle{%
4069 \ganttvalueof{calendar week text}%
4070 }{%
4071 \the\gtt@calendar@slots%
4072 }%
4073 \fi%
4074 }{}%
4075 }%
4076 \endgroup%
4077 \gtt@calendar@eoltrue%
4078 },%
4079 calendar/week/.default=1,%
4080 % \end{macrocode}
4081 % \end{macro}
4082 % \end{macro}
4083 % \end{macro}
4084 % \end{macro}
4085 % Line type |weekday|=\meta{format} draws weekdays. Internally, a weekday is represented by a number between 0 (Monday) and 6 (Sunday). However, when the title element is drawn, this number is fed to the macro |\pgfcalendarweekday|\meta{format} and possibly converted.
4086 % \begin{macrocode}
4087 calendar/weekday/.code={%
4088 \ifgtt@calendar@eol\ganttnewline\fi%
4089 \begingroup%
4090 \pgfcalendar{}{\gtt@calendar@startdate}{\gtt@calendar@enddate}{%
4091 \gantttitle{%
4092 \csname pgfcalendarweekday#1\endcsname{\pgfcalendarcurrentweekday}%
4093 }{1}%
4094 }%
4095 \endgroup%
4096 \gtt@calendar@eoltrue%
4097 },%
4098 % \end{macrocode}
4099 % Line type |day|=\meta{format} draws days of the month.
4100 % \begin{macrocode}
4101 calendar/day/.code={%
4102 \ifgtt@calendar@eol\ganttnewline\fi%
4103 \begingroup%
4104 \pgfcalendar{}{\gtt@calendar@startdate}{\gtt@calendar@enddate}{%
4105 \gantttitle{\pgfcalendarcurrentday}{1}%
4106 }%
4107 \endgroup%
4108 \gtt@calendar@eoltrue%
4109 }%
4110 }
4111
4112 % \end{macrocode}
4113 %
4114 %
4115 % \subsection{Chart Elements}
4116 %
4117 % \begin{option}{progress}
4118 % \begin{intmacro}{\gtt@progress}
4119 % \begin{option}{progress label text}
4120 % \begin{intmacro}{\gtt@progresslabeltext}
4121 % \begin{option}{name}
4122 % \begin{option}{chart element start border}
4123 % \begin{intmacro}{\ifgtt@ce@startatleftborder}
4124 % \begin{option}{inline}
4125 % \begin{intmacro}{\ifgtt@inline}
4126 % Keys that apply to all chart elements. The parameter token |#1| in the value of \opt{progress label text} is replaced by the argument of |\gtt@progresslabeltext|.
4127 % \begin{macrocode}
4128 \ganttset{%
4129 progress/.code={%
4130 \def\gtt@progress{#1}%
4131 },%
4132 progress=none,%
4133 progress label text/.code={%
4134 \def\gtt@progresslabeltext##1{#1}%
4135 },%
4136 progress label text={%
4137 \pgfmathprintnumber[precision=0, verbatim]{#1}\% complete%
4138 }%
4139 }
4140 \@gtt@keydef{name}{}
4141 \newif\ifgtt@ce@startatleftborder
4142 \ganttset{%
4143 chart element start border/.is choice,%
4144 chart element start border/left/.code=\gtt@ce@startatleftbordertrue,%,
4145 chart element start border/right/.code=\gtt@ce@startatleftborderfalse,%
4146 chart element start border=left%
4147 }
4148 \newif\ifgtt@inline
4149 \ganttset{%
4150 inline/.is if=gtt@inline,%
4151 inline=false%
4152 }
4153
4154 % \end{macrocode}
4155 % \end{intmacro}
4156 % \end{option}
4157 % \end{intmacro}
4158 % \end{option}
4159 % \end{option}
4160 % \end{intmacro}
4161 % \end{option}
4162 % \end{intmacro}
4163 % \end{option}
4164 % \begin{intmacro}{\gtt@lastelement}
4165 % \begin{intmacro}{\gtt@currentelement}
4166 % \begin{intmacro}{\ifgtt@draw@complete}
4167 % \begin{intmacro}{\ifgtt@draw@incomplete}
4168 % \begin{intmacro}{\ifgtt@draw@clip}
4169 % \begin{intmacro}{\gtt@left@slot}
4170 % \begin{intmacro}{\gtt@right@slot}
4171 % The macros |\gtt@lastelement| and |\gtt@currentelement| save the name of the current and last chart element drawn. Thereby, the |\ganttlinked...| macros can add a link connecting them. |\ifgtt@draw@complete|, |\ifgtt@draw@incomplete| and |\ifgtt@draw@clip| decide whether to draw the complete and incomplete part of a chart element and if these parts are clipped. |\gtt@left@slot| and |\gtt@right@slot| store a chart element's start and end time slot, respectively.
4172 % \begin{macrocode}
4173 \def\gtt@lastelement{}
4174 \def\gtt@currentelement{}
4175 \newif\ifgtt@draw@complete
4176 \newif\ifgtt@draw@incomplete
4177 \newif\ifgtt@draw@clip
4178 \newcount\gtt@left@slot
4179 \newcount\gtt@right@slot
4180
4181 % \end{macrocode}
4182 % \end{intmacro}
4183 % \end{intmacro}
4184 % \end{intmacro}
4185 % \end{intmacro}
4186 % \end{intmacro}
4187 % \end{intmacro}
4188 % \end{intmacro}
4189 % \begin{intmacro}{\gtt@chartelement}
4190 % \begin{intmacro}{\local@timeslotmodifier}
4191 % \begin{intmacro}{\gtt@name}
4192 % |\gtt@chartelement|\oarg{options}\marg{label}\marg{start tss}\marg{end tss}\marg{type}\\is the generic command for drawing chart elements of a certain \meta{type}. First, |\gtt@chartelement| converts \meta{start tss} to |\gtt@left@slot| and \meta{end tss} to |\gtt@right@slot|. Then it calculates the usual coordinates. |\gtt@name| stores the name of the chart element.
4193 % \begin{macrocode}
4194 \newcommand\gtt@chartelement[5][]{%
4195 \begingroup%
4196 \ganttset{#1}%
4197 \gtt@tsstojulian{#3}{\gtt@left@slot}%
4198 \gtt@juliantotimeslot{\gtt@left@slot}{\gtt@left@slot}%
4199 \gtt@tsstojulian{#4}{\gtt@right@slot}%
4200 \gtt@juliantotimeslot{\gtt@right@slot}{\gtt@right@slot}%
4201 \def\local@timeslotmodifier{-1}%
4202 \ifgtt@ce@startatleftborder\else%
4203 \ifnum\gtt@left@slot=\gtt@right@slot\relax\else%
4204 \def\local@timeslotmodifier{0}%
4205 \fi%
4206 \fi%
4207 \pgfmathsetmacro\x@left{%
4208 (\gtt@left@slot + \local@timeslotmodifier%
4209 + \ganttvalueof{#5 left shift})%
4210 * \ganttvalueof{x unit}%
4211 }%
4212 \pgfmathsetmacro\x@right{%
4213 (\gtt@right@slot + \ganttvalueof{#5 right shift})%
4214 * \ganttvalueof{x unit}%
4215 }%
4216 \pgfmathsetmacro\x@mid{%
4217 (\x@left + \x@right) / 2%
4218 }%
4219 \pgfmathsetmacro\x@size{%
4220 \x@right - \x@left%
4221 }%
4222 \pgfmathsetmacro\y@upper{%
4223 \gtt@lasttitleline * \ganttvalueof{y unit title}
4224 + (\gtt@currentline - \gtt@lasttitleline
4225 - \ganttvalueof{#5 top shift}) * \ganttvalueof{y unit chart}%
4226 }%
4227 \pgfmathsetmacro\y@lower{%
4228 \y@upper - \ganttvalueof{#5 height} * \ganttvalueof{y unit chart}%
4229 }%
4230 \pgfmathsetmacro\y@mid{%
4231 (\y@upper + \y@lower) / 2%
4232 }%
4233 \pgfmathsetmacro\y@size{%
4234 \y@upper - \y@lower%
4235 }%
4236 \edef\gtt@name{\ganttvalueof{name}}%
4237 \ifx\gtt@name\@empty\edef\gtt@name{elem\the\gtt@elementid}\fi%
4238 % \end{macrocode}
4239 % \end{intmacro}
4240 % \end{intmacro}
4241 % \begin{intmacro}{\local@none}
4242 % Depending on the values of \opt{progress} and \opt{today}, we determine the correct value for |\gtt@progress|. A value between 0 and 100 corresponds to a percentage of completeness. A value of 999 indicates that the chart element has no associated progress.
4243 % \begin{macrocode}
4244 \def\local@none{none}%
4245 \ifx\gtt@progress\local@none%
4246 \def\gtt@progress{999}%
4247 \else%
4248 \def\@tempa{today}%
4249 \ifx\gtt@progress\@tempa%
4250 \edef\@tempa{\ganttvalueof{today}}%
4251 \ifx\@tempa\local@none%
4252 \@gtt@PackageWarning{%
4253 Value of today is `none'. Ignoring `progress=today'%
4254 }%
4255 \def\gtt@progress{999}%
4256 \else\ifnum\gtt@today@slot>\gtt@right@slot\relax%
4257 \def\gtt@progress{100}%
4258 \else\ifnum\gtt@today@slot<\gtt@left@slot\relax%
4259 \def\gtt@progress{0}%
4260 \else%
4261 \pgfmathsetmacro\gtt@progress{%
4262 (\gtt@today@slot - \gtt@left@slot - \local@timeslotmodifier)%
4263 / (\gtt@right@slot - \gtt@left@slot - \local@timeslotmodifier)%
4264 * 100%
4265 }%
4266 \fi\fi\fi%
4267 \fi%
4268 \fi%
4269 % \end{macrocode}
4270 % \end{intmacro}
4271 % \begin{intmacro}{\x@clip@size}
4272 % Now we determine whether only the complete part of the chart element, only its incomplete one or both are drawn. In the former two cases, we refrain from clipping the (in)complete part.
4273 % \begin{macrocode}
4274 \gtt@draw@completetrue%
4275 \gtt@draw@incompletetrue%
4276 \gtt@draw@cliptrue%
4277 \ifdim\gtt@progress pt<0.001pt\relax%
4278 \gtt@draw@completefalse%
4279 \gtt@draw@clipfalse%
4280 \else\ifdim\gtt@progress pt>99.999pt\relax%
4281 \gtt@draw@incompletefalse%
4282 \gtt@draw@clipfalse%
4283 \fi\fi%
4284 \ifgtt@draw@clip%
4285 \pgfmathsetmacro\x@clip@size{%
4286 (\gtt@right@slot - \gtt@left@slot - \local@timeslotmodifier)%
4287 * \gtt@progress / 100%
4288 }
4289 \pgfmathsetmacro\x@clip{%
4290 (\gtt@left@slot + \local@timeslotmodifier + \x@clip@size%
4291 + \ganttvalueof{today offset} - 1) * \ganttvalueof{x unit}%
4292 }%
4293 \fi%
4294 % \end{macrocode}
4295 % \end{intmacro}
4296 % We draw the chart element within a |pgfinterruptboundingbox|, since we clip a large area of the canvas in order to avoid removing parts of the chart element border.
4297 % \begin{macrocode}
4298 \begin{pgfinterruptboundingbox}%
4299 \begin{scope}%
4300 \ifgtt@draw@clip%
4301 \clip (\x@left pt - 10cm, \y@upper pt + 10cm) rectangle
4302 (\x@clip pt, \y@lower pt - 10cm);%
4303 \fi%
4304 \ifgtt@draw@complete%
4305 \node [/pgfgantt/#5, minimum width=\x@size pt,
4306 minimum height=\y@size pt]
4307 (\gtt@name) at (\x@mid pt, \y@mid pt) {};%
4308 \fi%
4309 \end{scope}%
4310 \begin{scope}%
4311 \ifgtt@draw@clip%
4312 \clip (\x@clip pt, \y@upper pt + 10cm) rectangle
4313 (\x@right pt + 10cm, \y@lower pt - 10cm);%
4314 \fi%
4315 \ifgtt@draw@incomplete%
4316 \node [/pgfgantt/#5 incomplete, minimum width=\x@size pt,
4317 minimum height=\y@size pt]
4318 (\gtt@name) at (\x@mid pt, \y@mid pt) {};%
4319 \fi%
4320 \end{scope}%
4321 \end{pgfinterruptboundingbox}%
4322 % \end{macrocode}
4323 % If \opt{progress} differs from |none| and \opt{progress label text} differs from |\relax|, the progress label is drawn.
4324 % \begin{macrocode}
4325 \ifdim\gtt@progress pt=999pt\relax\else%
4326 \expandafter\ifx\gtt@progresslabeltext\relax\relax\else%
4327 \node at (\gtt@name.\ganttvalueof{#5 progress label anchor})
4328 [/pgfgantt/#5 progress label node]
4329 {\gtt@progresslabeltext{\gtt@progress}};%
4330 \fi%
4331 \fi%
4332 % \end{macrocode}
4333 % If \meta{label} is not empty, a label is printed. Its anchor is either at the \textcolor{OliveGreen}{\meta{type}}\opt{ inline label anchor} of the chart element (|inline=true|) or at the left canvas border halfway between the upper and lower $y$-coordinate of the chart element (|inline=false|).
4334 % \begin{macrocode}
4335 \def\@tempa{#2}%
4336 \ifx\@tempa\@empty\else%
4337 \ifgtt@inline%
4338 \node at (\gtt@name.\ganttvalueof{#5 inline label anchor})
4339 [/pgfgantt/#5 inline label node]
4340 {\csname gtt@#5labeltext\endcsname{#2}};%
4341 \else%
4342 \node at (0, \y@mid pt)
4343 [/pgfgantt/#5 label node]
4344 {\csname gtt@#5labeltext\endcsname{#2}};%
4345 \fi%
4346 \fi%
4347 % \end{macrocode}
4348 % Since the first bar clearly appears after the last line containing a title element, we set the boolean |\ifgtt@intitle| to false.
4349 % \begin{macrocode}
4350 \xdef\gtt@lastelement{\gtt@currentelement}%
4351 \xdef\gtt@currentelement{\gtt@name}%
4352 \global\advance\gtt@elementid by1\relax%
4353 \global\gtt@intitlefalse%
4354 \endgroup%
4355 }
4356
4357 % \end{macrocode}
4358 % \end{intmacro}
4359 % \begin{macro}{\newganttchartelement}
4360 % \begin{macro}{\newganttchartelement*}
4361 % |\newganttchartelement| checks whether it was invoked in the starred or nonstarred form and executes |\@newganttchartelement@one| or |\@newganttchartelement@two|, respectively.
4362 % \begin{macrocode}
4363 \def\newganttchartelement{%
4364 \@gtt@ifstar\@newganttchartelement@one\@newganttchartelement@two%
4365 }
4366
4367 % \end{macrocode}
4368 % \end{macro}
4369 % \end{macro}
4370 % \begin{intmacro}{\@newganttchartelement@one}
4371 % \begin{intmacro}{\@newganttchartelement@two}
4372 % Both |\@newganttchartelement@one|\marg{type} and |...two|\marg{type} define two macros |\gantt|\meta{type} and |\ganttlinked|\meta{type}, which draw a singular chart element or one that is linked to its predecessor. However, the newly defined macros will take three or four mandatory arguments (cf. |\ganttmilestone| vs. |\ganttbar|). At the end, we execute |\@newganttchartelement@definekeys| to process the second mandatory argument of |\newganttchartelement|.
4373 % \begin{macrocode}
4374 \newcommand\@newganttchartelement@one[1]{%
4375 \expandafter\newcommand\csname gantt#1\endcsname[3][]{%
4376 \gtt@chartelement[##1]{##2}{##3}{##3}{#1}%
4377 }%
4378 \expandafter\newcommand\csname ganttlinked#1\endcsname[3][]{%
4379 \begingroup%
4380 \ganttset{##1}%
4381 \gtt@chartelement{##2}{##3}{##3}{#1}%
4382 \ganttlink{\gtt@lastelement}{\gtt@currentelement}%
4383 \endgroup%
4384 }%
4385 \@newganttchartelement@definekeys{#1}%
4386 }
4387
4388 \newcommand\@newganttchartelement@two[1]{%
4389 \expandafter\newcommand\csname gantt#1\endcsname[4][]{%
4390 \gtt@chartelement[##1]{##2}{##3}{##4}{#1}%
4391 }%
4392 \expandafter\newcommand\csname ganttlinked#1\endcsname[4][]{%
4393 \begingroup%
4394 \ganttset{##1}%
4395 \gtt@chartelement{##2}{##3}{##4}{#1}%
4396 \ganttlink{\gtt@lastelement}{\gtt@currentelement}%
4397 \endgroup%
4398 }%
4399 \@newganttchartelement@definekeys{#1}%
4400 }
4401
4402 % \end{macrocode}
4403 % \end{intmacro}
4404 % \end{intmacro}
4405 % \begin{intmacro}{\@newganttchartelement@definekeys}
4406 % |\@newganttchartelement@definekeys|\marg{type}\marg{key-value list} introduces 14 keys for the newly generated chart element \meta{type}.
4407 % \begin{macrocode}
4408 \newcommand\@newganttchartelement@definekeys[2]{%
4409 \@gtt@stylekeydef{#1}{shape=rectangle, inner sep=0pt, draw, fill=white}%
4410 \@gtt@stylekeydef{#1 incomplete}{/pgfgantt/#1, fill=black!25}%
4411 \@gtt@keydef{#1 label font}{\normalsize}%
4412 \@gtt@stylekeydef{#1 label node}{%
4413 anchor=east, font=\ganttvalueof{#1 label font}%
4414 }%
4415 \@gtt@keydef{#1 inline label anchor}{center}%
4416 \@gtt@stylekeydef{#1 inline label node}{%
4417 anchor=center, font=\ganttvalueof{#1 label font}%
4418 }%
4419 \@gtt@keydef{#1 progress label anchor}{east}%
4420 \@gtt@keydef{#1 progress label font}{\scriptsize}%
4421 \@gtt@stylekeydef{#1 progress label node}{%
4422 anchor=west, font=\ganttvalueof{#1 progress label font}%
4423 }%
4424 \@gtt@keydef{#1 left shift}{0}%
4425 \@gtt@keydef{#1 right shift}{0}%
4426 \@gtt@keydef{#1 top shift}{.3}%
4427 \@gtt@keydef{#1 height}{.4}%
4428 \ganttset{%
4429 #1 label text/.code={%
4430 \expandafter\def\csname gtt@#1labeltext\endcsname####1{##1}%
4431 },%
4432 #1 label text=\strut##1,%
4433 #2%
4434 }%
4435 }
4436
4437 % \end{macrocode}
4438 % \end{intmacro}
4439 % \begin{macro}{\ganttbar}
4440 % \begin{macro}{\ganttlinkedbar}
4441 % \begin{option}{bar}
4442 % \begin{option}{bar incomplete}
4443 % \begin{option}{bar label text}
4444 % \begin{option}{bar label font}
4445 % \begin{option}{bar label node}
4446 % \begin{option}{bar inline label anchor}
4447 % \begin{option}{bar inline label node}
4448 % \begin{option}{bar progress label anchor}
4449 % \begin{option}{bar progress label font}
4450 % \begin{option}{bar progress label node}
4451 % \begin{option}{bar left shift}
4452 % \begin{option}{bar right shift}
4453 % \begin{option}{bar top shift}
4454 % \begin{option}{bar height}
4455 % Code for the predefined chart element type |bar|.
4456 % \begin{macrocode}
4457 \newganttchartelement{bar}{%
4458 bar/.style={shape=ganttbar, inner sep=0pt, draw, fill=white},%
4459 bar incomplete/.style={/pgfgantt/bar, fill=black!25},%
4460 bar label text=\strut#1,%
4461 bar label font=\normalsize,%
4462 bar label node/.style={%
4463 anchor=east, font=\ganttvalueof{bar label font}%
4464 },%
4465 bar inline label anchor=center,%
4466 bar inline label node/.style={%
4467 anchor=center, font=\ganttvalueof{bar label font}%
4468 },%
4469 bar progress label anchor=east,%
4470 bar progress label font=\scriptsize,%
4471 bar progress label node/.style={%
4472 anchor=west, font=\ganttvalueof{bar progress label font}%
4473 },%
4474 bar left shift=0,%
4475 bar right shift=0,%
4476 bar top shift=.3,%
4477 bar height=.4%
4478 }
4479
4480 % \end{macrocode}
4481 % \end{option}
4482 % \end{option}
4483 % \end{option}
4484 % \end{option}
4485 % \end{option}
4486 % \end{option}
4487 % \end{option}
4488 % \end{option}
4489 % \end{option}
4490 % \end{option}
4491 % \end{option}
4492 % \end{option}
4493 % \end{option}
4494 % \end{option}
4495 % \end{macro}
4496 % \end{macro}
4497 % \clearpage
4498 % \begin{macro}{\ganttgroup}
4499 % \begin{macro}{\ganttlinkedgroup}
4500 % \begin{option}{group}
4501 % \begin{option}{group incomplete}
4502 % \begin{option}{group label text}
4503 % \begin{option}{group label font}
4504 % \begin{option}{group label node}
4505 % \begin{option}{group inline label anchor}
4506 % \begin{option}{group inline label node}
4507 % \begin{option}{group progress label anchor}
4508 % \begin{option}{group progress label font}
4509 % \begin{option}{group progress label node}
4510 % \begin{option}{group left shift}
4511 % \begin{option}{group right shift}
4512 % \begin{option}{group top shift}
4513 % \begin{option}{group height}
4514 % Code for the predefined chart element type |group|.
4515 % \begin{macrocode}
4516 \newganttchartelement{group}{%
4517 group/.style={shape=ganttgroup, inner sep=0pt, fill=black},%
4518 group incomplete/.style={/pgfgantt/group, fill=black!25},%
4519 group label text=\strut#1,%
4520 group label font=\bfseries,%
4521 group label node/.style={%
4522 anchor=east, font=\ganttvalueof{group label font}%
4523 },%
4524 group inline label anchor=center,%
4525 group inline label node/.style={%
4526 anchor=south, font=\ganttvalueof{group label font}%
4527 },%
4528 group progress label anchor=east,%
4529 group progress label font=\scriptsize,%
4530 group progress label node/.style={%
4531 anchor=west, font=\ganttvalueof{group progress label font}%
4532 },%
4533 group left shift=-.1,%
4534 group right shift=.1,%
4535 group top shift=.4,%
4536 group height=.2%
4537 }
4538 % \end{macrocode}
4539 % \end{option}
4540 % \end{option}
4541 % \end{option}
4542 % \end{option}
4543 % \end{option}
4544 % \end{option}
4545 % \end{option}
4546 % \end{option}
4547 % \end{option}
4548 % \end{option}
4549 % \end{option}
4550 % \end{option}
4551 % \end{option}
4552 % \end{option}
4553 % \end{macro}
4554 % \end{macro}
4555 % \begin{option}{group right peak tip position}
4556 % \begin{option}{group right peak width}
4557 % \begin{option}{group right peak height}
4558 % \begin{option}{group left peak tip position}
4559 % \begin{option}{group left peak width}
4560 % \begin{option}{group left peak height}
4561 % \begin{option}{group peaks tip position}
4562 % \begin{option}{group peaks width}
4563 % \begin{option}{group peaks height}
4564 % More keys for the appearance of groups.
4565 % \begin{macrocode}
4566 \@gtt@keydef{group right peak tip position}{.5}
4567 \@gtt@keydef{group right peak width}{.4}
4568 \@gtt@keydef{group right peak height}{.1}
4569 \@gtt@keydef{group left peak tip position}{.5}
4570 \@gtt@keydef{group left peak width}{.4}
4571 \@gtt@keydef{group left peak height}{.1}
4572 \ganttset{%
4573 group peaks tip position/.code={%
4574 \ganttset{%
4575 group left peak tip position=#1,%
4576 group right peak tip position=#1%
4577 }%
4578 },%
4579 group peaks width/.code={%
4580 \ganttset{%
4581 group left peak width=#1,%
4582 group right peak width=#1%
4583 }%
4584 },%
4585 group peaks height/.code={%
4586 \ganttset{%
4587 group left peak height=#1,%
4588 group right peak height=#1%
4589 }%
4590 }%
4591 }
4592
4593 % \end{macrocode}
4594 % \end{option}
4595 % \end{option}
4596 % \end{option}
4597 % \end{option}
4598 % \end{option}
4599 % \end{option}
4600 % \end{option}
4601 % \end{option}
4602 % \end{option}
4603 % \begin{macro}{\ganttmilestone}
4604 % \begin{macro}{\ganttlinkedmilestone}
4605 % \begin{option}{milestone}
4606 % \begin{option}{milestone incomplete}
4607 % \begin{option}{milestone label text}
4608 % \begin{option}{milestone label font}
4609 % \begin{option}{milestone label node}
4610 % \begin{option}{milestone inline label anchor}
4611 % \begin{option}{milestone inline label node}
4612 % \begin{option}{milestone progress label anchor}
4613 % \begin{option}{milestone progress label font}
4614 % \begin{option}{milestone progress label node}
4615 % \begin{option}{milestone left shift}
4616 % \begin{option}{milestone right shift}
4617 % \begin{option}{milestone top shift}
4618 % \begin{option}{milestone height}
4619 % Code for the predefined chart element type |milestone|.
4620 % \begin{macrocode}
4621 \newganttchartelement*{milestone}{%
4622 milestone/.style={%
4623 shape=ganttmilestone, inner sep=0pt, draw, fill=black%
4624 },%
4625 milestone incomplete/.style={/pgfgantt/milestone, fill=black!25},%
4626 milestone label text=\strut#1,%
4627 milestone label font=\itshape,%
4628 milestone label node/.style={%
4629 anchor=east, font=\ganttvalueof{milestone label font}%
4630 },%
4631 milestone inline label anchor=center,%
4632 milestone inline label node/.style={%
4633 anchor=south, font=\ganttvalueof{milestone label font}%
4634 },%
4635 milestone progress label anchor=center,%
4636 milestone progress label font=\scriptsize,%
4637 milestone progress label node/.style={%
4638 anchor=west, font=\ganttvalueof{milestone progress label font}%
4639 },%
4640 milestone left shift=.6,%
4641 milestone right shift=.4,%
4642 milestone top shift=.3,%
4643 milestone height=.4%
4644 }
4645
4646 % \end{macrocode}
4647 % \end{option}
4648 % \end{option}
4649 % \end{option}
4650 % \end{option}
4651 % \end{option}
4652 % \end{option}
4653 % \end{option}
4654 % \end{option}
4655 % \end{option}
4656 % \end{option}
4657 % \end{option}
4658 % \end{option}
4659 % \end{option}
4660 % \end{option}
4661 % \end{macro}
4662 % \end{macro}
4663 %
4664 %
4665 % \subsection{Node Shapes}
4666 %
4667 % \begin{option}{on top fraction}
4668 % \begin{option}{on bottom fraction}
4669 % \begin{option}{on left fraction}
4670 % \begin{option}{on right fraction}
4671 % Keys for configuring the additional anchors of the new node shapes.
4672 % \begin{macrocode}
4673 \@gtt@keydef{on top fraction}{.5}
4674 \@gtt@keydef{on bottom fraction}{.5}
4675 \@gtt@keydef{on left fraction}{.5}
4676 \@gtt@keydef{on right fraction}{.5}
4677
4678 % \end{macrocode}
4679 % \end{option}
4680 % \end{option}
4681 % \end{option}
4682 % \end{option}
4683 % Code for node shape |ganttbar|. Anchors and background path derive from node shape |rectangle|. The four additional anchors |on top|, |on bottom|, |on left| and |on right| are defined.
4684 % \begin{macrocode}
4685 \pgfdeclareshape{ganttbar}{
4686 \inheritsavedanchors[from=rectangle]
4687 \inheritanchor[from=rectangle]{center}
4688 \inheritanchor[from=rectangle]{mid}
4689 \inheritanchor[from=rectangle]{base}
4690 \inheritanchor[from=rectangle]{north}
4691 \inheritanchor[from=rectangle]{south}
4692 \inheritanchor[from=rectangle]{west}
4693 \inheritanchor[from=rectangle]{mid west}
4694 \inheritanchor[from=rectangle]{base west}
4695 \inheritanchor[from=rectangle]{north west}
4696 \inheritanchor[from=rectangle]{south west}
4697 \inheritanchor[from=rectangle]{east}
4698 \inheritanchor[from=rectangle]{mid east}
4699 \inheritanchor[from=rectangle]{base east}
4700 \inheritanchor[from=rectangle]{north east}
4701 \inheritanchor[from=rectangle]{south east}
4702 \inheritanchorborder[from=rectangle]
4703 \anchor{on top}{
4704 \southwest
4705 \pgf@xa=\pgf@x
4706 \northeast
4707 \pgf@xb=\pgf@x
4708 \advance\pgf@xb by-\pgf@xa
4709 \pgf@xb=\ganttvalueof{on top fraction}\pgf@xb
4710 \advance\pgf@xa by\pgf@xb
4711 \pgf@x=\pgf@xa
4712 }
4713 \anchor{on bottom}{
4714 \northeast
4715 \pgf@xb=\pgf@x
4716 \southwest
4717 \pgf@xa=\pgf@x
4718 \advance\pgf@xb by-\pgf@xa
4719 \pgf@xb=\ganttvalueof{on bottom fraction}\pgf@xb
4720 \advance\pgf@xa by\pgf@xb
4721 \pgf@x=\pgf@xa
4722 }
4723 \anchor{on left}{
4724 \northeast
4725 \pgf@ya=\pgf@y
4726 \southwest
4727 \pgf@yb=\pgf@y
4728 \advance\pgf@yb by-\pgf@ya
4729 \pgf@yb=\ganttvalueof{on left fraction}\pgf@yb
4730 \advance\pgf@ya by\pgf@yb
4731 \pgf@y=\pgf@ya
4732 }
4733 \anchor{on right}{
4734 \southwest
4735 \pgf@yb=\pgf@y
4736 \northeast
4737 \pgf@ya=\pgf@y
4738 \advance\pgf@yb by-\pgf@ya
4739 \pgf@yb=\ganttvalueof{on right fraction}\pgf@yb
4740 \advance\pgf@ya by\pgf@yb
4741 \pgf@y=\pgf@ya
4742 }
4743 \inheritbackgroundpath[from=rectangle]
4744 }
4745
4746 % \end{macrocode}
4747 % Code for node shape |ganttgroup|. Anchors derive from node shape |ganttbar|. The two additional anchors |left peak| and |right peak| are defined.
4748 % \begin{macrocode}
4749 \pgfdeclareshape{ganttgroup}{
4750 \inheritsavedanchors[from=rectangle]
4751 \inheritanchor[from=rectangle]{center}
4752 \inheritanchor[from=rectangle]{mid}
4753 \inheritanchor[from=rectangle]{base}
4754 \inheritanchor[from=rectangle]{north}
4755 \inheritanchor[from=rectangle]{south}
4756 \inheritanchor[from=rectangle]{west}
4757 \inheritanchor[from=rectangle]{mid west}
4758 \inheritanchor[from=rectangle]{base west}
4759 \inheritanchor[from=rectangle]{north west}
4760 \inheritanchor[from=rectangle]{south west}
4761 \inheritanchor[from=rectangle]{east}
4762 \inheritanchor[from=rectangle]{mid east}
4763 \inheritanchor[from=rectangle]{base east}
4764 \inheritanchor[from=rectangle]{north east}
4765 \inheritanchor[from=rectangle]{south east}
4766 \inheritanchorborder[from=rectangle]
4767 \inheritanchor[from=ganttbar]{on top}
4768 \inheritanchor[from=ganttbar]{on bottom}
4769 \inheritanchor[from=ganttbar]{on left}
4770 \inheritanchor[from=ganttbar]{on right}
4771 \anchor{left peak}{
4772 \pgf@process{
4773 \pgfpointadd{
4774 \southwest
4775 }{
4776 \pgfpoint%
4777 {\pgfkeysvalueof{/pgf/outer xsep}}%
4778 {\pgfkeysvalueof{/pgf/outer ysep}}
4779 }
4780 }
4781 \pgfmathsetlength\pgf@x{
4782 \pgf@x + \ganttvalueof{group left peak tip position}
4783 * \ganttvalueof{group left peak width} * \ganttvalueof{x unit}
4784 }
4785 \pgfmathsetlength\pgf@y{
4786 \pgf@y - \ganttvalueof{group left peak height}
4787 * \ganttvalueof{y unit chart}
4788 }
4789 }
4790 \anchor{right peak}{
4791 \pgf@process{
4792 \pgfpointadd{
4793 \northeast
4794 }{
4795 \pgfpointscale{-1}{
4796 \pgfpoint%
4797 {\pgfkeysvalueof{/pgf/outer xsep}}%
4798 {\pgfkeysvalueof{/pgf/outer ysep}}
4799 }
4800 }
4801 }
4802 \pgf@xa=\pgf@x
4803 \pgf@process{
4804 \pgfpointadd{
4805 \southwest
4806 }{
4807 \pgfpoint%
4808 {\pgfkeysvalueof{/pgf/outer xsep}}%
4809 {\pgfkeysvalueof{/pgf/outer ysep}}
4810 }
4811 }
4812 \pgfmathsetlength\pgf@x{
4813 \pgf@xa - \ganttvalueof{group right peak tip position}
4814 * \ganttvalueof{group right peak width} * \ganttvalueof{x unit}
4815 }
4816 \pgfmathsetlength\pgf@y{
4817 \pgf@y - \ganttvalueof{group right peak height}
4818 * \ganttvalueof{y unit chart}
4819 }
4820 }
4821 \backgroundpath{
4822 \pgf@process{
4823 \pgfpointadd{
4824 \northeast
4825 }{
4826 \pgfpointscale{-1}{
4827 \pgfpoint%
4828 {\pgfkeysvalueof{/pgf/outer xsep}}%
4829 {\pgfkeysvalueof{/pgf/outer ysep}}
4830 }
4831 }
4832 }
4833 \pgf@xb=\pgf@x
4834 \pgf@ya=\pgf@y
4835 \pgf@process{
4836 \pgfpointadd{
4837 \southwest
4838 }{
4839 \pgfpoint%
4840 {\pgfkeysvalueof{/pgf/outer xsep}}%
4841 {\pgfkeysvalueof{/pgf/outer ysep}}
4842 }
4843 }
4844 \pgf@xa=\pgf@x
4845 \pgf@yb=\pgf@y
4846 \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
4847 \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
4848 \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}}
4849 \pgfmathsetlength\pgf@xc{
4850 \pgf@xb - \ganttvalueof{group right peak tip position}
4851 * \ganttvalueof{group right peak width} * \ganttvalueof{x unit}
4852 }
4853 \pgfmathsetlength\pgf@yc{
4854 \pgf@yb - \ganttvalueof{group right peak height}
4855 * \ganttvalueof{y unit chart}
4856 }
4857 \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
4858 \pgfmathsetlength\pgf@xc{
4859 \pgf@xb - \ganttvalueof{group right peak width}
4860 * \ganttvalueof{x unit}
4861 }
4862 \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yb}}
4863 \pgfmathsetlength\pgf@xc{
4864 \pgf@xa + \ganttvalueof{group left peak width}
4865 * \ganttvalueof{x unit}
4866 }
4867 \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yb}}
4868 \pgfmathsetlength\pgf@xc{
4869 \pgf@xa + \ganttvalueof{group left peak tip position}
4870 * \ganttvalueof{group left peak width} * \ganttvalueof{x unit}
4871 }
4872 \pgfmathsetlength\pgf@yc{
4873 \pgf@yb - \ganttvalueof{group left peak height}
4874 * \ganttvalueof{y unit chart}
4875 }
4876 \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
4877 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}
4878 \pgfpathclose
4879 }
4880 }
4881
4882 % \end{macrocode}
4883 % Code for node shape |ganttmilestone|. Anchors and background path derive from node shape |diamond|. The four additional anchors |on top|, |on bottom|, |on left| and |on right| are defined.
4884 % \begin{macrocode}
4885 \pgfdeclareshape{ganttmilestone}{
4886 \inheritsavedanchors[from=diamond]
4887 \inheritanchor[from=diamond]{text}
4888 \inheritanchor[from=diamond]{center}
4889 \inheritanchor[from=diamond]{mid}
4890 \inheritanchor[from=diamond]{base}
4891 \inheritanchor[from=diamond]{north}
4892 \inheritanchor[from=diamond]{south}
4893 \inheritanchor[from=diamond]{west}
4894 \inheritanchor[from=diamond]{north west}
4895 \inheritanchor[from=diamond]{south west}
4896 \inheritanchor[from=diamond]{east}
4897 \inheritanchor[from=diamond]{north east}
4898 \inheritanchor[from=diamond]{south east}
4899 \inheritanchorborder[from=diamond]
4900 \inheritbackgroundpath[from=diamond]
4901 \anchor{on top}{
4902 \pgf@process{\outernortheast}
4903 \pgf@xa=2\pgf@x
4904 \pgf@x=-\pgf@x
4905 \advance\pgf@x by\ganttvalueof{on top fraction}\pgf@xa
4906 \pgf@ya=2\pgf@y
4907 \pgf@y=0pt
4908 \pgfmathparse{
4909 \ganttvalueof{on top fraction} < 0.5
4910 ? \ganttvalueof{on top fraction}
4911 : 1 - \ganttvalueof{on top fraction}
4912 }
4913 \advance\pgf@y by\pgfmathresult\pgf@ya
4914 }
4915 \anchor{on bottom}{
4916 \pgf@process{\outernortheast}
4917 \pgf@xa=2\pgf@x
4918 \pgf@x=-\pgf@x
4919 \advance\pgf@x by\ganttvalueof{on bottom fraction}\pgf@xa
4920 \pgf@ya=-2\pgf@y
4921 \pgf@y=0pt
4922 \pgfmathparse{
4923 \ganttvalueof{on bottom fraction} < 0.5
4924 ? \ganttvalueof{on bottom fraction}
4925 : 1 - \ganttvalueof{on bottom fraction}
4926 }
4927 \advance\pgf@y by\pgfmathresult\pgf@ya
4928 }
4929 \anchor{on right}{
4930 \pgf@process{\outernortheast}
4931 \pgf@ya=-2\pgf@y
4932 \advance\pgf@y by\ganttvalueof{on right fraction}\pgf@ya
4933 \pgf@xa=2\pgf@x
4934 \pgf@x=0pt
4935 \pgfmathparse{
4936 \ganttvalueof{on right fraction} < 0.5
4937 ? \ganttvalueof{on right fraction}
4938 : 1 - \ganttvalueof{on right fraction}
4939 }
4940 \advance\pgf@x by\pgfmathresult\pgf@xa
4941 }
4942 \anchor{on left}{
4943 \pgf@process{\outernortheast}
4944 \pgf@ya=-2\pgf@y
4945 \advance\pgf@y by\ganttvalueof{on left fraction}\pgf@ya
4946 \pgf@xa=-2\pgf@x
4947 \pgf@x=0pt
4948 \pgfmathparse{
4949 \ganttvalueof{on left fraction} < 0.5
4950 ? \ganttvalueof{on left fraction}
4951 : 1 - \ganttvalueof{on left fraction}
4952 }
4953 \advance\pgf@x by\pgfmathresult\pgf@xa
4954 }
4955 }
4956
4957 % \end{macrocode}
4958 %
4959 %
4960 % \subsection{Links}
4961 % \label{ssc:ImplLinks}
4962 %
4963 % \begin{option}{link}
4964 % \begin{option}{link type}
4965 % \begin{option}{link label}
4966 % \begin{option}{link label font}
4967 % \begin{option}{link label node}
4968 % Keys for configuring links.
4969 % \begin{macrocode}
4970 \@gtt@stylekeydef{link}{-latex, rounded corners=1pt}
4971 \@gtt@keydef{link type}{auto}
4972 \@gtt@keydef{link label}{}
4973 \@gtt@keydef{link label font}{\scriptsize\itshape}
4974 \@gtt@stylekeydef{link label node}{%
4975 anchor=west, font=\ganttvalueof{link label font}%
4976 }
4977 % \end{macrocode}
4978 % \end{option}
4979 % \end{option}
4980 % \end{option}
4981 % \end{option}
4982 % \end{option}
4983 % \begin{macro}{\newganttlinktype}
4984 % |\newganttlinktype|\marg{type}\marg{code} stores \meta{code} in an internal macro\\|\@gtt@linktype@|\meta{type}, which is later called by |\gtt@drawlink|.
4985 % \begin{macrocode}
4986 \newcommand\newganttlinktype[2]{%
4987 \expandafter\def\csname @gtt@linktype@#1\endcsname{#2}%
4988 }
4989
4990 % \end{macrocode}
4991 % \end{macro}
4992 % \begin{macro}{\setganttlinklabel}
4993 % |\setganttlinklabel|\marg{type}\marg{label} stores a given \meta{label} in an internal macro |\@gtt@linktype@|\meta{type}|@label|, which is later used by |\gtt@drawlink|.
4994 % \begin{macrocode}
4995 \newcommand\setganttlinklabel[2]{%
4996 \expandafter\def\csname @gtt@linktype@#1@label\endcsname{#2}%
4997 }
4998
4999 % \end{macrocode}
5000 % \end{macro}
5001 % \begin{macro}{\newganttlinktypealias}
5002 % |\newganttlinktypealias|\marg{new link type}\marg{existing link type} copies both the link code and label of an \meta{existing link type} into the internal macros associated with a \meta{new link type}.
5003 % \begin{macrocode}
5004 \newcommand\newganttlinktypealias[2]{%
5005 \expandafter\def\csname @gtt@linktype@#1\endcsname{%
5006 \csname @gtt@linktype@#2\endcsname%
5007 }%
5008 \expandafter\def\csname @gtt@linktype@#1@label\endcsname{%
5009 \csname @gtt@linktype@#2@label\endcsname%
5010 }%
5011 }
5012
5013 % \end{macrocode}
5014 % \end{macro}
5015 % \begin{option}{link mid}
5016 % \begin{option}{link bulge}
5017 % \begin{option}{link tolerance}
5018 % We will define three link subtypes for the type |auto|, which require the following keys:
5019 % \begin{macrocode}
5020 \@gtt@keydef{link mid}{.5}
5021 \@gtt@keydef{link bulge}{.4}
5022 \@gtt@keydef{link tolerance}{.6}
5023 % \end{macrocode}
5024 % \end{option}
5025 % \end{option}
5026 % \end{option}
5027 % (1) |r| (short for ``right'') draws a straight arrow. Note that |r| and |default| are alias types.
5028 % \begin{macrocode}
5029 \newganttlinktype{r}{%
5030 \draw [/pgfgantt/link]
5031 (\xLeft, \yUpper) --
5032 (\xRight, \yLower)
5033 node [pos=.5, /pgfgantt/link label node] {\ganttlinklabel};
5034 }
5035 \newganttlinktypealias{default}{r}
5036
5037 % \end{macrocode}
5038 % (2) |rdr| (``right-down-right'') is an unlabeled three-part arrow. The value of \opt{link mid} sets the position of the middle segment.
5039 % \begin{macrocode}
5040 \newganttlinktype{rdr}{%
5041 \draw [/pgfgantt/link]
5042 (\xLeft, \yUpper) --
5043 ($(\xLeft, \yUpper)!\ganttvalueof{link mid}!
5044 (\xRight, \yUpper)$) --
5045 ($(\xLeft, \yLower)!\ganttvalueof{link mid}!
5046 (\xRight, \yLower)$) --
5047 (\xRight, \yLower);%
5048 }
5049
5050 % \end{macrocode}
5051 % (3) |rdldr| (``right-down-left-down-right'') is an unlabeled five-part arrow, which considers the values of \opt{link bulge} and \opt{link mid}.
5052 % \begin{macrocode}
5053 \newganttlinktype{rdldr}{%
5054 \draw [/pgfgantt/link]
5055 (\xLeft, \yUpper) --
5056 (\xLeft + \ganttvalueof{link bulge} * \ganttvalueof{x unit},
5057 \yUpper) --
5058 ($(\xLeft + \ganttvalueof{link bulge} * \ganttvalueof{x unit},
5059 \yUpper)!%
5060 \ganttvalueof{link mid}!%
5061 (\xLeft + \ganttvalueof{link bulge} * \ganttvalueof{x unit},
5062 \yLower)$) --
5063 ($(\xRight - \ganttvalueof{link bulge} * \ganttvalueof{x unit},
5064 \yUpper)!%
5065 \ganttvalueof{link mid}!%
5066 (\xRight - \ganttvalueof{link bulge} * \ganttvalueof{x unit},
5067 \yLower)$) --
5068 (\xRight - \ganttvalueof{link bulge} * \ganttvalueof{x unit},
5069 \yLower) --
5070 (\xRight, \yLower);%
5071 }
5072
5073 % \end{macrocode}
5074 % Now we may define linke type |auto|: The first and last coordinate of the link should touch the preceding or following element at the center of its right or left border, respectively. We check if the connected elements lie in the same row or not (i. e., their $y$-coordinates differ at most 1~pt). In the latter case, |\pgfmathparse| yields 0.
5075 % \begin{macrocode}
5076 \newganttlinktype{auto}{%
5077 \pgfmathparse{abs(\yUpper - \yLower) <= 1}%
5078 \ifcase\pgfmathresult%
5079 % \end{macrocode}
5080 % Once again, two possibilities arise: Either the elements to be connected are at least separated by \opt{link tolerance} time slots, in which case we draw a three-part arrow (i. e., link type |rdr|). Alternatively, the elements lie in adjacent time slots or even overlap, in which case we draw a five-part arrow (i. e., link type |rdldr|).
5081 % \begin{macrocode}
5082 \pgfmathparse{
5083 (\xRight - \xLeft)
5084 >= \ganttvalueof{link tolerance} * \ganttvalueof{x unit}
5085 }%
5086 \ifcase\pgfmathresult%
5087 \gtt@drawlink{rdldr}%
5088 \else%
5089 \gtt@drawlink{rdr}%
5090 \fi%
5091 % \end{macrocode}
5092 % For elements that lie in the same row, we draw a simple arrow (i. e., link type |r|).
5093 % \begin{macrocode}
5094 \else%
5095 \gtt@drawlink{r}%
5096 \fi%
5097 }
5098 % \end{macrocode}
5099 % The |dr| type is explained in section~\ref{ssc:Links}.
5100 % \begin{macrocode}
5101 \newganttlinktype{dr}{%
5102 \ganttsetstartanchor{south}%
5103 \ganttsetendanchor{west}%
5104 \draw [/pgfgantt/link]
5105 (\xLeft, \yUpper) --
5106 (\xLeft, \yLower)
5107 node [pos=.5, /pgfgantt/link label node] {\ganttlinklabel} --
5108 (\xRight, \yLower);%
5109 }
5110
5111 % \end{macrocode}
5112 % Here is the definition of the four straight link types and their labels.
5113 % \begin{macrocode}
5114 \newganttlinktype{s-s}{%
5115 \ganttsetstartanchor{south west}%
5116 \ganttsetendanchor{north west}%
5117 \draw [/pgfgantt/link]
5118 (\xLeft, \yUpper) --
5119 (\xRight, \yLower)
5120 node [pos=.5, /pgfgantt/link label node] {\ganttlinklabel};
5121 }
5122 \setganttlinklabel{s-s}{start-to-start}
5123
5124 \newganttlinktype{s-f}{%
5125 \ganttsetstartanchor{on bottom=0}%
5126 \ganttsetendanchor{on top=1}%
5127 \draw [/pgfgantt/link]
5128 (\xLeft, \yUpper) --
5129 (\xRight, \yLower)
5130 node [pos=.5, /pgfgantt/link label node] {\ganttlinklabel};
5131 }
5132 \setganttlinklabel{s-f}{start-to-finish}
5133
5134 \newganttlinktype{f-s}{%
5135 \ganttsetstartanchor{south east}%
5136 \ganttsetendanchor{north west}%
5137 \draw [/pgfgantt/link]
5138 (\xLeft, \yUpper) --
5139 (\xRight, \yLower)
5140 node [pos=.5, /pgfgantt/link label node] {\ganttlinklabel};
5141 }
5142 \setganttlinklabel{f-s}{finish-to-start}
5143
5144 \newganttlinktype{f-f}{%
5145 \ganttsetstartanchor{south east}%
5146 \ganttsetendanchor{north east}%
5147 \draw [/pgfgantt/link]
5148 (\xLeft, \yUpper) --
5149 (\xRight, \yLower)
5150 node [pos=.5, /pgfgantt/link label node] {\ganttlinklabel};
5151 }
5152 \setganttlinklabel{f-f}{finish-to-finish}
5153
5154 % \end{macrocode}
5155 % \begin{intmacro}{\gtt@drawlink}
5156 % \begin{intmacro}{\@gtt@currlinktype}
5157 % |\gtt@drawlink|\marg{link type} first checks if the \meta{link type} is defined, falling back to type |default| if it is unknown. |\@gtt@currlinktype| stores the link type for future reference.
5158 % \begin{macrocode}
5159 \newcommand\gtt@drawlink[1]{%
5160 \@ifundefined{@gtt@linktype@#1}{%
5161 \@gtt@PackageWarning{Link type `#1' unknown, using `default'.}%
5162 \def\@gtt@currlinktype{default}%
5163 }{%
5164 \def\@gtt@currlinktype{#1}%
5165 }%
5166 % \end{macrocode}
5167 % \end{intmacro}
5168 % \begin{intmacro}{\@gtt@currlabel}
5169 % \begin{macro}{\ganttlinklabel}
5170 % If the \opt{link label} key contains any value, it locally overrides the label set by |\setganttlinklabel|. |\ganttlinklabel| is defined accordingly.
5171 % \begin{macrocode}
5172 \edef\@gtt@currlabel{\ganttvalueof{link label}}%
5173 \ifx\@gtt@currlabel\@empty%
5174 \def\ganttlinklabel{%
5175 \csname @gtt@linktype@\@gtt@currlinktype @label\endcsname%
5176 }%
5177 \else%
5178 \edef\ganttlinklabel{%
5179 \ganttvalueof{link label}%
5180 }%
5181 \fi%
5182 % \end{macrocode}
5183 % \end{macro}
5184 % \end{intmacro}
5185 % Finally, we call the internal macro that stores the code for the desired link type.
5186 % \begin{macrocode}
5187 \csname @gtt@linktype@\@gtt@currlinktype\endcsname%
5188 }
5189
5190 % \end{macrocode}
5191 % \end{intmacro}
5192 % \begin{intmacro}{\@gtt@link@anchor}
5193 % We need the following keys for setting the start and end anchor of a link: Whenever a key |/pgfgantt/link anchor/|\meta{anchor} is undefined, \pack{pgfgantt} stores \meta{anchor} in |\@gtt@link@anchor|.
5194 % \begin{macrocode}
5195 \ganttset{%
5196 link anchor/.unknown/.code={%
5197 \edef\@gtt@link@anchor{\pgfkeyscurrentname}%
5198 },%
5199 }
5200 % \end{macrocode}
5201 % \end{intmacro}
5202 % \begin{intmacro}{\@gtt@linkanchordef}
5203 % |\@gtt@linkanchordef|\marg{anchor} deals with the anchors |on top| etc.: It creates a code key |/pgfgantt/link anchor/|\meta{anchor}, which stores its own name in |\@gtt@link@anchor| and sets the appropriate \opt{\dots fraction} key.
5204 % \begin{macrocode}
5205 \def\@gtt@linkanchordef#1{%
5206 \ganttset{%
5207 link anchor/#1/.code={%
5208 \edef\@gtt@link@anchor{#1}%
5209 \ganttset{#1 fraction=##1}%
5210 },%
5211 link anchor/#1/.default=.5%
5212 }%
5213 }
5214 \@gtt@linkanchordef{on top}
5215 \@gtt@linkanchordef{on bottom}
5216 \@gtt@linkanchordef{on left}
5217 \@gtt@linkanchordef{on right}
5218
5219 % \end{macrocode}
5220 % \end{intmacro}
5221 % \begin{intmacro}{\@gtt@setstartanchor}
5222 % \begin{macro}{\xLeft}
5223 % \begin{macro}{\yUpper}
5224 % |\@gtt@setstartanchor|\marg{anchor} recalls the coordinates of the anchor stored in |\@gtt@link@anchor| from chart element |\@gtt@link@startelement|. It stores these coordinates in the auxiliary macros |\xLeft| and |\yUpper|.
5225 % \begin{macrocode}
5226 \newcommand\@gtt@setstartanchor[1]{%
5227 \pgfqkeys{/pgfgantt/link anchor}{#1}%
5228 \pgfpointanchor{\@gtt@link@startelement}{\@gtt@link@anchor}%
5229 \edef\xLeft{\the\pgf@x}%
5230 \edef\yUpper{\the\pgf@y}%
5231 }
5232
5233 % \end{macrocode}
5234 % \end{macro}
5235 % \end{macro}
5236 % \end{intmacro}
5237 % \begin{intmacro}{\@gtt@setendanchor}
5238 % \begin{macro}{\xRight}
5239 % \begin{macro}{\yLower}
5240 % |\@gtt@setendanchor|\marg{anchor} is similar to the command above. However, it stores the anchor coordinates in the auxiliary macros |\xRight| and |\yLower|.
5241 % \begin{macrocode}
5242 \newcommand\@gtt@setendanchor[1]{%
5243 \pgfqkeys{/pgfgantt/link anchor}{#1}%
5244 \pgfpointanchor{\@gtt@link@endelement}{\@gtt@link@anchor}%
5245 \edef\xRight{\the\pgf@x}%
5246 \edef\yLower{\the\pgf@y}%
5247 }
5248
5249 % \end{macrocode}
5250 % \end{macro}
5251 % \end{macro}
5252 % \end{intmacro}
5253 % \begin{macro}{\ganttlink}
5254 % \begin{intmacro}{\@gtt@link@startelement}
5255 % \begin{intmacro}{\@gtt@link@endelement}
5256 % |\ganttlink|\oarg{options}\marg{E1}\marg{E2} executes the \meta{options} and stores the names of the connected elements \meta{E1} and \meta{E2} in |\@gtt@link@startelement| and |\@gtt@link@endelement|.
5257 % \begin{macrocode}
5258 \newcommand\ganttlink[3][]{%
5259 \begingroup%
5260 \ganttset{#1}%
5261 \def\@gtt@link@startelement{#2}%
5262 \def\@gtt@link@endelement{#3}%
5263 % \end{macrocode}
5264 % \end{intmacro}
5265 % \end{intmacro}
5266 % \begin{macro}{\ganttsetstartanchor}
5267 % \begin{macro}{\ganttsetendanchor}
5268 % |\ganttsetstartanchor| and |\ganttsetendanchor| are only valid in the second argument of |\newganttlinktype|. Since you may wish to omit one of those commands, we set default anchors for the link.
5269 % \begin{macrocode}
5270 \let\ganttsetstartanchor\@gtt@setstartanchor%
5271 \let\ganttsetendanchor\@gtt@setendanchor%
5272 \ganttsetstartanchor{east}%
5273 \ganttsetendanchor{west}%
5274 % \end{macrocode}
5275 % \end{macro}
5276 % \end{macro}
5277 % We call |\gtt@drawlink| with the value of \opt{link type}.
5278 % \begin{macrocode}
5279 \gtt@drawlink{\ganttvalueof{link type}}%
5280 \endgroup%
5281 }
5282
5283 % \end{macrocode}
5284 % \end{macro}
5285 %
5286 % \iffalse
5287 %</pgfgantt>
5288 % \fi
5289 % \Finale
5290 \endinput