diff options
author | Karl Berry <karl@freefriends.org> | 2011-03-11 00:29:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-03-11 00:29:04 +0000 |
commit | 84ad55c805b5ac1f8b77bff0c9740a6f05925a80 (patch) | |
tree | be9f5f7696a120c28abd1a2c46052fd4b09d05d7 /Master/texmf-dist/source | |
parent | edd2db0890ea11b90c892ff6a7810c6ad49850db (diff) |
new tikz package pgfgantt (10mar11)
git-svn-id: svn://tug.org/texlive/trunk@21681 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/pgfgantt/pgfgantt.dtx | 2866 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/pgfgantt/pgfgantt.ins | 61 |
2 files changed, 2927 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/pgfgantt/pgfgantt.dtx b/Master/texmf-dist/source/latex/pgfgantt/pgfgantt.dtx new file mode 100644 index 00000000000..1afd8e73841 --- /dev/null +++ b/Master/texmf-dist/source/latex/pgfgantt/pgfgantt.dtx @@ -0,0 +1,2866 @@ +% \iffalse meta-comment +% +% Copyright (C) 2011 by Wolfgang Skala +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% \fi +% +% \iffalse +%<pgfgantt>\ProvidesPackage{pgfgantt}[2011/03/01 v1.0 Draw Gantt diagrams with TikZ] +%<pgfgantt>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +% +%<*driver> +\documentclass[captions=tableheading,cleardoublepage=empty]{scrartcl} +\usepackage[english]{babel} + \frenchspacing +\usepackage[hdivide={2cm,*,5cm}]{geometry} +\usepackage{url} +\usepackage[dvipsnames]{xcolor} +\usepackage{listings} + \lstset{ + language=[AlLaTeX]TeX, + basicstyle=\ttfamily, + texcsstyle=*\color{RoyalBlue}, + keywordstyle=\color{Maroon}, + commentstyle=\itshape\color{black!50}, + columns=fullflexible, + backgroundcolor=\color{black!5}, + tabsize=2, + gobble=2, + frame=tlrb, + framesep=.25em, + xleftmargin=.25em, + xrightmargin=.25em, + rulecolor=\color{white}, + morekeywords={ganttchart,tikzpicture,tabular}, + moretexcs={ + gantttitle,gantttitlelist,ganttbar,ganttlink, + ganttlinkedbar,ganttmilestone,ganttlinkedmilestone,ganttgroup, + ganttset,ganttnewline,textcolor,foreach, + pgfcalendarweekdayshortname,usetikzlibrary, + color,rotatebox,definecolor,sfdefault,mddefault,bfdefault,fcolorbox + }, + escapeinside=`', + escapebegin=\begin{rmfamily}, + escapeend=\end{rmfamily}, + emph={ + anchor, bar, bulge, canvas, font, group, height, hgrid, + in, include, incomplete, label, last, left, link, line, list, mid, milestone, + options, peak, peaks, progress, right, rule, shift, style, text, title, + today, top, vgrid, width, xshift, yshift, + b-b, b-m, m-b, m-m, s-s, s-f, f-s, f-f + }, + emphstyle=\color{OliveGreen}, + } + \lstnewenvironment{texcode}[1][]{\lstset{basicstyle=\small\ttfamily,#1}}{} +\usepackage{doc} + \setlength\MacroIndent{0pt} + \setlength\MacroTopsep\parskip + \setlength\MacrocodeTopsep\medskipamount + \def\MacroFont{\small\ttfamily} + \def\theCodelineNo{\sffamily\scriptsize\color{black!50}\arabic{CodelineNo}} + \setcounter{IndexColumns}{2} + \def\pack#1{\texttt{#1}} + \def\main#1{\textit{#1}} + \def\usage#1{\textbf{#1}} + \providecommand\marg[1]{{\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} + \providecommand\oarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}} + \def\PrintDescribeMacro#1{\strut\MacroFont\color{RoyalBlue}\string#1} + \def\PrintDescribeEnv#1{\strut\MacroFont\color{Maroon}#1} + \def\PrintDescribeOpt#1{\strut\MacroFont\color{OliveGreen}#1} + \def\PrintMacroName#1{\strut\MacroFont\color{RoyalBlue}\string#1} + \def\PrintEnvName#1{\strut\MacroFont\color{Maroon}#1} + \def\PrintOptName#1{\strut\MacroFont\color{OliveGreen}#1} + \def\PrintIntMacroName#1{\strut\MacroFont\string#1} + +\makeatletter +\def\page@wrindex#1{\if@filesw + \immediate\write\@indexfile + {\string\indexentry{#1}% + {\thepage}}\fi} + +\def\SpecialUsageIndex#1{\@bsphack + {\let\special@index\page@wrindex\SpecialIndex@{#1}{\encapchar usage}}% + \@esphack} +\def\SpecialEnvIndex#1{\@bsphack\page@wrindex{% + #1\actualchar + {\string\ttfamily\space#1} + (environment)% + \encapchar usage}% + \page@wrindex{environments:\levelchar#1\actualchar{% + \string\ttfamily\space#1}\encapchar + usage}\@esphack} +\def\SpecialOptIndex#1{\@bsphack\page@wrindex{% + #1\actualchar + {\string\ttfamily\space#1} + (option)% + \encapchar usage}% + \page@wrindex{options:\levelchar#1\actualchar{% + \string\ttfamily\space#1}\encapchar + usage}\@esphack} +\def\SpecialMainOptIndex#1{\@bsphack\special@index{% + #1\actualchar + {\string\ttfamily\space#1} + (option)% + \encapchar main}% + \special@index{options:\levelchar#1\actualchar{% + \string\ttfamily\space#1}\encapchar + main}\@esphack} + +\def\DescribeOpt{\Describe@Opt} +\def\Describe@Macro#1{\endgroup + \marginpar{\rlap{\raggedright\PrintDescribeMacro{#1}}}% + \SpecialUsageIndex{#1}\@esphack\ignorespaces} +\def\Describe@Env#1{\endgroup + \marginpar{\rlap{\raggedright\PrintDescribeEnv{#1}}}% + \SpecialEnvIndex{#1}\@esphack\ignorespaces} +\def\Describe@Opt#1{\SpecialOptIndex{#1}\ignorespaces} + +\def\macro{\begingroup + \catcode`\\12 + \MakePrivateLetters \m@cro@ 1} +\def\environment{\begingroup + \catcode`\\12 + \MakePrivateLetters \m@cro@ 2} +\def\option{\begingroup + \catcode`\\12 + \MakePrivateLetters \m@cro@ 3} +\def\intmacro{\begingroup + \catcode`\\12 + \MakePrivateLetters \m@cro@ 4} +\long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist + \edef\saved@macroname{\string#2}% + \def\makelabel##1{\rlap{\hskip5pt\hskip\textwidth\hskip\marginparsep##1}}% + \if@inlabel + \let\@tempa\@empty \count@\macro@cnt + \loop \ifnum\count@>\z@ + \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat + \edef\makelabel##1{\rlap{\hskip5pt\hskip\textwidth\hskip\marginparsep\vtop to\baselineskip + {\@tempa\hbox{##1}\vss}}}% + \advance \macro@cnt \@ne + \else \macro@cnt\@ne \fi + \edef\@tempa{\noexpand\item[% + \ifcase #1\or% + \noexpand\PrintMacroName + \or + \noexpand\PrintEnvName + \or + \noexpand\PrintOptName + \or + \noexpand\PrintIntMacroName + \fi + {\string#2}]}% + \@tempa + \global\advance\c@CodelineNo\@ne + \ifcase #1\or% + \SpecialMainIndex{#2}\nobreak + \DoNotIndex{#2}% + \or + \SpecialMainEnvIndex{#2}\nobreak + \or + \SpecialMainOptIndex{#2}\nobreak + \or + \SpecialMainIndex{#2}\nobreak + \DoNotIndex{#2}% + \fi + \global\advance\c@CodelineNo\m@ne + \ignorespaces} +\let\endoption\endmacro +\let\endintmacro\endmacro +\makeatother + +\AtBeginDocument{\lstMakeShortInline|} + +\begingroup + \makeatletter + \def\x\begingroup#1\@nil{% + \endgroup + \def\DoNotIndex{% + \begingroup + \@makeother\#% + \@makeother\$% + \@makeother\%% + \@makeother\^% + \@makeother\_% + \@makeother\~% + \@makeother\ % + \@makeother\&% + #1% + }% + }% +\expandafter\x\DoNotIndex\@nil + +\newcommand\keyline[3]{\noindent\DescribeOpt{#1}\texttt{\color{OliveGreen}/pgfgantt/#1}#2\hfill#3\par\noindent\ignorespaces} +\newenvironment{key}[3]{% + \bigskip% + \keyline{#1}{#2}{#3}% +}{} +\def\TikZ{Ti\textit{k}Z} + +\usepackage{pgfgantt} +\usepackage{pgfcalendar} +\usetikzlibrary{positioning,shadows,shadings} + +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\IndexPrologue{\section{Index}Numbers written in bold refer to the page where the corresponding entry is described; numbers in italic refer to the code line of the definition; numbers in roman refer to the code lines where the entry is used.} +\GlossaryPrologue{\section{Change History}} + +\setkomafont{title}{\rmfamily\bfseries} +\addtokomafont{sectioning}{\rmfamily} +\normalmarginpar +\pdfpageattr{/Group <</S /Transparency /I true /CS /DeviceRGB>>} + + +\begin{document} + \DocInput{pgfgantt.dtx} +\end{document} +%</driver> +% \fi +% +% \CheckSum{891} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \GetFileInfo{pgfgantt.sty} +% +% \DoNotIndex{\@empty,\@tempa,\@tempb,\addtocounter,\begin,\begingroup,\bfseries,\clip,\csname,\def,\draw,\else,\end,\endcsname,\endgroup,\expandafter,\fi,\foreach,\global,\ifcase,\ifx,\itshape,\let,\newcommand,\newcounter,\newenvironment,\newif,\node,\normalsize,\path,\pgfkeys,\pgfkeysdef,\pgfkeysdefnargs,\pgfmathparse,\pgfmathresult,\pgfmathsetmacro,\pgfqkeys,\relax,\RequirePackage,\scriptsize,\setcounter,\small,\stepcounter,\usetikzlibrary,\value} +% +% +% \title{Drawing Gantt Charts in \LaTeX\\with \TikZ} +% \subtitle{The \texttt{pgfgantt} package\footnote{This document describes version \fileversion, dated \filedate.}} +% \author{Wolfgang Skala\thanks{Division of Structural Biology, Department of Molecular Biology, University of Salzburg, Austria; \texttt{Wolfgang.Skala@stud.sbg.ac.at}}} +% \date{March 1st, 2011} +% \maketitle +% \changes{v1.0}{2011/03/01}{Initial release} +% +% \begin{abstract} +% 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, namely titles (|\gantttitle|, |\gantttitlelist|), bars (|\ganttbar|), milestones (|\ganttmilestone|), groups (|\ganttgroup|) and different links between these elements (|\ganttlink|). Furthermore, the appearance of the chart elements is highly customizable, owing to a number of keys. +% \end{abstract} +% +% \tableofcontents +% +% +% \section{Introduction} +% +% 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{http://www.martin-kumm.de/tex_gantt_package.php}} (which inspired \pack{pgfgantt}'s fundamental aspects), \pack{pgfgantt} bases upon the \TikZ\ frontend of \textsc{pgf}\footnote{\url{http://ctan.org/tex-archive/graphics/pgf/}}. Besides, it provides a comprehensive (and portable) alternative to \pack{pst-gantt}\footnote{\url{http://ctan.org/tex-archive/graphics/pstricks/contrib/pst-gantt/}}. +% +% \pack{pgfgantt} requires a current \textsc{pgf} installation. To load the package, simply put +% \begin{texcode} +% \usepackage{pgfgantt} +% \end{texcode} +% into the document preamble. +% +% \section{User Guide} +% +% \subsection{Overview} +% +% Compare the following code, which demonstrates some commands provided by \pack{pgfgantt}, to the output it produces: +% +% \begin{texcode}[alsoletter={-}] +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}{12} +% \gantttitle{2011}{12} \\ +% \gantttitlelist{1,...,12}{1} \\ +% \ganttgroup{Group 1}{1}{7} \\ +% \ganttbar{Task 1}{1}{2} \\ +% \ganttlinkedbar{Task 2}{3}{7} \ganttnewline +% \ganttmilestone{Milestone}{7} \ganttnewline +% \ganttbar{Final Task}{8}{12} +% \ganttlink[b-m]{7}{5}{7}{6} +% \ganttlink[m-b]{7}{6}{8}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}{12} +% \gantttitle{2011}{12} \\ +% \gantttitlelist{1,...,12}{1} \\ +% \ganttgroup{Group 1}{1}{7} \\ +% \ganttbar{Task 1}{1}{2} \\ +% \ganttlinkedbar{Task 2}{3}{7} \ganttnewline +% \ganttmilestone{Milestone}{7} \ganttnewline +% \ganttbar{Final Task}{8}{12} +% \ganttlink[b-m]{7}{5}{7}{6} +% \ganttlink[m-b]{7}{6}{8}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% +% +% \subsection{Specifying Keys} +% +% \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. +% \begin{texcode} +% \ganttbar[bar label font=\bfseries]{Task 1}{1}{2} +% \end{texcode} +% 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 globally (or rather within the current \TeX\ group): +% \begin{texcode} +% \ganttset{bar label font=\bfseries} +% \end{texcode} +% 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. +% +% \subsection{The Canvas} +% +% 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{elements}, such as titles, bars and connections between bars. Commands that start with |\gantt|\dots\ draw these elements. When specifying start and end \textit{coordinates} for these commands, we use the dimensionless \textit{chart coordinate system}, whose origin lies in the top left corner. Along the $x$-axis, one unit corresponds to one \textit{time slot}; along the $y$-axis, one unit equals one \textit{line}. +% +% The \DescribeEnv{ganttchart}|ganttchart| environment groups several of the element-drawing macros into a single chart: +% \begin{texcode} +% \begin{ganttchart}`\oarg{options}\marg{number of time slots}' +% `$\cdots$' +% \end{ganttchart} +% \end{texcode} +% The environment has one optional and one mandatory argument. The former specifies the \meta{options} for the chart, the latter indicates the \meta{number of time slots}. +% +% Each |ganttchart| must be surrounded by a |tikzpicture| environment, whose $x$-vector/$y$-vector ratio should approximate $1:2$ (for example, |x=.5cm, y=1cm| as above). Other ratios are well possible, but you might have to change several spacing-related keys in order to obtain a pleasing chart. +% +% \begin{key}{canvas}{=\meta{style}}{initial value: \texttt{fill=white}} +% The |canvas| key changes the appearance of the canvas. \meta{style} is a list of \TikZ\ keys such as |fill|, |draw| or |dashed|. By default, the canvas is a white rectangle with a black frame. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [canvas={fill=yellow!25, draw=blue, dashed, very thick}]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{2} \\ +% \ganttbar{}{3}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [canvas={fill=yellow!25, draw=blue, dashed, very thick}]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{2} \\ +% \ganttbar{}{3}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{hgrid}{\texttt{[}=\texttt{false}/\texttt{true}/\meta{style}\texttt{]}}{\texttt{false}} +% \keyline{hgrid style}{=\meta{style}}{\texttt{dotted}} +% \keyline{vgrid}{\texttt{[}=\texttt{false}/\texttt{true}/\meta{style}\texttt{]}}{\texttt{false}} +% \keyline{vgrid style}{=\meta{style}}{\texttt{dotted}} +% |hgrid| draws a horizontal grid which starts immediately below the last title element. The key can be specified in four different ways: Firstly, |hgrid=false| eliminates the horizontal grid. You may omit this declaration, since it is the default. Secondly, both |hgrid| and |hgrid=true| activate the horizontal grid, which is then drawn in the default style |dotted|. Finally, |hgrid=|\meta{style} draws the horizontal grid in the given \meta{style}. +% +% You must change the style of the horizontal grid explicitly with |hgrid style| if you only wish to draw selected grid lines with |\ganttnewline[grid]| (see section~\ref{ssc:newline}). Actually, |hgrid=|\meta{style} is just a shortcut for |hgrid=true, hgrid style=|\meta{style}. +% +% The |vgrid| key governs the vertical grid; otherwise, it is similar to |hgrid|. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[hgrid=true, vgrid={draw=red, dashed}]{6} +% \gantttitle{Title 1}{6} \\ +% \gantttitle{Title 2}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[hgrid=true, vgrid={draw=red, dashed}]{6} +% \gantttitle{Title 1}{6} \\ +% \gantttitle{Title 2}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{hgrid shift}{=\meta{factor}}{\texttt{-0.3}} +% With default space parameters, the upper edge of a bar has an integral $y$-coordinate. Consequently, horizontal grid lines should be shifted upwards (i.\,e., along the negative $y$-axis) from their standard positions (see chart on the left). Otherwise, they will clash with the top of the bars (see chart on the right). +% \par\bigskip\noindent +% \begin{minipage}[t]{.5\textwidth} +% \begin{texcode} +% % Correct hgrid position +% +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [hgrid={green, ultra thick}]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \end{minipage}\hfill +% \begin{minipage}[t]{.47\textwidth} +% \begin{texcode} +% % Wrong hgrid position +% +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [hgrid={red, ultra thick}, +% hgrid shift=0]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \end{minipage} +% +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [hgrid={green, ultra thick}]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture}\hspace{1cm} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [hgrid={red, ultra thick}, +% hgrid shift=0]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{last line height}{=\meta{factor}}{\texttt{0.7}} +% With the default space parameters, the last line would appear too high and the element it contains would appear vertically displaced (see chart on the left). Therefore, the height of the bottommost line is by default decreased to 70\,\% of its native size (see chart on the right). +% \par\bigskip\noindent +% \begin{minipage}[t]{.48\textwidth} +% \begin{texcode} +% % Last line too high +% +% \begin{tikzpicture}% +% [x=.5cm, y=1cm, baseline] +% \begin{ganttchart}% +% [hgrid, +% last line height=1]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \end{minipage}\hfill +% \begin{minipage}[t]{.48\textwidth} +% \begin{texcode} +% % Last line correct +% +% \begin{tikzpicture}% +% [x=.5cm, y=1cm, baseline] +% \begin{ganttchart}% +% [hgrid, +% last line height=0.7]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \end{minipage} +% +% \begin{center} +% \begin{tikzpicture}% +% [x=.5cm, y=1cm, baseline] +% \begin{ganttchart}% +% [hgrid,last line height=1]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture}\hspace{1cm} +% \begin{tikzpicture}% +% [x=.5cm, y=1cm, baseline] +% \begin{ganttchart}% +% [hgrid,last line height=0.7]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{today}{=\meta{time slot}}{\texttt{none}} +% \keyline{today rule}{=\meta{style}}{\texttt{dashed, line width=1pt}} +% \keyline{today label}{=\meta{text}}{\texttt{TODAY}} +% 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 |today| key, which draws a vertical rule at the corresponding \meta{time slot}. This rule appears in the \meta{style} denoted by |today rule|, while |today label| contains the \meta{text} below the rule. +% \par\bigskip\noindent +% \begin{minipage}[t]{.44\textwidth} +% \begin{texcode} +% \begin{tikzpicture}% +% [x=.5cm, y=1cm, baseline] +% \begin{ganttchart}% +% [vgrid, today=2]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \end{minipage}\hfill +% \begin{minipage}[t]{.54\textwidth} +% \begin{texcode} +% \begin{tikzpicture}% +% [x=.5cm, y=1cm, baseline] +% \begin{ganttchart}% +% [vgrid, today=3, +% today label=\textcolor{blue}% +% {Current Week}, +% today rule={blue, ultra thick}]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \end{minipage} +% +% \begin{center} +% \begin{tikzpicture}% +% [x=.5cm, y=1cm, baseline] +% \begin{ganttchart}% +% [vgrid, today=2]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture}\hspace{1cm} +% \begin{tikzpicture}% +% [x=.5cm, y=1cm, baseline] +% \begin{ganttchart}% +% [vgrid, today=3, +% today label=\textcolor{blue}% +% {Current Week}, +% today rule={blue, ultra thick}]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% +% \subsection{Line Breaks between Chart Elements} +% \label{ssc:newline} +% +% \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|. Within a |ganttchart| environment, \DescribeMacro{\\}|\\| is defined as a shortcut for |\ganttnewline|, so that the syntax is reminiscent of \LaTeX's |tabular| enviroment. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[hgrid, vgrid]{6} +% \gantttitle{Title 1}{3} +% \gantttitle{Title 2}{3} \\ +% \ganttbar{}{1}{3} \ganttnewline +% \ganttbar{}{2}{3} +% \ganttbar{}{5}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[hgrid, vgrid]{6} +% \gantttitle{Title 1}{3} +% \gantttitle{Title 2}{3} \\ +% \ganttbar{}{1}{3} \ganttnewline +% \ganttbar{}{2}{3} +% \ganttbar{}{5}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% +% 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 between the current and the new line. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[hgrid style={thick, blue}]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{}{1}{3} \ganttnewline[grid] +% \ganttbar{}{4}{5} \\ +% \ganttbar{}{6}{10} \\[grid] +% \ganttbar{}{11}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[hgrid style={thick, blue}]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{}{1}{3} \ganttnewline[grid] +% \ganttbar{}{4}{5} \\ +% \ganttbar{}{6}{10} \\[grid] +% \ganttbar{}{11}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% +% +% \subsection{Titles} +% +% 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 two titling commands. +% +% \DescribeMacro{\gantttitle}|\gantttitle| draws a single title element: +% \begin{texcode} +% \gantttitle`\oarg{options}\marg{label}\marg{number of time slots}' +% \end{texcode} +% The \meta{label} appears in the center of 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. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[hgrid, vgrid]{12} +% \gantttitle{2011}{12} \\ +% \ganttbar{}{1}{4} +% \ganttbar{}{6}{11} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[hgrid, vgrid]{12} +% \gantttitle{2011}{12} \\ +% \ganttbar{}{1}{4} +% \ganttbar{}{6}{11} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% +% 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: +% \begin{texcode} +% \gantttitlelist`\oarg{options}\marg{pgffor list}\marg{length of each element}' +% \end{texcode} +% This macro generates one title element for each member of the \meta{pgffor list}. The second mandatory argument specifies the \meta{length of each element}. The \TikZ\ manual describes the syntax for the \meta{pgffor list} in more detail, but we will mention two of the most common applications: +% \begin{enumerate}\parskip0pt +% \item In order to draw twelve title elements that contain the numbers from 1 to 12 (indicating the months of a year), enter |1,...,12| as the \meta{pgffor} list. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[hgrid, vgrid]{12} +% \gantttitlelist{1,...,12}{1} \\ +% \ganttbar{}{1}{3} +% \ganttbar{}{5}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[hgrid, vgrid]{12} +% \gantttitlelist{1,...,12}{1} \\ +% \ganttbar{}{1}{3} +% \ganttbar{}{5}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% Note that we would have obtained the same result if we had written +% \begin{texcode} +% \gantttitle{1}{1} \gantttitle{2}{1} `\dots' \gantttitle{12}{1} \\ +% \end{texcode} +% \item In order to draw seven title elements containing the names of the weekdays (e.\,g., ``Mon'' to ``Sun''), we have to change the |title list options| key:\par +% \begin{key}{title list options}{=\meta{pgffor options}}{\texttt{var=\string\x, evaluate=\string\x}} +% This key changes the \meta{pgffor options} of the |\foreach| command called by |\gantttitlelist|. Again, the \TikZ\ manual is the definitive reference on possible \meta{pgffor options}. There is just one thing to keep in mind: The macro that yields the labels to be printed by |\gantttitlelist| must be called |\x|. +% \end{key}\par +% The following example shows how you can implement a title line enumerating the days of the week: +% \par\bigskip\noindent +% \begin{texcode} +% \usepackage{pgfcalendar} +% `$\cdots$' +% \begin{tikzpicture}[x=1cm, y=1cm] +% \begin{ganttchart}[hgrid, vgrid]{7} +% \gantttitlelist[title list options={% +% var=\y, evaluate=\y as \x% +% using "\pgfcalendarweekdayshortname{\y}"% +% }]{0,...,6}{1} \\ +% \ganttbar{}{1}{4} +% \ganttbar{}{6}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=1cm, y=1cm] +% \begin{ganttchart}[hgrid, vgrid]{7} +% \gantttitlelist[title list options={% +% var=\y, evaluate=\y as \x% +% using "\pgfcalendarweekdayshortname{\y}"% +% }]{0,...,6}{1} \\ +% \ganttbar{}{1}{4} +% \ganttbar{}{6}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{enumerate} +% +% \begin{key}{title}{=\meta{style}}{\texttt{fill=white}} +% Sets the appearance of a title element. +% \par\bigskip\noindent +% \begin{texcode} +% \usetikzlibrary{shadows} +% \usetikzlibrary{shadings} +% `$\cdots$' +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, canvas={draw=none}, +% title={fill=blue!20, rounded corners=2mm, drop shadow}]{7} +% \gantttitle{First week}{7} \\ +% \gantttitlelist[title={draw=none, inner color=red}]{1,...,7}{1} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, canvas={draw=none},title={fill=blue!20, rounded corners=2mm, drop shadow}]{7} +% \gantttitle{First week}{7} \\ +% \gantttitlelist[title={draw=none, inner color=red}]{1,...,7}{1} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{title label font}{=\meta{font commands}}{\texttt{\string\small}} +% Selects the font of the text inside a title element. In most cases, you can include font format commands directly in the first mandatory argument of |\gantttitle|. However, you \textit{must} use the |title label font| key if you intend to change the font size. Otherwise, the vertical alignment of the title label will be incorrect with the standard anchor. +% \par\bigskip\noindent +% \begin{minipage}[t]{.49\textwidth} +% \begin{texcode} +% % Wrong alignment +% +% \begin{tikzpicture}[x=.5cm, y=1.3cm] +% \begin{ganttchart}% +% [vgrid, hgrid]{6} +% \gantttitle{% +% \LARGE\color{violet}% +% \scshape Title}{6} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \end{minipage}\hfill +% \begin{minipage}[t]{.49\textwidth} +% \begin{texcode} +% % Correct alignment +% +% \begin{tikzpicture}[x=.5cm, y=1.3cm] +% \begin{ganttchart}% +% [vgrid, hgrid, +% title label font={\LARGE, +% \color{violet}, \scshape}]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \end{minipage} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1.3cm] +% \begin{ganttchart}% +% [vgrid, hgrid]{6} +% \gantttitle{% +% \LARGE\color{violet}% +% \scshape Title}{6} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture}\hspace{1cm} +% \begin{tikzpicture}[x=.5cm, y=1.3cm] +% \begin{ganttchart}% +% [vgrid, hgrid, +% title label font={\LARGE, \color{violet}, +% \scshape}]{6} +% \gantttitle{Title}{6} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{title label anchor}{=\meta{anchor}}{\texttt{anchor=mid}} +% By default, title labels are vertically centered at half their x-height. This yields a good alignment for labels whose letters have equal amounts of ascenders and descenders (e.\,g., lowercase numbers). However, when the letters contain mostly ascenders (e.\,g., uppercase numbers), the label position will appear too high. In this case, you should change the anchor: +% \par\bigskip\noindent +% \begin{minipage}[t]{.44\textwidth} +% \begin{texcode} +% % Badly centered label +% +% \begin{tikzpicture}% +% [x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid, +% title label font={\LARGE}% +% ]{6} +% \gantttitle{2011}{6} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \end{minipage}\hfill +% \begin{minipage}[t]{.54\textwidth} +% \begin{texcode} +% % Nicely centered label +% +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid, +% title label font={\LARGE}, +% title label anchor={below=-1.5ex}% +% ]{6} +% \gantttitle{2011}{6} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \end{minipage} +% \begin{center} +% \begin{tikzpicture}% +% [x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid, +% title label font={\LARGE}% +% ]{6} +% \gantttitle{2011}{6} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture}\hspace{1cm} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid, +% title label font={\LARGE}, +% title label anchor={below=-1.5ex}% +% ]{6} +% \gantttitle{2011}{6} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{title left shift}{=\meta{factor}}{\texttt{0}} +% \keyline{title right shift}{=\meta{factor}}{\texttt{0}} +% \keyline{title top shift}{=\meta{factor}}{\texttt{0}} +% \keyline{title height}{=\meta{factor}}{\texttt{0.6}} +% The first three keys shift the coordinates of a title element's borders (or rather of its corners), while |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: +% +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid]{6} +% \gantttitle{2011}{6} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \small +% \draw[blue, line width=1.5pt, dashed] (0,0) rectangle (1,-1); +% \draw[teal, line width=1.5pt, dashed] (5,0) rectangle (6,-1); +% \fill[red] (0,0) circle (1.5pt) node[above left] {start: $(0, 0)$}; +% \fill[black!75] (6,-1) circle (1.5pt) node[below right] {$(6, 1)$}; +% \fill[red] (6,-0.6) circle (1.5pt) node[right] {$(6, 0+0.6)$: stop}; +% \draw[-latex,blue] (.2,.6) node[above=-4pt] {Start time slot (1)} -- (.5,-.5); +% \draw[-latex,teal] (6.2,.1) node[above=-4pt] {End time slot (6)} -- (5.5,-.5); +% \end{tikzpicture} +% \end{center} +% The figure below shows a Gantt chart with two lines and one (large) time slot and indicates the distances modified by these keys. +% \begin{center} +% \begin{tikzpicture}[x=7cm, y=2cm] +% \begin{ganttchart}[title={line width=1.5pt,fill=yellow!10},title left shift=.2,title right shift=-.3,title top shift=.25, title height=.5]{1} +% \gantttitle{}{1} \\ +% \end{ganttchart} +% \small +% \draw[densely dashed] (0,-1) -- (1,-1); +% \draw[dashed,cyan,line width=1pt] (0,0) rectangle (1,-.6); +% \draw[cyan,-latex] (.8,.5) node[right,align=left] {Title element\\with standard values} -- (.75,0); +% \fill (0,0) circle (1.5pt) node[left] {$(0,0)$}; +% \fill (0,-1) circle (1.5pt) node[left] {$(0,1)$}; +% \fill (1,0) circle (1.5pt) node[right] {$(1,0)$}; +% \fill (1,-1) circle (1.5pt) node[right] {$(1,1)$}; +% \draw[latex-latex,line width=1pt,blue] +% (0, -.5) node[align=right,left] {\texttt{title left shift}\\(here: \texttt{0.2})} -- (.2,-.5); +% \draw[latex-latex,line width=1pt,blue] +% (.7, -.5) -- (1,-.5) node[align=left,right] {\texttt{title right shift}\\(here: \texttt{-0.3})}; +% \draw[latex-latex,line width=1pt,red] +% (.45, 0) node[align=left,above] {\texttt{title top shift}\\(here: \texttt{0.25})} -- (.45,-.25); +% \draw[latex-latex,line width=1pt,red] +% (.6, -.25) -- (.6,-.75) node[align=left,below] {\texttt{title height}\\(here: \texttt{0.5})}; +% \end{tikzpicture} +% \end{center} +% For example, you might devise a layout where the title element does not touch the borders of the start and end time slot. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, title={fill=teal, draw=none}, +% title label font=\color{white}\bfseries, +% title left shift=.1, title right shift=-.1, +% title top shift=.05, title height=.75]{7} +% \gantttitle{Title}{7} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, title={fill=teal, draw=none}, +% title label font=\color{white}\bfseries, +% title left shift=.1, title right shift=-.1, +% title top shift=.05, title height=.75]{7} +% \gantttitle{Title}{7} \\ +% \ganttbar{}{1}{2} +% \ganttbar{}{4}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{include title in canvas}{=\texttt{false}/\texttt{true}}{\texttt{true}} +% 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 |include title in canvas=false|. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [hgrid={draw=red, line width=2pt}, vgrid, +% title={draw=none, fill=none}, include title in canvas=false]{7} +% \gantttitlelist{1,...,7}{1} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [hgrid={draw=red, line width=2pt}, vgrid, +% title={draw=none, fill=none}, include title in canvas=false]{7} +% \gantttitlelist{1,...,7}{1} \\ +% \ganttbar{}{1}{3} \\ +% \ganttbar{}{4}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% +% \subsection{Bars} +% +% On a Gantt chart, a \textit{bar} indicates the duration of a task or one of its parts. +% \begin{texcode} +% \ganttbar`\oarg{options}\marg{label}\marg{start time slot}\marg{end time slot}' +% \end{texcode} +% The \DescribeMacro{\ganttbar}|\ganttbar| macro draws a bar from the \meta{start time slot} to the \meta{end time slot} and adds a \meta{label} at the left of the chart. Note that a bar will touch the left border of the \meta{start time slot} (and not the right, as it would if the \meta{start time slot} were strictly interpreted as an $x$-coordinate). +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{3} \\ +% \ganttbar{Task 2}{4}{10} \\ +% \ganttbar{Final task}{11}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{3} \\ +% \ganttbar{Task 2}{4}{10} \\ +% \ganttbar{Final task}{11}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% +% \begin{key}{bar}{=\meta{style}}{\texttt{fill=white}} +% Determines the appearance of the bar. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, bar={fill=red!50}]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{3} \\ +% \ganttbar[bar={fill=yellow, dashed}]{Task 2}{4}{10} \\ +% \ganttbar[bar={fill=green, draw=none}]{Final task}{11}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, bar={fill=red!50}]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{3} \\ +% \ganttbar[bar={fill=yellow, dashed}]{Task 2}{4}{10} \\ +% \ganttbar[bar={fill=green, draw=none}]{Final task}{11}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{bar label font}{=\meta{font commands}}{\texttt{\string\normalsize}} +% \keyline{bar label anchor}{=\meta{anchor}}{\texttt{anchor=east}} +% The |bar label font| key selects the font for the bar label, |bar label anchor| determines its anchor. The last control sequence in \meta{font commands} may take a single argument (like |\textit|). +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, bar label font=\Large]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar[bar label anchor={left=1cm}]{Task 1}{1}{3} \\ +% \ganttbar[bar label font=\color{orange}]{Task 2}{4}{10} \\ +% \ganttbar[bar label font=\MakeUppercase]{Final task}{11}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, bar label font=\Large]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar[bar label anchor={left=1cm}]{Task 1}{1}{3} \\ +% \ganttbar[bar label font=\color{orange}]{Task 2}{4}{10} \\ +% \ganttbar[bar label font=\MakeUppercase]{Final task}{11}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{bar left shift}{=\meta{factor}}{\texttt{0}} +% \keyline{bar right shift}{=\meta{factor}}{\texttt{0}} +% \keyline{bar top shift}{=\meta{factor}}{\texttt{0}} +% \keyline{bar height}{=\meta{factor}}{\texttt{0.4}} +% The first three keys shift the coordinates of a bar's borders (or rather of its corners), while |bar height| changes its height. By default, the left upper corner of a bar coincides with the origin of the start time slot; its right lower corner touches the right border of the end time slot $0.4$ units below the upper line border: +% +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid]{8} +% \gantttitle{Title}{8} \\ +% \ganttbar{}{2}{7} \\ +% \ganttbar{}{8}{8} +% \end{ganttchart} +% \small +% \draw[blue, line width=1.5pt, dashed] (1,-1) rectangle (2,-2); +% \draw[teal, line width=1.5pt, dashed] (6,-1) rectangle (7,-2); +% \fill[red] (1,-1) circle (1.5pt) node[left=1pt] {start: $(1, 1)$}; +% \fill[black!75] (7,-2) circle (1.5pt) node[below left] {$(7, 2)$}; +% \fill[red] (7,-1.4) circle (1.5pt) node[right=-1pt] {$(7, 1+0.4)$: stop}; +% \draw[-latex,blue] (.2,.2) node[above=-4pt] {Start time slot (2)} -- (1.5,-1.3); +% \draw[-latex,teal] (7.2,.1) node[above=-4pt] {End time slot (7)} -- (6.5,-1.3); +% \end{tikzpicture} +% \end{center} +% The figure below shows a Gantt chart with two lines and one (large) time slot and indicates the distances modified by these keys. +% \begin{center} +% \begin{tikzpicture}[x=8cm, y=2cm] +% \begin{ganttchart}[bar left shift=.2,bar right shift=-.3,bar top shift=.25, bar height=.5]{1} +% \ganttbar[bar={line width=1.5pt,fill=yellow!10}]{}{1}{1} \\ +% \end{ganttchart} +% \small +% \draw[densely dashed] (0,-1) -- (1,-1); +% \draw[dashed,cyan,line width=1pt] (0,0) rectangle (1,-.4); +% \draw[cyan,-latex] (.8,.5) node[right,align=left] {Bar with standard values} -- (.75,0); +% \fill (0,0) circle (1.5pt) node[left] {$(0,0)$}; +% \fill (0,-1) circle (1.5pt) node[left] {$(0,1)$}; +% \fill (1,0) circle (1.5pt) node[right] {$(1,0)$}; +% \fill (1,-1) circle (1.5pt) node[right] {$(1,1)$}; +% \draw[latex-latex,line width=1pt,blue] +% (0, -.5) node[align=right,left] {\texttt{bar left shift}\\(here: \texttt{0.2})} -- (.2,-.5); +% \draw[latex-latex,line width=1pt,blue] +% (.7, -.5) -- (1,-.5) node[align=left,right] {\texttt{bar right shift}\\(here: \texttt{-0.3})}; +% \draw[latex-latex,line width=1pt,red] +% (.45, 0) node[align=left,above] {\texttt{bar top shift}\\(here: \texttt{0.25})} -- (.45,-.25); +% \draw[latex-latex,line width=1pt,red] +% (.6, -.25) -- (.6,-.75) node[align=left,below] {\texttt{bar height}\\(here: \texttt{0.5})}; +% \end{tikzpicture} +% \end{center} +% For example, you might devise a layout with small, rounded bars that do not touch the borders of their start and end time slots. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, bar={fill=red, rounded corners=3pt}, +% bar left shift=.15, bar right shift=-.15, +% bar top shift=.1, bar height=.2]{7} +% \gantttitle{Title}{7} \\ +% \ganttbar{Task 1}{1}{2} \\ +% \ganttbar{Task 2}{3}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, bar={fill=red, rounded corners=3pt}, +% bar left shift=.15, bar right shift=-.15, +% bar top shift=.1, bar height=.2]{7} +% \gantttitle{Title}{7} \\ +% \ganttbar{Task 1}{1}{2} \\ +% \ganttbar{Task 2}{3}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% +% \subsection{Groups} +% +% \textit{Groups} subsume several subtasks (represented by bars) into a single task. +% \begin{texcode} +% \ganttgroup`\oarg{options}\marg{label}\marg{start time slot}\marg{end time slot}' +% \end{texcode} +% The \DescribeMacro{\ganttgroup}|\ganttgroup| macro draws a group from the \meta{start time slot} to the \meta{end time slot} and adds a \meta{label} at the left of the chart. Note that a group will start at the left border of the \meta{start time slot} (and not at the right, as it would if the \meta{start time slot} were strictly interpreted as an $x$-coordinate). +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid]{12} +% \gantttitle{Title}{12} \\ +% \ganttgroup{Group}{1}{10} \\ +% \ganttbar{Subtask 1}{1}{3} \\ +% \ganttbar{Subtask 2}{4}{10} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid]{12} +% \gantttitle{Title}{12} \\ +% \ganttgroup{Group}{1}{10} \\ +% \ganttbar{Subtask 1}{1}{3} \\ +% \ganttbar{Subtask 2}{4}{10} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% +% \begin{key}{group}{=\meta{style}}{\texttt{fill=black}} +% Changes the appearance of a group. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, group={draw=black, fill=green!50}]{12} +% \gantttitle{Title}{12} \\ +% \ganttgroup{Group}{1}{10} \\ +% \ganttbar{Subtasks}{1}{3} +% \ganttbar{}{5}{10} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, group={draw=black, fill=green!50}]{12} +% \gantttitle{Title}{12} \\ +% \ganttgroup{Group}{1}{10} \\ +% \ganttbar{Subtasks}{1}{3} +% \ganttbar{}{5}{10} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{group label font}{=\meta{font commands}}{\texttt{\string\normalsize\string\bfseries}} +% \keyline{group label anchor}{=\meta{anchor}}{\texttt{anchor=east}} +% The |group label font| key selects the font of the group label, |group label anchor| determines its anchor. The last control sequence in \meta{font commands} may take a single argument (like |\textit|). +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid, +% group label font={\fcolorbox{brown}{brown!10}}, +% group label anchor={left=1cm}]{12} +% \gantttitle{Title}{12} \\ +% \ganttgroup{Group}{1}{10} \\ +% \ganttbar{Subtasks}{1}{3} +% \ganttbar{}{5}{10} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid, +% group label font={\fcolorbox{brown}{brown!10}}, +% group label anchor={left=1cm}]{12} +% \gantttitle{Title}{12} \\ +% \ganttgroup{Group}{1}{10} \\ +% \ganttbar{Subtasks}{1}{3} +% \ganttbar{}{5}{10} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{group left shift}{=\meta{factor}}{\texttt{-0.1}} +% \keyline{group right shift}{=\meta{factor}}{\texttt{0.1}} +% \keyline{group top shift}{=\meta{factor}}{\texttt{0.1}} +% \keyline{group height}{=\meta{factor}}{\texttt{0.2}} +% The first three keys shift the coordinates of a group's borders (or rather of its corners), while |group height| changes its height. By default, the left upper corner of a group is 0.1 units left of and 0.1 units below the start time slot origin; its right lower corner (not counting the peak) lies 0.1 units right of and 0.3 units below the right border of the end time slot: +% +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid]{8} +% \gantttitle{Title}{8} \\ +% \ganttgroup{}{2}{6} \\ +% \ganttbar{}{2}{2} +% \ganttbar{}{4}{6} +% \end{ganttchart} +% \small +% \draw[blue, line width=1.5pt, dashed] (1,-1) rectangle (2,-2); +% \draw[teal, line width=1.5pt, dashed] (5,-1) rectangle (6,-2); +% \fill[red] (.9,-1.1) circle (1.5pt) node[left] {start: $(1-0.1, 1+0.1)$}; +% \fill[black!75] (6,-2) circle (1.5pt) node[below right] {$(6, 2)$}; +% \fill[red] (6.1,-1.3) circle (1.5pt) node[right] {$(6+0.1, 1+0.1+0.2)$: stop}; +% \draw[-latex,blue] (.2,.2) node[above=-4pt] {Start time slot (2)} -- (1.5,-1); +% \draw[-latex,teal] (6.2,.1) node[above=-4pt] {End time slot (6)} -- (5.5,-1); +% \end{tikzpicture} +% \end{center} +% The figure below shows a Gantt chart with two lines and one (large) time slot and indicates the distances modified by these keys. +% \begin{center} +% \begin{tikzpicture}[x=7cm, y=2cm] +% \begin{ganttchart}[group left shift=.2,group right shift=-.3,group top shift=.25, group height=.3,group peaks={.05}{.1}{.2}]{1} +% \ganttgroup[group={draw=black,line width=1.5pt,fill=yellow!10}]{}{1}{1} \\ +% \end{ganttchart} +% \small +% \draw[densely dashed] (0,-1) -- (1,-1); +% \draw[dashed,cyan,line width=1pt] (-.1,-.1) rectangle (1.1,-.3); +% \draw[cyan,-latex] (.8,.5) node[right,align=left] {Group with standard values\\(without peaks)} -- (.75,-.1); +% \fill (0,0) circle (1.5pt) node[left] {$(0,0)$}; +% \fill (0,-1) circle (1.5pt) node[left] {$(0,1)$}; +% \fill (1,0) circle (1.5pt) node[right] {$(1,0)$}; +% \fill (1,-1) circle (1.5pt) node[right] {$(1,1)$}; +% \draw[latex-latex,line width=1pt,blue] +% (0, -.5) node[align=right,left] {\texttt{group left shift}\\(here: \texttt{0.2})} -- (.2,-.5); +% \draw[latex-latex,line width=1pt,blue] +% (.7, -.5) -- (1,-.5) node[align=left,right] {\texttt{group right shift}\\(here: \texttt{-0.3})}; +% \draw[latex-latex,line width=1pt,red] +% (.45, 0) node[align=left,above] {\texttt{group top shift}\\(here: \texttt{0.25})} -- (.45,-.25); +% \draw[latex-latex,line width=1pt,red] +% (.55, -.25) -- (.55,-.55) node[align=left,below left=0pt and -10pt] {\texttt{group height}\\(here: \texttt{0.3})}; +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{group left peak}{=\marg{tip x}\marg{groove x}\marg{tip y}}{} +% \keyline{group right peak}{=\marg{tip x}\marg{groove x}\marg{tip y}}{} +% \keyline{group peaks}{=\marg{tip x}\marg{groove x}\marg{tip y}}{\texttt{0.2 0.4 0.1}} +% These keys govern the appearance of the peaks at both ends of a group. By default, the tip of each peak lies 0.2 units inward from a group's bottom corner and 0.1 units beneath, while the groove lies 0.4 units inward. While |group left peak| applies only to the left peak and |group right peak| affects only the right peak, |group peaks| sets the dimensions for both peaks simultaneously. You always have to specify three arguments for these keys. However, if you leave one of them blank, the corresponding space parameter retains its current value. +% +% The figure below exemplifies the space parameters as they apply to the left peak. +% \begin{center} +% \begin{tikzpicture}[x=8cm, y=2cm] +% \small +% \draw (0,0) rectangle (1,-1.3); +% \draw[line width=1.5pt, dashed] (.5,-.2) -- (.7,-.2); +% \draw[line width=1.5pt, solid] (.5,-.2) -- (.2,-.2) -- (.2,-.5) -- (.3,-.8) -- (.4,-.5) -- (.5,-.5); +% \draw[line width=1.5pt, dashed] (.5,-.5) -- (.7,-.5); +% \draw[densely dashed] (.2,-.5) -- (.2,-1.3); +% \draw[densely dashed] (.3,-.8) -- (.3,-1.3); +% \draw[densely dashed] (.3,-.8) -- (1,-.8); +% \fill (0,0) circle (1.5pt) node[left] {$(0,0)$}; +% \fill (0,-1) circle (1.5pt) node[left] {$(0,1)$}; +% \fill (1,0) circle (1.5pt) node[right] {$(1,0)$}; +% \fill (1,-1) circle (1.5pt) node[right] {$(1,1)$}; +% \draw[latex-latex,line width=1pt,blue] +% (.2, -.5) node[left=-3pt] {\meta{groove x}} -- (.4,-.5); +% \draw[latex-latex,line width=1pt,teal] +% (.2, -.9) node[left=-3pt] {\meta{tip x}} -- (.3,-.9); +% \draw[latex-latex,line width=1pt,red] +% (.5, -.5) node[below right] {\meta{tip y}} -- (.5,-.8); +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% For example, you might prefer that your groups stay within the start and end time slot, and that the peaks are more acute: +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, group left shift=0, group right shift=0, +% group peaks={0}{}{.4}]{7} +% \gantttitle{Title}{7} \\ +% \ganttgroup{Group}{1}{7} \\ +% \ganttbar{Tasks}{1}{2} +% \ganttbar{}{4}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, group left shift=0, group right shift=0, +% group peaks={0}{}{.4}]{7} +% \gantttitle{Title}{7} \\ +% \ganttgroup{Group}{1}{7} \\ +% \ganttbar{Tasks}{1}{2} +% \ganttbar{}{4}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% +% +% \subsection{Progress Bars and Progress Groups} +% +% \textit{Progress bars} and \textit{progress groups} illustrate the extent to which a (sub-)task has been completed. In order to draw a progress element, you simply specify the |progress| key in the optional argument to the respective standard macro. +% +% \begin{key}{progress}{=\texttt{none}/\meta{number}}{\texttt{none}} +% \keyline{bar incomplete}{=\meta{style}}{} +% \keyline{group incomplete}{=\meta{style}}{} +% \keyline{incomplete}{=\meta{style}}{\texttt{fill=black!25}} +% The |progress| key specifies that a task (represented by a bar) or a group thereof is \meta{number} percent complete. Starting from the left, \meta{number} percent of the element's area appear in the basic style (i.\,e., |bar| or |group|), while the |bar incomplete| and |group incomplete| keys, respectively, determine the appearance of the remainder. For convenience, the |incomplete| key simultaneously sets the incomplete style for bars and groups. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, bar={fill=green}]{12} +% \gantttitle{Title}{12} \\ +% \ganttgroup[progress=45]{Group 1}{1}{10} \\ +% \ganttbar[progress=100]{Subtask 1}{1}{3} \\ +% \ganttbar[progress=10, bar incomplete={fill=red}]{Subtask 2}{4}{10} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, bar={fill=green}]{12} +% \gantttitle{Title}{12} \\ +% \ganttgroup[progress=45]{Group 1}{1}{10} \\ +% \ganttbar[progress=100]{Subtask 1}{1}{3} \\ +% \ganttbar[progress=10, bar incomplete={fill=red}]{Subtask 2}{4}{10} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{progress label text}{=\meta{text}}{\texttt{\#1\string\% complete}} +% \keyline{progress label font}{=\meta{font commands}}{\texttt{\string\scriptsize}} +% \keyline{progress label anchor}{=\meta{anchor}}{\texttt{anchor=west}} +% The |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 value of |progress|. The label is typeset in the |progress label font|. In addition, |progress label anchor| governs its placement. By changing the default value, you may prevent the label from overlapping with other elements of your chart. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, bar={fill=green}]{12} +% \gantttitle{Title}{12} \\ +% \ganttgroup% +% [progress=45, progress label anchor={below=3pt}]% +% {Group 1}{1}{10} \\ +% \ganttbar% +% [progress=100, progress label font=\color{green!25!black}\textsf]% +% {Subtask 1}{1}{3} \\ +% \ganttbar% +% [progress=10, incomplete={fill=red}, +% progress label text={$\displaystyle\frac{#1}{100}$}]% +% {Subtask 2}{4}{10} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, bar={fill=green}]{12} +% \gantttitle{Title}{12} \\ +% \ganttgroup% +% [progress=45, progress label anchor={below=3pt}]% +% {Group 1}{1}{10} \\ +% \ganttbar% +% [progress=100, progress label font=\color{green!25!black}\textsf]% +% {Subtask 1}{1}{3} \\ +% \ganttbar% +% [progress=10, incomplete={fill=red}, +% progress label text={$\displaystyle\frac{#1}{100}$}]% +% {Subtask 2}{4}{10} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% +% \subsection{Milestones} +% +% A \textit{milestone} signifies that an important task has been completed or that a crucial goal has been reached. +% \begin{texcode} +% \ganttmilestone`\oarg{options}\marg{label}\marg{time slot}' +% \end{texcode} +% The \DescribeMacro{\ganttmilestone}|\ganttmilestone| macro draws a milestone at the given \meta{time slot} and adds a \meta{label} at the left of the chart. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{ganttchart}[vgrid, hgrid]{7} +% \gantttitle{Title}{7} \\ +% \ganttbar{Task 1}{1}{4} \\ +% \ganttmilestone{Milestone}{4} \\ +% \ganttbar{Task 2}{5}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid]{7} +% \gantttitle{Title}{7} \\ +% \ganttbar{Task 1}{1}{4} \\ +% \ganttmilestone{Milestone}{4} \\ +% \ganttbar{Task 2}{5}{7} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% Note that the milestone is usually centered on the vertical grid line between its \meta{time slot} and the following one. +% +% \begin{key}{milestone}{=\meta{style}}{\texttt{fill=black}} +% Determines the appearance of the milestone. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid, +% milestone={fill=orange, draw=black, rounded corners=3pt}]{7} +% \gantttitle{Title}{7} \\ +% \ganttbar{Task 1}{1}{5} \\ +% \ganttmilestone{Milestone}{5} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid, +% milestone={fill=orange, draw=black, rounded corners=3pt}]{7} +% \gantttitle{Title}{7} \\ +% \ganttbar{Task 1}{1}{5} \\ +% \ganttmilestone{Milestone}{5} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{milestone label font}{=\meta{font commands}}{\texttt{\string\normalsize\string\itshape}} +% \keyline{milestone label anchor}{=\meta{anchor}}{\texttt{anchor=east}} +% The former key sets the font of the milestone label, while the latter determines its placement. The last macro in \meta{font commands} may take a single argument, as we show in the following (somewhat silly) example. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid, +% milestone label font=\color{magenta}\rotatebox{30}, +% milestone label anchor={right=1cm}]{7} +% \gantttitle{Title}{7} \\ +% \ganttbar{Task 1}{1}{5} \\ +% \ganttmilestone{Milestone}{5} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid, +% milestone label font=\color{magenta}\rotatebox{30}, +% milestone label anchor={right=1cm}]{7} +% \gantttitle{Title}{7} \\ +% \ganttbar{Task 1}{1}{5} \\ +% \ganttmilestone{Milestone}{5} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \begin{key}{milestone width}{=\meta{factor}}{\texttt{0.8}} +% \keyline{milestone height}{=\meta{factor}}{\texttt{0.4}} +% \keyline{milestone xshift}{=\meta{factor}}{\texttt{0}} +% \keyline{milestone yshift}{=\meta{factor}}{\texttt{0.2}} +% These keys set the width and height of a milestone and shift the coordinates of its center. By default, a milestone is 0.8 units wide and 0.4 units high. Since the ideal $x$-vector/$y$-vector ratio of the parent |tikzpicture| is $1:2$, the milestone appears square with these settings. Its center lies on the right border and 0.2 units below the top border of its time slot. +% +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid]{7} +% \gantttitle{Title}{7} \\ +% \ganttmilestone{}{4} \\ +% \end{ganttchart} +% \small +% \draw[teal, line width=1.5pt, dashed] (3,-1) rectangle (4,-2); +% \fill[red] (4,-1.2) circle (1.5pt) node[right=7pt] {center: $(4+0, 1+0.2)$}; +% \draw[-latex, teal] (1.8,.2) node[above=-4pt] {Time slot (4)} -- (3.5,-1); +% \end{tikzpicture} +% \end{center} +% The figure below shows a Gantt chart with a single milestone and two (large) time slots; it indicates the distances modified by the four keys explained above. +% \begin{center} +% \begin{tikzpicture}[x=4cm, y=2cm] +% \begin{ganttchart}[milestone width=0.4, milestone height=0.7, milestone xshift=-.2, milestone yshift=.5]{2} +% \ganttmilestone[milestone={draw=black,line width=1.5pt,fill=yellow!10}]{}{1} \\ +% \end{ganttchart} +% \small +% \draw[densely dashed] (0,-1) -- (2,-1); +% \draw[densely dashed] (1,0) -- (1,-1.7); +% \draw[dashed, cyan, line width=1pt] (1,0) -- (1.4, -0.2) -- (1, -0.4) -- (0.6, -0.2) --cycle; +% \draw[cyan,-latex] (.8,.3) node[above] {Milestone with standard values} -- (.75,-.1); +% \draw[dashdotted] (.8, -.5) -- (.8, -1.5); +% \draw[dashdotted] (.8, -.5) -- (1.5, -.5); +% \fill[red] (.8,-.5) circle (1.5pt); +% \fill (0,0) circle (1.5pt) node[left] {$(0,0)$}; +% \fill (0,-1) circle (1.5pt) node[left] {$(0,1)$}; +% \fill (1,0) circle (1.5pt) node[above] {$(1,0)$}; +% \fill (1,-1) circle (1.5pt) node[below right] {$(1,1)$}; +% \fill (2,0) circle (1.5pt) node[above right] {$(2,0)$}; +% \fill (2,-1) circle (1.5pt) node[right] {$(2,1)$}; +% \draw[latex-latex, line width=1pt, blue] +% (0.8, -1.5) node[align=left, below] {\texttt{milestone xshift}\\(here: \texttt{-0.2})} -- (1,-1.5); +% \draw[latex-latex, line width=1pt, blue] +% (1.4, 0) -- (1.4,-.5) node[align=left, above right] {\texttt{milestone yshift}\\(here: \texttt{0.5})}; +% \draw[latex-latex, line width=1pt, red] +% (.6, -.9) node[align=left, below=4pt] {\texttt{milestone width}\\(here: \texttt{0.4})} -- (1,-.9); +% \draw[latex-latex, line width=1pt, red] +% (.6, -.15) node[align=right, below left=5pt] {\texttt{milestone height}\\(here: \texttt{0.7})} -- (.6,-.85); +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% +% \subsection{Links} +% +% 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. +% \begin{texcode} +% \ganttlink`\oarg{options}\marg{start time slot}\marg{start line}\marg{end time slot}\marg{end line}' +% \end{texcode} +% The \DescribeMacro{\ganttlink}|\ganttlink| macro connects two elements. The first element is in the \meta{start line} and ends at the \meta{start time slot}, while the second element resides in the \meta{end line} and starts at the \meta{end time slot}. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{4} \\ +% \ganttbar{Task 2}{5}{7} \\ +% \ganttbar{Task 3}{10}{12} +% \ganttlink{4}{2}{5}{3} +% \ganttlink{7}{3}{10}{4} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{4} \\ +% \ganttbar{Task 2}{5}{7} \\ +% \ganttbar{Task 3}{10}{12} +% \ganttlink{4}{2}{5}{3} +% \ganttlink{7}{3}{10}{4} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% +% \begin{key}{link}{=\meta{style}}{\texttt{-latex, rounded corners=1pt}} +% Sets the appearance of the link. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, link={[-to, line width=1pt, blue}]{7} +% \gantttitle{Title}{7} \\ +% \ganttbar{Task 1}{1}{4} \\ +% \ganttbar{Task 2}{5}{7} +% \ganttlink{4}{2}{5}{3} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, link={[-to, line width=1pt, blue}]{7} +% \gantttitle{Title}{7} \\ +% \ganttbar{Task 1}{1}{4} \\ +% \ganttbar{Task 2}{5}{7} +% \ganttlink{4}{2}{5}{3} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \pack{pgfgantt} calculates the actual start and stop coordinates for each link, but in order to succeed, it has to know which types of elements it should connect. Consequently, the optional argument of |\ganttlink| must contain a \textit{link type key}. +% +% The syntax of a link type key is similar to the syntax for specifying arrow tips in \TikZ: Each such key is composed of two letters separated by a hyphen. +% +% Link types fall into two categories: +% \begingroup\lstset{alsoletter={-}} +% \begin{enumerate}\parskip0pt +% \item \DescribeOpt{b-b}\DescribeOpt{b-m}\DescribeOpt{m-b}\DescribeOpt{m-m}\textit{Arrow-like links} may contain the letters |b| (for bar) and |m| (for milestone). Thus, |b-b| denotes a link between two bars, while |b-m| denotes a link from a bar to a milestone. Note that |b-b| is the default link type, so you do not have to specify it for connecting two bars. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid, link={-latex, red, rounded corners=1pt}]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{3} \\ +% \ganttbar{Task 2}{4}{7} \\ +% \ganttmilestone{Milestone 1a}{7} \\ +% \ganttmilestone{Milestone 1b}{7} \\ +% \ganttbar{Final Task}{10}{12} +% \ganttlink{3}{2}{4}{3} +% \ganttlink[b-m]{7}{3}{7}{4} +% \ganttlink[m-m]{7}{4}{7}{5} +% \ganttlink[m-b]{7}{5}{10}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid, link={-latex, red, rounded corners=1pt}]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{3} \\ +% \ganttbar{Task 2}{4}{7} \\ +% \ganttmilestone{Milestone 1a}{7} \\ +% \ganttmilestone{Milestone 1b}{7} \\ +% \ganttbar{Final Task}{10}{12} +% \ganttlink{3}{2}{4}{3} +% \ganttlink[b-m]{7}{3}{7}{4} +% \ganttlink[m-m]{7}{4}{7}{5} +% \ganttlink[m-b]{7}{5}{10}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% As you can see from this graph, arrow-like links 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). +% +% Two keys further modify the appearance of arrow-like links: +% +% \begin{key}{link mid}{=\meta{factor}}{\texttt{0.5}} +% The |link mid| key 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 +% \keyline{link bulge}{=\meta{factor}}{\texttt{0.4}} +% In five-part links, the upper and lower vertical segments are shifted along the $x$-axis by $+$|link bulge| and $-$|link bulge|, respectively. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, link mid=.25, link bulge=1.3]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{4} \\ +% \ganttbar{Task 2}{5}{7} \\ +% \ganttbar{Task 3}{10}{12} +% \ganttlink{4}{2}{5}{3} +% \ganttlink[link mid=.8]{7}{3}{10}{4} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, link mid=.25, link bulge=1.3]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{4} \\ +% \ganttbar{Task 2}{5}{7} \\ +% \ganttbar{Task 3}{10}{12} +% \ganttlink{4}{2}{5}{3} +% \ganttlink[link mid=.8]{7}{3}{10}{4} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% +% \item \DescribeOpt{s-s}\DescribeOpt{s-f}\DescribeOpt{f-s}\DescribeOpt{f-f}\textit{Straight links} may contain the letters |s| (for start) and |f| (for finish). They are only meant for connecting two bars in order to establish start-to-finish relations (|s-f|), start-to-start relations (|s-s|) etc. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, link={-latex, red}]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{2}{3} \\ +% \ganttbar{Task 2}{2}{5} \\ +% \ganttbar{Task 3}{6}{11} \\ +% \ganttbar{Task 4}{8}{11} +% \ganttlink[s-s]{2}{2}{2}{3} +% \ganttlink[f-s]{5}{3}{6}{4} +% \ganttlink[f-f]{11}{4}{11}{5} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, link={-latex, red}]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{2}{3} \\ +% \ganttbar{Task 2}{2}{5} \\ +% \ganttbar{Task 3}{6}{11} \\ +% \ganttbar{Task 4}{8}{11} +% \ganttlink[s-s]{2}{2}{2}{3} +% \ganttlink[f-s]{5}{3}{6}{4} +% \ganttlink[f-f]{11}{4}{11}{5} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% +% \begin{key}{link label}{=\marg{link type key}\marg{label text}}{(miscellaneous)} +% \keyline{link label font}{=\meta{font commands}}{\texttt{\string\scriptsize\string\itshape}} +% \keyline{link label anchor}{=\meta{anchor}}{\texttt{anchor=west}} +% Since straight links all look the same, a label indicates the respective relationship. You can redefine these labels with the |link label| key, which changes the \meta{label text} for a \meta{link type key}. +% +% The |link label font| key specifies the font for the label, |link label anchor| determines its placement (by default, the label appears to the right of the straight link's center). +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, +% link label font=\small\color{purple}\textbf, +% link label={f-s}{f$\to$s}]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{2}{3} \\ +% \ganttbar{Task 2}{2}{5} \\ +% \ganttbar{Task 3}{6}{11} \\ +% \ganttbar{Task 4}{8}{11} \\ +% \ganttbar{Task 5}{4}{7} +% \ganttlink[s-s]{2}{2}{2}{3} +% \ganttlink[f-s]{5}{3}{6}{4} +% \ganttlink[f-f, link label anchor={anchor=east}]{11}{4}{11}{5} +% \ganttlink[s-f, link label anchor={anchor=base}]{8}{5}{7}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, +% link label font=\small\color{purple}\textbf, +% link label={f-s}{f$\to$s}]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{2}{3} \\ +% \ganttbar{Task 2}{2}{5} \\ +% \ganttbar{Task 3}{6}{11} \\ +% \ganttbar{Task 4}{8}{11} \\ +% \ganttbar{Task 5}{4}{7} +% \ganttlink[s-s]{2}{2}{2}{3} +% \ganttlink[f-s]{5}{3}{6}{4} +% \ganttlink[f-f, link label anchor={anchor=east}]{11}{4}{11}{5} +% \ganttlink[s-f, link label anchor={anchor=base}]{8}{5}{7}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% \end{enumerate} +% \endgroup +% +% +% \subsection{Linked Bars and Linked Milestones} +% +% Since you'll most likely draw a lot of arrow-like links between bars and milestones, \pack{pgfgantt} provides two convenient shortcuts for these tasks: +% \begin{texcode} +% \ganttlinkedbar`\oarg{options}\marg{label}\marg{start time slot}\marg{end time slot}' +% \ganttlinkedmilestone`\oarg{options}\marg{label}\marg{time slot}' +% \end{texcode} +% These \DescribeMacro{\ganttlinkedbar}macros work exactly like the standard versions, but they additionally draw a link from the previous \DescribeMacro{\ganttlinkedmilestone}element to the bar or milestone. In the following example, the code on the left is equivalent to the code on the right. + +% \begingroup\lstset{alsoletter={-}} +% \begin{minipage}[t]{.49\textwidth} +% \begin{texcode} +% % Short version +% +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{4} \\ +% \ganttlinkedbar{Task 2}{5}{6} \\ +% \ganttlinkedmilestone{M 1}{6} \\ +% \ganttlinkedbar% +% [m-b]{Task 3}{7}{11} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \end{minipage}\hfill +% \begin{minipage}[t]{.47\textwidth} +% \begin{texcode} +% % Long version +% +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{4} \\ +% \ganttbar{Task 2}{5}{6} \\ +% \ganttmilestone{M 1}{6} \\ +% \ganttbar{Task 3}{7}{11} +% \ganttlink{4}{2}{5}{3} +% \ganttlink[b-m]{6}{3}{6}{4} +% \ganttlink[m-b]{6}{4}{7}{5} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \end{minipage} + +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, hgrid]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{1}{4} \\ +% \ganttlinkedbar{Task 2}{5}{6} \\ +% \ganttlinkedmilestone{M 1}{6} \\ +% \ganttlinkedbar% +% [m-b]{Task 3}{7}{11} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \endgroup +% +% +% \subsection{Style Examples} +% +% The first example plays around with colors and notably uses equal $x$- and $y$-vectors. +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=0.5cm,y=0.5cm] +% \begin{ganttchart}% +% [vgrid, +% title={draw=none, fill=RoyalBlue!50!black}, +% title label font=\sffamily\bfseries\color{white}, +% title label anchor={below=-1.6ex}, +% title left shift=.05, +% title right shift=-.05, +% title height=.8, +% bar={draw=none, fill=OliveGreen!75}, +% bar height=.6, +% bar label font=\normalsize\color{black!50}, +% group right shift=0, +% group top shift=.3, +% group height=.3, +% group peaks={}{}{.2}, +% incomplete={fill=Maroon}, +% link={OliveGreen}]{16} +% \gantttitle{2010}{4} +% \gantttitle{2011}{12} \\ +% \ganttbar% +% [progress=100, progress label font=\small\color{OliveGreen!75}, +% progress label anchor={right=4pt}, +% bar label font=\normalsize\color{OliveGreen}]% +% {Preliminary Project}{1}{4} \\ +% \ganttlink[link mid=.4]{4}{2}{5}{4} +% \ganttlink[link mid=.159]{4}{2}{5}{7} +% \ganttset{progress label text={}, link={black, -to}} +% \ganttgroup{Objective 1}{5}{16} \\ +% \ganttbar[progress=4]{Task A}{5}{10} \\ +% \ganttlinkedbar[progress=0]{Task B}{11}{16} \\ +% \ganttgroup{Objective 2}{5}{16} \\ +% \ganttbar[progress=15]{Task A}{5}{13} \\ +% \ganttlinkedbar[progress=0]{Task B}{14}{16} \\ +% \ganttgroup{Objective 3}{9}{12} \\ +% \ganttbar[progress=0]{Task A}{9}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% +% \begin{center} +% \begin{tikzpicture}[x=0.5cm,y=0.5cm] +% \begin{ganttchart}% +% [vgrid, +% title={draw=none, fill=RoyalBlue!50!black}, +% title label font=\sffamily\bfseries\color{white}, +% title label anchor={below=-1.6ex}, +% title left shift=.05, +% title right shift=-.05, +% title height=.8, +% bar={draw=none, fill=OliveGreen!75}, +% bar height=.6, +% bar label font=\normalsize\color{black!50}, +% group right shift=0, +% group top shift=.3, +% group height=.3, +% group peaks={}{}{.2}, +% incomplete={fill=Maroon}, +% link={OliveGreen}]{16} +% \gantttitle{2010}{4} +% \gantttitle{2011}{12} \\ +% \ganttbar% +% [progress=100, progress label font=\small\color{OliveGreen!75}, +% progress label anchor={right=4pt}, +% bar label font=\normalsize\color{OliveGreen}]% +% {Preliminary Project}{1}{4} \\ +% \ganttlink[link mid=.4]{4}{2}{5}{4} +% \ganttlink[link mid=.159]{4}{2}{5}{7} +% \ganttset{progress label text={}, link={black, -to}} +% \ganttgroup{Objective 1}{5}{16} \\ +% \ganttbar[progress=4]{Task A}{5}{10} \\ +% \ganttlinkedbar[progress=0]{Task B}{11}{16} \\ +% \ganttgroup{Objective 2}{5}{16} \\ +% \ganttbar[progress=15]{Task A}{5}{13} \\ +% \ganttlinkedbar[progress=0]{Task B}{14}{16} \\ +% \ganttgroup{Objective 3}{9}{12} \\ +% \ganttbar[progress=0]{Task A}{9}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% +% \bigskip +% 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{http://en.wikipedia.org/wiki/Gantt_chart}.) +% \par\bigskip\noindent +% \begin{texcode} +% \definecolor{barblue}{RGB}{153,204,254} +% \definecolor{groupblue}{RGB}{51,102,254} +% \definecolor{linkred}{RGB}{165,0,33} +% \begin{tikzpicture}[x=0.5cm,y=1cm] +% \renewcommand\sfdefault{phv} +% \renewcommand\mddefault{mc} +% \renewcommand\bfdefault{bc} +% \sffamily +% \begin{ganttchart}% +% [canvas={fill=none, draw=black!5, line width=.75pt}, +% hgrid style={draw=black!5, line width=.75pt}, +% vgrid={draw=black!5, line width=.75pt}, +% today=7.1, +% today rule={draw=black!64, +% dash pattern=on 3.5pt off 4.5pt, line width=1.5pt}, +% today label={\small\bfseries TODAY}, +% title={draw=none, fill=none}, +% title label font=\bfseries\footnotesize, +% title label anchor={below=-2pt}, +% include title in canvas=false, +% bar label font=\mdseries\small\color{black!70}, +% bar label anchor={left=2cm}, +% bar={draw=none, fill=black!63}, +% bar incomplete={fill=barblue}, +% progress label font=\mdseries\footnotesize\color{black!70}, +% group incomplete={fill=groupblue}, +% group left shift=0, +% group right shift=0, +% group height=.5, +% group peaks={0}{}{}, +% group label anchor={left=.6cm}, +% link={-latex, line width=1.5pt, linkred}, +% link label font=\scriptsize\bfseries\color{linkred}\MakeUppercase, +% link label anchor={below left=-2pt and 0pt} +% ]{13} +% \gantttitle[title label anchor={below left=-2pt and -3pt}]% +% {WEEKS:\quad1}{1} +% \gantttitlelist{2,...,13}{1} \\ +% \ganttgroup[progress=57, progress label font=\bfseries\small]% +% {WBS 1 Summary Element 1}{1}{10} \\ +% \ganttbar[progress=75]{\textbf{WBS 1.1} Activity A}{1}{8} \\ +% \ganttbar[progress=67]{\textbf{WBS 1.2} Activity B}{1}{3} \\ +% \ganttbar[progress=50]{\textbf{WBS 1.3} Activity C}{4}{10} \\ +% \ganttbar[progress=0]{\textbf{WBS 1.4} Activity D}{4}{10} \\[grid] +% \ganttgroup[progress=0, progress label font=\bfseries\small]% +% {WBS 2 Summary Element 2}{4}{10} \\ +% \ganttbar[progress=0]{\textbf{WBS 2.1} Activity E}{4}{5} \\ +% \ganttbar[progress=0]{\textbf{WBS 2.2} Activity F}{6}{8} \\ +% \ganttbar[progress=0]{\textbf{WBS 2.3} Activity G}{9}{10} +% \ganttlink[s-s]{1}{3}{1}{4} +% \ganttlink[f-s]{3}{4}{4}{5} +% \ganttlink[f-f, link label anchor={left}]{10}{5}{10}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% +% \begin{center} +% \definecolor{barblue}{RGB}{153,204,254} +% \definecolor{groupblue}{RGB}{51,102,254} +% \definecolor{linkred}{RGB}{165,0,33} +% \begin{tikzpicture}[x=0.5cm,y=1cm] +% \renewcommand\sfdefault{phv} +% \renewcommand\mddefault{mc} +% \renewcommand\bfdefault{bc} +% \sffamily +% \begin{ganttchart}% +% [canvas={fill=none, draw=black!5, line width=.75pt}, +% hgrid style={draw=black!5, line width=.75pt}, +% vgrid={draw=black!5, line width=.75pt}, +% today=7.1, +% today rule={draw=black!64, +% dash pattern=on 3.5pt off 4.5pt, line width=1.5pt}, +% today label={\small\bfseries TODAY}, +% title={draw=none, fill=none}, +% title label font=\bfseries\footnotesize, +% title label anchor={below=-2pt}, +% include title in canvas=false, +% bar label font=\mdseries\small\color{black!70}, +% bar label anchor={left=2cm}, +% bar={draw=none, fill=black!63}, +% bar incomplete={fill=barblue}, +% progress label font=\mdseries\footnotesize\color{black!70}, +% group incomplete={fill=groupblue}, +% group left shift=0, +% group right shift=0, +% group height=.5, +% group peaks={0}{}{}, +% group label anchor={left=.6cm}, +% link={-latex, line width=1.5pt, linkred}, +% link label font=\scriptsize\bfseries\color{linkred}\MakeUppercase, +% link label anchor={below left=-2pt and 0pt} +% ]{13} +% \gantttitle[title label anchor={below left=-2pt and -3pt}]% +% {WEEKS:\quad1}{1} +% \gantttitlelist{2,...,13}{1} \\ +% \ganttgroup[progress=57, progress label font=\bfseries\small]% +% {WBS 1 Summary Element 1}{1}{10} \\ +% \ganttbar[progress=75]{\textbf{WBS 1.1} Activity A}{1}{8} \\ +% \ganttbar[progress=67]{\textbf{WBS 1.2} Activity B}{1}{3} \\ +% \ganttbar[progress=50]{\textbf{WBS 1.3} Activity C}{4}{10} \\ +% \ganttbar[progress=0]{\textbf{WBS 1.4} Activity D}{4}{10} \\[grid] +% \ganttgroup[progress=0, progress label font=\bfseries\small]% +% {WBS 2 Summary Element 2}{4}{10} \\ +% \ganttbar[progress=0]{\textbf{WBS 2.1} Activity E}{4}{5} \\ +% \ganttbar[progress=0]{\textbf{WBS 2.2} Activity F}{6}{8} \\ +% \ganttbar[progress=0]{\textbf{WBS 2.3} Activity G}{9}{10} +% \ganttlink[s-s]{1}{3}{1}{4} +% \ganttlink[f-s]{3}{4}{4}{5} +% \ganttlink[f-f, link label anchor={left}]{10}{5}{10}{6} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% +% +% \StopEventually{\PrintIndex\PrintChanges} +% \lstDeleteShortInline| +% \MakeShortVerb{\|} +% \section{Implementation} +% +% +% \subsection{Packages} +% +% \pack{pgfgantt} is modest in terms of dependencies: It only requires the \TikZ\ package and some of its libraries. +% +% \iffalse +%<*pgfgantt> +% \fi +% \begin{macrocode} +\RequirePackage{tikz} + \usetikzlibrary{arrows,backgrounds,calc,patterns,positioning} + +% \end{macrocode} +% +% \subsection{Global Counters and Booleans} +% +% We define a number of global counters: |gtt@width| equals the number of time slots. |gtt@currentline| holds the current line; it starts from 0 and decreases. |gtt@lastline| is the line of the last element drawn (used by |\ganttlinkedbar|). |gtt@lastslot| is the $x$-coordinate of the right border of the last drawn element. |gtt@lasttitleline| equals the line of the title element drawn last, and |gtt@lasttitleslot| corresponds to the $x$-coordinate of its right border. +% +% The boolean |\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. +% \begin{macrocode} +\newcounter{gtt@width} +\newcounter{gtt@currentline} +\newcounter{gtt@lastline} +\newcounter{gtt@lastslot} +\newcounter{gtt@lasttitleline} +\newcounter{gtt@lasttitleslot} +\newif\ifgtt@intitle + +% \end{macrocode} +% +% +% \subsection{Macros for Key Management} +% +% \begin{macro}{\ganttset} +% |\ganttset| changes the current key path to |/pgfgantt/| and then executes the keys in its mandatory argument. +% \begin{macrocode} +\def\ganttset#1{\pgfqkeys{/pgfgantt}{#1}} + +% \end{macrocode} +% \end{macro} +% \begin{intmacro}{\@gtt@keydef} +% The following four auxiliary macros save us some code when we devise keys later on. Firstly, |\@gtt@keydef|\marg{key} declares the key |/pgfgantt/|\meta{key}, which saves its value in the macro |gtt@|\meta{key}. +% \begin{macrocode} +\def\@gtt@keydef#1{% + \pgfkeysdef{/pgfgantt/#1}{% + \expandafter\def\csname gtt@#1\endcsname{##1}% + }% +} +% \end{macrocode} +% \end{intmacro} +% \begin{intmacro}{\@gtt@get} +% Secondly, |\@gtt@get|\marg{key} retrieves the value stored by a \meta{key}. +% \begin{macrocode} +\def\@gtt@get#1{\csname gtt@#1\endcsname} +% \end{macrocode} +% \end{intmacro} +% \begin{intmacro}{\@gtt@stylekeydef} +% Thirdly, |\@gtt@stylekeydef|\marg{key} declares a \meta{key} which saves its value as the internal style key |/pgfgantt/|\meta{key}|@style|. +% \begin{macrocode} +\def\@gtt@stylekeydef#1{% + \pgfkeysdef{/pgfgantt/#1}{% + \pgfkeys{/pgfgantt/#1@style/.style={##1}}% + }% +} +% \end{macrocode} +% \end{intmacro} +% \begin{intmacro}{\@gtt@linkkeydef} +% Finally, |\@gtt@linkkeydef|\marg{link type}\marg{start type}\marg{end type}\marg{label} declares the key |/pgfgantt/|\meta{start type}|-|\meta{end type}. Such keys change the appearance of a |\ganttlink|, since they store the \meta{start type} (|b|, |m|, |s| or |f|) in |\gtt@link@starttype|, the \meta{end type} in |\gtt@link@endtype| and the \meta{link type} (either |0| for arrow-like links or |1| for straight links) in |\gtt@link@type|. If \meta{label} differs from |\relax|, it is saved for the respective link. +% \begin{macrocode} +\def\@gtt@linkkeydef#1#2#3#4{% + \pgfkeysdef{/pgfgantt/#2-#3}{% + \def\gtt@link@type{#1}% + \def\gtt@link@starttype{#2}% + \def\gtt@link@endtype{#3}% + }% + \def\@tempa{#4}% + \ifx\@tempa\relax\else\ganttset{link label={#2-#3}{#4}}\fi% +} + +% \end{macrocode} +% \end{intmacro} +% +% \subsection{Option Declarations} +% +% \begin{option}{hgrid} +% \begin{option}{hgrid style} +% |hgrid| checks whether its value is |false| and sets the boolean |\ifgtt@hgrid| accordingly. If the value is |true| or missing, the |hgrid style| should draw |dotted| lines. +% \begin{macrocode} +\@gtt@stylekeydef{hgrid style} +\newif\ifgtt@hgrid +\pgfkeysdef{/pgfgantt/hgrid}{% + \def\@tempa{#1}% + \def\@tempb{false}% + \ifx\@tempa\@tempb% + \gtt@hgridfalse% + \else% + \gtt@hgridtrue% + \def\@tempb{true}% + \ifx\@tempa\@tempb% + \pgfkeys{/pgfgantt/hgrid style={dotted}}% + \else% + \pgfkeys{/pgfgantt/hgrid style={#1}}% + \fi% + \fi% +} +\pgfkeys{/pgfgantt/hgrid/.default=dotted} + +% \end{macrocode} +% \end{option} +% \end{option} +% \begin{option}{vgrid} +% \begin{option}{vgrid style} +% Analogously, we declare |vgrid| and |vgridstyle|. +% \begin{macrocode} +\@gtt@stylekeydef{vgrid style} +\newif\ifgtt@vgrid +\pgfkeysdef{/pgfgantt/vgrid}{% + \def\@tempa{#1}% + \def\@tempb{false}% + \ifx\@tempa\@tempb% + \gtt@vgridfalse% + \else% + \gtt@vgridtrue% + \def\@tempb{true}% + \ifx\@tempa\@tempb% + \pgfkeys{/pgfgantt/vgrid style={dotted}}% + \else% + \pgfkeys{/pgfgantt/vgrid style={#1}}% + \fi% + \fi% +} +\pgfkeys{/pgfgantt/vgrid/.default=dotted} + +% \end{macrocode} +% \end{option} +% \end{option} +% \begin{option}{canvas}\begin{option}{today}\begin{option}{today rule}\begin{option}{today label}\begin{option}{hgrid shift}\begin{option}{last line height} +% Here is a set of keys related to the canvas \dots +% \begin{macrocode} +\@gtt@stylekeydef{canvas} +\@gtt@keydef{today} +\@gtt@stylekeydef{today rule} +\@gtt@keydef{today label} +\@gtt@keydef{hgrid shift} +\@gtt@keydef{last line height} + +% \end{macrocode} +% \end{option}\end{option}\end{option}\end{option}\end{option}\end{option} +% \begin{option}{title}\begin{option}{title label font}\begin{option}{title label anchor}\begin{option}{title list options}\begin{option}{title left shift}\begin{option}{title right shift}\begin{option}{title top shift}\begin{option}{title height} +% \dots\ and of keys that influence the title. Note that |\@gtt@keydef| cannot define |title list options|, since |\@gtt@titlelistoptions| is expanded after a |\foreach| statement, where |\@gtt@get| will not work. +% \begin{macrocode} +\@gtt@stylekeydef{title} +\@gtt@keydef{title label font} +\@gtt@stylekeydef{title label anchor} +\pgfkeysdef{/pgfgantt/title list options}{% + \def\gtt@titlelistoptions{[#1]}% +} +\@gtt@keydef{title left shift} +\@gtt@keydef{title right shift} +\@gtt@keydef{title top shift} +\@gtt@keydef{title height} + +% \end{macrocode} +% \end{option}\end{option}\end{option}\end{option}\end{option}\end{option}\end{option}\end{option} +% \begin{option}{include title in canvas} +% |include title in canvas| is the only true boolean key in the package. +% \begin{macrocode} +\newif\ifgtt@includetitle +\pgfkeys{/pgfgantt/include title in canvas/.is if=gtt@includetitle} + +% \end{macrocode} +% \end{option} +% \begin{option}{bar}\begin{option}{bar label font}\begin{option}{bar label anchor}\begin{option}{bar left shift}\begin{option}{bar right shift}\begin{option}{bar top shift} \begin{option}{bar height} +% Some standard key declarations for bars \dots +% \begin{macrocode} +\@gtt@stylekeydef{bar} +\@gtt@keydef{bar label font} +\@gtt@stylekeydef{bar label anchor} +\@gtt@keydef{bar left shift} +\@gtt@keydef{bar right shift} +\@gtt@keydef{bar top shift} +\@gtt@keydef{bar height} + +% \end{macrocode} +% \end{option}\end{option}\end{option}\end{option}\end{option}\end{option}\end{option} +% \begin{option}{group}\begin{option}{group label font}\begin{option}{group label anchor}\begin{option}{group left shift}\begin{option}{group right shift}\begin{option}{group top shift}\begin{option}{group height} +% \dots\ and groups. +% \begin{macrocode} +\@gtt@stylekeydef{group} +\@gtt@keydef{group label font} +\@gtt@stylekeydef{group label anchor} +\@gtt@keydef{group left shift} +\@gtt@keydef{group right shift} +\@gtt@keydef{group top shift} +\@gtt@keydef{group height} +% \end{macrocode} +% \end{option}\end{option}\end{option}\end{option}\end{option}\end{option}\end{option} +% \begin{option}{group left peak} +% |gantt left peak| checks for each of its three values whether it is non-empty and only then changes the corresponding length macro. +% \begin{macrocode} +\pgfkeysdefnargs{/pgfgantt/group left peak}{3}{% + \def\@tempa{#1}% + \ifx\@tempa\@empty\else\def\gtt@groupleftpeakmidx{#1}\fi% + \def\@tempa{#2}% + \ifx\@tempa\@empty\else\def\gtt@groupleftpeakinnerx{#2}\fi% + \def\@tempa{#3}% + \ifx\@tempa\@empty\else\def\gtt@groupleftpeaky{#3}\fi% +} +% \end{macrocode} +% \end{option} +% \begin{option}{group right peak} +% |group right peak| works similar, but a |-| also counts as an empty value (the reason for this will soon become apparent). +% \begin{macrocode} +\pgfkeysdefnargs{/pgfgantt/group right peak}{3}{% + \def\@tempa{#1}% + \def\@tempb{-}% + \ifx\@tempa\@empty\else% + \ifx\@tempa\@tempb\else\def\gtt@grouprightpeakmidx{#1}\fi% + \fi% + \def\@tempa{#2}% + \ifx\@tempa\@empty\else% + \ifx\@tempa\@tempb\else\def\gtt@grouprightpeakinnerx{#2}\fi% + \fi% + \def\@tempa{#3}% + \ifx\@tempa\@empty\else\def\gtt@grouprightpeaky{#3}\fi% +} +% \end{macrocode} +% \end{option} +% \begin{option}{group peaks} +% |group peaks| simultaneously sets |group left peak| and |group right peak|. In order to preserve the symmetry of the peaks, the key adds a negative sign (i.\,e., a hyphen in the source code) to \meta{groove x} and \meta{inner x} of |group right peak|. Therefore, the latter key must interpret its first and second value as ``empty'' even if they contain a single hyphen. +% \begin{macrocode} +\pgfkeysdefnargs{/pgfgantt/group peaks}{3}{% + \ganttset{group left peak={#1}{#2}{#3}, group right peak={-#1}{-#2}{#3}}% +} + +% \end{macrocode} +% \end{option} +% \begin{option}{progress}\begin{option}{bar incomplete}\begin{option}{group incomplete}\begin{option}{incomplete}\begin{option}{progress label lext}\begin{option}{progress label font}\begin{option}{progress label anchor} +% The keys below manage the progress elements. Note the way in which we declare |progress label text|, so that a |#1| in its value is replaced by the argument of |\gtt@progresslabeltext|. +% \begin{macrocode} +\@gtt@keydef{progress} +\@gtt@stylekeydef{bar incomplete} +\@gtt@stylekeydef{group incomplete} +\pgfkeysdef{/pgfgantt/incomplete}{% + \ganttset{bar incomplete={#1}, group incomplete={#1}}% +} +\pgfkeysdef{/pgfgantt/progress label text}{% + \def\gtt@progresslabeltext##1{#1}% +} +\@gtt@keydef{progress label font} +\@gtt@stylekeydef{progress label anchor} + +% \end{macrocode} +% \end{option}\end{option}\end{option}\end{option}\end{option}\end{option}\end{option} +% \begin{option}{milestone}\begin{option}{milestone label font}\begin{option}{milestone label anchor}\begin{option}{milestone width}\begin{option}{milestone height}\begin{option}{milestone xshift}\begin{option}{milestone yshift} +% Here are the declarations of the milestone-related keys. +% \begin{macrocode} +\@gtt@stylekeydef{milestone} +\@gtt@keydef{milestone label font} +\@gtt@stylekeydef{milestone label anchor} +\@gtt@keydef{milestone width} +\@gtt@keydef{milestone height} +\@gtt@keydef{milestone xshift} +\@gtt@keydef{milestone yshift} + +% \end{macrocode} +% \end{option}\end{option}\end{option}\end{option}\end{option}\end{option}\end{option} +% \begin{option}{link}\begin{option}{link label font}\begin{option}{link label anchor}\begin{option}{link label}\begin{option}{link mid}\begin{option}{link bulge} +% Next, we declare the keys that modify links. +% \begin{macrocode} +\@gtt@stylekeydef{link} +\@gtt@keydef{link label font} +\@gtt@stylekeydef{link label anchor} +\pgfkeysdefnargs{/pgfgantt/link label}{2}{% + \expandafter\def\csname gtt@link@#1@labeltext\endcsname{#2}% +} +\@gtt@keydef{link mid} +\@gtt@keydef{link bulge} +% \end{macrocode} +% \end{option}\end{option}\end{option}\end{option}\end{option}\end{option} +% \begin{option}{b-b}\begin{option}{b-m}\begin{option}{m-b}\begin{option}{m-m}\begin{option}{s-s}\begin{option}{s-f}\begin{option}{f-s}\begin{option}{f-f} +% The definitions of the eight link types follow. +% \begin{macrocode} +\@gtt@linkkeydef 0 b b \relax +\@gtt@linkkeydef 0 b m \relax +\@gtt@linkkeydef 0 m b \relax +\@gtt@linkkeydef 0 m m \relax +\@gtt@linkkeydef 1 s s {start-to-start} +\@gtt@linkkeydef 1 s f {start-to-finish} +\@gtt@linkkeydef 1 f s {finish-to-start} +\@gtt@linkkeydef 1 f f {finish-to-finish} + +% \end{macrocode} +% \end{option}\end{option}\end{option}\end{option}\end{option}\end{option}\end{option}\end{option} +% Finally, we initialize all keys in order to define the commands that save their values. +% \begin{macrocode} +\ganttset{ + canvas={fill=white}, + hgrid style=dotted, + vgrid style=dotted, + today=none, + today rule={dashed, line width=1pt}, + today label=TODAY, + hgrid shift=-.3, + last line height=.7, + title={fill=white}, + title label font=\small, + title label anchor={anchor=mid}, + title left shift=0, + title right shift=0, + title top shift=0, + title height=.6, + title list options={var=\x, evaluate=\x}, + include title in canvas, + bar={fill=white}, + bar label font=\normalsize, + bar label anchor={anchor=east}, + bar left shift=0, + bar right shift=0, + bar top shift=0, + bar height=.4, + group={fill=black}, + group label font=\normalsize\bfseries, + group label anchor={anchor=east}, + group left shift=-.1, + group right shift=.1, + group top shift=.1, + group height=.2, + group peaks={.2}{.4}{.1}, + progress=none, + incomplete={fill=black!25}, + progress label text={#1\% complete}, + progress label font=\scriptsize, + progress label anchor={anchor=west}, + milestone={fill=black}, + milestone label font=\normalsize\itshape, + milestone label anchor={anchor=east}, + milestone width=.8, + milestone height=.4, + milestone xshift=0, + milestone yshift=.2, + link={-latex, rounded corners=1pt}, + link label font=\scriptsize\itshape, + link label anchor={anchor=west}, + b-b, + link mid=.5, + link bulge=.4, +} + +% \end{macrocode} +% +% +% \subsection{The Main Environment} +% +% \begin{environment}{ganttchart} +% \begin{macro}{\\} +% At the beginning of a |ganttchart| environment, the keys in its optional argument are executed. |gtt@width| saves the environment's mandatory argument (i.\,e., the number of time slots). All line counters are set to 0. Since we expect a chart to start with at least one title element, |\ifgtt@intitle| is true. Within the environment, the control symbol |\\| is equivalent to |\ganttnewline| (similar to the syntax of a \LaTeX\ table). +% \begin{macrocode} +\newenvironment{ganttchart}[2][]{% + \ganttset{#1}% + \setcounter{gtt@width}{#2}% + \setcounter{gtt@currentline}{0}% + \setcounter{gtt@lastline}{0}% + \setcounter{gtt@lasttitleline}{0}% + \gtt@intitletrue% + \let\\\ganttnewline% +}{% +% \end{macrocode} +% \begin{intmacro}{\x@left}\begin{intmacro}{\x@right}\begin{intmacro}{\y@upper}\begin{intmacro}{\y@lower} +% After the contents of the environment have been drawn, we add the canvas to the background layer. The |ganttchart| environment and all |\gantt...| macros save their $x$- and $y$-coordinates in local internal macros called |\x@left|, |\x@right|, |\y@upper| and |\y@lower|. The upper $y$-coordinate of the canvas is either zero or excludes the title lines if |include title in canvas| is false. The lower $y$-coordinate must take |last line height| into account. +% \begin{macrocode} + \begin{scope}[on background layer]% + \ifgtt@includetitle% + \def\y@upper{0}% + \else% + \def\y@upper{\value{gtt@lasttitleline}-\@gtt@get{hgrid shift}}% + \fi% + \def\y@lower{\value{gtt@currentline}-\@gtt@get{last line height}}% + \draw[/pgfgantt/canvas@style] + (0, \y@upper) rectangle + (\value{gtt@width}, \y@lower);% +% \end{macrocode} +% \end{intmacro}\end{intmacro}\end{intmacro}\end{intmacro} +% A |\foreach| loop iterates over all time slots and adds vertical grid lines between them, considering |hgrid shift| for the upper $y$-coordinate. +% \begin{macrocode} + \ifgtt@vgrid% + \foreach \t [evaluate=\t using \t-1] + in {2,3,...,\value{gtt@width}} {% + \draw[/pgfgantt/vgrid style@style] + (\t, \value{gtt@lasttitleline}-\@gtt@get{hgrid shift}) -- + (\t, \y@lower);% + }% + \fi% +% \end{macrocode} +% 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. +% \begin{macrocode} + \ifgtt@hgrid% + \ifgtt@includetitle\else\addtocounter{gtt@lasttitleline}{-1}\fi% + \foreach \t [evaluate=\t] + in {\value{gtt@lasttitleline},...,\value{gtt@currentline}} {% + \draw[/pgfgantt/hgrid style@style] + (0, \t-\@gtt@get{hgrid shift}) -- + (\value{gtt@width}, \t-\@gtt@get{hgrid shift});% + }% + \ifgtt@includetitle\else\stepcounter{gtt@lasttitleline}\fi% + \fi% +% \end{macrocode} +% The last task of |ganttchart| is to apply the |today| key if its value differs from |none|. +% \begin{macrocode} + \def\@tempa{none}% + \ifx\gtt@today\@tempa\else% + \draw[/pgfgantt/today rule@style] + (\@gtt@get{today}, + \value{gtt@lasttitleline}-\@gtt@get{hgrid shift}) -- + (\@gtt@get{today}, \y@lower);% + \node at (\@gtt@get{today}, \y@lower) + [anchor=north] {\@gtt@get{today label}};% + \fi% + \end{scope}% +} + +% \end{macrocode} +% \end{macro} +% \end{environment} +% +% +% \subsection{Starting a New Line} +% +% \begin{macro}{\ganttnewline} +% If the optional argument of |\ganttnewline| contains |grid|, this macro adds a horizontal grid rule between the current and the new line. 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. +% \begin{macrocode} +\newcommand\ganttnewline[1][]{% + \def\@tempa{#1}% + \def\@tempb{grid}% + \ifx\@tempa\@tempb% + \draw[/pgfgantt/hgrid style@style] + (0, \value{gtt@currentline}-1-\@gtt@get{hgrid shift}) -- + (\value{gtt@width}, + \value{gtt@currentline}-1-\@gtt@get{hgrid shift});% + \fi% + \addtocounter{gtt@currentline}{-1}% + \ifgtt@intitle\addtocounter{gtt@lasttitleline}{-1}\fi% + \setcounter{gtt@lasttitleslot}{0}% +} + +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Title Elements} +% +% \begin{macro}{\gantttitle} +% |\gantttitle| draws a title element (i.\,e., a rectangle with a single node at its center). For reasons that will become clear below, the rectangle essentially starts at the $x$-coordinate stored in |gtt@lasttitleslot|. At the end of the macro, |gtt@lasttitleslot| and |gtt@lastline| are updated accordingly. +% +% Note that in order to keep key changes local, all macros that draw chart elements set the keys specified as their optional argument within a group. +% \begin{macrocode} +\newcommand\gantttitle[3][]{% + \begingroup% + \ganttset{#1}% + \def\x@left{\value{gtt@lasttitleslot}+\@gtt@get{title left shift}}% + \def\x@right{\value{gtt@lasttitleslot}+#3+\@gtt@get{title right shift}}% + \def\y@upper{\value{gtt@currentline}-\@gtt@get{title top shift}}% + \def\y@lower{\value{gtt@currentline}-\@gtt@get{title top shift}% + -\@gtt@get{title height}}% + \draw[/pgfgantt/title@style] + (\x@left, \y@upper) rectangle + (\x@right, \y@lower);% + \@gtt@get{title label font}% + \node at ($(\x@left,\y@upper)!.5!(\x@right,\y@lower)$) + [/pgfgantt/title label anchor@style] {#2};% + \addtocounter{gtt@lasttitleslot}{#3}% + \setcounter{gtt@lastline}{\value{gtt@currentline}}% + \endgroup% +} + +% \end{macrocode} +% \end{macro} +% \begin{macro}{\gantttitlelist} +% |\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. +% \begin{macrocode} +\newcommand\gantttitlelist[3][]{% + \begingroup% + \ganttset{#1}% + \expandafter\foreach\gtt@titlelistoptions in {#2} {\gantttitle{\x}{#3}}% + \endgroup% +} + +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Bars} +% +% \begin{macro}{\ganttbar} +% |\ganttbar| begins by defining the usual coordinate macros. +% \begin{macrocode} +\newcommand\ganttbar[4][]{% + \begingroup% + \ganttset{#1}% + \def\x@left{#3-1+\@gtt@get{bar left shift}}% + \def\x@right{#4+\@gtt@get{bar right shift}}% + \def\y@upper{\value{gtt@currentline}-\@gtt@get{bar top shift}}% + \def\y@lower{\value{gtt@currentline}-\@gtt@get{bar top shift}% + -\@gtt@get{bar height}}% +% \end{macrocode} +% If the first mandatory argument of |\ganttbar| is not empty, we print a label with its anchor at the left canvas border halfway between the upper and lower $y$-coordinate of the bar. +% \begin{macrocode} + \def\@tempa{#2}% + \ifx\@tempa\@empty\else% + \node at ($(0, \y@upper)!.5!(0, \y@lower)$) + [/pgfgantt/bar label anchor@style] {\@gtt@get{bar label font}{#2}};% + \fi% +% \end{macrocode} +% \begin{intmacro}{\gtt@pl@draw} +% |\gtt@pl@draw| saves the commands that will produce the progress label. This macro does nothing unless (a) the |progress| key differs from |none| and (b) |progress label text| differs from |\relax|. Otherwise, it creates a vertically centered node to the right of the bar. +% \begin{macrocode} + \def\@tempa{none}% + \ifx\gtt@progress\@tempa% + \def\gtt@progress{100}% + \let\gtt@pl@draw\relax% + \else + \expandafter\ifx\gtt@progresslabeltext\relax\relax% + \let\gtt@pl@draw\relax% + \else% + \def\gtt@pl@draw{% + \node at ($(\x@right, \y@upper)!.5!(\x@right, \y@lower)$) + [/pgfgantt/progress label anchor@style] {% + \@gtt@get{progress label font}{% + \@gtt@get{progresslabeltext}{\@gtt@get{progress}}% + }% + };% + }% + \fi% + \fi% +% \end{macrocode} +% \end{intmacro} +% In order to draw the left (complete) and right (incomplete) part of a progress bar, we clip the corresponding rectangles depending on the value of |progress|. Note that we turn off the border of these rectangles and draw it with an additional, third command. +% \begin{macrocode} + \begin{scope}% + \clip (\x@left,\y@upper) rectangle + ($(\x@left, \y@lower)!\gtt@progress/100!(\x@right, \y@lower)$);% + \draw[/pgfgantt/bar@style, draw=none] (\x@left, \y@upper) + rectangle (\x@right, \y@lower);% + \end{scope}% + \begin{scope}% + \clip ($(\x@left,\y@upper)!\gtt@progress/100!(\x@right,\y@upper)$) + rectangle (\x@right,\y@lower);% + \draw[/pgfgantt/bar incomplete@style, draw=none] + (\x@left, \y@upper) rectangle (\x@right, \y@lower);% + \end{scope}% + \draw[/pgfgantt/bar@style, fill=none] + (\x@left, \y@upper) rectangle (\x@right, \y@lower);% + \gtt@pl@draw% +% \end{macrocode} +% Since the first bar clearly appears after the last line containing a title element, we set the boolean |\ifgtt@intitle| to false. +% \begin{macrocode} + \setcounter{gtt@lastslot}{#4}% + \setcounter{gtt@lastline}{\value{gtt@currentline}}% + \global\gtt@intitlefalse% + \endgroup% +} + +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ganttlinkedbar} +% The shortcut version |\ganttlinkedbar| calls both |\ganttbar| and |\ganttlink|, taking care of the correct coordinates for the link. +% \begin{macrocode} +\newcommand\ganttlinkedbar[4][]{% + \begingroup% + \ganttset{#1}% + \ganttlink{\value{gtt@lastslot}}{-\value{gtt@lastline}-1}% + {#3}{-\value{gtt@currentline}-1}% + \ganttbar{#2}{#3}{#4}% + \endgroup% +} + +% \end{macrocode} +% \end{macro} +% +% \subsection{Links} +% +% \begin{macro}{\ganttlink} +% |\ganttlink| takes two completely different approaches to drawing links, depending on the link type defined by |\@gtt@linkkeydef|. +% \begin{macrocode} +\newcommand\ganttlink[5][]{% + \begingroup% + \ganttset{#1}% + \ifcase\gtt@link@type% +% \end{macrocode} +% Link type |0| (arrow-like): 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. Therefore, we have to correct these coordinates if the link starts or ends at a milestone. +% \begin{macrocode} + \def\x@left{#2+\@gtt@get{bar right shift}}% + \def\x@right{#4-1+\@gtt@get{bar left shift}}% + \def\y@upper{-#3+1-\@gtt@get{bar top shift}/2-\@gtt@get{bar height}/2}% + \def\y@lower{-#5+1-\@gtt@get{bar top shift}/2-\@gtt@get{bar height}/2}% + \def\@tempa{m} + \ifx\gtt@link@starttype\@tempa + \def\x@left{% + #2+\@gtt@get{milestone xshift}+\@gtt@get{milestone width}/2% + }% + \def\y@upper{-#3+1-\@gtt@get{milestone yshift}}% + \fi + \ifx\gtt@link@endtype\@tempa + \def\x@right{% + #4+\@gtt@get{milestone xshift}-\@gtt@get{milestone width}/2% + }% + \def\y@lower{-#5+1-\@gtt@get{milestone yshift}}% + \fi +% \end{macrocode} +% Now we check if the connected elements lie in the same row or not. In the latter case, |\pgfmathparse| yields 0. +% \begin{macrocode} + \pgfmathparse{#3==#5}% + \ifcase\pgfmathresult% +% \end{macrocode} +% Once again, two possibilities arise: Either the elements to be connected are at least separated by one time slot, in which case we draw a three-part arrow. Alternatively, the elements lie in adjacent time slots or even overlap, in which case we draw a five-part arrow. +% \begin{macrocode} + \pgfmathparse{(#4-1)>#2}% + \ifcase\pgfmathresult% + \draw[/pgfgantt/link@style] + (\x@left, \y@upper) -- + (\x@left+\@gtt@get{link bulge}, \y@upper) -- + ($(\x@left+\@gtt@get{link bulge},\y@upper)!% + \@gtt@get{link mid}!% + (\x@left+\@gtt@get{link bulge},\y@lower)$) -- + ($(\x@right-\@gtt@get{link bulge},\y@upper)!% + \@gtt@get{link mid}!% + (\x@right-\@gtt@get{link bulge},\y@lower)$) -- + (\x@right-\@gtt@get{link bulge}, \y@lower) -- + (\x@right, \y@lower);% + \else% + \draw[/pgfgantt/link@style] + (\x@left, \y@upper) -- + ($(\x@left,\y@upper)!\@gtt@get{link mid}!(\x@right,\y@upper)$) -- + ($(\x@left,\y@lower)!\@gtt@get{link mid}!(\x@right,\y@lower)$) -- + (\x@right, \y@lower);% + \fi% +% \end{macrocode} +% For elements that lie in the same row, we only draw an arrow if they are separated by at least one time slot. +% \begin{macrocode} + \else% + \pgfmathparse{(#4-1)==#2}% + \ifcase\pgfmathresult% + \draw[/pgfgantt/link@style] + (\x@left, \y@upper) -- (\x@right, \y@lower);% + \fi% + \fi% +% \end{macrocode} +% Link type |1| (straight): We calculate the start and end coordinates accordingly. Due to our conventions for specifying time slots instead of ``real'' $x$-coordinates, some subtleties arise. +% \begin{macrocode} + \else% + \def\@tempa{f}% + \ifx\gtt@link@starttype\@tempa% + \def\x@left{#2+\@gtt@get{bar right shift}}% + \else + \def\@tempa{s} + \ifx\gtt@link@starttype\@tempa + \def\x@left{#2-1+\@gtt@get{bar right shift}}% + \fi% + \fi% + \def\@tempa{f}% + \ifx\gtt@link@endtype\@tempa% + \def\x@right{#4+\@gtt@get{bar left shift}}% + \else + \def\@tempa{s} + \ifx\gtt@link@endtype\@tempa + \def\x@right{#4-1+\@gtt@get{bar left shift}}% + \fi% + \fi% + \def\y@upper{-#3+1-\@gtt@get{bar height}}% + \def\y@lower{-#5+1-\@gtt@get{bar top shift}}% +% \end{macrocode} +% The remainder is straightforward: A vertical line connects the two elements; the label is anchored halfway between the start and end coordinates. +% \begin{macrocode} + \draw[/pgfgantt/link@style] + (\x@left, \y@upper) -- + (\x@right, \y@lower);% + \node at ($(\x@left, \y@upper)!.5!(\x@right, \y@lower)$) + [/pgfgantt/link label anchor@style] {% + \@gtt@get{link label font}{% + \csname gtt@link@\gtt@link@starttype-\gtt@link@endtype% + @labeltext\endcsname% + }% + };% + \fi% + \endgroup% +} + +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Groups} +% +% \begin{macro}{\ganttgroup} +% Groups and bars are quite similar. First, we define the usual coordinate macros. +% \begin{macrocode} +\newcommand\ganttgroup[4][]{% + \begingroup% + \ganttset{#1}% + \def\x@left{#3-1+\@gtt@get{group left shift}}% + \def\x@right{#4+\@gtt@get{group right shift}}% + \def\y@upper{\value{gtt@currentline}-\@gtt@get{group top shift}}% + \def\y@lower{\value{gtt@currentline}-\@gtt@get{group top shift}% + -\@gtt@get{group height}}% +% \end{macrocode} +% If the first mandatory argument of |\ganttgroup| is not empty, we print a label with its anchor at the left canvas border halfway between the upper and lower $y$-coordinate of the group. +% \begin{macrocode} + \def\@tempa{#2}% + \ifx\@tempa\@empty\else% + \node at ($(0, \y@upper)!.5!(0, \y@lower)$) + [/pgfgantt/group label anchor@style] + {\@gtt@get{group label font}{#2}};% + \fi% +% \end{macrocode} +% |\gtt@pl@draw| saves the commands that will produce the progress label. This macro does nothing unless (a) the |progress| key differs from none and (b) |progress label text| differs from |\relax|. Otherwise, it creates a vertically centered node to the right of the group. +% \begin{macrocode} + \def\@tempa{none}% + \ifx\gtt@progress\@tempa% + \def\gtt@progress{100}% + \let\gtt@pl@draw\relax% + \else + \expandafter\ifx\gtt@progresslabeltext\relax\relax% + \let\gtt@pl@draw\relax% + \else% + \def\gtt@pl@draw{% + \node at ($(\x@right, \y@upper)!.5!(\x@right, \y@lower)$) + [/pgfgantt/progress label anchor@style] {% + \@gtt@get{progress label font}{% + \@gtt@get{progresslabeltext}{\@gtt@get{progress}}% + }% + };% + }% + \fi% + \fi% +% \end{macrocode} +% \begin{intmacro}{\@maxpeak} +% In order to draw the left (complete) and right (incomplete) part of a progress group, we clip the corresponding polygons depending on the value of |progress|. Note that we turn off the border of these polygons and draw it with an additional, third command. The clipped area must include the highest peak, so we determine its height and store it in |\@maxpeak|. +% \begin{macrocode} + \pgfmathsetmacro\@maxpeak{% + \gtt@grouprightpeaky>\gtt@groupleftpeaky?% + \gtt@grouprightpeaky:\gtt@groupleftpeaky% + }% + \begin{scope}% + \clip (\x@left,\y@upper) rectangle + ($(\x@left,\y@lower-\@maxpeak)!% + \gtt@progress/100!% + (\x@right,\y@lower-\@maxpeak)$);% + \path[/pgfgantt/group@style,draw=none] + (\x@left, \y@upper) -- + (\x@right, \y@upper) -- + (\x@right, \y@lower) -- + (\x@right+\gtt@grouprightpeakmidx, \y@lower-\gtt@grouprightpeaky) -- + (\x@right+\gtt@grouprightpeakinnerx, \y@lower) -- + (\x@left+\gtt@groupleftpeakinnerx, \y@lower) -- + (\x@left+\gtt@groupleftpeakmidx, \y@lower-\gtt@groupleftpeaky) -- + (\x@left, \y@lower) -- + cycle;% + \end{scope}% + \begin{scope}% + \clip ($(\x@left,\y@upper)!% + \gtt@progress/100!% + (\x@right,\y@upper)$) + rectangle (\x@right,\y@lower-\@maxpeak); + \path[/pgfgantt/group incomplete@style] + (\x@left, \y@upper) -- + (\x@right, \y@upper) -- + (\x@right, \y@lower) -- + (\x@right+\gtt@grouprightpeakmidx, \y@lower-\gtt@grouprightpeaky) -- + (\x@right+\gtt@grouprightpeakinnerx, \y@lower) -- + (\x@left+\gtt@groupleftpeakinnerx, \y@lower) -- + (\x@left+\gtt@groupleftpeakmidx, \y@lower-\gtt@groupleftpeaky) -- + (\x@left, \y@lower) -- + cycle;% + \end{scope}% + \path[/pgfgantt/group@style,fill=none] + (\x@left, \y@upper) -- + (\x@right, \y@upper) -- + (\x@right, \y@lower) -- + (\x@right+\gtt@grouprightpeakmidx, \y@lower-\gtt@grouprightpeaky) -- + (\x@right+\gtt@grouprightpeakinnerx, \y@lower) -- + (\x@left+\gtt@groupleftpeakinnerx, \y@lower) -- + (\x@left+\gtt@groupleftpeakmidx, \y@lower-\gtt@groupleftpeaky) -- + (\x@left, \y@lower) -- + cycle;% + \gtt@pl@draw% + \global\gtt@intitlefalse% + \endgroup% +} + +% \end{macrocode} +% \end{intmacro} +% \end{macro} +% +% +% \subsection{Milestones} +% +% \begin{macro}{\ganttmilestone} +% |\ganttmilestone| has to calculate a single pair of coordinates, namely its center. +% \begin{macrocode} +\newcommand\ganttmilestone[3][]{% + \begingroup% + \ganttset{#1}% + \def\x@mid{#3+\@gtt@get{milestone xshift}}% + \def\y@mid{\value{gtt@currentline}-\@gtt@get{milestone yshift}}% +% \end{macrocode} +% If the first mandatory argument of |\ganttmilestone| is not empty, we print a label whose anchor lies on the left canvas border at the height of the milestone's center. +% \begin{macrocode} + \def\@tempa{#2}% + \ifx\@tempa\@empty\else% + \node at (0, \y@mid) + [/pgfgantt/milestone label anchor@style] + {\@gtt@get{milestone label font}{#2}};% + \fi% +% \end{macrocode} +% Drawing the milestone itself is quite simple, since the |progress| key is irrelevant. +% \begin{macrocode} + \path[/pgfgantt/milestone@style] + (\x@mid-\@gtt@get{milestone width}/2, \y@mid) -- + (\x@mid, \y@mid-\@gtt@get{milestone height}/2) -- + (\x@mid+\@gtt@get{milestone width}/2, \y@mid) -- + (\x@mid, \y@mid+\@gtt@get{milestone height}/2) -- + cycle;% + \setcounter{gtt@lastslot}{#3}% + \setcounter{gtt@lastline}{\value{gtt@currentline}}% + \global\gtt@intitlefalse% + \endgroup% +} + +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ganttlinkedmilestone} +% The shortcut version |\ganttlinkedmilestone| calls both |\ganttmilestone| and |\ganttlink|, taking care of the correct coordinates for the link. +% \begin{macrocode} +\newcommand\ganttlinkedmilestone[3][]{% + \begingroup% + \ganttset{b-m,#1}% + \ganttlink{\value{gtt@lastslot}}{-\value{gtt@lastline}-1}% + {#3}{-\value{gtt@currentline}-1}% + \ganttmilestone{#2}{#3}% + \endgroup% +} +% \end{macrocode} +% \end{macro} +% \iffalse +%</pgfgantt> +% \fi +% \Finale +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/pgfgantt/pgfgantt.ins b/Master/texmf-dist/source/latex/pgfgantt/pgfgantt.ins new file mode 100644 index 00000000000..57300a4fa1c --- /dev/null +++ b/Master/texmf-dist/source/latex/pgfgantt/pgfgantt.ins @@ -0,0 +1,61 @@ +%% pgfgantt.ins +%% +%% Copyright (C) 2011 by Wolfgang Skala +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Wolfgang Skala. +%% +%% This work consists of the files pgfgantt.dtx and pgfgantt.ins +%% and the derived file pgfgantt.sty. + +\input docstrip.tex +\keepsilent + +\usedir{tex/latex/pgfgantt} + +\preamble + +Copyright (C) 2011 by Wolfgang Skala + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3 +of this license or (at your option) any later version. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +\endpreamble + +\generate{\file{pgfgantt.sty}{\from{pgfgantt.dtx}{pgfgantt}}} + +\obeyspaces +\Msg{****************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the} +\Msg{* following file into a directory searched by TeX} +\Msg{*} +\Msg{* pgfgantt.sty} +\Msg{*} +\Msg{* To produce the documentation execute the} +\Msg{* following commands:} +\Msg{*} +\Msg{* pdflatex pgfgantt.dtx} +\Msg{* makeindex -s gind.ist -o pgfgantt.ind pgfgantt.idx} +\Msg{* makeindex -s gglo.ist -o pgfgantt.gls pgfgantt.glo} +\Msg{* pdflatex pgfgantt.dtx} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{****************************************************} + +\endbatchfile
\ No newline at end of file |