%%
%% This is file `monthly.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% monthly.dtx  (with options: `class')
%% This file is part of the Calendar package,
%% Copyright (C) 1996, 1997 Frank Bennett, Jr.
%% All rights reserved.
%% ------------------------------------------
%% 
%% IMPORTANT NOTICE:
%% 
%% You are not allowed to change this file.  You may however copy
%% this file to a file with a different name and then change the
%% copy if (a) you do not charge for the modified code, (b) you
%% acknowledge the author of this file in the new file, if it
%% is distributed to others, and (c) you attach these same
%% conditions to the new file.
%% 
%% You are not allowed to distribute this file alone.  You are not
%% allowed to take money for the distribution or use of this file
%% (or a changed version) except for a nominal charge for copying
%% etc.
%% 
%% You are allowed to distribute this file under the condition that
%% it is distributed with all of its contents, intact.
%% 
%% For error reports, or offers to help make this a more powerful,
%% friendlier, and altogether more thrilling package, please contact me on
%% fb@soas.ac.uk.  Better yet, make a contribution to
%% my pension.  Account details available on request.
%% ------------------------------------------
%% 
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{monthly}
          [1998/01/17 18:15:10 3.1.1.1 Monthly Calendar (Frank Bennett)]
\newcount\mon@tempcount
\newcount\mon@firstday
\newtoks\mon@tempreg@b
\newlength\mon@tablewidth
\newtoks\mon@tempreg@a
\newlength{\mon@vh}
\newlength{\mon@hw}
\newlength{\mon@templen}
\newlength{\mon@heightlessboxes}
\newlength{\mon@widthlessboxes}
\newif\ifmon@explicittitle
\newif\ifmon@shortdays
\newlength{\mon@oddsidemargin}
\newlength{\mon@evensidemargin}
\newlength{\mon@topmargin}
\newif\ifmon@usedgeometry
\newlength{\mon@adjustment}
\newlength{\mon@textwidth}
\newlength{\mon@textheight}
\input calopts.cfg
\InputIfFileExists{dates.cfg}{}{}
\ProcessOptions
\RequirePackage{array}[1996/06/14]
\RequirePackage{calendar}
  \def\mon@settableheight{%
    \setlength{\mon@vh}{\vsize}%
    \addtolength{\mon@vh}{-0.001pt}}%
  \def\mon@settablewidth{%
    \setlength{\mon@tablewidth}{\hsize}}%

\define@key{opt}{title}{%
  \def\mon@title{#1}\mon@explicittitletrue}
\define@key{opt}{labels}{%
  \@storelabels#1,,{}}
\define@key{opt}{shortdays}{%
  \mon@shortdaystrue}
\define@key{opt}{firstday}{%
  \mon@firstday=#1}
\define@key{opt}{titletype}{\def\mon@titletype{#1}}
\define@key{opt}{daynametype}{\def\mon@nametype{#1}}
\define@key{opt}{datetype}{\def\mon@datetype{#1}}
\define@key{opt}{texttype}{\def\mon@texttype{#1}}
\mon@firstday=0%
\def\@storelabels{%
  \def\mon@labeltext{}%
  \@@storelabels}
\def\@@storelabels#1,#2#{%
  \ifcat$#1$%
    \mon@tempreg@a=\expandafter\expandafter\expandafter{%
      \expandafter\@gobble\mon@labeltext}%
    \protected@edef\mon@labeltext{\the\mon@tempreg@a}%
    \let\next\@gobble%
  \else%
    \let\next\@@storelabels%
    \mon@tempreg@a=\expandafter{\mon@labeltext}%
    \protected@edef\mon@labeltext{\the\mon@tempreg@a&#1}%
  \fi%
    \next#2{}}
\def\mon@theweekday{\ifmon@shortdays\theshortweekday\else%
  \theweekday\fi}%
\def\mon@titletype{\large\bfseries}%
\def\mon@daynametype{\bfseries}%
\def\mon@datetype{\bfseries}%
\def\mon@texttype{\tiny}%
\mon@firstday=0%
\newcalendar%
{monthly}
{\cal@insert}
{\mon@firstday}
{\dates@days}
{7}
{&}
{I}
{\mon@header}
{\\\hline\end{tabular}}
{\cal@footer\newpage\cal@header}
{\\\hline}
{\dates@requiremonthtrue}
{\dates@day=1%
  \dates@fix%
  \caldate%
  \cal@range@start\dates@date%
  \message{^^JStart: \theshortweekday\space%
    \theday\space\theshortmonth\space\theyear}%
  \dates@date\cal@range@end%
  \caldate%
  \dates@day\dates@days%
  \dates@fix%
  \caldate%
  \cal@range@end\dates@date%
  \message{^^JEnd: \theshortweekday\space%
    \theday\space\theshortmonth\space\theyear}%
  \dates@date=\cal@range@start%
  \caldate%
  \mon@settablewidth%
  \mon@settableheight%
  \settoheight{\mon@templen}{\vbox{\boxmaxdepth=0pt%
    \begin{tabular}{c}%
      \mon@titletype%
      \the\dates@monthname%
    \end{tabular}}}%
  \setlength{\mon@heightlessboxes}{\mon@templen}%
  \settoheight{\mon@templen}{\vbox{\boxmaxdepth=0pt%
    \begin{tabular}{c}%
      \mon@daynametype%
      Monday%
    \end{tabular}}}%
  \addtolength{\mon@heightlessboxes}{\mon@templen}%
  \addtolength{\mon@heightlessboxes}{10\arrayrulewidth}%
  \addtolength{\mon@heightlessboxes}{\doublerulesep}%
   \addtolength{\mon@heightlessboxes}{\mon@adjustment}%
   \addtolength{\mon@heightlessboxes}{2pt}%
  \addtolength{\mon@vh}{-\mon@heightlessboxes}%
  \divide\mon@vh by6%
  \setlength{\mon@hw}{\mon@tablewidth}%
  \setlength{\mon@widthlessboxes}{8\arrayrulewidth}%
  \addtolength{\mon@hw}{-\mon@widthlessboxes}%
  \addtolength{\mon@hw}{-14\tabcolsep}%
  \divide\mon@hw by7\relax%
  \@ifundefined{mon@labeltext}{%
    \def\mon@defaultlabels{}%
    \mon@tempcount=1%
    \advance\dates@date by-\dates@weekd%
    \advance\dates@date by\mon@firstday%
    \caldate%
    \loop%
      \mon@tempreg@a=\expandafter{\mon@defaultlabels}%
      \edef\mon@defaultlabels{\the\mon@tempreg@a\mon@theweekday,}%
    \ifnum\mon@tempcount<7%
     \advance\dates@date by1%
     \caldate%
     \advance\mon@tempcount by 1\relax%
    \repeat%
    \expandafter\@storelabels\mon@defaultlabels,,{}%
    \dates@date\cal@range@start%
    \caldate}%
    {}%
  \def\mon@settitle{\ifmon@explicittitle\else%
     \def\mon@title{\themonth\space\theyear}\fi}%
  \protected@edef\mon@header{%
    \noexpand\mon@settitle%
    \noexpand\begin{tabular}{|c|c|c|c|c|c|c|}%
    \noexpand\hline%
      \noexpand\multicolumn{7}{|c|}{\mon@titletype%
        \noexpand\mon@title}\noexpand\\%
    \noexpand\hline\noexpand\hline%
      \mon@labeltext\noexpand\\%
    \noexpand\hline}}%
{\par}%
{\cal@get@appointments\cal@get@events}%
{\relax%
   \ifnum\dates@time@start>0\relax%
    \ifnum\dates@time@start=\dates@time@end%
      \protected@edef\cal@entry@text{%
        \thetimestart\space%
        \cal@textcolor{\calcolor}{\theshorttext}}%
    \else%
      \protected@edef\cal@entry@text{%
        \thetimestart--\thetimeend\space%
        \cal@textcolor{\calcolor}{\theshorttext}}%
    \fi%
  \else%
      \protected@edef\cal@entry@text{%
        \cal@textcolor{\calcolor}{\theshorttext}}%
  \fi}%
{\vbox to\mon@vh{%
    \vskip\medskipamount%
    \hbox{\parbox{\mon@hw}{\mon@datetype\theday}}%
       \ifcat$\theevents$%
       \else%
        \vskip\smallskipamount%
        \hbox{\parbox{\mon@hw}{\raggedright%
          \mon@texttype\theevents}}%
       \fi%
       \ifcat$\theappointments$%
       \else%
        \vskip\smallskipamount%
        \hbox{\parbox{\mon@hw}{\raggedright%
          \mon@texttype\theappointments}}%
       \fi%
 \vfil}}%
\endinput
%%
%% End of file `monthly.sty'.
