[Tex/LaTex] How to combine a timeline with a calendar

calendarpgfgantttikz-pgf

I'm using the pgfgantt package to create a timeline. This is what I've got so far:

\documentclass[landscape]{article}
\usepackage[dvipsnames,usenames]{xcolor}
\usepackage{tikz}
\usepackage{pgfgantt}
\usepackage{pgfcalendar}
\renewcommand{\familydefault}{\sfdefault}
\definecolor{barblue}{RGB}{153,204,254}
\begin{document}
    \begin{tikzpicture}[x=1cm,y=1cm]
        \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},
            title={draw=none, fill=none},
            title label font=\bfseries\footnotesize,
            title label anchor={below=-2pt},
            include title in canvas=false,
            bar={draw=none, fill=barblue},
            ]{33}
        \gantttitle[title label anchor={below left=-2pt and -3pt}]{Date:}{0}
        \gantttitlelist[title list options={%
            var=\y, evaluate=\y as \x%
            using "\pgfcalendarweekdayshortname{\y}"%
        }]{0,...,6}{1} \\
        \ganttbar{Task 1}{1}{7} \\
        \ganttbar{Task 2}{8}{14} \\
        \ganttbar{Task 3}{15}{21} \\
        \end{ganttchart}
    \end{tikzpicture}
\end{document}

The result is this:
Gantt chart

This is not exactly what I'm expecting. I'd also like to have the date of the current day beside the name of the day (for example: Mon, 1.8.). And this should be repeated for several weeks. For example I'd like to have a timeline for five weeks, starting from today without manually filling in all the dates. I don't know if this is possible with these packages but I'd really appreciate any help.

Best Answer

You can use the \pgfcalendar macro in place of the default \pgffor used by \gantttitlelist as follows:

\documentclass[landscape]{article}
\usepackage[dvipsnames,usenames]{xcolor}
\usepackage{tikz}
\usepackage{pgfgantt}
\usepackage{pgfcalendar}
\renewcommand{\familydefault}{\sfdefault}
\definecolor{barblue}{RGB}{153,204,254}
\begin{document}
    \begin{tikzpicture}[x=1cm,y=1cm]
        \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},
            title={draw=none, fill=none},
            title label font=\bfseries\footnotesize,
            title label anchor={below=-2pt},
            include title in canvas=false,
            bar={draw=none, fill=barblue},
            ]{33}
        \gantttitle[title label anchor={below left=-2pt and -3pt}]{Date:}{0}
%        \gantttitlelist[title list options={%
%            var=\y, evaluate=\y as \x%
%            using "\pgfcalendarweekdayshortname{\y}"%
%        }]{0,...,6}{1} \\
        \pgfcalendar{titlecal}{2011-09-21}{2011-10-12}{%
          \gantttitle{\pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday} 
          \pgfcalendarcurrentday}{1}}\\
        \ganttbar{Task 1}{1}{7} \\
        \ganttbar{Task 2}{8}{14} \\
        \ganttbar{Task 3}{15}{21} \\
        \end{ganttchart}
    \end{tikzpicture}
\end{document}

The first argument (here "titlecal") is a prefix to the names of the nodes created, which isn't of any particular use here, but then the next two are the starting and stopping dates. You can change the actual text that's displayed using the commands in section 57 of the PGF manual.