% DIN-A4 doublesided year calendar
% Author: Robert Krause
% License : Creative Commons attribution license
% Submitted to TeXample.net on 13 July 2012
\documentclass[landscape,a4paper, 10pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{tikz} % Use the calendar.sty style
\usepackage{translator} % German Month and Day names
\usepackage{fancyhdr} % header and footer
\usepackage{fix-cm} % Large year in header
\usepackage[landscape, headheight = 2cm, margin=.5cm,
top = 3.2cm, nofoot]{geometry}
\usetikzlibrary{calc}
\usetikzlibrary{calendar}
\renewcommand*\familydefault{\sfdefault}
% User defined
\def\year{2016}
\def\nextyear{2017}
% Names of Holidays are inserted by employing this macro
\def\termin#1#2{
\node [anchor=north west, text width= 3.4cm] at
($(cal-#1.north west)+(3em, 0em)$) {\tiny{#2}};
}
%Header
\renewcommand{\headrulewidth}{0.0pt}
\setlength{\headheight}{3ex}
\chead{
%\fontsize{60}{70}\selectfont\textbf{\year}
\Large\textbf{Cleaning Plan}\hfill
}
%Footer
%\cfoot{\footnotesize\texttt{http://www.texample.net/}}
\pagenumbering{gobble}
% === Macro that returns a name if given a number from 0 to 29, "Error!" otherwise
\newcommand{\Person}[1]{%
\ifcase#1
Bryant Romans \or
Latricia Stoneman \or
Wilmer Lytton \or
Tommie Lenahan \or
Antonio Hoggard \or
Edward Lanctot \or
Chassidy Hyndman \or
Marianela Wojciechowski \or
Edna Kreitzer \or
Harrison Cruze \or
Marna Meloy \or
Georgene Joly \or
Ken Denley \or
William Loeffler \or
Young Spinelli \or
Glendora Bruss \or
Kraig Calloway \or
Chantal Callejas \or
Eleni Graziani \or
Ilene Crumpler \or
Ali Valliere \or
Sonya Barlett \or
Frederick Delacruz \or
Kayce Foti \or
Orval Kirchner \or
Corrinne Cahoon \or
Modesto Mulloy \or
Alessandra Rodenberger \or
Bernita Redman \or
Iola Eudy \else
Error! \fi
}
\xdef\cleanerID{18}
\begin{document}
\pagestyle{fancy}
\begin{center}
\begin{tikzpicture}[every day/.style={anchor = north}]
\calendar[
dates=\year-09-01 to \nextyear-02-28,
name=cal,
day yshift = 3em,
day code=
{ %=== Define macro that holds cleaners name on cleaning days, empty otherwise
\ifdate{Monday,Wednesday,Saturday}%
{ \ifdate{between=\year-11-18 and \year-12-09, at least=\nextyear-01-03}
{ \xdef\InsertName{\Person{\cleanerID}}
\pgfmathtruncatemacro{\newCleanerID}{mod(\cleanerID+1,30)}
\xdef\cleanerID{\newCleanerID}
}
{ \xdef\InsertName{}
}
}
{ \xdef\InsertName{}
}
\ifdate{equals=\year-11-21}
{ \xdef\InsertName{Iola Eudy}
\tikzset{every day/.style={fill=cyan!50!blue!50}}
}{}
\ifdate{equals=\nextyear-01-06}
{ \xdef\InsertName{Ilene Crumpler}
\tikzset{every day/.style={fill=cyan!50!blue!50}}
}{}
\node[name=\pgfcalendarsuggestedname,every day,shape=rectangle,
minimum height= .53cm, text width = 4.4cm, draw = gray]{\tikzdaytext};
%=== Insert the cleaners name here
\draw (-1.8cm, -.1ex) node[anchor = west]{\footnotesize%
\pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday} \InsertName
};
},
execute before day scope=
{
\ifdate{day of month=1}
{
% Shift right
\pgftransformxshift{4.8cm}
% Print month name
\draw (0,0)node [shape=rectangle, minimum height= .53cm,
text width = 4.4cm, fill = black, text= white, draw = black, text centered]
{\textbf{\pgfcalendarmonthname{\pgfcalendarcurrentmonth} \pgfcalendarcurrentyear}
};
}{}
\ifdate{workday}
{
% normal days are white
\tikzset{every day/.style={fill=white}}
}{}
% Saturdays and half holidays (Christma's and New year's eve)
\ifdate{Saturday}{\tikzset{every day/.style={fill=red!10}}}{}
% Sundays and full holidays
\ifdate{Sunday}{\tikzset{every day/.style={fill=red!20}}}{}
},
execute at begin day scope=
{
% each day is shifted down according to the day of month
\pgftransformyshift{-.53*\pgfcalendarcurrentday cm}
}
];
\end{tikzpicture}
% Repeat the whole thing for the second page
%\pagebreak
\begin{tikzpicture}[every day/.style={anchor = north}]
\calendar[dates=\nextyear-05-01 to \nextyear-10-31,
name=cal,
day yshift = 3em,
day code=
{ %=== Define macro that holds cleaners name on cleaning days, empty otherwise
\ifdate{Monday,Wednesday,Saturday}%
{ \ifdate{at least=\nextyear-01-03}
{ \xdef\InsertName{\Person{\cleanerID}}
\pgfmathtruncatemacro{\newCleanerID}{mod(\cleanerID+1,30)}
\xdef\cleanerID{\newCleanerID}
}
{ \xdef\InsertName{}
}
}
{ \xdef\InsertName{}
}
\node[name=\pgfcalendarsuggestedname,every day,shape=rectangle,
minimum height= .53cm, text width = 4.4cm, draw = gray]{\tikzdaytext};
%=== Insert the cleaners name here
\draw (-1.8cm, -.1ex) node[anchor = west]{\footnotesize%
\pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday} \InsertName
};
},
execute before day scope=
{
\ifdate{day of month=1} {
% Shift right
\pgftransformxshift{4.8cm}
% Print month name
\draw (0,0)node [shape=rectangle, minimum height= .53cm,
text width = 4.4cm, fill = black, text= white, draw = black, text centered]
{
\textbf{\pgfcalendarmonthname{\pgfcalendarcurrentmonth} \pgfcalendarcurrentyear}
};
}{}
\ifdate{workday}
{
\tikzset{every day/.style={fill=white}}
}{}
% Saturdays and half holidays (Christma's and New year's eve)
\ifdate{Saturday}{\tikzset{every day/.style={fill=red!10}}}{}
% Sundays and full holidays
\ifdate{Sunday}{\tikzset{every day/.style={fill=red!20}}}{}
},
execute at begin day scope=
{
% Each day is shifted down according to the day of month
\pgftransformyshift{-.53*\pgfcalendarcurrentday cm}
}
];
\end{tikzpicture}
\end{center}
\end{document}
Changed
I've changed following lines:
% User defined
\def\year{2015}
\def\nextyear{2016}
dates=\year-11-01 to \nextyear-04-30,
Problems
I'm a flight assistant. Following I don't know how to change:
We are 15 people at my team. It's always Mondays and Thursdays. Flight assistant (Number 13) doesn't have to clean the toilets at all --- so I need a counting like [... 11, 12, 14, 15, 1 ...]. The toilet cleaning starts with number the 5th of September.
Vacation: the 21st of December - 23rd of January and the 26th of May - the 1st of September. The calendar should break there.
Problem solving
Changing the number
\pgfmathtruncatemacro{\newCleanerID}{mod(\cleanerID+1,30)}
I would change it to following:
\pgfmathtruncatemacro{\newCleanerID}{mod(\cleanerID+1,15)}
I hope you will help me :-)
NB! Is it possible to define the start / stop of the calendar / cleaning at the top; and is it possible to define the vacation at the top as well? So instead of digging through the code?

\Personlist if number 13 should never be included in the rota? Why not just include the names of the 14 who do have to do the cleaning? – cfr Sep 04 '16 at 19:53\defin LaTeX unless you know it is necessary, you know it is safe and you understand the risks. Here, you are overwriting an existing macro. Are you sure that is OK? Are you sure you don't need it? Are you sure it won't have unwanted side-effects in unexpected places? – cfr Sep 04 '16 at 20:21