Calendar for May 2014
\documentclass{article}
\usepackage{etoolbox}
\usepackage{tikz}
\usepackage{pgfcalendar}
\usetikzlibrary{shapes.multipart}
\begin{document}
\newcount\rowcount
\rowcount=1\relax
\newcount\julianday
\csdef{cal-2014-05-05}{Early May BH}
\csdef{cal-2014-05-26}{Spring BH}
\fbox{%
\let\%\pgfcalendarshorthand
\begin{tikzpicture}[x=1.5cm,y=1.75cm]
\begin{scope}[every node/.style={rectangle,fill=green!5,minimum width=1.4cm}]
\foreach \x in {0,...,6}
{\path (\x,0) node {\pgfcalendarweekdayshortname{\x}};}
\end{scope}
\pgfcalendar{cal}{2014-05-01}{2014-05-31}{%
% is this the first day of the month?
\ifnum\pgfcalendarcurrentday=1\relax
% Fill in days from previous month if this isn't a Monday
\ifdate{Monday}{}%
{%
% Get last day of previous month
\julianday = \pgfcalendarcurrentjulian\relax
\advance\julianday by -\pgfcalendarcurrentweekday\relax
\foreach \x in {0,...,\numexpr\pgfcalendarcurrentweekday-1}
{
\pgfcalendarjuliantodate{\julianday}{\theyear}{\themonth}{\theday}
\path (\x,-1)
node
[
rectangle split,
rectangle split parts=2,
draw]
{\number\theday
\nodepart{two}%
\parbox[t][1cm]{1.2cm}{\mbox{}}%
};
\global\advance\julianday by 1\relax
}
}%
\fi
\def\thebackground{magenta!4}%
\ifcsdef{\pgfcalendarsuggestedname}%
{%
\def\thecontents{\csuse{\pgfcalendarsuggestedname}}%
\def\thebackground{black!4}%
}%
{%
\def\thecontents{\mbox{}}%
\ifdate{weekend}{\def\thebackground{black!4}}{}%
}%
\path (\pgfcalendarcurrentweekday,-\rowcount)
node
[
rectangle split,
rectangle split parts=2,
rectangle split part fill={cyan!20,\thebackground},
draw]
{\%d-
\nodepart{two}%
\parbox[t][1cm]{1.2cm}{\small\thecontents }%
};
\ifdate{Sunday}{\global\advance\rowcount by 1}{}%
\xdef\lastjulianday{\number\pgfcalendarcurrentjulian}%
\xdef\lastweekday{\number\pgfcalendarcurrentweekday}%
}%
\ifnum\lastweekday < 6\relax
\julianday = \lastjulianday\relax
\edef\lastweekday{\number\numexpr\lastweekday+1}%
\foreach \x in {\lastweekday,...,6}
{
\global\advance\julianday by 1\relax
\pgfcalendarjuliantodate{\julianday}{\theyear}{\themonth}{\theday}
\path (\x,-\rowcount)
node
[
rectangle split,
rectangle split parts=2,
draw]
{\number\theday
\nodepart{two}%
\parbox[t][1cm]{1.2cm}{\mbox{}}%
};
}
\fi
\end{tikzpicture}%
}
\end{document}
Download may2014-bh2.tex or may2014-bh2.pdf.
