% \iffalse
%
% File timesht.dtx
% Copyright (C) 1996 by Frank Bennett.  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 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 Calendar a more powerful,
% friendlier, and altogether more thrilling package, please contact me on
% fb@soas.ac.uk
% 
%<*dtx>
          \ProvidesFile{timesht.dtx}
%</dtx>
%<style>\NeedsTeXFormat{LaTeX2e}[1995/06/01]
%<style>\ProvidesPackage{timesht}
%<style>          [1996/11/09 v0.03 Timesheet generator (Frank Bennett)]
% \fi
%
% \def\fileversion{v0.03}
% \def\filedate{1996/11/27}
%
% \iffalse
%<*driver>
\documentclass{ltxdoc}
\begin{document}
%\OnlyDescription            % comment out for implementation details
\DocInput{timesht.dtx}
\end{document}
%</driver>
% \fi
%
% \changes{v0.01}{1996/11/10}{Initial Version}
% \changes{v0.02}{1996/11/11}{Minor bug fixes. Initial release.}
% \changes{v0.03}{1996/11/27}{Minor alterations to make the
%   class work with the updated calendar package.}
%
%
% \title{User's Guide to the Timesheet package\thanks{This file is version number
%    \fileversion{}.  It was last revised on
%    \filedate.}}
%
% \author{Frank G. Bennett, Jr.\thanks{The page-formatting code contained in this
%    file is for the most part copied from the \texttt{ltnews.cls}
%    class file version 0.11 by Alan Jeffrey, which forms part of the
%    \LaTeXe{} distribution.  The rest is my own creation.  Enjoy.}}
%
%  \maketitle
% 
% \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
% \DoNotIndex{\@flushglue,\@gobble,\@input}
% \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
% \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
% \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
% \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
% \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
% \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
% \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
% \DoNotIndex{\cal,\csname,\def,\documentstyle,\dospecials,\edef}
% \DoNotIndex{\egroup}
% \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
% \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
% \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
% \DoNotIndex{\ifcase}
% \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
% \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
% \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
% \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
% \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
% \DoNotIndex{\strutbox}
% \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
% \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
% \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
% \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
% \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
% \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
% \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
% \DoNotIndex{\nopagebreak}
% \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
% \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
% \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
% \DoNotIndex{\[,\{,\},\]}
% \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
% \DoNotIndex{\baselineskip,\begin,\tw@}
% \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
% \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
% \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
% \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
% \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
% \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
% \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
% \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
% \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
% \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
% \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
% \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
% \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
% \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
% \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
% \DoNotIndex{\bfdefault}
% \setcounter{StandardModuleDepth}{1}
% \DeleteShortVerb{\|}
% \MakeShortVerb{\"}
%
% \begin{abstract}
% \noindent This package provides a style that can be used to
% create timesheets, to monitor the amount of time 
% you spend fussing with \LaTeXe.
% \end{abstract}
%
% \changes{v0.01}{1996/11/10}
%    {Created "docstrip" version.}
% \changes{v0.02}{1996/11/11}
%    {Fixed missing 30-40 line, and a few other minor adjustments.}
% \changes{v0.02}{1996/11/11}
%    {Added sample document to distribution.}
%
% \CheckSum{236}
%
% \section{Introduction}
%
% This packages creates a style, "timesheet", and a macro called
% "\timesheets" which
% accepts two arguments.  Both arguments are dates of the form
% \verb+YYYY/MM/DD+.  This will generate a two-page timesheet
% for all dates within the range specified in the arguments,
% inclusive.  To use this package you will also need the
% "calendar" package, which is also available from CTAN.
% 
%
%\StopEventually{\PrintIndex}
%
% \section{The Macros}
% Let's start by switching off some of the article options.
%    \begin{macrocode}
%<*style>
\DeclareOption{a4paper}{\OptionNotUsed}
\DeclareOption{a5paper}{\OptionNotUsed}
\DeclareOption{b5paper}{\OptionNotUsed}
\DeclareOption{letterpaper}{\OptionNotUsed}
\DeclareOption{legalpaper}{\OptionNotUsed}
\DeclareOption{executivepaper}{\OptionNotUsed}
\DeclareOption{landscape}{\OptionNotUsed}
\DeclareOption{twoside}{\OptionNotUsed}
\DeclareOption{titlepage}{\OptionNotUsed}
\DeclareOption{onecolumn}{\OptionNotUsed}
%    \end{macrocode}
% Sizing options should be passed to the article class.
%    \begin{macrocode}
\DeclareOption{10pt}{\PassOptionsToPackage{\CurrentOption}{article}}
\DeclareOption{11pt}{\PassOptionsToPackage{\CurrentOption}{article}}
\DeclareOption{12pt}{\PassOptionsToPackage{\CurrentOption}{article}}
%    \end{macrocode}
% The default action for any option is to pass it to the calendar package.
%    \begin{macrocode} 
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{calendar}}
%    \end{macrocode} 
% Execute the options.
%    \begin{macrocode} 
\ProcessOptions
%    \end{macrocode} 
% Load the article class.
%    \begin{macrocode} 
\LoadClass[oneside]{article}
%    \end{macrocode}
% Specify the page style.
%    \begin{macrocode} 
\pagestyle{empty}
\setlength{\parindent}{1em}
\setlength{\rightskip}{0pt plus \textwidth}
\setlength{\@rightskip}{\rightskip}
\setlength{\parfillskip}{0pt plus 2\textwidth}
\setlength{\columnsep}{2em}
%    \end{macrocode}
% Specify the text size.  This spec tries to work with both A4 and letter paper
% sizes. 
%    \begin{macrocode}
\setlength{\textheight}{230mm}
\setlength{\topmargin}{-10mm}
\setlength{\linewidth}{\textwidth}
 \setlength{\textwidth}{180mm}
