Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
% DIN-A4 doublesided year calendar
% Author: Robert Krause
% Modified by: Sérgio Jardim (@sjardim)
% License : Creative Commons attribution license
% Submitted to TeXample.net on 13 July 2012
\documentclass[landscape,a1paper,21pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz} % Use the calendar.sty style
\usepackage{fancyhdr} % header and footer
\usepackage{fix-cm} % Large year in header
\usepackage[landscape, headheight = 1cm, margin=0cm,
top = 1.2cm, nofoot]{geometry}
\usetikzlibrary{calc}
\usetikzlibrary{calendar}
\usepackage{verbatim}
\usepackage{PTSansNarrow}
\renewcommand*\familydefault{\sfdefault}
%========= INSTRUCTIONS ============================================
% TO EDIT THE CALENDAR, FOLLOW THE #NUMBERED STEPS (ONLY 3)
% IGNORE THE OTHER SETTINGS UNLESS YOU KNOW WHAT YOU'RE DOING :)
% LINES 32, 55 AND 87
% #01 Set the base year
\def\year{2018}
\def\nextYear{2019}
% Names of Holidays are inserted by employing this macro
\def\holiday#1#2{
\node [anchor=north west, text width= 5.9cm] at
($(cal-#1.north west)+(0em, 0em)$) {\tiny{#2}};
}
%Header
\renewcommand{\headrulewidth}{0.0pt}
\setlength{\headheight}{10ex}
%\chead{}
%Footer
\cfoot{\footnotesize\texttt{}}
\definecolor{titlescolor}{RGB}{128,128,128}
\begin{document}
\pagestyle{fancy}
\begin{center}
\begin{tikzpicture}[every day/.style={anchor = north}]
\calendar[
% #02 Set the months period (that will appear as columns)
dates=\year-01-01 to \nextYear-01-31,
name=cal,
day yshift = 1em,
day code=
{
\node[name=\pgfcalendarsuggestedname,every day,shape=rectangle,
minimum height= 1.7cm, text width = 5.9cm, draw = black]{\hskip-.15cm\bfseries\tikzdaytext};
\draw (-9ex, -1.4ex) node[anchor = west]{\tiny%
\pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}};
},
execute before day scope=
{
\ifdate{day of month=1}
{
% Shift right
\pgftransformxshift{6.4cm}
% Print month name
\draw (0,-.2ex)node [shape=rectangle, minimum height= 1cm,
text width = 5.9cm, fill = titlescolor, text= white, draw = titlescolor, text centered]
{\MakeUppercase{\large\textbf{\pgfcalendarmonthname{\pgfcalendarcurrentmonth}\strut}}};
}{}
\ifdate{workday}
{
% normal days are white
\tikzset{every day/.style={fill=none}}
}{}
% Saturdays
\ifdate{Saturday}{\tikzset{every day/.style={fill=black!15}}}{}
% Sundays
\ifdate{Sunday}{\tikzset{every day/.style={fill=black!30}}}{}
% Holidays
% #03 Set the holidays, per line
\ifdate{equals=\year-01-01}{\tikzset{every day/.style={fill=orange!40}}}{} % New Year's Eve
\ifdate{equals=\year-01-16}{\tikzset{every day/.style={fill=orange!40}}}{} % Martin L. King day
\ifdate{equals=\year-02-20}{\tikzset{every day/.style={fill=orange!40}}}{} % President's day
\ifdate{equals=\year-05-29}{\tikzset{every day/.style={fill=orange!40}}}{} % Memorial Day
\ifdate{equals=\year-07-04}{\tikzset{every day/.style={fill=orange!40}}}{} % Independence Day
\ifdate{equals=\year-09-04}{\tikzset{every day/.style={fill=orange!40}}}{} % Labor day
\ifdate{equals=\year-10-09}{\tikzset{every day/.style={fill=orange!40}}}{} % Columbus day
\ifdate{equals=\year-11-11}{\tikzset{every day/.style={fill=orange!40}}}{} % Veterans day
\ifdate{equals=\year-11-23}{\tikzset{every day/.style={fill=orange!40}}}{} % Thanksgiving day
\ifdate{equals=\year-12-25}{\tikzset{every day/.style={fill=orange!40}}}{} % Xmas
\ifdate{equals=\nextYear-01-01}{\tikzset{every day/.style={fill=orange!40}}}{} % New Year's Eve
},
execute at begin day scope=
{
% each day is shifted down according to the day of month
\pgftransformyshift{-1.7*\pgfcalendarcurrentday cm}
}
];
% Print name of Holidays
% \holiday{\year-01-01}{New Year's Eve}
% \holiday{\year-04-17}{Maundy Thursday}
\end{tikzpicture}
\end{center}
\end{document}
@sjardim
Copy link
Author

sjardim commented May 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment