%
%   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=12in
\newdimen\CalendarHeight \CalendarHeight=9in

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

\font\datenumfont = amssmc40
\font\notefont = cmss10 scaled \magstep 1

% 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
\setbox\DateBOX=\vbox{\datenumfont\number\Date}
\ifdim\ht\TopNotes>\ht\DateBOX
\ht\TopNotes=\ht\DateBOX\fi
{\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}}%
}

\newbox\DateBOX

\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=30in
\newbox\CalBox

%%%%%%%%%

\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
\setbox\CalBox\vbox\bgroup\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\egroup\copy\CalBox\vfill\eject}

\output{%
\count1=1 \shipout\vbox{\moveright 0.5in
\ifdim\ht\CalBox>\CalendarHeight \vbox{\kern -\boxheight\copy\CalBox}
\message{Raising}
\else \copy \CalBox\fi }
\count1=2 \shipout\vbox{\moveleft  5.7in \box\CalBox}
\global\advance\pageno by 1
\setbox201=\box255}

%%%%%

\font\moviefont = cmssbx10 scaled \magstep 1
\font\timefont = cmssq8    scaled \magstep 1
\font\dolbyfont = dolby     scaled \magstep 1 

\nopagenumbers

%% WHERE SHOULD WE PUT THE REG DAY MOVIE?  IT'S ON JAN 31...
%% Also, we need a \classic command...
%% emphasize non-7&10 movie times

%% when is new-member sign-up??

\calendar
\firstmonth 0     % sept starts on a sunday

\ondate 6:\movie{Splash}{7 \&\ 10}{26-100}
\ondate 7:\movie{Heathers}{5, 7:30 \&\ 10}{26-100}
\ondate 8:\movie{The Graduate}{7 \&\ 10}{10-250}
\ondate 9:\movie{The Doors}{6:30 \&\ 10}{Kresge}
\note{Registration Day}
\ondate 10:\note{Classes start}
\ondate 11:\note{Alternate}\note{Registration}\note{Day}
\ondate 13:\movie{Desk Set}{7:30}{54-100}
\movie{Dances with Wolves}{6 \&\ 10}{26-100}\movie{}{8:00}{10-250}
\ondate 14:\movie{Green Card}{7 \&\ 10}{26-100}
\ondate 15:\movie{Casablanca}{7 \&\ 10}{10-250}
\ondate 20:\movie{Gaslight}{7:30}{10-250}
\movie{Sleeping}{}{}\movie{with the Enemy}{7 \&\ 10}{26-100}
\ondate 21:\movie{Defending Your Life}{7 \&\ 10}{26-100}
\ondate 22:\movie{Stakeout}{7 \&\ 10}{10-250}
\ondate 27:\movie{The Thin Man}{7:30}{10-250}
\movie{The Long}{}{}\movie{Walk Home}{7 \&\ 10}{26-100}
\ondate 28:\movie{The Silence}{}{}\movie{of the Lambs}{7 \&\ 10}{26-100}
\ondate 29:\movie{Diva}{7 \&\ 10}{10-250}
\endmonth 31.

\newmonth   % October
\ondate 4:\movie{Dial ``M'' for Murder}{7:30}{10-250}
\movie{Ju Dou}{7 \&\ 10}{26-100}
\ondate 5:\movie{Switch}{7 \&\ 10}{26-100}
\ondate 6:\movie{A Man for}{}{}\movie{All Seasons}{7 \&\ 10}{10-250}
\ondate 11:\movie{(No Classic)}{}{}
\movie{Class Action}{7 \&\ 10}{26-100}
\note{Add Date}
\ondate 12:\movie{White Fang}{3, 7 \&\ 10}{26-100}
\ondate 13:\movie{Three Days}{}{}\movie{of the Condor}{7 \&\
10}{10-250}
\ondate 14:\note{Columbus Day}
\ondate 15:\note{No Classes}
\ondate 18:\movie{La Grande Illusion}{7:30}{10-250}
\movie{Truly, Madly, Deeply}{7 \&\ 10}{26-100}
\ondate 19:\movie{Cyrano de Bergerac}{6:30 \&\ 10}{26-100}
\ondate 20:\movie{Moonstruck}{7 \&\ 10}{10-250}
\ondate 25:\movie{Blithe Spirit}{7:30}{10-250}
\movie{L.A. Story}{7 \&\ 10}{26-100}
\ondate 26:\movie{Oscar}{7 \&\ 10}{26-100}
\ondate 27:\movie{Little Shop of Horrors}{7 \&\ 10}{10-250}
\ondate 31:\note{Hallowe'en}
\endmonth 32.

\newmonth   % November
\movie{Invasion of the}{}{}
\movie{Body Snatchers}{7:30}{10-250}
\movie{la femme Nikita}{7 \&\ 10}{26-100}
\ondate 2:\movie{City Slickers}{7 \&\ 10}{26-100}
\ondate 3:\movie{Rain Man}{6:30 \&\ 10}{10-250}
\ondate 8:\movie{The Ladykillers}{7:30}{10-250}
\movie{Thelma \& Louise}{7 \&\ 10}{26-100}
\ondate 9:\movie{Soapdish}{7 \&\ 10}{26-100}
\ondate 10:\movie{The Lion in Winter}{6:30 \&\ 10}{10-250}
\ondate 11:\note{Veterans Day}\note{No Classes}
\ondate 15:\movie{Anna Karenina}{7:30}{10-250}
\movie{Mortal Thoughts}{7 \&\ 10}{26-100}
\ondate 16:\movie{Backdraft}{6:30 \&\ 10}{26-100}
\ondate 17:\movie{Baby Boom}{7 \&\ 10}{10-250}
\ondate 21:\movie{Drop Date Eve Movie}{FREE}{TBA}
\ondate 22:\movie{An American}{}{}\movie{in Paris}{7:30}{10-250}
\movie{Jungle Fever}{7 \&\ 10}{26-100}
\note{Drop Date}
\ondate 23:\movie{F/X 2}{7 \&\ 10}{26-100}
\ondate 24:\movie{Amadeus}{6 \&\ 10}{10-250}
\ondate 28:\note{Thanksgiving}
\ondate 29:\movie{(No Classic)}{}{}
\movie{An American Tail}{8:00}{26-100}
\note{No Classes}
\ondate 30:\movie{Shipwrecked}{8:00}{26-100}
\endmonth 31.

\newmonth   % December
\movie{My Fair Lady}{8:00}{26-100}
\ondate 6:\movie{Rebel}{}{}\movie{Without a Cause}{7:30}{10-250}
\movie{Bill \& Ted's}{}{}\movie{Bogus Journey}{7 \&\ 10}{26-100}
\ondate 7:\movie{Robin Hood:}{}{}\movie{Prince of Thieves}{6:30 \&\ 10}{26-100}
\ondate 8:\movie{TBA}{7 \&\ 10}{10-250}
\ondate 12:\movie{Terminator 2}{6:30 \&\ 10}{26-100}
\note{Classes End}
\ondate 13:\movie{Miracle on}{}{}\movie{34th Street}{7:30}{10-250}
\movie{The Rocketeer}{7 \&\ 10}{26-100}
\ondate 14:\movie{Scrooged}{7 \&\ 10}{26-100}
\ondate 16:\note{Finals}
\ondate 17:\note{Finals}
\ondate 18:\note{Finals}
\ondate 19:\note{Finals}
\ondate 20:\note{Finals}
\endmonth 32.

\endcalendar

\end