\setlength{\oddsidemargin}{-10mm}
%    \end{macrocode}
% Declare some lengths and counters.
%    \begin{macrocode}
\newcounter{timecount}
\newcounter{timecountlimit}
\newlength{\timesheetleft}
\newlength{\timesheetright}
%    \end{macrocode}
% Declare a toggle for turning hash marks on and off.
%    \begin{macrocode}
\newif\if@makehash
%    \end{macrocode}
% Figure out how much space is chewed up by the times and lines
% and stuff.  The remainder will be empty space for handwritten notes.
%    \begin{macrocode}
\settowidth{\timesheetleft}{00:00\ --\ 00:00}
\addtolength{\timesheetleft}{5\arrayrulewidth}
\addtolength{\timesheetleft}{6\tabcolsep}
\addtolength{\timesheetleft}{\doublerulesep}
\setlength{\timesheetright}{\textwidth}
\addtolength{\timesheetright}{-\timesheetleft}
%    \end{macrocode}
% Create a macro that will put down a one one-hour chunk of times
% for use in a tabular environment.  Because we can't have
% anything after the last "\\" (not even a "\relax") if the table
% is not to over-run, we have to start the table off ``by hand''
% in the lead-off macro, defined below, and leave the last "\\"
% out of the definition here, so it can be supplied when the
% iteration dies.
%    \begin{macrocode}
\def\@@maketimes#1{\xdef\timearg{\the\c@timecount}
\addtocounter{timecount}{1}%
\\\hline
\@makehashtrue
\timearg &00& \timearg &10&&\\
\timearg &10& \timearg &20&&\\
\timearg &20& \timearg &30&&\\
\timearg &30& \timearg &40&&\\
\timearg &40& \timearg &50&&\\
\timearg &50&\arabic{timecount}&00&&%
\@makehashfalse}
%    \end{macrocode}
% This performs the iteration.
%    \begin{macrocode}
\def\@maketimes{\@@maketimes{\arabic{timecount}}%
 \ifnum\c@timecount>\c@timecountlimit%
  \let\next\\\else\let\next\@maketimes\fi%
 \next}
