# vertical week list in TikZ calendar

I read about week list in the PGF/TikZ manual, but I couldn't find an example that arranges the days of the week vertically:

June 1997

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


Could you help me with an example of how to create a week list arrangement like this?

-
Maybe also have a look at the ctan.org/pkg/calxxxx and ctan.org/pkg/calxxxx-yyyy packages. –  Stephen Jan 2 '12 at 18:02

Here's a new style vertical week list, which is adapted from the week list style found in the TikZ source code. The day labels are adapted from the answer to Weekday captions with the TikZ library "calendar".

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calendar}

\makeatletter
\tikzstyle{week list}=[%
execute before day scope={%
\ifdate{day of month=1}{\ifdate{equals=\pgfcalendarbeginiso}{}
{%
% On first of month, except when first date in calendar.
\pgfmathsetlength{\pgf@x}{\tikz@lib@cal@month@xshift}%
\pgftransformxshift{\pgf@x}
}%
}{}%
},
execute at begin day scope={%
\pgfmathsetlength\pgf@y{\tikz@lib@cal@yshift}%
\pgf@y=\pgfcalendarcurrentweekday\pgf@y%
\pgftransformyshift{-\pgf@y}%
},
execute after day scope={%
\ifdate{Sunday}{%
\pgfmathsetlength{\pgf@x}{\tikz@lib@cal@xshift}%
\pgftransformxshift{\pgf@x}
}{}%
}
]

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

\begin{document}
\begin{tikzpicture}
\calendar[
dates=1997-06-01 to 1997-06-last,
week list,
month label above left,
month text=\%mt \%y0
];
\end{tikzpicture}
\end{document}

-

You could use \pgftransformyshift for shifting days down. Here's an example style arranging the days vertically:

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{calendar}
\tikzstyle{week list downward}=[%
execute before day scope={%
\ifdate{day of month=1}{\ifdate{equals=\pgfcalendarbeginiso}{}{%
\pgftransformxshift{1.5em}}%
}{}},
execute after day scope={%
\ifdate{Sunday}{%
\pgftransformyshift{6em}
\pgftransformxshift{1.5em}
}{\pgftransformyshift{-1em}}},
]
\begin{document}
\tikz\calendar [dates=2012-01-01 to 2012-03-last,week list downward];
\end{document}


-
Thanks, great example of \pgftransformyshift! –  Nyiti Jan 2 '12 at 10:04