blob: 240ceb9c9b435c8b8fa4b96af9f540b1958488df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
% This macro source file is from the four volume series
% "TeX in Practice" by Stephan von Bechtolsheim, published
% 1993 by Springer-Verlag, New York.
% Copyright 1993 Stephan von Bechtolsheim.
% No warranty or liability is assumed.
% This macro may be copied freely if no fees other than
% media cost or shipping charges are charged and as long
% as this copyright and the following source code itself
% is not changed. Please see the series for further information.
%
% Version: 1.0
% Date: May 1, 1993
%
%
% This source code is documented in 26.19, p. III-385.
% Original source in file "macros6.TEX", starting line 1327.
\wlog{L: "mocal.tip" ["macros6.TEX," l. 1327, p. III-385]}%
% This file DOES belong to format "texip."
\InputD{dateofw.tip}
\InputD{doloop.tip}
\InputD{arbday.tip}
\InputD{nextday.tip}
\InputD{numdyr.tip}
\InputD{prmonth.tip}
\catcode`\@ = 11
\newcount\@InitialDayOfMonth
\newcount\@MCDays
\newcount\@MonthlyCalendarBodyTemp
\def\MonthlyCalendarBody #1#2#3{%
{%
\CheckDate{#1}{#2}{1}%
\ArbitraryDayOfWeek{#1}%
{#2}{1}{\@InitialDayOfMonth}%
\gdef #3{}%
\DoLoop{\@MonthlyCalendarBodyTemp}%
{1}{1}{\@InitialDayOfMonth}%
{\xdef#3{#3&}}
\NumberOfDaysInMonth{#1}{#2}{\@MCDays}%
\DoLoop{\@MonthlyCalendarBodyTemp}{1}{1}{\@MCDays}{%
\xdef#3{#3\the\@MonthlyCalendarBodyTemp}%
\ifnum\@InitialDayOfMonth = \Saturday
\xdef#3{#3\cr}%
\else
\xdef#3{#3&}%
\fi
\advance\@InitialDayOfMonth by 1
\IModN{\@InitialDayOfMonth}{7}{\@InitialDayOfMonth}%
}%
}%
\xdef#3{#3\crcr}%
}
\newcount\@MonthlyCalendarCount
\def\MonthlyCalendar #1#2#3{%
{%
\MonthlyCalendarBody{#1}{#2}{\TableBody}%
\vtop{
\hsize = #3\relax
\ProvideMonth{#2}{0}{\MonthNameTemp}%
\@MonthlyCalendarCount = #1\relax
\centerline{\MyStrut\MonthNameTemp\space
\the\@MonthlyCalendarCount}%
\smallskip
\hrule
\smallskip
\tabskip = 0pt
\halign to \hsize{
% So
\hfil##\relax \tabskip = 0pt plus 1fil&
\hfil##& % Mo
\hfil##& % Tu
\hfil##& % We
\hfil##& % Th
\hfil##& % Fr
\hfil##\relax \tabskip = 0pt
\cr
\omit\hfil So\hfil&
\omit\hfil Mo\hfil&
\omit\hfil Tu\hfil&
\omit\hfil We\hfil&
\omit\hfil Th\hfil&
\omit\hfil Fr\hfil&
\omit\hfil Sa\hfil\cr
\TableBody
}%
\smallskip
\hrule
}%
}%
}%
\catcode`\@ = 12
|