DIN-A4 doublesided year calendar

时间:2022-05-11 20:57:09
 % DIN-A4 doublesided year calendar
% Author: Robert Krause
% License : Creative Commons attribution license
% Submitted to TeXample.net on July
\documentclass[landscape,a4paper, ngerman, 10pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{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 = .2cm, nofoot]{geometry}
\usetikzlibrary{calc}
\usetikzlibrary{calendar}
%%%<
\usepackage{verbatim}
\usepackage[tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
%%%>
\begin{comment}
:Title: A calender for doublesided DIN-A4
Tags: Calendar library;Calendars
:Author: Robert Krause An example how the calendar package can be used to provide
an doublesided calendar for the whole year.
\end{comment} \renewcommand*\familydefault{\sfdefault} % User defined
\def\year{}
% Names of Holidays are inserted by employing this macro
\def\termin##{
\node [anchor=north west, text width= .4cm] at
($(cal-#.north west)+(3em, 0em)$) {\tiny{#}};
} %Header
\renewcommand{\headrulewidth}{.0pt}
\setlength{\headheight}{10ex}
\chead{
\fontsize{}{}\selectfont\textbf{\year}
\Large\textbf{Calendar}\hfill
}
%Footer
\cfoot{\footnotesize\texttt{http://www.cnblogs.com/wangshixi12/}} \begin{document}
\pagestyle{fancy}
\begin{center}
\begin{tikzpicture}[every day/.style={anchor = north}]
\calendar[
dates=\year-- to \year--,
name=cal,
day yshift = 3em,
day code=
{
\node[name=\pgfcalendarsuggestedname,every day,shape=rectangle,
minimum height= .53cm, text width = .4cm, draw = black]{\tikzdaytext};
\draw (-.8cm, -.1ex) node[anchor = west]{\footnotesize%
\pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}};
},
execute before day scope=
{
\ifdate{day of month=}
{
% Shift right
\pgftransformxshift{.8cm}
% Print month name
\draw (,)node [shape=rectangle, minimum height= .53cm,
text width = .4cm, fill = white, text= black, draw = black, text centered]
{\textbf{\pgfcalendarmonthname{\pgfcalendarcurrentmonth}}};
}{}
\ifdate{workday}
{
% normal days are white
\tikzset{every day/.style={fill=white}}
% Vacation (Germany, Baden-Wuerrtemberg) gray background
\ifdate{between=-- and --}{%
\tikzset{every day/.style={fill=white}}}{}
\ifdate{between=-- and --}{%
\tikzset{every day/.style={fill=white}}}{}
\ifdate{between=-- and --}{%
\tikzset{every day/.style={fill=white}}}{}
\ifdate{between=-- and --}{%
\tikzset{every day/.style={fill=white}}}{}
\ifdate{between=-- and --}{%
\tikzset{every day/.style={fill=white}}}{}
\ifdate{between=-- and --}{%
\tikzset{every day/.style={fill=white}}}{}
}{}
% Saturdays and half holidays (Christma's and New year's eve)
\ifdate{Saturday}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
% Sundays and full holidays
\ifdate{Sunday}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
% Christian holidays
\ifdate{equals=--}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=--}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=--}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=--}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=--}{\tikzset{every day/.style={fill=white}}}{}
},
execute at begin day scope=
{
% each day is shifted down according to the day of month
\pgftransformyshift{-.*\pgfcalendarcurrentday cm}
}
];
\end{tikzpicture}
% Repeat the whole thing for the second page
\pagebreak
\begin{tikzpicture}[every day/.style={anchor = north}]
\calendar[dates=\year-- to \year--,
name=cal,
day yshift = 3em,
day code=
{
\node[name=\pgfcalendarsuggestedname,every day,shape=rectangle,
minimum height= .53cm, text width = .4cm, draw = black]{\tikzdaytext};
\draw (-.8cm, -.1ex) node[anchor = west]
{
\footnotesize\pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}
};
},
execute before day scope=
{
\ifdate{day of month=} {
% Shift right
\pgftransformxshift{.8cm}
% Print month name
\draw (,)node [shape=rectangle, minimum height= .53cm,
text width = .4cm, fill = white, text= black, draw = black, text centered]
{
\textbf{\pgfcalendarmonthname{\pgfcalendarcurrentmonth}}
};
}{}
\ifdate{workday}
{
\tikzset{every day/.style={fill=white}}
% Vacation (Germany Baden-Wuerrtemberg)
\ifdate{between=-- and --}{%
\tikzset{every day/.style={fill=white}}}{}
\ifdate{between=-- and --}{%
\tikzset{every day/.style={fill=white}}}{}
\ifdate{between=-- and --}{%
\tikzset{every day/.style={fill=white}}}{}
\ifdate{between=-- and --}{%
\tikzset{every day/.style={fill=white}}}{}
\ifdate{between=-- and --}{%
\tikzset{every day/.style={fill=white}}}{}
\ifdate{between=-- and --}{%
\tikzset{every day/.style={fill=white}}}{}
}{}
% Sundays and full holidays
\ifdate{Sunday}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
\ifdate{equals=-}{\tikzset{every day/.style={fill=white}}}{}
},
execute at begin day scope=
{
% Each day is shifted down according to the day of month
\pgftransformyshift{-.*\pgfcalendarcurrentday cm}
}
]; \end{tikzpicture}
\end{center}
\end{document}