%
%   Calendar-generating macros in TeX.
%   by Andrew Marc Greene
%   Student Information Processing Board, MIT
%   <amgreene@mit.edu>
%
%

% Here are the declarations of how large to make each calendar.

\newdimen\CalendarWidth  \CalendarWidth=6.5in
\newdimen\CalendarHeight \CalendarHeight=4in

% Here are the font declarations for date numbers and notes.

\font\datenumfont = amssmc40
\font\notefont = cmss10

% Here are the commands that set TeX's parameters for
% calendar-setting.

\def\calendar{\begingroup
\parindent=0pt
\parskip=0pt
\hbadness=10000
\baselineskip=0pt}  % Pack it as closely as you can!
\def\endcalendar{\endgroup}

% Here are the TeX registers used for the actual setting of calendars.
% Date contains the date of the NEXT box.
% Day contains the day of the week (0=Sun)
% OnDate is the next ``interesting date.''
% boxwidth and boxheight are the size of each date's box.
% boxrulewid is the width of the rules that form the grid.
% TopNotes is the box that accumulates the notes for the top of boxes.
% BotNotes is the box that accumulates the notes for the bottom of boxes.

\newcount\Date
\newcount\Day
\newcount\OnDate
\newdimen\boxwidth   \boxwidth=\CalendarWidth   \divide\boxwidth by 7
\newdimen\boxheight  \boxheight=\CalendarHeight \divide\boxheight by 5
\newdimen\boxrulewid \boxrulewid=2pt
\newbox\TopNotes
\newbox\BotNotes

\def\DayBox{\hbox{\vsize=\boxheight \hsize=\boxwidth \relax
\vrule width -\boxrulewid \relax
\vrule width \boxrulewid \relax
\vrule width -1sp \relax
\vbox to \vsize{\vsize=\boxheight \hsize=\boxwidth \relax
\hrule height \boxrulewid \relax
\vskip \boxrulewid
{\datenumfont\number\Date}\ \box\TopNotes\hfill\break
\global\advance\Date by 1 \relax
\global\advance\Day  by 1 \relax
\vfill
\box\BotNotes
\vskip\boxrulewid
\hrule depth \boxrulewid}%
{\vrule width -\boxrulewid
\vrule width \boxrulewid}}%
}


\def\addmovie#1{\setbox\BotNotes\vbox{\hsize=\boxwidth\relax
\unvbox\BotNotes #1}}

