7

I would like to make a Cleaning Calendar in Tikz. We are thirty people living on my storey, and we clean the floors three times a week: Mondays, Wednesdays and Saturdays.

I have changed a calendar template so it looks like how I want it:

% DIN-A4 doublesided year calendar
% Author: Robert Krause
% License : Creative Commons attribution license
% Submitted to TeXample.net on 13 July 2012
\documentclass[landscape,a4paper, ngerman, 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{2015}
% 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}{10ex}
\chead{
  \fontsize{60}{70}\selectfont\textbf{\year}
  \Large\textbf{Cleaning Plan}\hfill
}
%Footer
%\cfoot{\footnotesize\texttt{http://www.texample.net/}}
\pagenumbering{gobble}

\begin{document}
\pagestyle{fancy}
\begin{center}
\begin{tikzpicture}[every day/.style={anchor = north}]
\calendar[
  dates=\year-01-01 to \year-06-30,
  name=cal,
  day yshift = 3em,
  day code=
  {
    \node[name=\pgfcalendarsuggestedname,every day,shape=rectangle,
    minimum height= .53cm, text width = 4.4cm, draw = gray]{\tikzdaytext};
    \draw (-1.8cm, -.1ex) node[anchor = west]{\footnotesize%
      \pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}};
  },
  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}}};
    }{}
    \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=\year-07-01 to \year-12-31,
  name=cal,
  day yshift = 3em,
  day code=
  {
    \node[name=\pgfcalendarsuggestedname,every day,shape=rectangle, 
      minimum height= .53cm, text width = 4.4cm, draw = gray]{\tikzdaytext};
    \draw (-1.8cm, -.1ex) node[anchor = west]
    {
      \footnotesize\pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}
    };
  },
  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}}
    };
  }{}
  \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}

The names of the people living on my floor:

names=[Bryant Romans; Latricia Stoneman; Wilmer Lytton; Tommie Lenahan; Antonio Hoggard; Edward Lanctot; Chassidy Hyndman; Marianela Wojciechowski; Edna Kreitzer; Harrison Cruze; Marna Meloy; Georgene Joly; Ken Denley; William Loeffler; Young Spinelli; Glendora Bruss; Kraig Calloway; Chantal Callejas; Eleni Graziani; Ilene Crumpler; Ali Valliere; Sonya Barlett; Frederick Delacruz; Kayce Foti; Orval Kirchner; Corrinne Cahoon; Modesto Mulloy; Alessandra Rodenberger; Bernita Redman; Iola Eudy]

Where I need help

The thirty people have to clean the floor. First Bryan, then Latricia and so on. Mondays, Wednesdays and Saturdays. I would make a list of the thrity people and then letting LaTeX Calendar filling the array (from Bryant to Iola) into the calendar (if ending with Iola, it should start with Bryan again). I don't know how I can do it! It could be nice if you could help there.

Furthermore I would love to pause the Working List from one date and then letting it repeat on another day; so if there are holidays, no one is written as the guy who has to do anything - but after the holidays it would start with the next name before the pause. And I would like to change some of the dates manually, if two on my floor have changed their floors service.

Hopefully some here can help me! In the meantime, thank you so much for your attention and participation.

6

You can use a number to track the person currently in charge of cleaning. Then you can use an \ifcase<number> number construct to return names corresponding to that number. Finally, alter the day code to do the following: If it's acleaning day, retrieve the cleaners name, save it in a macro then step the counter; if its not set the macro to be empty. Finally, add the macro to the day string. Here's only the parts that I added or changed:

Code

The name returning macro:

% === 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
}

Initializing the cleaning counter:

\xdef\cleanerID{0}

The updated day code:

  day code=
  { %=== Define macro that holds cleaners name on cleaning days, empty otherwise
    \ifdate{Monday,Wednesday,Saturday}%
    {   \xdef\InsertName{\Person{\cleanerID}}
        \pgfmathtruncatemacro{\newCleanerID}{mod(\cleanerID+1,30)}
            \xdef\cleanerID{\newCleanerID}
    }
    {   \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
      };
  },

Output

enter image description here

As you can see, after 10 weeks, after Iola Eudy was the cleaner, it starts over with Bryant Romans

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.