%    \end{macrocode}
% This is the lead-off macro used as an interface to the above
% material.  It accepts a range of integers corresponding to
% hours in the day.
%    \begin{macrocode}
\def\maketimes#1#2{%
   \setcounter{timecount}{#1}%
   \setcounter{timecountlimit}{#2}%
\addtocounter{timecount}{1}%
\@makehashtrue
#1 &00& #1 &10&&\\
#1 &10& #1 &20&&\\
#1 &20& #1 &30&&\\
#1 &30& #1 &40&&\\
#1 &40& #1 &50&&\\
#1 &50&\arabic{timecount}&00&&
\@makehashfalse
\@maketimes}
%    \end{macrocode}
% We need to have a bunch of tools loaded for all of this to
% work.
%    \begin{macrocode}
\RequirePackage{longtable}[1996/05/24]
\RequirePackage{array}[1996/06/14]
\RequirePackage{calendar}
%    \end{macrocode}
% A little flash is nice.  The "mygoth" package is my personal hackery.
% Send a message to "fb@soas.ac.uk" if you'd like a copy.
%    \begin{macrocode}
\IfFileExists{mygoth.sty}{\RequirePackage{mygoth}}{\let\textgoth\relax}
%    \end{macrocode}
% We also need to quelch the left and right margin offsets, so that the
% table can fill the whole page.
%    \begin{macrocode}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
%    \end{macrocode}
% Define a new environment, which is essentially just a
% particular instance of the "longtable" environment.
%    \begin{macrocode}
\newenvironment{timesheet}
   {\begin{longtable}{%
     |r%
      @{:}%
      l%
      @{\ --\ }%
      r%
      @{:}%
      l%
     |p{0.33\timesheetright}%
     ||p{0.67\timesheetright}|%
}%
   \multicolumn{4}{l}{}&%
     \multicolumn{2}{l}{\large\bf\theweekday\hfill%
     {\Huge\textgoth{Timesheet}}\hfill%
     \theday{} %
     \themonth{} %
     \theyear}\\
   \multicolumn{6}{l}{}\\
     \multicolumn{4}{c}{\small Time}&%
     \multicolumn{1}{c}{\small Plan}&%
     \multicolumn{1}{c}{\small Action}\\
   \hline
   \endhead
   \hline
    \endfoot}
   {\end{longtable}}
%    \end{macrocode}
% Define a high-level macro that invokes the above environment,
% making things very clean and straightforward in the document.
%    \begin{macrocode}
\def\timesheets#1#2{%
  \everyday
   {#1}
   {#2}
   {\begin{timesheet}\maketimes{7}{22}\end{timesheet}}
}
%</style>
%    \end{macrocode}
% \section{A Demonstration Document}
% The following document will produce a single
% timesheet.  Adjust dates to taste.
%    \begin{macrocode}
%<*demo>
\documentclass[10pt]{timesht}
\begin{document}
\timesheets{1996/11/24}{1996/11/24}
\end{document}
%</demo>
%    \end{macrocode}
% \section{The Installation File}
%    \begin{macrocode}
%<*installer>
\def\batchfile{timesht.ins}
\input docstrip.tex

\keepsilent

\preamble

This file is part of the Timesheet package.
Copyright (C) 1996 Frank Bennett, Jr.
All rights reserved.
------------------------------------------
This is a generated file.

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(s) 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 Timesheet a more powerful,
friendlier, and better package, please contact me on
`fb' at soas.ac.uk

\endpreamble

\generateFile{timesht.cls}   {n}{\from{timesht.dtx}{style}}

\preamble

This file is part of the Timesheet package.
Copyright (C) 1996 Frank Bennett, Jr.
All rights reserved.
------------------------------------------
This is a generated file.

You are welcome to modify this file in any way you wish.

For error reports, or offers to help make Timesheet a more powerful,
friendlier, and better package, please contact me on
`fb' at soas.ac.uk

\endpreamble

\generateFile{timesheet.tex} {n}{\from{timesht.dtx}{demo}}

\Msg{***********************************************************}
\Msg{*}
\Msg{* To finish the installation, you have to move the following}
\Msg{* file into a directory searched by TeX:}
\Msg{*}
\Msg{* \space\space timesht.cls}
\Msg{*}
\Msg{***********************************************************}
}
%</installer>
%    \end{macrocode}
% \Finale \PrintChanges




