# How to combine a timeline with a calendar

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} \\
\end{ganttchart}
\end{tikzpicture}
\end{document}


The result is this:

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.

-
You accidentally created two unregistered accounts which I merged now together. Please register your account to avoid this in the future. Then you will also be able to comment to all answers of your question(s). Please don't post feedback as "answer" post. Thank you. –  Martin Scharrer Sep 22 '11 at 6:38

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}}\\

Yes, this looks fine. The problem now is that the timline overflows the paper size. Do you know a solution? Maybe some expression to check if there's still enough space and if not start a new line. Well, this could also been done manually for every week but it would be nice if this could be done automatically. Another point – yes, I know it's not part of my original question – is how can I center the timeline on the paper? I tried it using the center environment but I didn't succeed. –  Frank Sep 21 '11 at 16:30
center seems to work for me provided the timeline fits on the page. But I'm afraid automatically breaking a plot doesn't appear to be trivial. (You might like to pose this as a separate question, since it's quite a different issue: I will have a go if I get a chance, and no doubt so will others!) However, you can squeeze quite a lot more on one page by setting title label anchor={rotate=90} and decreasing x: e.g., I can fit five weeks happily on an A4 page this way using x=4mm and \scriptsize font. –  Ant Sep 21 '11 at 18:11
Does title label anchor={anchor=base west, rotate=90} do what you want? –  Ant Sep 21 '11 at 20:37
You could potentially add an xshift=-10pt or similar in there too, if you want the bottom of the rotated text to line up with the bottom of the "Date: " text. –  Ant Sep 21 '11 at 20:42