# Weekday captions with the TikZ library “calendar”

I use the TikZ library calendar to produce a week list. The code looks like this:

\documentclass{article}

\usepackage{pgf,tikz}
\usetikzlibrary{calendar}

\begin{document}
\tikz\calendar[dates=2011-02-01 to 2011-02-last,week list];
\end{document}


However, I want to add abbreviated captions for the weekdays (M, T, W, ...) in the first line of the week list:

 M  T  W  T  F  S  S
1  2  3  4  5  6
7  8  9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28


I couldn't find any option to the \calendar macro which produces this effect. Is there any other solution to achieve my goal?

-

There's no way of doing this with a single option, but the following code is a way of getting the weekday headings in a way that keeps all options of the week list calendar. It adds the style day letter headings (which in this form only makes sense to use with the week list style). The style of the headings can be set with the option day headings.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{calendar}

\makeatletter%
execute before day scope={ \ifdate{day of month=1}{%
\pgfmathsetlength{\pgf@ya}{\tikz@lib@cal@yshift}%
\pgfmathsetlength\pgf@xa{\tikz@lib@cal@xshift}%
\pgftransformyshift{-\pgf@ya}
\foreach \d/\l in {0/M,1/T,2/W,3/T,4/F,5/S,6/S} {
\pgf@xa=\d\pgf@xa%
\pgftransformxshift{\pgf@xa}%
\pgftransformyshift{\pgf@ya}%
}
}{}%
}%
]

\makeatother%

\begin{document}
\tikz\calendar[dates=2011-02-01 to 2011-04-last,
week list,
month label above centered,
day xshift = 0.8cm,

BTW: A slash is missing between \d and \l (it should be \foreach \d/\l in {0/M,1/T,2/W,3/T,4/F,5/S,6/S} {, otherwise, I get an error message). – diabonas Feb 4 '11 at 12:39