From 25834c6cd58d70575a52a49fde46601de3e5e8e5 Mon Sep 17 00:00:00 2001 From: mirabilos <thorsten.glaser@teckids.org> Date: Sat, 1 Sep 2018 18:40:31 +0200 Subject: [PATCH] fix calendar rendering, also move pgflibrarycalendar.easter.code.tex here --- pgflibrarycalendar.easter.def | 87 +++++++++++++++++++++++++++++++++++ teckidscal.sty | 7 +-- 2 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 pgflibrarycalendar.easter.def diff --git a/pgflibrarycalendar.easter.def b/pgflibrarycalendar.easter.def new file mode 100644 index 0000000..d98034b --- /dev/null +++ b/pgflibrarycalendar.easter.def @@ -0,0 +1,87 @@ +% Copyright © 2017 +% Qrrbrbirlbel +% +% Provided that these terms and disclaimer and all copyright notices +% are retained or reproduced in an accompanying document, permission +% is granted to deal in this work without restriction, including un†+% limited rights to use, publicly perform, distribute, sell, modify, +% merge, give away, or sublicence. +% +% This work is provided “AS IS†and WITHOUT WARRANTY of any kind, to +% the utmost extent permitted by applicable law, neither express nor +% implied; without malicious intent or gross negligence. In no event +% may a licensor, author or contributor be held liable for indirect, +% direct, other damage, loss, or other issues arising in any way out +% of dealing in the work, even if advised of the possibility of such +% damage or existence of a defect, except proven that it results out +% of said person’s immediate fault when using the work as intended. + +% This is made for http://tex.stackexchange.com/a/144186/16595 +% and used the formula from https://de.wikibooks.org/w/index.php?title=Algorithmensammlung:_Kalender:_Feiertage&oldid=670965 + +\def\pgfcalendar@Easter#1{% + \begingroup + \count0=#1\relax % Yeah 0 + \count1=\count0% % K 1 + \divide\count1 100 % K 1 + \count2=\count1 % M 3 + \multiply\count2 3 + \advance\count2 3 + \divide\count2 4 % 2 holds (3 * K +3) \ 4 + \count3=\count1 + \multiply\count3 8 + \advance\count3 13 + \divide\count3 -25 + \advance\count3\count2 + \advance\count3 15 % M 3 + \count2-\count2 % S 2 + \advance\count2 2 + \count4=\count0 % A 4 + \divide\count4 19 + \multiply\count4 -19 + \advance\count4\count0 % A 4 + \count1=\count4 % D 1 * + \multiply\count1 19 + \advance\count1\count3 + \count5\count1 + \divide\count1 30 + \multiply\count1 -30 + \advance\count1\count5 % D 1 * + \divide\count4 11 % R 4 * + \advance\count4\count1 + \divide\count4 29 % R 4 * + \advance\count1-\count4 % OG 1 ** + \advance\count1 21 % OG 1 ** + \count3\count0 % SZ 3 * + \divide\count3 4 + \advance\count3\count0 + \advance\count3\count2 + \count4-\count3 + \divide\count3 7 + \multiply\count3 7 + \advance\count3\count4 + \advance\count3 7 % SZ 3 * + \count4-\count3 % OE 4 ** + \advance\count4\count1 + \count3-\count4 + \divide\count4 7 + \multiply\count4 7 + \advance\count4\count3 + \advance\count4 7 % OE 4 ** + \advance\count4\count1 + \pgfcalendardatetojulian{\the\count0-03-\the\count4}\pgfutil@tempcnta + \expandafter\xdef\csname pgfcalendar@Easter@\the\count0\endcsname + {\the\pgfutil@tempcnta}% + \endgroup} +\pgfqkeys{/pgf/calendar/Easter}{ + .default=0, + .code={% + \expandafter\ifx\csname pgfcalendar@Easter@\pgfcalendarifdateyear\endcsname\relax + \pgfcalendar@Easter{\pgfcalendarifdateyear}% + \fi + \expandafter\pgfutil@tempcnta + \csname pgfcalendar@Easter@\pgfcalendarifdateyear\endcsname + \advance\pgfutil@tempcnta#1\relax + \ifnum\pgfcalendarifdatejulian=\pgfutil@tempcnta + \pgfcalendarmatchestrue + \fi}} diff --git a/teckidscal.sty b/teckidscal.sty index f1f785d..96084ac 100644 --- a/teckidscal.sty +++ b/teckidscal.sty @@ -1,6 +1,6 @@ % -*- mode: tex -*- %- -% Copyright © 2016, 2017 +% Copyright © 2016, 2017, 2018 % Thorsten Glaser <thorsten.glaser@teckids.org> % % Provided that these terms and disclaimer and all copyright notices @@ -21,9 +21,9 @@ % Teckids e.V. Wandkalender-Utilities \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{teckidscal}[2017/03/29 1.3 Teckids e.V. Wandkalender-Utilities]% +\ProvidesPackage{teckidscal}[2018/09/01 1.4 Teckids e.V. Wandkalender-Utilities]% \RequirePackage{pgfkeys,pgfcalendar}% -\input{pgflibrarycalendar.easter.code}% +\input{pgflibrarycalendar.easter.def}% \RequirePackage{etoolbox}% \RequirePackage{multirow}% \RequirePackage{stringstrings}% @@ -647,6 +647,7 @@ \vspace{2ex}% \linespread{1.42}\selectfont% + \color{black}% Feiertage für Nordrhein-Westfalen; \emph{alle Angaben ohne Gewähr!} \dash Fußnoten: \tkFNtext -- GitLab