1

I'm currently modifying the following calendar (TeXample) to match my needs and I wanted to rebuild the option where holidays are defined.

If you look at the code by Robert Krause you see, that he defines the holidays of the first six month in the first \begin{tikzfigure} and those of the last six month in the second tikzfigure-environment. To have a more maintainable calendar, I'd like to define the holidays in the preamble and let the calendar do the rest.

Furthermore I'd like to use this calendar for university, so I'd like to add exam dates which should be filled in red!20.

So I want to define all these holidays (fill with gray!30) and exam dates (fill with red!20) in the preamble and make the code dynamic. When compiling, tikz sould check if there are any exam dates defined and if so, it sould write the name in the corresponding field and fill that field red. If there are holidays defined it sould write their name in the field and fill it gray.

Here is a similar logic which I think I need, written in php:

<?php
$holidays = array(
        "2017-01-01" => "New Year",
        "2017-04-16" => "Easter Sunday",
        "2017-05-01" => "Labour Day",
        "2017-12-25" => "First Christmas Day"
    );

foreach( $holidays as $holiday => $name ){
    $date = strtotime($holiday);

    if($date <= strtotime("2017-06-30")) {
        // Place $name in the corrensponding field of the first six month and colour the field with gray!30
        echo "January to June: " . $name . "\r\n";
    }
    else if($date > strtotime("2017-06-30")) {
        // Place $name in the corrensponding field of the last six month and colour the field with gray!30
        echo "July to December: " . $name . "\r\n";
    }
}
?>

A similar behaviour for vacations where I could define the start and the end date and tikz would fill all the fields in bewteen gray would be awesome. At the moment, vacations also have to be defined in either of the tikzpicture-environments.

Your Answer

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

Browse other questions tagged or ask your own question.