\def\movie#1#2#3{%  title, time, room
\addmovie{\centerline{\moviefont #1}
\line{\thinspace\timefont #2 \hfill #3\ }
\vskip\boxrulewid}\ignorespaces}

\def\dolby#1#2#3{%  title, time, room
\addmovie{\centerline{\moviefont #1}
\line{\thinspace\rlap{\timefont #2}\hfill{\dolbyfont D}%
\hfill\llap{\timefont #3}\ }
\vskip\boxrulewid}\ignorespaces}

%\hsize=7\boxwidth
%\vsize=5\boxheight

%%%%%%%%%

\def\note #1{\setbox\TopNotes\vbox{\hsize=0pt \hfuzz=4in \relax
\unvbox\TopNotes\vskip\boxrulewid\line{\notefont #1}}%
\ignorespaces}

\def\firstmonth#1{%  #1 is starting day of week, 0 = Sunday
\Day=#1\relax
\newmonth}

\def\newmonth{\Date=1\relax
\hbox\bgroup\null\expandafter\hskip\the\Day\boxwidth
\ignorespaces}

\def\dodate{\DayBox
\ifnum\Day=7\relax
\egroup\vskip-1.7\boxrulewid\hbox\bgroup
\global\Day=0\relax
\fi
\ifnum\Date<\OnDate
  \let\next=\dodate
\else
  \let\next=\ignorespaces
\fi
\next}

\def\ondate#1:{\global\OnDate=#1\relax\dodate}

\def\endmonth#1.{\ondate #1:\egroup\vfill\eject}

%%%%%

\font\moviefont = cmssbx10
\font\timefont = cmssq8
\font\dolbyfont = dolby


\nopagenumbers

\calendar
\firstmonth 5     % June starts on a Friday
\ondate 4:\note{Graduation}
\ondate 8:\movie{Superman}{7:00}{10-250}
          \movie{Superman II}{9:45}{10-250}
\ondate 9:\movie{Ladyhawke}{8:00}{10-250}
          \movie{Tom Jones}{11:30}{10-250}
\ondate 14:\note{Flag Day}
\ondate 15:\movie{Body Double}{7:00}{10-250}
           \movie{Dressed to Kill}{9:15}{10-250}
\ondate 16:\movie{A Guy Named Joe}{8:00}{10-250}
\ondate 17:\note{Father's Day}
\ondate 21:\note{Summer}\note{begins}
\ondate 22:\dolby{Star Trek I}{6:00}{10-250}
           \dolby{Star Trek II}{8:15}{10-250}
           \dolby{Star Trek III}{10:30}{10-250}
\ondate 23:\dolby{Star Trek IV}{7:00}{10-250}
           \dolby{Star Trek V}{9:15}{10-250}
\ondate 29:\dolby{Alien}{7:00}{10-250}
           \dolby{Aliens}{9:15}{10-250}
\ondate 30:\dolby{Hairspray}{8:00}{10-250}
\endmonth 31.

\newmonth
\ondate 4:\note{Independence Day}
\ondate 6:\movie{A Fistful of Dollars}{7:00}{10-250}
          \movie{For\thinspace a\thinspace Few\thinspace 
          Dollars\thinspace More}{9:00}{10-250}
\ondate 7:\dolby{Die Hard}{8:00}{10-250}
\ondate 13:\movie{Star Wars}{6:00}{10-250}
           \movie{\kern -2pt\ignorespaces
           The\thinspace Empire\kern 1pt Strikes\kern 1pt\ignorespaces
           Back}{8:15}{10-250}
           \movie{The\thinspace Return\thinspace of\thinspace
           the\thinspace Jedi}{10:30}{10-250}
\ondate 14:\note{Bastille Day}
           \movie{Blazing Saddles}{8:00}{10-250}
\ondate 20:\movie{Mad Max}{7:00}{10-250}
           \movie{The Road Warrior}{8:45}{10-250}
           \movie{Beyond Thunderdome}{10:30}{10-250}
\ondate 21:\movie{Comedy Sportz}{8:00}{10-250}
\ondate 27:\movie{Romancing the Stone}{7:00}{26-100}
           \movie{Jewel of the Nile}{9:00}{26-100}
\ondate 28:\movie{Chinatown}{8:00}{26-100}
\endmonth 32.

\newmonth
\ondate 3:\dolby{Cocoon}{7:00}{10-250}
          \dolby{Cocoon II}{9:15}{10-250}
\ondate 4:\movie{The Running Man}{8:00}{10-250}
\ondate 10:\movie{Rocky}{7:00}{10-250}
           \movie{Rocky II}{9:15}{10-250}
\ondate 11:\movie{Star Trek: The Series}{}{}
           \addmovie{\vskip 2pt}\ignorespaces
           \movie{The Menagerie}{7:00}{10-250}
           \movie{\kern -2pt\relax
           The\kern 1pt Ultimate\kern 1pt Computer}{9:15}{10-250}
\ondate 17:\movie{Escape to}{}{}\addmovie{\vskip -2pt}\ignorespaces
           \movie{Witch Mountain}{7:00}{10-250}
           \movie{Return from}{}{}\movie{Witch Mountain}{9:00}{10-250}
\ondate 18:\movie{Harold and Maude}{8:00}{10-250}
\ondate 24:\movie{Weird Science}{8:00}{10-250}
\ondate 25:\movie{Silverado}{8:00}{10-250}
\ondate 30:\note{R/O Begins}
\endmonth 32.

\end


