summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/calxxxx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/calxxxx
Initial commit
Diffstat (limited to 'macros/latex/contrib/calxxxx')
-rw-r--r--macros/latex/contrib/calxxxx/cal2000.tex102
-rw-r--r--macros/latex/contrib/calxxxx/calxxxx.tex176
-rw-r--r--macros/latex/contrib/calxxxx/readme.pdfbin0 -> 59210 bytes
-rw-r--r--macros/latex/contrib/calxxxx/readme.tex170
4 files changed, 448 insertions, 0 deletions
diff --git a/macros/latex/contrib/calxxxx/cal2000.tex b/macros/latex/contrib/calxxxx/cal2000.tex
new file mode 100644
index 0000000000..91bdc77dfb
--- /dev/null
+++ b/macros/latex/contrib/calxxxx/cal2000.tex
@@ -0,0 +1,102 @@
+% This is a freeware program written in LaTeX2e. It prints calendar for the
+% years 1990--2020. For the years 1901--2099, use the 28-year period, so the
+% year 2099 has the same calendar as 2099-3*28=2015. Outside this interval,
+% period is 2800 years, but a program `CalXXXX.tex' can help.
+
+% Safe modifications are between two `=====' lines. Any other modification are
+% recommended only for TeXperts.
+
+\documentclass{article}
+\usepackage{array}
+\nofiles\thispagestyle{empty}
+
+\newif\ifCmRule % cm rule at right
+
+%========== Start of Safe Modifications =============
+% The following definitions are safe to change
+
+\setlength{\topmargin}{-1in} \setlength{\oddsidemargin}{-1in} % No margins
+
+\setlength{\tabcolsep}{.6pt}\renewcommand{\arraystretch}{.9}% Lenghts in the table
+\setlength{\extrarowheight}{1pt}\setlength{\doublerulesep}{2pt}
+
+\newcommand{\nsize}{\tiny}\newcommand{\tsize}{\scriptsize} % Numbers and text sizes
+
+% Language dependent definitions
+\newcommand{\YearMonths} % `Year' and months
+{Year & \bfseries J& F & \bfseries M & A & \bfseries M & J & \bfseries J & \bfseries A & S &
+ \bfseries O & N & \bfseries D}
+\newcommand{\Day}[1]{\bfseries\ifcase#1 S \or M \or T \or W \or T \or F \or S \fi} % days of the week
+
+% Do you wish a cm rule? (default is false)
+\CmRulefalse % don't print the cm rule
+%\CmRuletrue % print the cm rule
+
+%========== End of Safe Modifications =============
+% It is not recommended to change anything below this line!
+
+% Print the cm scale at right
+\def\cmscale(#1,#2){\setlength{\unitlength}{1mm}
+\begin{picture}(0,0)(#1,#2)\tsize
+ \newcounter{cms}\put(-.3,71){cm}
+ \multiput(2,70)(0,-1){73}{\line(1,0){1}} \multiput(1,65)(0,-10){7}{\line(1,0){2}}
+ \multiput(0,70)(0,-10){8}{\line(1,0){3}}
+ \multiput(1,60.5)(0,-10){7}{\makebox(0,0)[b]{\addtocounter{cms}{1}\arabic{cms}}}
+\end{picture}}
+
+\begin{document} \nsize\noindent
+
+\ifCmRule\cmscale(-76,74.5)\fi% Print cm rule
+
+\begin{tabular}[t]{|r|*{4}{*{3}{>{\centering}m{6pt}}|}|c|rrrrrr|c|rrrrrr|}
+ \hline
+\YearMonths&\multicolumn{7}{c|}{\textbf{0}}&\multicolumn{7}{c|}{\textbf{1}}\\ \hline
+1990 &1&4&4&0&2&5&0&3&6&1&4&6&\Day{0}& 1& 8&15&22&29&&\Day{0}& & 7&14&21&28&\\
+1991 &2&5&5&1&3&6&1&4&0&2&5&0&\Day{1}& 2& 9&16&23&30&&\Day{1}& 1& 8&15&22&29&\\
+1992 &3&6&0&3&5&1&3&6&2&4&0&2&\Day{2}& 3&10&17&24&31&&\Day{2}& 2& 9&16&23&30&\\
+1993 &5&1&1&4&6&2&4&0&3&5&1&3&\Day{3}& 4&11&18&25& &&\Day{3}& 3&10&17&24&31&\\
+1994 &6&2&2&5&0&3&5&1&4&6&2&4&\Day{4}& 5&12&19&26& &&\Day{4}& 4&11&18&25& &\\
+1995 &0&3&3&6&1&4&6&2&5&0&3&5&\Day{5}& 6&13&20&27& &&\Day{5}& 5&12&19&26& &\\
+1996 &1&4&5&1&3&6&1&4&0&2&5&0&\Day{6}& 7&14&21&28& &&\Day{6}& 6&13&20&27& &\\
+ \cline{14-27}
+1997 &3&6&6&2&4&0&2&5&1&3&6&1&\multicolumn{7}{c|}{\textbf{2}}&\multicolumn{7}{c|}{\textbf{3}}\\
+ \cline{14-27}
+1998 &4&0&0&3&5&1&3&6&2&4&0&2&\Day{0}& & 6&13&20&27&&\Day{0}& & 5&12&19&26&\\
+1999 &5&1&1&4&6&2&4&0&3&5&1&3&\Day{1}& & 7&14&21&28&&\Day{1}& & 6&13&20&27&\\
+2000 &6&2&3&6&1&4&6&2&5&0&3&5&\Day{2}& 1& 8&15&22&29&&\Day{2}& & 7&14&21&28&\\
+ \cline{1-13}
+2001 &1&4&4&0&2&5&0&3&6&1&4&6&\Day{3}& 2& 9&16&23&30&&\Day{3}& 1& 8&15&22&29&\\
+2002 &2&5&5&1&3&6&1&4&0&2&5&0&\Day{4}& 3&10&17&24&31&&\Day{4}& 2& 9&16&23&30&\\
+2003 &3&6&6&2&4&0&2&5&1&3&6&1&\Day{5}& 4&11&18&25& &&\Day{5}& 3&10&17&24&31&\\
+2004 &4&0&1&4&6&2&4&0&3&5&1&3&\Day{6}& 5&12&19&26& &&\Day{6}& 4&11&18&25& &\\
+ \cline{14-27}
+2005 &6&2&2&5&0&3&5&1&4&6&2&4&\multicolumn{7}{c|}{\textbf{4}}&\multicolumn{7}{c|}{\textbf{5}}\\
+ \cline{14-27}
+2006 &0&3&3&6&1&4&6&2&5&0&3&5&\Day{0}& & 4&11&18&25&&\Day{0}& & 3&10&17&24&31\\
+2007 &1&4&4&0&2&5&0&3&6&1&4&6&\Day{1}& & 5&12&19&26&&\Day{1}& & 4&11&18&25&\\
+2008 &2&5&6&2&4&0&2&5&1&3&6&1&\Day{2}& & 6&13&20&27&&\Day{2}& & 5&12&19&26&\\
+2009 &4&0&0&3&5&1&3&6&2&4&0&2&\Day{3}& & 7&14&21&28&&\Day{3}& & 6&13&20&27&\\
+2010 &5&1&1&4&6&2&4&0&3&5&1&3&\Day{4}& 1& 8&15&22&29&&\Day{4}& & 7&14&21&28&\\
+ \cline{1-13}
+2011 &6&2&2&5&0&3&5&1&4&6&2&4&\Day{5}& 2& 9&16&23&30&&\Day{5}& 1& 8&15&22&29&\\
+2012 &0&3&4&0&2&5&0&3&6&1&4&6&\Day{6}& 3&10&17&24&31&&\Day{6}& 2& 9&16&23&30&\\
+ \cline{14-27}
+2013 &2&5&5&1&3&6&1&4&0&2&5&0&\multicolumn{7}{c|}{\textbf{6}}&\multicolumn{7}{c|}{}\\ \cline{14-20}
+2014 &3&6&6&2&4&0&2&5&1&3&6&1&\Day{0}& & 2& 9&16&23&30&
+ \multicolumn{7}{l|}{\ \tsize For the other}\\
+2015 &4&0&0&3&5&1&3&6&2&4&0&2&\Day{1}& & 3&10&17&24&31&
+ \multicolumn{7}{l|}{\ \tsize years, add or}\\
+2016 &5&1&2&5&0&3&5&1&4&6&2&4&\Day{2}& & 4&11&18&25& &
+ \multicolumn{7}{l|}{\ \tsize subtract 28.}\\
+2017 &0&3&3&6&1&4&6&2&5&0&3&5&\Day{3}& & 5&12&19&26& &
+ \multicolumn{7}{l|}{\ \tsize So, for year}\\
+2018 &1&4&4&0&2&5&0&3&6&1&4&6&\Day{4}& & 6&13&20&27& &
+ \multicolumn{7}{l|}{\ \tsize 2080, look for}\\
+2019 &2&5&5&1&3&6&1&4&0&2&5&0&\Day{5}& & 7&14&21&28& &
+ \multicolumn{7}{l|}{\ \tsize $2080-3\times28$}\\
+2020 &3&6&0&3&5&1&3&6&2&4&0&2&\Day{6}& 1& 8&15&22&29& &
+ \multicolumn{7}{l|}{\ \tsize $=1996$}\\
+\hline \multicolumn{27}{l}{\ \copyright Slobodan Jankovi\'c
+ (\texttt{slobodan@archimed.filfak.ni.ac.yu})}
+\end{tabular}\\
+\end{document}
diff --git a/macros/latex/contrib/calxxxx/calxxxx.tex b/macros/latex/contrib/calxxxx/calxxxx.tex
new file mode 100644
index 0000000000..658af975ca
--- /dev/null
+++ b/macros/latex/contrib/calxxxx/calxxxx.tex
@@ -0,0 +1,176 @@
+% This is a freeware program written in LaTeX2e. It prints the calendar for a given year.
+
+% Safe modifications are between two `=====' lines. Any other modification are recommended
+% only for TeXperts.
+
+\documentclass{article}
+\usepackage{array}
+\nofiles\thispagestyle{empty}
+
+% Counters, logical, and lengths
+\newcount\y \newcount\m \newcount\x % year, month, day of the week
+\newcount\p \newcount\q % temporary counters
+\newif\ifleap % if leap year
+\newif\ifJulian % if Julian calendar
+\newif\ifZeroExist % if 0th year exist
+\newif\ifCmRule % cm rule at right
+\newlength{\Wd} % the widest name of days
+\newlength{\Wdx} % temporary dim
+
+%========== Start of Safe Modifications =============
+% The following definitions are safe to change
+
+% Fonts for Year, Months and Days
+\def\yearfont{\normalsize\bfseries} \def\monthfont{\scriptsize\scshape} \def\dayfont{\tiny}
+
+% Language Dependent Definitions (B.C., A.D., months, and days)
+
+\def\BC{ B.C.}\def\AD{} % ` B.C.' after a negative year, nothing after a positive
+
+\def\Jan{January} \def\Feb{February}\def\Mar{March} \def\Apr{April}
+\def\May{May} \def\Jun{June} \def\Jul{July} \def\Aug{August}
+\def\Sep{September}\def\Oct{October} \def\Nov{November}\def\Dec{December}
+
+\def\Sun{\textbf{S}} \def\Mon{\textbf{M}} \def\Tue{\textbf{T}} \def\Wen{\textbf{W}}
+\def\Thr{\textbf{T}} \def\Fri{\textbf{F}} \def\Sat{\textbf{S}}
+
+% Margins and Spaces
+\setlength{\topmargin}{-1in}\setlength{\oddsidemargin}{-1in} % no margins
+\def\sm{\hspace{2pt}} % space between months
+
+% Select Gregorian/Julian calendar and zero/nonzero (default are both false)
+\Julianfalse % don't use Julian, use Gregorian calendar
+\ZeroExistfalse % zero year doesn't exist (before 1st is -1st year)
+%\Juliantrue % use Julian, don't use Gregorian calendar
+%\ZeroExisttrue % zero year exists (before 1st is 0th year)
+
+% Do you wish a cm rule? (default is false)
+\CmRulefalse % don't print the cm rule
+%\CmRuletrue % print the cm rule
+
+%========== End of Safe Modifications =============
+% It is not recommended to change anything below this line!
+
+% Set \x=the day of the week (0=Sunday, 1=Monday,...)
+\def\dayofweek#1{\m=#1 \x=\y % x:=y;
+\ifnum \x>0\else % if x<=0 then
+ \ifZeroExist \else \advance\x by 1 \fi % begin if not ZeroExist x:=y+1;
+ \q=\x \divide\q by 2800 \advance\q by -1 % q:=x; q:=(q div 2800-1)*2800;
+ \multiply\q by 2800 \advance\x by -\q % x:=x-q
+\fi % end;
+\p=\x % p:=x;
+\q=\m \multiply \q by 3 % q=m*31;
+\advance \x by \q \advance \x by 4 % x:=x+q+4;
+\ifnum \m<3 \advance \p by -1 \else % if m<3 then p:=p-1 else
+ \q=\m \multiply\q by 4 \advance\q by 23 % begin q:=(4*m+23) div 10;
+ \divide\q by 10 \advance\x by -\q% x:=x-q
+\fi % end;
+\q=\p \divide\q by 4 \advance\x by \q % q:=p div 4; x:=x+q;
+\ifJulian \else % if not Julian then
+ \divide\p by 100 \advance\p by 1 % begin p:=p div 100+1;
+ \multiply\p by 3 \divide\p by 4 % p:=p*3 div 4;
+ \advance\x by -\p % x:=x-p
+\fi % end;
+\p=\x \divide\p by 7 \multiply\p by 7 % p:=(x div 7)*7;
+\advance \x by -\p} % x:=x-p;
+
+%Is \y a leap year?
+\def\setleap{\leapfalse \x=\y % leap:=false; x:=y;
+\ifnum \x<0 % if x<0 then
+ \ifZeroExist \else \advance\x by 1 \fi % begin if not ZeroExist else x:=x+1
+\fi % end;
+\p=\x \divide\p by 4 \multiply\p by 4 % p:=(x div 4)*4;
+\ifnum \x=\p % if x=p then
+ \q=\x \divide\q by 100 \multiply\q by 100 % begin q:=(x div 100)*100;
+ \ifnum \x=\q % if x=q then
+ \q=\x \divide\q by 400 \multiply\q by 400 % begin q:=(x div 400)*400;
+ \ifnum \x=\q \leaptrue \fi % if x=q then leap:=true
+ \else \leaptrue % end else leap:=true
+\fi\fi}% end end
+
+% Defines all kind of rows
+\def\rows{%
+\def\rone{&1&8&15&22&29&}%rows for a month with 31 days
+\def\rtwo{&2&9&16&23&30&}\def\btwo{&&2&9&16&23&30}%
+\def\rthree{&3&10&17&24&31&}\def\bthree{&&3&10&17&24&31}%
+\def\rfour{&4&11&18&25&&}\def\bfour{&&4&11&18&25&}%
+\def\rfive{&5&12&19&26&&}\def\bfive{&&5&12&19&26&}%
+\def\rsix{&6&13&20&27&&}\def\bsix{&&6&13&20&27&}%
+\def\rseven{&7&14&21&28&&}\def\bseven{&&7&14&21&28&}%
+\ifnum\m=2 % if February ...
+ \ifleap\else\def\rone{&1&8&15&22&&}\fi %if it isn't a leap year
+ \def\rtwo{&2&9&16&23&&}\def\btwo{&&2&9&16&23&}%
+ \def\rthree{&3&10&17&24&&}\def\bthree{&&3&10&17&24&}%
+\else % if other month with <=30 days ...
+ \ifnum\m=1\else\ifnum\m=3\else\ifnum\m=5\else\ifnum\m=7\else\ifnum\m=8\else
+ \ifnum\m=10\else\ifnum\m=12\else
+ \def\rthree{&3&10&17&24&&}\def\bthree{&&3&10&17&24&}%
+\fi\fi\fi\fi\fi\fi\fi\fi}
+
+% Calendar of a month
+\def\Month#1{% #1=month
+\setleap\dayofweek{#1}\rows % set leap, set \x=day of the week, and define all rows
+\setlength{\tabcolsep}{0pt}
+\begin{tabular*}{7em}{|>{\centering}p{\Wd}|@{\extracolsep{\fill}}rrrrrr|}
+\multicolumn{7}{l}{\sm\monthfont %print name of a month \m
+ \ifcase\m \or\Jan\or\Feb\or\Mar\or\Apr\or\May\or\Jun\or\Jul\or\Aug\or\Sep\or\Oct\or\Nov\or\Dec \fi}\\
+\hline
+\ifcase\x
+ \Sun\rone\\ \Mon\rtwo\\ \Tue\rthree\\ \Wen\rfour\\ \Thr\rfive\\ \Fri\rsix\\ \Sat\rseven\\ \or %if Sunday
+ \Sun\bseven\\ \Mon\rone\\ \Tue\rtwo\\ \Wen\rthree\\ \Thr\rfour\\ \Fri\rfive\\ \Sat\rsix\\ \or %if Monday
+ \Sun\bsix\\ \Mon\bseven\\ \Tue\rone\\ \Wen\rtwo\\ \Thr\rthree\\ \Fri\rfour\\ \Sat\rfive\\ \or %if Tuesday
+ \Sun\bfive\\ \Mon\bsix\\ \Tue\bseven\\ \Wen\rone\\ \Thr\rtwo\\ \Fri\rthree\\ \Sat\rfour\\ \or %if Wednesday
+ \Sun\bfour\\ \Mon\bfive\\ \Tue\bsix\\ \Wen\bseven\\ \Thr\rone\\ \Fri\rtwo\\ \Sat\rthree\\ \or %if Thursday
+ \Sun\bthree\\ \Mon\bfour\\ \Tue\bfive\\ \Wen\bsix\\ \Thr\bseven\\ \Fri\rone\\ \Sat\rtwo\\ \or %if Friday
+ \Sun\btwo\\ \Mon\bthree\\ \Tue\bfour\\ \Wen\bfive\\ \Thr\bsix\\ \Fri\bseven\\ \Sat\rone\\ \fi %if Saturday
+\hline
+\end{tabular*}}
+
+% Enter the year
+\def\enteryear{\typeout{}
+\typeout{Enter the year (negative for B.C., 0th year does\ifZeroExist \else n't\fi \space exist),}
+\typeout{and I will make the calendar for that year!}
+\typeout{}\typeout{For the current year, \number\year th, just press the ENTER key!}
+\loop
+ \typein[\Year]{}\ifx \Year\empty \y=\year \else \y=\Year \fi \relax
+ \leapfalse \ifnum \y=0 \ifZeroExist \else \leaptrue \fi\fi
+\ifleap \typeout{}\typeout{0th year doesn't exist! Maybe you want the year -1.} \repeat
+\typeout{}\typeout{\ifJulian Julian \else Gregorian \fi Calendar for the year \number\y.}\typeout{}}
+
+% Set \Wd to the widest name of the days
+\def\SetWidth{%
+\settowidth{\Wd} {\dayfont\Sun} % Wd:=width(Sun);
+\settowidth{\Wdx}{\dayfont\Mon}\ifdim\Wd<\Wdx \Wd=\Wdx \fi % if Wd<width(Mon) then Wd:=width(Mon);
+\settowidth{\Wdx}{\dayfont\Tue}\ifdim\Wd<\Wdx \Wd=\Wdx \fi % etc.
+\settowidth{\Wdx}{\dayfont\Wen}\ifdim\Wd<\Wdx \Wd=\Wdx \fi
+\settowidth{\Wdx}{\dayfont\Thr}\ifdim\Wd<\Wdx \Wd=\Wdx \fi
+\settowidth{\Wdx}{\dayfont\Fri}\ifdim\Wd<\Wdx \Wd=\Wdx \fi
+\settowidth{\Wdx}{\dayfont\Sat}\ifdim\Wd<\Wdx \Wd=\Wdx \fi}
+
+% Print the calendar for the given year
+\def\printyear{%
+\begin{minipage}{.5\textwidth}\dayfont % set font for the days
+{\sm \yearfont
+ \ifnum\y>0 \number\y\AD \else \ifZeroExist \the\y \else \p=-\y \number\p\BC\fi\fi
+ \ifJulian \ (Julian)\fi}\\[.5ex] % print year
+\SetWidth
+\Month{1}\sm\Month{2}\sm\Month{3}\\% print all months
+\Month{4}\sm\Month{5}\sm\Month{6}\\ \Month{7}\sm\Month{8}\sm\Month{9}\\
+\Month{10}\sm\Month{11}\sm\Month{12}\par
+\ \copyright\texttt{slobodan@archimed.filfak.ni.ac.yu}
+\end{minipage}}
+
+% Print cm scale at right
+\def\cmscale(#1,#2){\setlength{\unitlength}{1mm}
+\begin{picture}(0,0)(#1,#2)\scriptsize
+ \newcounter{cms}\put(-.3,71){cm}
+ \multiput(2,70)(0,-1){70}{\line(1,0){1}} \multiput(1,65)(0,-10){7}{\line(1,0){2}}
+ \multiput(0,70)(0,-10){8}{\line(1,0){3}}
+ \multiput(1,60.5)(0,-10){7}{\makebox(0,0)[b]{\addtocounter{cms}{1}\arabic{cms}}}
+\end{picture}}
+
+\begin{document}
+ \noindent \enteryear
+ \printyear
+ \ifCmRule\cmscale(8,35)\fi% Print cm rule
+\end{document}
diff --git a/macros/latex/contrib/calxxxx/readme.pdf b/macros/latex/contrib/calxxxx/readme.pdf
new file mode 100644
index 0000000000..d469f2859f
--- /dev/null
+++ b/macros/latex/contrib/calxxxx/readme.pdf
Binary files differ
diff --git a/macros/latex/contrib/calxxxx/readme.tex b/macros/latex/contrib/calxxxx/readme.tex
new file mode 100644
index 0000000000..68efebf6dd
--- /dev/null
+++ b/macros/latex/contrib/calxxxx/readme.tex
@@ -0,0 +1,170 @@
+\documentclass{article}
+\nofiles
+
+\renewcommand{\div}{\rm\,div\,}\newcommand{\mod}{\rm\,mod\,}
+\newcommand{\dfrac}{\displaystyle\frac}
+
+\begin{document}
+
+\section*{\texttt{ReadMe} file --- Instructions}
+
+This file explains the use of \verb|CalXXXX.tex| and \verb|Cal2000.tex| files, possible
+modifications and gives the mathematical background for the calculation of the calendar. Both files
+are for \LaTeXe, and use the \verb|array.sty| package. At the end, there are some interesting
+numerical values and historical facts.
+
+\subsection*{The use}
+
+To print a calendar for a given year, use \verb|CalXXXX.tex| file. \LaTeXe it, type in the year
+(for example 2002), and the calendar for that year is produced. For the year B. C., enter the
+negative number (for example $-6$), and for the current year, \number\year th, you can press the
+ENTER key only.
+
+To print calendar for the years 1990--2020, use \verb|Cal2000.tex| file. \LaTeXe it and you will
+have the calendar for all that years.
+
+\subsection*{Possible modifications}
+
+In both files there is a peace of code clearly denoted for safe modifications.
+
+In \verb|CalXXXX.tex|, the most important changes are for a language: \verb|\Jan|, \dots
+\verb|\Dec| define names of the months. You can also set type of the calendar: Gregorian
+(\verb|\Julianfalse|) or Julian (\verb|\Juliantrue|). For details, see explanations later. Some
+misunderstanding could be for 0th year; normally it doesn't exist (before 1st is a $-1$st year),
+but if, for some reason, you need a 0th year, set \verb|\ZeroExisttrue| and the 0th year will exist
+(before 1st is 0th, and before it $-1$st). \verb|\BC| and \verb|\AD| are text after the year (in
+English, $-6$th year is 6~BC and 6th year is 6~AD).
+
+In the \verb|Cal2000.tex|, the most important changes are also for a language. Change definition
+for \verb|\YearMonths| and \verb|\Day| according to your language.
+
+Both files have a command \verb|\CmRulefalse|. If you change it to a \verb|\CmRuletrue|, you will
+see a centimeter scale at the right edge.
+
+Beside of these, other modifications are possible, but not recommended.
+
+\subsection*{Mathematical background}
+
+In both files, the day $x$ (0 for Sunday, 1 for Monday, etc.) for a date $d.m.y$ is calculated as
+\[ x=\left\{\begin{array}{ll}
+ x_0 \mod 7 & \mbox{if $m<3$} \\ (x_0-(4m+23) \div 10) \mod 7 & \mbox{if $m\ge3$}
+ \end{array}\right. \]
+where
+\[x_0=365y+31m+d+3+k \div 4-(k \div 100+1)\cdot3 \div 4\]
+and
+\[ k=\left\{\begin{array}{ll} y-1 & \mbox{if $m<3$}\\ y & \mbox{if $m\ge3$} \end{array}\right.\]
+
+This formulae are used in both files. In \verb|CalXXXX.tex|, you can see how \TeX calculates. In
+\verb|Cal2000.tex|, since the years 1990--2020 are fixed, there is no need to calculate anything,
+but the first day for all months for the years 1990--2020, are produced with the following Pascal
+code:
+
+\begin{verbatim}
+program cal(output);
+var x,y,m,k: longint;
+begin writeln('Year J F M A M J J A S O N D');
+ for y:=1990 to 2020 do
+ begin write(y,' ');
+ for m:=1 to 12 do
+ begin x:=365*y+31*m+4; { 4=d+3 }
+ if m<3 then k:=y-1 else k:=y;
+ x:=x+k div 4-(k div 100+1)*3 div 4;
+ if m>=3 then x:=x-(4*m+23) div 10;
+ x:=x mod 7;
+ write(' ',x)
+ end; writeln;
+ end;
+end.
+\end{verbatim}
+
+\subsection*{Numerical values}
+
+The lengths of solar (tropical) year and lunar month in days are
+\[ Y=365.24219872,\quad M=29.530588. \]
+(These are values for a period December 31st, 1900, at 12h --- since it slowly decreases.) The
+solar calendar should have about 365.24 days in a year (on average), while the lunar calendar
+should have months of 29.5 days (usually, 30 and 29 alternately). The lunisolar calendar should
+have both, but the ratio of these two lengths $Y/M=12.36826706\ldots$ is not an integer and most
+years should have 12 and leap years 13 months. In 432 BC, Athens astronomer Meton, discover that in
+19 years there are almost exactly 235 lunar months ($19\times 12.36826706=234.997$). This became a
+base for all calendar with lunar months and solar year.
+
+The Julian year has 365.25 days (on average), and the difference is $0.0078013 \linebreak[1]
+\mbox{days}=11'14''$ or 1 day in 128 years, while the Gregorian year has 365.2425 days, with the
+difference of $0.0003013 \mbox{ days} =26''$ or 1 day in 3319 years. More precise calendar will
+follow from the expansion of the length of the tropical year in an infinite fraction
+\[ {365.24219872}
+ =365+\dfrac{1}{4+\dfrac{1}{7+\dfrac{1}{1+\dfrac{1}{3+\dfrac{1}{5+\dfrac{1}{5+\cdots}}}}}}
+\]
+With the first fraction only, we have $365+\frac14=365.25$ days, what is Julian year. With the
+first two fraction, $365+\frac{1}{4+\frac{1}{7}}=365+\frac{7}{29}=365.2414$ and with the three
+$365+\frac{8}{33}=365.2424$ what is better then Gregorian year. With the four
+$365+\frac{31}{128}=365.2421875$ with the difference $0.0000112 \mbox{ days}=1''$ or 1 day in
+almost 10\,000 years. So, if in a cycle of 128 years we put 31 leap years, the calendar will be
+almost perfect.
+
+\subsection*{Brief History}
+
+In Babylon a calendar had 12 lunar months of 30 days each, with added extra month when necessary to
+keep the months in line with the seasons of the year. Later, a year of 354 days was introduced with
+12 months with intercalations in the years 3, 6, 8, 11, 14, 17, and 19 of the 19-year cycle. In
+Iran, Zoroastrian calendar has year of 12 months of 30 days, plus five days, giving totally 365.
+The ancient Egyptians measured the solar year as 365 days, divided into 12 months of 30 days each,
+with 5 extra days at the end. About 238~BC King Ptolemy~III added an extra day to every fourth
+year. In ancient Greece a lunar calendar was in use, with a year of 354 days. In Rome, the year had
+10 months with 304 days and began with March. Two more months, January and February were added
+later in the 7th century BC. Furthermore, an extra month had to be intercalated approximately every
+second year.
+
+In 45~BC Julius Caesar, upon the advice of the Alexandrian astronomer Sosigenes, decided to use a
+solar calendar similar to Egyptian. This calendar, known today the Julian calendar, had the normal
+year at 365 days, and the leap year, every fourth year, at 366 days. In this calendar January,
+March, May, July, September, and November had 31 days, other months 30 days, while February had 29
+or 30 days. This calendar also established the order of the months and the days of the week as they
+exist in present-day calendars. Julius Caesar also changed the name of the month Quintilis to
+Julius (July). In 8~AD the emperor Caesar Augustus renamed the month Sextilis to Augustus (August),
+increased it to 31 days, reduced September and November to 30 days, and increased October and
+December to 31 days. Such complicated calendar was adopted by Christian church and spread to western
+world.
+
+Since the year in Julian calendar was some longer then solar year, this discrepancy accumulated
+until by 1582 the error was 10 days. To fix it, Pope Gregory~XIII issued a decree dropping 10 days
+from the calendar and order that century years divisible by 400 should be leap years only. Catholic
+states adopted this new calendar immediately, but other counties did that later. Britain adopted it
+in 1752, Denmark and the Dutch and German Protestant states in 1699-1700, Soviet Union in 1918, and
+Greece in 1923. The monarch republic Holy Mountain, in Greece, is only territory with the official
+use of the Julian calendar, but some Orthodox churches also keep the Julian calendar for religious
+use.
+
+The Islamic calendar is a purely lunar. It has 12 lunar months alternately 30 and 29 days long. In
+each thirty years the 2nd, 5th, 7th, 10th, 13th, 16th, 18th, 21st, 24th, 26th, and 29th years have
+the last month as leap month with 30 instead of 29 days. So the year has 354 or 355 days. There are
+no intercalations of months and the months regress through all the seasons every $32\frac12$ years.
+
+The Jewish calendar is lunisolar, based on 12 lunar months of 29 days or 30 days. Such year has 354
+days, but an extra month of 30 days is intercalated in the 3rd, 6th, 8th, 11th, 14th, 17th, and
+19th years in a 19-year cycle. This gives an average length of 365.05 days.
+
+The Chinese calendar is also lunisolar, its year consisting of 12 months of alternately 29 and 30
+days, equal to 354 days. Intercalary months are inserting to keep the calendar year in step with
+the solar year of 365 days.
+
+\subsection*{Notices}
+
+These files may be freely used on any number of machines for any time period. It can be freely
+copied and distributed, on the condition that the distribution will be complete and with no
+modification.
+
+The author disclaims all warranties as to this software, whether express or implied, including
+without limitation any implied warranties of merchantability or fitness for a particular purpose.
+
+\subsection*{}
+\copyright Slobodan Jankovi\'c, \texttt{slobodan@archimed.filfak.ni.ac.yu}
+
+\end{document}
+
+
+
+\[ \frac{365.24219872}{29.530588} = 12.36826706\ldots
+ =12+\cfrac{1}{2+\cfrac{1}{1+\cfrac{1}{2+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{16+\cfrac{1}{1+\dotsb}}}}}}}
+\]