summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/calendar/a6.sty
blob: d6fa4e274b07e4b6a613410787b8c1d58a2165d8 (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
%%
%%    FILE a6.sty
%%
\baselineskip=10pt
\newcount\daysinpage
\newdimen\cellwidth
\newdimen\cellheight
\vsize=5in\voffset=-0.2in
\hsize=3.5in\hoffset=-0.25in
\newdimen\sphsize
\sphsize=\hsize
\divide\sphsize by2\advance\sphsize by-0.4pt
\cellheight=\vsize
\divide\cellheight by3
\advance\cellheight by-0.4pt\parindent=0pt
\font\bf=cmbx12
\font\rm=cmr12
\font\small=cmr9
\headline={\hfill
 \ifodd\pageno
  \rm\xdef\ftmk{\firstmark}%
  \divide\pageno by2\advance\pageno by1
  Week \#\the\pageno
 \else
  \bf\edef\btmk{\botmark}%
  \ifx\ftmk\btmk\else\ftmk/\fi\btmk
 \fi\hfill}
\footline={}
\def\newpage{\vfill\penalty-10000}
\def\beginday{
 \ifcase\daysinpage\or\hrule\or\hrule\or\or
  \hrule\or\hrule\fi
 \mark{\themonth} % Outside any box
 \setbox1=\vbox to\cellheight\bgroup\vglue4pt
 \ifnum\daysinpage>4\hsize=\sphsize\fi
 \setbox3=\vbox\bgroup
  \ifnum\daysinpage>2
   \rightskip=1.45cm plus 1fill
  \else
   \leftskip=1.45cm plus 1fill\fi
  \noindent\small}
\def\endday{\egroup
  \setbox0=\hbox to\hsize{\rm\ifholy\bf\fi
   \ifnum\daysinpage=6\bf\fi
   \ifnum\daysinpage>2
    \hfill{{\rm\theshortweekday}
    \ \the\Day\hskip0.5em}
   \else
    {\hskip0.5em\the\Day
    \ {\rm\theshortweekday}}\hfill\fi}
  \copy0\kern-\ht0\vskip0pt\box3
  \vfill\egroup
  \advance\daysinpage by1
  \ifcase\daysinpage\or\box1\or\box1\or
   \box1\newpage\or\box1\or\box1\or
   \setbox2=\box1\or
   \hbox{\box2\vrule\box1}\newpage
   \daysinpage=0\fi}
%
% Local: from monday ...
\Day=1\Month=1\dayno\prevday1\currentdate=\date
% Local: ... to sunday.
\Day=31\Month=12\dayno\nextday0\lastdate=\date
\leftskip=3pt\rightskip=3pt
\daysinpage=0
\def\epilog{}