From 43f2113ef8ba863ee054d6ba3955f1f2cdee1910 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 23 Apr 2011 00:58:57 +0000 Subject: pgfgantt (22apr11) git-svn-id: svn://tug.org/texlive/trunk@22166 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/pgfgantt/pgfgantt.dtx | 214 +++++++++++++++------ 1 file changed, 158 insertions(+), 56 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/pgfgantt/pgfgantt.dtx b/Master/texmf-dist/source/latex/pgfgantt/pgfgantt.dtx index 1afd8e73841..42306faf713 100644 --- a/Master/texmf-dist/source/latex/pgfgantt/pgfgantt.dtx +++ b/Master/texmf-dist/source/latex/pgfgantt/pgfgantt.dtx @@ -13,7 +13,7 @@ % \fi % % \iffalse -%\ProvidesPackage{pgfgantt}[2011/03/01 v1.0 Draw Gantt diagrams with TikZ] +%\ProvidesPackage{pgfgantt}[2011/04/18 v1.1 Draw Gantt diagrams with TikZ] %\NeedsTeXFormat{LaTeX2e}[1999/12/01] % %<*driver> @@ -52,9 +52,9 @@ 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, + in, include, incomplete, label, last, left, link, line, lines, list, mid, milestone, + modifier, options, peak, peaks, progress, right, rule, shift, slot, style, + text, time, title, today, tolerance, top, vgrid, width, xshift, yshift, b-b, b-m, m-b, m-m, s-s, s-f, f-s, f-f }, emphstyle=\color{OliveGreen}, @@ -226,7 +226,7 @@ % % \fi % -% \CheckSum{891} +% \CheckSum{923} % % \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 @@ -247,13 +247,13 @@ % % \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} +% \DoNotIndex{\@empty,\@tempa,\@tempb,\addtocounter,\begin,\begingroup,\bfseries,\clip,\csname,\def,\draw,\else,\end,\endcsname,\endgroup,\expandafter,\fi,\foreach,\gdef,\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,\strut,\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} +% \date{April 18th, 2011} % \maketitle % \changes{v1.0}{2011/03/01}{Initial release} % @@ -268,7 +268,10 @@ % % 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 +% \changes{v1.1}{2011/04/18}{The introduction now clarifies what I mean by ``a current \textsc{pgf} installation''.} +% \pack{pgfgantt} requires a \textit{current} \textsc{pgf} installation. \textbf{Note that the version number must at least be 2.10, dated October 25th, 2010.} If you get a lot of errors and \LaTeX\ complains that |\pgfkeysdefnargs| is undefined, your \textsc{pgf} installation is most liekly too old. +% +% To load the package, simply put % \begin{texcode} % \usepackage{pgfgantt} % \end{texcode} @@ -395,6 +398,31 @@ % \end{center} % \end{key} % +% \begin{key}{vgrid lines list}{=\meta{pgffor list}}{\texttt{2,3,...,\string\value\string{gtt@width\string}}} +% If the chart contains many time slots, drawing vertical grid lines between all of them will lead to a confusing appearance. In such a case, you can change the |vgrid lines list| key in order to draw every second grid line, for example.\changes{v1.1}{2011/04/18}{The \texttt{vgrid lines list} key now determines the number of vertical grid lines drawn.} +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, vgrid lines list={3,5,...,\value{gtt@width}}]{12} +% \gantttitlelist{1,...,12}{1} \\ +% \ganttbar{}{1}{4} \\ +% \ganttbar{}{5}{11} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}% +% [vgrid, vgrid lines list={3,5,...,\value{gtt@width}}]{12} +% \gantttitlelist{1,...,12}{1} \\ +% \ganttbar{}{1}{4} \\ +% \ganttbar{}{5}{11} +% \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 @@ -976,7 +1004,7 @@ % \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). +% 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. % \par\bigskip\noindent % \begin{texcode} % \begin{tikzpicture}[x=.5cm, y=1cm] @@ -999,6 +1027,31 @@ % \end{tikzpicture} % \end{center} % +% \begin{key}{time slot modifier}{=\meta{factor}}{\texttt{-1}} +% Note that a bar usually touches 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. However, you may prefer to work with ``real'' $x$-coordinates instead of time slots. In this case, just set the |time slot modifier| key to zero. This will essentially eliminate the semi-intelligent behavior of \pack{pgfgantt} with respect to the conversion of $x$-coordinates. This feature may prove useful if you decide to use real numbers for some time slots. \changes{v1.1}{2011/04/18}{The \texttt{time slot modifier} key has been added. If set to zero, all $x$-coordinates are interpreted as given, without regarding them as time slots.} +% \par\bigskip\noindent +% \begin{texcode} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, time slot modifier=0]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{0}{3} \\ +% \ganttbar{Task 2}{3}{10} \\ +% \ganttbar{Final task}{10}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{texcode} +% \begin{center} +% \begin{tikzpicture}[x=.5cm, y=1cm] +% \begin{ganttchart}[vgrid, hgrid, time slot modifier=0]{12} +% \gantttitle{Title}{12} \\ +% \ganttbar{Task 1}{0}{3} \\ +% \ganttbar{Task 2}{3}{10} \\ +% \ganttbar{Final task}{10}{12} +% \end{ganttchart} +% \end{tikzpicture} +% \end{center} +% \end{key} +% % \begin{key}{bar}{=\meta{style}}{\texttt{fill=white}} % Determines the appearance of the bar. % \par\bigskip\noindent @@ -1024,13 +1077,16 @@ % \end{center} % \end{key} % -% \begin{key}{bar label font}{=\meta{font commands}}{\texttt{\string\normalsize}} +% \begin{key}{bar label text}{=\meta{text}}{\texttt{\string\strut\#1}} +% \keyline{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|). +% The |bar label text| key configures the label \meta{text} next to each bar. This key should contain a single parameter token (|#1|), which is replaced by the first mandatory argument of |\ganttbar|. The |\strut| in the standard value ensures equal vertical spacing of the labels. |bar label font| 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|). \changes{v1.1}{2011/04/18}{\texttt{bar label text} configures the text of a bar label.} % \par\bigskip\noindent % \begin{texcode} % \begin{tikzpicture}[x=.5cm, y=1cm] -% \begin{ganttchart}[vgrid, hgrid, bar label font=\Large]{12} +% \begin{ganttchart} +% [vgrid, hgrid, bar label font=\Large, +% bar label text={--#1$\rightarrow$}]{12} % \gantttitle{Title}{12} \\ % \ganttbar[bar label anchor={left=1cm}]{Task 1}{1}{3} \\ % \ganttbar[bar label font=\color{orange}]{Task 2}{4}{10} \\ @@ -1040,7 +1096,9 @@ % \end{texcode} % \begin{center} % \begin{tikzpicture}[x=.5cm, y=1cm] -% \begin{ganttchart}[vgrid, hgrid, bar label font=\Large]{12} +% \begin{ganttchart} +% [vgrid, hgrid, bar label font=\Large, +% bar label text={--#1$\rightarrow$}]{12} % \gantttitle{Title}{12} \\ % \ganttbar[bar label anchor={left=1cm}]{Task 1}{1}{3} \\ % \ganttbar[bar label font=\color{orange}]{Task 2}{4}{10} \\ @@ -1178,16 +1236,18 @@ % \end{center} % \end{key} % -% \begin{key}{group label font}{=\meta{font commands}}{\texttt{\string\normalsize\string\bfseries}} +% \begin{key}{group label text}{=\meta{text}}{\texttt{\string\strut\#1}} +% \keyline{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|). +% The |group label text| key configures the label \meta{text} next to each group. This key should contain a single parameter token (|#1|), which is replaced by the first mandatory argument of |\ganttgroup|. The |\strut| in the standard value ensures equal vertical spacing of the labels. |group label font| 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|). \changes{v1.1}{2011/04/18}{\texttt{group label text} configures the text of a group label.} % \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} +% group label anchor={left=1cm}, +% group label text={+#1+}]{12} % \gantttitle{Title}{12} \\ % \ganttgroup{Group}{1}{10} \\ % \ganttbar{Subtasks}{1}{3} @@ -1200,7 +1260,8 @@ % \begin{ganttchart}% % [vgrid, hgrid, % group label font={\fcolorbox{brown}{brown!10}}, -% group label anchor={left=1cm}]{12} +% group label anchor={left=1cm}, +% group label text={+#1+}]{12} % \gantttitle{Title}{12} \\ % \ganttgroup{Group}{1}{10} \\ % \ganttbar{Subtasks}{1}{3} @@ -1448,16 +1509,18 @@ % \end{center} % \end{key} % -% \begin{key}{milestone label font}{=\meta{font commands}}{\texttt{\string\normalsize\string\itshape}} +% \begin{key}{milestone label text}{=\meta{text}}{\texttt{\string\strut\#1}} +% \keyline{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. +% The |milestone label text| key configures the label \meta{text} next to each milestone. This key should contain a single parameter token (|#1|), which is replaced by the first mandatory argument of |\ganttmilestone|. The |\strut| in the standard value ensures equal vertical spacing of the labels. |milestone label font| sets the font of the milestone label, while |milestone label anchor| determines its placement. The last macro in \meta{font commands} may take a single argument, as we show in the following (somewhat silly) example. \changes{v1.1}{2011/04/18}{\texttt{milestone label text} configures the text of a milestone label.} % \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} +% milestone label anchor={right=.7cm}, +% milestone label text={#1 *}]{7} % \gantttitle{Title}{7} \\ % \ganttbar{Task 1}{1}{5} \\ % \ganttmilestone{Milestone}{5} @@ -1469,7 +1532,8 @@ % \begin{ganttchart}% % [vgrid, hgrid, % milestone label font=\color{magenta}\rotatebox{30}, -% milestone label anchor={right=1cm}]{7} +% milestone label anchor={right=.7cm}, +% milestone label text={#1 *}]{7} % \gantttitle{Title}{7} \\ % \ganttbar{Task 1}{1}{5} \\ % \ganttmilestone{Milestone}{5} @@ -1632,12 +1696,14 @@ % \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: +% Three 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. +% 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 +% \keyline{link tolerance}{=\meta{factor}}{\texttt{0.6}} +% This key governs whether \pack{pgfgantt} draws a five- or a three-part link. If the true $x$-coordinates of the link start and end differ by at least |link tolerance| (this is the case for the second link in the example below), the package draws a five-part link.\changes{v1.1}{2011/04/18}{\texttt{link tolerance} decides whether a five- or a three-part link is drawn.} % \par\bigskip\noindent % \begin{texcode} % \begin{tikzpicture}[x=.5cm, y=1cm] @@ -2032,16 +2098,18 @@ % % \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. +% 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@lasttitleline| equals the line of the title element drawn last. Furthermore, |gtt@lasttitleslot| corresponds to the $x$-coordinate of its right border. +% +% The |\gtt@lastslot| macro contains the $x$-coordinate of the right border of the last drawn element. We use a macro instead of a counter in order to allow fractional coordinates.\changes{v1.1}{2011/04/18}{The \texttt{gtt@lastslot} counter is now a macro. Thereby, fractional coordinates are possible.} % % 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} +\def\gtt@lastslot{0} \newif\ifgtt@intitle % \end{macrocode} @@ -2126,9 +2194,8 @@ % \end{macrocode} % \end{option} % \end{option} -% \begin{option}{vgrid} -% \begin{option}{vgrid style} -% Analogously, we declare |vgrid| and |vgridstyle|. +% \begin{option}{vgrid}\begin{option}{vgrid style}\begin{option}{vgrid lines list} +% Analogously, we declare |vgrid| and |vgridstyle|. |vgrid lines list| specifies a |\foreach| list that gives the vertical grid lines to be drawn. % \begin{macrocode} \@gtt@stylekeydef{vgrid style} \newif\ifgtt@vgrid @@ -2148,10 +2215,12 @@ \fi% } \pgfkeys{/pgfgantt/vgrid/.default=dotted} +\pgfkeysdef{/pgfgantt/vgrid lines list}{% + \def\gtt@vgridlineslist{#1}% +} % \end{macrocode} -% \end{option} -% \end{option} +% \end{option}\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} @@ -2188,10 +2257,19 @@ % \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} +% \begin{option}{time slot modifier} +% The |time slot modifier| option controls the semi-intelligent behaviour of the package regarding the conversion of title slots to $x$-coordinates. A value of |0| essentially means ``interpret all end time slots as $x$-coordinates''. +% \begin{macrocode} +\@gtt@keydef{time slot modifier} +% \end{macrocode} +% \end{option} +% \begin{option}{bar}\begin{option}{bar label text}\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} +\pgfkeysdef{/pgfgantt/bar label text}{% + \def\gtt@barlabeltext##1{#1}% +} \@gtt@keydef{bar label font} \@gtt@stylekeydef{bar label anchor} \@gtt@keydef{bar left shift} @@ -2200,11 +2278,14 @@ \@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} +% \end{option}\end{option}\end{option}\end{option}\end{option}\end{option}\end{option}\end{option} +% \begin{option}{group}\begin{option}{group label text}\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} +\pgfkeysdef{/pgfgantt/group label text}{% + \def\gtt@grouplabeltext##1{#1}% +} \@gtt@keydef{group label font} \@gtt@stylekeydef{group label anchor} \@gtt@keydef{group left shift} @@ -2212,7 +2293,7 @@ \@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} +% \end{option}\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} @@ -2253,7 +2334,7 @@ % \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} +% \begin{option}{progress}\begin{option}{bar incomplete}\begin{option}{group incomplete}\begin{option}{incomplete}\begin{option}{progress label text}\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} @@ -2270,10 +2351,13 @@ % \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} +% \begin{option}{milestone}\begin{option}{milestone label text}\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} +\pgfkeysdef{/pgfgantt/milestone label text}{% + \def\gtt@milestonelabeltext##1{#1}% +} \@gtt@keydef{milestone label font} \@gtt@stylekeydef{milestone label anchor} \@gtt@keydef{milestone width} @@ -2282,8 +2366,8 @@ \@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} +% \end{option}\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}\begin{option}{link tolerance} % Next, we declare the keys that modify links. % \begin{macrocode} \@gtt@stylekeydef{link} @@ -2294,8 +2378,9 @@ } \@gtt@keydef{link mid} \@gtt@keydef{link bulge} +\@gtt@keydef{link tolerance} % \end{macrocode} -% \end{option}\end{option}\end{option}\end{option}\end{option}\end{option} +% \end{option}\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} @@ -2316,6 +2401,7 @@ canvas={fill=white}, hgrid style=dotted, vgrid style=dotted, + vgrid lines list={2,3,...,\value{gtt@width}}, today=none, today rule={dashed, line width=1pt}, today label=TODAY, @@ -2330,7 +2416,9 @@ title height=.6, title list options={var=\x, evaluate=\x}, include title in canvas, + time slot modifier=-1, bar={fill=white}, + bar label text={\strut#1}, bar label font=\normalsize, bar label anchor={anchor=east}, bar left shift=0, @@ -2338,6 +2426,7 @@ bar top shift=0, bar height=.4, group={fill=black}, + group label text={\strut#1}, group label font=\normalsize\bfseries, group label anchor={anchor=east}, group left shift=-.1, @@ -2351,6 +2440,7 @@ progress label font=\scriptsize, progress label anchor={anchor=west}, milestone={fill=black}, + milestone label text={\strut#1}, milestone label font=\normalsize\itshape, milestone label anchor={anchor=east}, milestone width=.8, @@ -2363,6 +2453,7 @@ b-b, link mid=.5, link bulge=.4, + link tolerance=0.6, } % \end{macrocode} @@ -2399,11 +2490,11 @@ (\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. +% A |\foreach| loop iterates over all time slots given by the |vgrid lines list| key 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}} {% + in \gtt@vgridlineslist {% \draw[/pgfgantt/vgrid style@style] (\t, \value{gtt@lasttitleline}-\@gtt@get{hgrid shift}) -- (\t, \y@lower);% @@ -2515,7 +2606,7 @@ \newcommand\ganttbar[4][]{% \begingroup% \ganttset{#1}% - \def\x@left{#3-1+\@gtt@get{bar left shift}}% + \def\x@left{#3+\@gtt@get{time slot modifier}+\@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}% @@ -2526,7 +2617,8 @@ \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}};% + [/pgfgantt/bar label anchor@style] + {\@gtt@get{bar label font}{\gtt@barlabeltext{#2}}};% \fi% % \end{macrocode} % \begin{intmacro}{\gtt@pl@draw} @@ -2572,7 +2664,7 @@ % \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}% + \gdef\gtt@lastslot{#4}% \setcounter{gtt@lastline}{\value{gtt@currentline}}% \global\gtt@intitlefalse% \endgroup% @@ -2586,7 +2678,7 @@ \newcommand\ganttlinkedbar[4][]{% \begingroup% \ganttset{#1}% - \ganttlink{\value{gtt@lastslot}}{-\value{gtt@lastline}-1}% + \ganttlink{\gtt@lastslot}{-\value{gtt@lastline}-1}% {#3}{-\value{gtt@currentline}-1}% \ganttbar{#2}{#3}{#4}% \endgroup% @@ -2608,7 +2700,9 @@ % 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\x@right{% + #4+\@gtt@get{time slot modifier}+\@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} @@ -2630,9 +2724,11 @@ \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. +% Once again, two possibilities arise: Either the elements to be connected are at least separated by |link tolerance| time slots, 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}% + \pgfmathparse{% + (#4+\@gtt@get{time slot modifier}-#2)>=\@gtt@get{link tolerance}% + }% \ifcase\pgfmathresult% \draw[/pgfgantt/link@style] (\x@left, \y@upper) -- @@ -2656,7 +2752,7 @@ % 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}% + \pgfmathparse{(#4+\@gtt@get{time slot modifier})==#2}% \ifcase\pgfmathresult% \draw[/pgfgantt/link@style] (\x@left, \y@upper) -- (\x@right, \y@lower);% @@ -2672,7 +2768,9 @@ \else \def\@tempa{s} \ifx\gtt@link@starttype\@tempa - \def\x@left{#2-1+\@gtt@get{bar right shift}}% + \def\x@left{% + #2+\@gtt@get{time slot modifier}+\@gtt@get{bar right shift}% + }% \fi% \fi% \def\@tempa{f}% @@ -2681,7 +2779,9 @@ \else \def\@tempa{s} \ifx\gtt@link@endtype\@tempa - \def\x@right{#4-1+\@gtt@get{bar left shift}}% + \def\x@right{% + #4+\@gtt@get{time slot modifier}+\@gtt@get{bar left shift}% + }% \fi% \fi% \def\y@upper{-#3+1-\@gtt@get{bar height}}% @@ -2715,7 +2815,9 @@ \newcommand\ganttgroup[4][]{% \begingroup% \ganttset{#1}% - \def\x@left{#3-1+\@gtt@get{group left shift}}% + \def\x@left{% + #3+\@gtt@get{time slot modifier}+\@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}% @@ -2727,7 +2829,7 @@ \ifx\@tempa\@empty\else% \node at ($(0, \y@upper)!.5!(0, \y@lower)$) [/pgfgantt/group label anchor@style] - {\@gtt@get{group label font}{#2}};% + {\@gtt@get{group label font}{\gtt@grouplabeltext{#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. @@ -2827,7 +2929,7 @@ \ifx\@tempa\@empty\else% \node at (0, \y@mid) [/pgfgantt/milestone label anchor@style] - {\@gtt@get{milestone label font}{#2}};% + {\@gtt@get{milestone label font}{\gtt@milestonelabeltext{#2}}};% \fi% % \end{macrocode} % Drawing the milestone itself is quite simple, since the |progress| key is irrelevant. @@ -2838,7 +2940,7 @@ (\x@mid+\@gtt@get{milestone width}/2, \y@mid) -- (\x@mid, \y@mid+\@gtt@get{milestone height}/2) -- cycle;% - \setcounter{gtt@lastslot}{#3}% + \gdef\gtt@lastslot{#3}% \setcounter{gtt@lastline}{\value{gtt@currentline}}% \global\gtt@intitlefalse% \endgroup% @@ -2852,7 +2954,7 @@ \newcommand\ganttlinkedmilestone[3][]{% \begingroup% \ganttset{b-m,#1}% - \ganttlink{\value{gtt@lastslot}}{-\value{gtt@lastline}-1}% + \ganttlink{\gtt@lastslot}{-\value{gtt@lastline}-1}% {#3}{-\value{gtt@currentline}-1}% \ganttmilestone{#2}{#3}% \endgroup% -- cgit v1.2.3