Rephrase the link to MobileOrg for Android
[Worg.git] / code / latex / gantt.sty
blobdb7e0ec75a8ceb4eca2458d0dc6fa4fa112aa438
1 % package for creating GANTT charts. Intended for use with org mode and babel
2 % Eric S Fraga $Id: gantt.sty,v 1.4 2010/10/16 19:49:32 ucecesf Exp $
3 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
4 \ProvidesPackage{gantt}
5 \RequirePackage{tikz}
7 \newcounter{gantttask}
8 \newcommand{\gantttaskcolour}{blue!50!white}
9 \newcommand{\ganttmilestonecolour}{red!50!white}
10 \newcommand{\ganttdatelinecolour}{black!50!white}
11 \newcommand{\ganttprojecttime}{1}
12 \newcommand{\ganttntasks}{1}
13 \newenvironment{gantt}[2]{%
14 \setcounter{gantttask}{0}
15 \pgfdeclarelayer{background}
16 \pgfdeclarelayer{foreground}
17 \pgfsetlayers{background,foreground}
18 \renewcommand{\ganttprojecttime}{#1}
19 \renewcommand{\ganttntasks}{#2}
20 \noindent
21 \begin{tikzpicture}[y=-0.75cm,x=0.75\textwidth]
22 \begin{pgfonlayer}{background}
23 \draw[very thin, red!10!white] (0,1+\ganttntasks) grid [ystep=0.75cm,xstep=1/\ganttprojecttime] (1,0);
24 \draw[\ganttdatelinecolour] (0,0) -- (1,0);
25 \draw[\ganttdatelinecolour] (0,1+\ganttntasks) -- (1,1+\ganttntasks);
26 \end{pgfonlayer}
27 }%beginning of gantt environment
28 {%end of gantt environment
29 \end{tikzpicture}
32 \newcommand\gantttask[6]{% label, activity, start, end, labelpos, align
33 \begin{pgfonlayer}{foreground}
34 % \node at (0,\thegantttask) [anchor=base east] {#2};
35 \stepcounter{gantttask}
36 \node [left] at (0,\thegantttask) {#1};
37 \draw[fill=\gantttaskcolour] (#3/\ganttprojecttime,\thegantttask-0.4) rectangle (#4/\ganttprojecttime,\thegantttask +0.4);
38 \node at (#5/\ganttprojecttime,\thegantttask) #6 {#2};
39 \end{pgfonlayer}
41 \newcommand\ganttpoint[3]{% line, tag, date
42 \node at (0,#1) [anchor=base east] {#2};
43 \fill[black] (#3/\ganttprojecttime,#1) circle (0.1/\ganttprojecttime);
45 \newcommand\ganttdateline[2]{% tag, date
46 \begin{pgfonlayer}{background}
47 \draw[\ganttdatelinecolour] (#2/\ganttprojecttime,0) -- (#2/\ganttprojecttime,\thegantttask+1);
48 \node at (#2/\ganttprojecttime,0) [above] {#1};
49 \end{pgfonlayer}
51 \newcommand\ganttmilestone[2]{% tag, date
52 \begin{pgfonlayer}{foreground}
53 \node at (#2/\ganttprojecttime,\thegantttask+1.0) [below] {#1};
54 \draw[black,fill=\ganttmilestonecolour] (#2/\ganttprojecttime-0.1\ganttntasks/\ganttprojecttime,\thegantttask+0.9) rectangle (#2/\ganttprojecttime+0.1\ganttntasks/\ganttprojecttime,\thegantttask+1.1);
55 \end{pgfonlayer}