calendar-generator/calpage.sty
Sebastian Hugentobler 57d352dbdc initial commit
2014-12-11 16:34:57 +01:00

95 lines
2.3 KiB
TeX

\NeedsTeXFormat{LaTeX2e}[2011/06/27]
\ProvidesPackage{calpage}[2014/12/10 Calendar Page Package]
\ExecuteOptions{}
\ProcessOptions\relax
\usepackage[export]{adjustbox}
\usepackage{xparse}
\ExplSyntaxOn
\keys_define:nn { hungerford/boxgraphics }
{
width .dim_set:N = \l_hungerford_box_wd_dim,
height .dim_set:N = \l_hungerford_box_ht_dim,
}
\NewDocumentCommand{\boxincludegraphics}{ m m }
{
\group_begin:
\keys_set:nn { hungerford/boxgraphics } { #1 }
\hungerford_include_graphics:n { #2 }
\group_end:
}
\cs_new_protected:Npn \hungerford_include_graphics:n #1
{
\adjustbox{
clip,
trim={
0~
\dim_eval:n { \height-\l_hungerford_box_ht_dim }~
\dim_eval:n { \width-\l_hungerford_box_wd_dim }~
0
}
}
{
\centerline{
\includegraphics[
min~width=\l_hungerford_box_wd_dim,
height=\l_hungerford_box_ht_dim
]{#1}
}
}
}
\ExplSyntaxOff
\newcommand{\calpage}[4]{
\offinterlineskip
\centering
\vbox{
\begin{minipage}[t][0.5\textheight][t]{\textwidth}
\center
\boxincludegraphics{width=\textwidth, height=170mm}{#1}
\vspace{2mm}
\end{minipage}
\begin{minipage}[b][0.360\textheight][t]{\textwidth}
\vspace{5mm}
\begin{center}
\begin{tikzpicture}[thick]
\calendar[dates=#2 to #3,
week list,
%month label below centered,
month text=\textsc{\%mt},
day headings={font=\footnotesize},
day letter headings]
if (Sunday,
Easter=39,
equals=01-01,
equals=08-01,
equals=12-25) [red]
if (equals=08-01) [observance=Nationalfeiertag]
if (Easter) [observance=Ostern]
if (Easter=39) [observance=Auffahrt]
if (equals=01-01) [observance=Neujahrstag]
if (equals=02-23) [observance=Basler Fasnacht]
if (equals=02-24) [observance=Basler Fasnacht]
if (equals=02-25) [observance=Basler Fasnacht]
if (Advent) [observance=Advent]
if (equals=12-25) [observance=Weihnachten]
;
\end{tikzpicture}
\end{center}
\end{minipage}
\begin{minipage}[b][0.140\textheight][t]{\textwidth}
\center\huge {#4}
\end{minipage}
}
}
\endinput