diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-11 23:51:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-11 23:51:32 +0000 |
commit | c527dbf71da60b363477eb3371989b216625a359 (patch) | |
tree | 0d1a4c6e27a25ceb604ac0883c0209c54e2b1c5e /Master/texmf-dist | |
parent | b4f9edbb6c7363a4534991abd962637d66ff3808 (diff) |
trunk/Master/texmf-dist/source/latex/calendar
git-svn-id: svn://tug.org/texlive/trunk@177 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
30 files changed, 10749 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/calendar/CATALOG b/Master/texmf-dist/source/latex/calendar/CATALOG new file mode 100644 index 00000000000..fbebd973d1d --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/CATALOG @@ -0,0 +1,17 @@ +Name: calendar +Problems-To: fb@soas.ac.uk +Author: Frank G Bennett, Jr +Version: 3.1 +Description: Provides an interface for the creation of calendars using + LaTeX. Each calendar "style" within this bundle produces a + calendar in a particular format. Calendars may incorporate lists of + events and appointments from external files. The package is stable, + easy to install, easy to use, powerful and flexible. The bundle + includes styles for: a yearly calendar, a monthly calendar, a weekly + filofax(tm) calendar, a timesheet generator and a timetable/conference/ + itinerary generator. +Keywords: calendar, timetable, diary, time management, office software, + scheduling +See-Also: CTAN://tex-archive/macros/plain/contrib/calendar. +Address: Law Department, School of Oriental and African Studies, + Thornhaugh Street, London WC1H 0XG diff --git a/Master/texmf-dist/source/latex/calendar/MANIFEST b/Master/texmf-dist/source/latex/calendar/MANIFEST new file mode 100644 index 00000000000..fcc4ea2a512 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/MANIFEST @@ -0,0 +1,31 @@ +The LaTeX Calendar bundle consists of the following files: + +CATALOG (LaTeX index entry) +MANIFEST (This file) +README (Blurb about the package) +calguide.tex (generic user manual) + +allcal.ins (Installation file) + +calendar.dtx (Core module) +dates.dtx (Core module) +overword.dtx (Core module) + +calopts.cfg (File containing common code) +dates.cfg (Sample language configuration file) +autofilo.dtx (Filofax(tm) page support) + +timesht.dtx (Timesheet style) +weekly.dtx (Weekly style) +monthly.dtx (Monthly style) +yearly.dtx (Yearly style) +timetabl.dtx (Timetable style) +evntlist.dtx (Event list style) +htmlstuf.dtx (Three HTML styles) + +margins.sty (Simple margin control) +mkaddr.dtx (Sample Tcl and Emacs Lisp code for managing addresses) +plotutil.dtx (Sample Tcl and LaTeX code for controlling HP 6xx plotters) + +caldemos.dtx (Calendar demo files) +bigdemo.tgz (Large set of data files and sample document) diff --git a/Master/texmf-dist/source/latex/calendar/README b/Master/texmf-dist/source/latex/calendar/README new file mode 100644 index 00000000000..8f7e561a6f0 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/README @@ -0,0 +1,128 @@ +The LaTeX Calendar bundle (version 3.1) + +INTRODUCTION +------------ +The files in this bundle provide an interface for the creation of calendars +using LaTeX. It is easy to use, flexible and powerful. Promise me more, +right? Read on. + +Each calendar "style" provides an environment which will read its contents +as a date or range of dates, and produce a corresponding calendar in a +particular format. For example, a calendar for the first two weeks in +August 1997 in the "weekly" style would be expressed as follows: + + \begin{weekly}{}{} + 1 Aug 1997 to 8 Aug 1997 + \end{weekly} + +The syntax for expressing dates is human-friendly: initial capitals are +converted to lower case, abbreviations will be recognized, and within +ordinary dates word order is irrelevant (i.e. both 1 aug 1997 and August 1 +1997 mean the same thing). + +Calendars may incorporate lists of events and appointments from external +files. The syntax for such files permits the use of recursive dates limited +by a range or ranges of dates ("every second saturday" during school +session, that sort of thing), with a stop-list of holidays. Entries +may also be color-coded if you have a color printer. You can also manage +complex data sets by building large lists from smaller files in an +object-oriented fashion. + +INSTALLATION +------------ +The simplest way to install the tools in the package is to make a +subdirectory in the search path of your TeX, FTP all of the source files to +that directory, and run "latex allcal.ins". You should then be able to run +the demonstration files. Note that demoover.tex and demodate.tex do not +produce any printed output; these files just demonstrate the capabilities of +the relevant code on the terminal. + +UPGRADING +--------- +If there is a previous version of the LaTeX Calendar package on your system, +these files should be used as a complete replacement. Each release +is likely to incorporate bug-fixes or enhancements that affect several +files, so it is best to save yourself the potential frustration of +a broken installation and do it from scratch each time. + +WHAT'S NEW +---------- +==Version 3.1== +The LaTeX Calendar Bundle now speaks HTML. Language support and +documentation have also vastly improved. You can now specify any language +as the default, AND you can include multiple languages in a single *.cld +file, choosing which text to include when a calendar is actually produced. +There is now ONE manual, that tells you everything you need to know. + +==Version 2.2== +Lots of bugfixes, large and small. + +First day in yearly calendars can now be selected at run time. + +Parsing code greatly optimized. Note that only the first letter +of words in date text is now downcased. + +Documentation in timetabl.dtx improved. + +==Version 2.1== +A lot of redundant and ornamental processing has been eliminated, +and the package is slightly faster now. + +A bug affecting 2nd and subseqent pages in the Timesheets package +has been fixed. + +The behaviour of "every other" declarations has been modified +to make this slightly more useful. See calman.tex for details. + +Validation of entries has been tightened up somewhat. + +==Version 2.0== +The "weekly" package and its supporting style "autofilo.sty" creates +calendars in Filofax(TM) format (those little ring-binder-type things that +seem such a good idea until you discover how much the commercially printed +pages cost). All page parameters, including the size, number and spacing +of the punch-marks, are configurable. + +For Unix systems with Emacs and Tcl, the "mkaddr" package includes some +hacks that can be used to generate Filofax(TM)-type-format address lists +from an Emacs BBDB database (q.v.). + +The limitation in the code which demanded that a bogus entry be placed at +the bottom of files in some circumstances to protect against reads beyond +end of file has been eliminated. The syntax for use in *.cld files has also +been slightly modified to make the interface internally consistent; =all= +declarations other than "freeze" are now meant to be followed by a +description in squiggly braces. + +Anniversaries are now supported. + +Several cross-nested global/local assignments to the same variable, which +produced "save size" errors with even relatively modest volumes of +data, have been fixed. I =think= that bugs of this kind have been +eliminated from the code, but if you do see this error on a large job, +send me the logfile and I'll try to track the problem down. + +CONTRIBUTORS +------------ + +Most of the code in this package was written by Frank Bennett +<fb@soas.ac.uk>. The core upon which it is based, however, is a collection +of calendar macros for plain TeX, still available in the plain TeX area on +CTAN. Very slightly modified versions of these macros are the means used +for generating dates, identifying days of the week and so forth. These +macros were released anonymously; if anyone can tell me who wrote them, I +will include their author among the credits here. + +Christian Horn and Miroslav Novak did beta-testing of early versions of +Bennett's LaTeX code, and their help is gratefully acknowledged here. The +"Timetable" package was suggested by Miroslav Novak, and implemented by +Bennett. Edward Czilli provided invaluable feedback in the testing phase of +versions 2.0, 2.1 and 2.2. Thanks are also due for comments and bug reports +received from Jason Alexander, Edward J. Czilli, Bob Fiegel, Lico Hoekema, +and Gabrielle Owen. To everyone who has corresponded with me about the +package, I want to convey my sincerest thanks. + +Enjoy! + +Frank Bennett +fb@soas.ac.uk diff --git a/Master/texmf-dist/source/latex/calendar/allcal.ins b/Master/texmf-dist/source/latex/calendar/allcal.ins new file mode 100644 index 00000000000..df226cb5c4e --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/allcal.ins @@ -0,0 +1,193 @@ +%\iffalse +% allcal.ins,v +% Revision 3.1 1998/01/17 16:55:22 root +% Release code +% +% Revision 2.10 1998/01/16 21:12:52 root +% *** empty log message *** +% +% Revision 2.9 1998/01/16 21:08:40 root +% *** empty log message *** +% +% Revision 2.8 1998/01/16 19:22:55 root +% *** empty log message *** +% +% Revision 2.7 1997/12/06 21:13:24 root +% Changed filoaddr.sty to filoaddr.cls +% +% Revision 2.6 1997/12/06 08:53:32 root +% Log offset fixed. +% +%Revision 2.5 1997/12/06 08:50:25 root +%Fixed missing log entry. +% +% allcal.ins,v +% Revision 2.1.1.1 1997/11/01 15:36:56 bennett +% *** empty log message *** +% +% Revision 2.1 1997/11/01 14:40:45 root +% Release code. +% +% Revision 1.4 1997/10/30 20:13:44 root +% Added \IfFileExists conditionals that paternalistically attempt +% to determine whether it's worth calling the existence of the +% Tcl/Emacs facilities to the attention of the user. +% +% Revision 1.3 1997/10/30 06:13:56 root +% Eliminated extract-all-installation-files option. +% +% Revision 1.2 1997/10/29 08:40:33 root +% Simple test of RCS. +% +% Revision 1.1 1997/10/29 08:17:52 root +% Initial revision +%\fi +% +\def\batchfile{allcal.ins} +\input docstrip.tex + +\def\calextract#1#2#3#4{% + \IfFileExists{#1.dtx}{% + \ifcat$#4$\def\calexfn{#1}\else\def\calexfn{#4}\fi + \generate{ + \file{\calexfn.#2} {\from{#1.dtx}{#3}}}} + \relax} + +\keepsilent + +\preamble +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. +------------------------------------------ + +\endpreamble + +\Ask\demo{% +^^JUnpack demonstration files? (optional) ^^J (y/n): +} + +\newif\if@Emacs +\IfFileExists{/usr/bin/emacs}{\@Emacstrue}{} +\IfFileExists{/usr/local/bin/emacs}{\@Emacstrue}{} +\IfFileExists{/usr/bin/mule}{\@Emacstrue}{} +\IfFileExists{/usr/local/bin/mule}{\@Emacstrue}{} +\if@Emacs +\IfFileExists{/usr/bin/tclsh}{\@Emacstrue}{} +\IfFileExists{/usr/local/bin/tclsh}{\@Emacstrue}{} +\IfFileExists{/usr/bin/expect}{\@Emacstrue}{} +\IfFileExists{/usr/local/bin/expect}{\@Emacstrue}{} +\Ask\unix{% +^^JUnpack address management files, meant for use on Unix systems (optional) ^^J (y/n): +} +\else +\message{If you are a Unix user and install Emacs, Tcl and the BBDB email} +\message{database, this pacakge contains a set of scripts that can be used} +\message{to print address lists for your personal diary.} +\fi + +\Ask\overwrite{% +^^JBlindly OVERWRITE existing files (careful with this one) ^^J (y/n): +} + +\ifx\overwrite\y\askforoverwritefalse\fi + +\calextract{overword}{sty}{style}{} +\calextract{dates}{sty}{style}{} +\calextract{calendar}{sty}{style}{} +\calextract{evntlist}{sty}{style}{} +\calextract{autofilo}{sty}{style}{} +\calextract{monthly}{sty}{class}{} +\calextract{timesht}{sty}{package}{} +\calextract{timetabl}{sty}{package}{} +\calextract{weekly}{cls}{class}{} +\calextract{yearly}{sty}{style}{} +\calextract{htmlstuf}{sty}{htmlmonth}{hmonth} +\calextract{htmlstuf}{sty}{htmlevent}{hlist} +\calextract{htmlstuf}{sty}{htmlmonthevent}{hml} + +\ifx\demo\y + \bgroup + +\preamble +\endpreamble + +\postamble +\endpostamble + + \def\ins{n} + \calextract{dates}{tex}{demo}{demodate} + \calextract{overword}{tex}{demo}{demoover} + \calextract{caldemos}{cld}{1997}{demo1997} + \calextract{caldemos}{cld}{appts}{demoapt} + \calextract{caldemos}{cld}{apptsr}{demoaptr} + \calextract{caldemos}{cld}{demolist}{demolist} + \calextract{caldemos}{cld}{events}{demoevt} + \calextract{caldemos}{cld}{eventsr}{demoevtr} + \calextract{caldemos}{tex}{monthly}{demomont} + \calextract{caldemos}{tex}{timesht}{demotsht} + \calextract{caldemos}{tex}{timetabl}{demottbl} + \calextract{caldemos}{tex}{weekly}{demowkly} + \calextract{caldemos}{tex}{yearly}{demoyrly} + \calextract{caldemos}{tex}{evntlist}{demoevnt} + \calextract{caldemos}{tex}{hmonth}{demohmth} + \calextract{caldemos}{tex}{hlist}{demohlst} + \calextract{caldemos}{tex}{hml}{demohml} + \egroup +\fi + +\ifx\unix\y + +\preamble +\endpreamble + +\postamble +\endpostamble + +\def\WritePreamble#1{} +\def\WritePostamble#1{} + +\generate{\file{mkaddr.Frank}{\from{mkaddr.dtx}{format}} + \file{mkaddr.tcl}{\from{mkaddr.dtx}{script}} + \file{dotemacs}{\from{mkaddr.dtx}{elisp}} + \file{filoaddr.cls}{\from{mkaddr.dtx}{style}} + \file{dvipshpplotq}{\from{plotutil.dtx}{script}} + \file{hpplotsz.sty}{\from{plotutil.dtx}{style}} + } +\fi + +\Msg{***********************************************************} +\Msg{*} +\Msg{* To finish the installation, you have to move all *.sty} +\Msg{* and *.cls files into a directory searched by TeX.} +\Msg{*} +\IfFileExists{mkaddr.dtx}{\ifx\unix\y +\Msg{* You might also want to move the "mkaddr" file into your} +\Msg{* executable search path after reading the documentation} +\Msg{* in mkaddr.dtx and experimenting with the script to see} +\Msg{* if you find it useful.} +\Msg{*}\fi}\relax +\Msg{***********************************************************} diff --git a/Master/texmf-dist/source/latex/calendar/autofilo.dtx b/Master/texmf-dist/source/latex/calendar/autofilo.dtx new file mode 100644 index 00000000000..34151b19e02 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/autofilo.dtx @@ -0,0 +1,642 @@ +%\iffalse +% +% file: autofilo.dtx +% Copyright (C) 1997 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 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. +% +%\fi +% +% \def\fileversion{3.1.1.1} +% \def\filedate{1998/01/17 18:13:42} +% +% \iffalse +% +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{autofilo.dtx} +\end{document} +%</driver> +%\fi +% +%\iffalse +% Source tree moved under RCS +% --------------------------- +% autofilo.dtx,v +% Revision 3.1.1.1 1998/01/17 18:13:42 root +% Release code, checksum verified +% +% Revision 3.1 1998/01/17 16:56:58 root +% Release code +% +% Revision 2.8 1998/01/16 11:52:55 root +% *** empty log message *** +% +% Revision 2.7 1998/01/15 10:45:24 root +% Filofax page now comes out centered on the physical page. +% Just fold the thing in half and cut. +% +% Revision 2.6 1997/12/05 17:01:48 root +% Added zero width vrule to force left-hand cut rule to right +% position even when jawline has no width. +% +% Revision 2.5 1997/12/05 13:47:40 root +% Fixed quandary of overlapping revisions. +% +% Revision 2.4 1997/12/05 12:14:08 root +% Fixed missing brace in af@circle, and added RequirePackage +% for keyval parser. +% Revision 2.2.1.5 1997/11/26 11:07:51 bennett +% Final change to documentation. +% +% Revision 2.2.1.4 1997/11/07 16:27:06 root +% Fixed checksum, added some documentation for the jawmarks +% code. +% +% Revision 2.2.1.3 1997/11/07 16:15:14 root +% Final fixes to jawmark code, maybe. +% +% Revision 2.2.1.2 1997/11/07 16:10:59 root +% Patched up code for jaw marks. +% +% Revision 2.2.1.1 1997/11/07 14:57:37 root +% Trial code for jaw marks. +% +% Revision 2.4 1997/12/05 12:14:08 root +% Fixed missing brace in af@circle, and added RequirePackage +% for keyval parser. +% +% Revision 2.3 1997/11/07 14:52:50 root +% Added trial code for jaw marks. +% +% Revision 2.2 1997/11/07 10:44:05 root +% Release code. +% +% Revision 2.1.1.1 1997/11/04 05:06:07 root +% Development branch +% +% Revision 2.1 1997/11/01 15:17:06 bennett +% Release code. +% +% Revision 1.2 1997/10/29 20:03:07 bennett +% *** empty log message *** +% +% Revision 1.1 1997/10/29 08:17:52 root +% Initial revision +% +%\fi +% +% \title{User's Guide to the \texttt{autofilo} +% package\thanks{This file is version number +% \fileversion{}. It was last revised on +% \filedate{}.}} +% +% \author{Frank G. Bennett, Jr.} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \begin{abstract} +% \noindent This package provides an environment +% within which pages are framed with cut lines and +% printed with punch-marks, so that printed text can +% easily be inserted into a filofax or binder. +% \end{abstract} +% +% \CheckSum{692} +% +% \section{About the Style} +% +% This style provides a rough solution to the design +% problem it addresses, but it does work. Pages are +% always printed in landscape, rotated using the "lscape" +% package from the "graphics" bundle, and centered on the +% physical paper.\footnote{As a technical note, the frame itself +% is not rotated, because it is inserted independently of +% the output boxes controlled by the \LaTeX{} output routine. +% The output modes (two-column, +% and a hacked-together four-column mode) have +% been modified to understand blocks of text as \cs{hbox}es +% to be laid atop one another, rather than as \cs{vbox}es +% to be set alongside one another.} It accepts two options, +% "twocolumn" (the default) and "fourcolumn". +% +% The style provides an environment called "autofilo". +% Most often, users of this package will be style +% authors who want to incorporate it into other +% environments that do more specific things. Because +% "autofilo" accepts several "keyval"-style parameters, +% style authors may have a use for documentation for those +% optional parameters. So here is some sample documentation: +% +% \begin{description} +% \item[\texttt{punchcluster}] Most filofaxes have two or +% or more clusters or groups of punches to hold the +% pages in place. This option sets the number of punches +% in each cluster. The default is three. +% \item[\texttt{intraspace}] This governs the space +% between punchouts within a group. The default is +% 19.25mm. +% \item[\texttt{punchgroups}] This option sets the number +% of groups of punches. The default is two groups. +% \item[\texttt{interspace}] This option sets the +% distance between the groups of punches. The default +% is 51.25mm. +% \item[\texttt{pageheight}] This fixes the height +% of a filofax page (not the physical paper on +% which it is printed). The default is 172mm. +% \item[\texttt{pagewidth}] This fixes the width of an individual +% page. The physical printed area will be twice this figure. +% The default is 95mm, for a 190mm printed area. +% \item[\texttt{grip}] This adjusts the distance from the +% edge of the page to the outer edge of the punchouts. +% Defaults to 5mm. +% \item[\texttt{punchmargin}] This adjusts the distance from the +% edge of the text to the inner edge of the punchouts. +% Defaults to 2mm. +% \item[\texttt{punchsize}] Size, in points, of punchouts. +% Defaults to 15. +% \item[\texttt{topspace}] Gap between top of filofax page +% and top of text page. +% \item[\texttt{bottomspace}] Gap between bottom of filofax page +% and bottom of text page. +% \item[\texttt{jawspread}] If set to a positive length, this places a set +% of rules the width of the punchmarks on either side of each +% punchhole, centered on its center and spread the distance specified. +% This can be useful as a guide with some one-hole punches that are +% designed to be used ``blind''. +% \item[\texttt{jawline}] Sets the width of the lines used to make +% jawmarks. The default value is \texttt{0.4pt}. +% \end{description} +% +% \StopEventually{\PrintIndex} +% +% \section{The Class File} +% +% \begin{macrocode} +%<*style> +\NeedsTeXFormat{LaTeX2e}[1995/06/01] +\ProvidesPackage{autofilo} + [1997/12/05 12:14:08 2.4 Filofax page outlines (Frank Bennett)] +% \end{macrocode} +% We need a boolean to process our sole option. +% \begin{macrocode} +\newif\if@usequadruplecolumn +% \end{macrocode} +% We provide four columns as an option. Two columns (one for +% each side of what will be the filofax page) will be the +% default. +% \begin{macrocode} +\DeclareOption{fourcolumn}{\@usequadruplecolumntrue} +% \end{macrocode} +% Process the option if present, and load a supporting package. +% \begin{macrocode} +\ProcessOptions +\RequirePackage{lscape} +\RequirePackage{keyval} +% \end{macrocode} +% Declare some variables. +% \begin{macrocode} +\newif\if@quadruplecolumn +\newbox\@leftleftcolumn +\newbox\@leftrightcolumn +\newbox\@rightleftcolumn +\newbox\@rightrightcolumn +\newcount\af@punchcluster +\newcount\af@punchgroups +\newlength\af@interspace +\newlength\af@intraspace +\newlength\af@grip +\newlength\af@punchmargin +\newcount\af@punchsize +\newlength\af@punchwidth +\newlength\af@halfpunchwidth +\newcount\af@subtempcount +\newcount\af@tempcount +\newlength\af@textwidth +\newlength\af@marginrel +\newlength\af@halftextwidth +\newlength\af@textheight +\newlength\af@topmargin +\newlength\af@bottommargin +\newcount\col@no +\newlength\af@jawspread +\newlength\af@halfjawspread +\newlength\af@jawline +% \end{macrocode} +% We'll need a macro to turn on the four-column mode. +% This is just a modified version of \cs{twocolumn} in +% the \LaTeX{} distribution. +% \begin{macrocode} +\def\quadruplecolumn{% + \clearpage + \global\columnwidth\textwidth + \global\advance\columnwidth-3\columnsep + \global\divide\columnwidth by4\relax + \global\hsize\columnwidth + \global\linewidth\columnwidth + \global\@twocolumntrue + \global\@quadruplecolumntrue + \global\@firstcolumntrue + \col@number=4\relax} +% \end{macrocode} +% Catch the output routine when the new mode is in effect. +% \begin{macrocode} +\def \@opcol {% + \if@twocolumn + \if@quadruplecolumn + \@outputqdrplcol + \else + \@outputdblcol + \fi + \else + \@outputpage + \fi + \global \@mparbottom \z@ \global \@textfloatsheight \z@ + \@floatplacement} +% \end{macrocode} +% Add a new output routine for the new mode, and a modified +% version of the two-column output routine. Note that these +% work \textit{only} inside the \texttt{landscape} environment. +% \begin{macrocode} +\def\@outputqdrplcol{% + \ifcase\col@no + \global\@firstcolumnfalse + \global \setbox\@leftleftcolumn \box\@outputbox + \or + \global \setbox\@leftrightcolumn \box\@outputbox + \or + \global \setbox\@rightleftcolumn \box\@outputbox + \or + \global \@firstcolumntrue + \global\setbox\@rightrightcolumn\box\@outputbox + \setbox\@outputbox \vbox to\textwidth{% + \hb@xt@\textheight {% + \vrule height\columnwidth depth0pt width0pt + \box\@rightrightcolumn \hss}% + \vfill + \hrule \@width\columnseprule + \vfill + \hb@xt@\textheight {% + \vrule height\columnwidth depth0pt width0pt + \box\@rightleftcolumn \hss}% + \vfill + \hrule \@width\columnseprule + \vfill + \hb@xt@\textheight {% + \vrule height\columnwidth depth0pt width0pt + \box\@leftrightcolumn \hss}% + \vfill + \hrule \@width\columnseprule + \vfill + \hb@xt@\textheight {% + \box\@leftleftcolumn \hss}% + }% + \@combinedblfloats + \@outputpage + \begingroup + \@dblfloatplacement + \@startdblcolumn + \@whilesw\if@fcolmade \fi + {\@outputpage + \@startdblcolumn}% + \endgroup + \fi + \global\advance\col@no by1\relax + \ifnum\col@no=4\relax\global\col@no=0\fi} +\def\@outputdblcol{% + \if@firstcolumn + \global \@firstcolumnfalse + \global \setbox\@leftcolumn \box\@outputbox + \else + \global \@firstcolumntrue + \setbox\@outputbox \vbox to\textwidth{% + \hbox to\textheight{% + \box\@outputbox}% + \vfil + \hrule \@width\columnseprule + \vfil + \hbox to\textheight{% + \box\@leftcolumn}}% + \@combinedblfloats + \@outputpage + \begingroup + \@dblfloatplacement + \@startdblcolumn + \@whilesw\if@fcolmade \fi + {\@outputpage + \@startdblcolumn}% + \endgroup + \fi +} +% \end{macrocode} +% We use circles to make punchmarks. +% When making circles, \TeX{} will put the center of the +% circle at point, but consume horizontal space equal +% to the full diameter of the circle. To compensate, +% we need to skip forward by radius, and back again +% after laying each circle. +% \begin{macrocode} +\def\af@circle{\hbox{\hskip\af@halfpunchwidth% + \ifnum\af@jawspread>0\relax% + \hskip-\af@halfjawspread% + \hskip-\af@jawline% + \vrule depth\af@halfpunchwidth% + height\af@halfpunchwidth% + width\af@jawline% + \hskip\af@halfjawspread% + \else% + \vrule depth\af@halfpunchwidth% + height\af@halfpunchwidth% + width0pt% + \fi% + \circle{\af@punchsize}% + \hskip-\af@punchwidth% + \ifnum\af@jawspread>0\relax% + \hskip\af@halfjawspread% + \vrule depth\af@halfpunchwidth% + height\af@halfpunchwidth + width\af@jawline% + \hskip-\af@halfjawspread% + \hskip-\af@jawline% + \fi% + \hskip-\af@halfpunchwidth}} +% \end{macrocode} +% We define a looping command that lays down a cluster +% of circles. Grouping allows this loop to be nested +% in another. +% \begin{macrocode} +\def\af@group{% + \bgroup% + \af@tempcount=0% + \af@circle% + \loop\advance\af@tempcount by1\relax% + \ifnum\af@tempcount<\af@punchcluster% + \hskip\af@intraspace\relax\af@circle% + \repeat% + \egroup} +% \end{macrocode} +% We define a command that lays down a set of clusters +% (groups). +% \begin{macrocode} +\def\af@circles{% + \af@tempcount=0\relax% + \af@group% + \loop\advance\af@tempcount by1\relax% + \ifnum\af@tempcount<\af@punchgroups% + \hskip\af@interspace\relax\af@group% + \repeat% + \af@tempcount=0} +% \end{macrocode} +% The following command creates a set of punchmarks. +% \begin{macrocode} +\def\af@punches{% + \hbox to\af@textheight{\hfil\af@circles\hskip\af@halfpunchwidth\relax\hfil}} +% \end{macrocode} +% The following creates a frame. The model was lifted from the "geometry" +% package. +% \begin{macrocode} +\def\@@@innerframe{% + \moveright-\af@topmargin% + \vbox to 0pt{% + \vskip\topmargin% + \vbox to0pt{\hrule width\af@textheight\vss}% + \hbox to\af@textheight{\llap{\vrule height\af@textwidth}% + \hfil\vrule height\af@textwidth}% + \vskip-\af@halftextwidth% + \vbox to0pt{\hrule width\af@textheight\vss}% + \vskip-\af@halftextwidth% + \vskip\af@grip% + \nointerlineskip\af@punches\nointerlineskip% + \vskip-\af@punchwidth% + \vskip-\af@grip% + \vskip\af@textwidth% + \vskip-\af@punchwidth% + \vskip-\af@grip% + \nointerlineskip\af@punches\nointerlineskip% + \vskip\af@grip% + \vbox to0pt{\hrule width\af@textheight\vss}% + \vss}}% +% \end{macrocode} +% A further modification of the output routine, +% this time to put the frame in place. This, too, is +% lifted from "geometry". It has been modified only +% slightly, but we drop \LaTeX 2.09 support altogether. +% \begin{macrocode} +\newif\if@latextwoe +\@ifundefined{if@compatibility}{\@latextwoefalse}{\@latextwoetrue} +\if@latextwoe +\def\@outputpage{% +\begingroup % the \endgroup is put in by \aftergroup + \let \protect \noexpand + \@resetactivechars + \let\-\@dischyph + \let\'\@acci\let\`\@accii\let\=\@acciii + \let\\\@normalcr + \let\par\@@par %% 15 Sep 87 + \shipout \vbox{% + \set@typeset@protect + \aftergroup \endgroup + \aftergroup \set@typeset@protect + \if@specialpage + \global\@specialpagefalse\@nameuse{ps@\@specialstyle}% + \fi + \if@twoside + \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot + \let\@themargin\oddsidemargin + \else \let\@thehead\@evenhead + \let\@thefoot\@evenfoot \let\@themargin\evensidemargin + \fi + \fi + \reset@font + \normalsize + \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@ + \@begindvi + \moveright\@themargin %<<<<<<<<<<<<<<<<<<<<< added + \vtop{\@@@innerframe %<<<<<<<<<<<<<<<<<<<<< added + \vskip \topmargin + \vskip \af@marginrel +% \moveright\@themargin \vbox OPENBRACE %<<<<<<<<<<<< original + \moveright\af@topmargin% <<<<<<<<<<<< Bennett + \vbox{% %<<<<<<<<<<<<<<<<<<<<< modified + \setbox\@tempboxa \vbox to\headheight{% + \vfil + \color@hbox + \normalcolor + \hb@xt@\textwidth {% + \let \label \@gobble + \let \index \@gobble + \let \glossary \@gobble %% 21 Jun 91 + \@thehead + }% + \color@endbox + }% %% 22 Feb 87 + \dp\@tempboxa \z@ + \box\@tempboxa + \vskip \headsep + \box\@outputbox + \baselineskip \footskip + \color@hbox + \normalcolor + \hb@xt@\textwidth{% + \let \label \@gobble + \let \index \@gobble %% 22 Feb 87 + \let \glossary \@gobble %% 21 Jun 91 + \@thefoot + }% + \color@endbox + }}%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< One more close bracket added + }% +\global \@colht \textheight +\stepcounter{page}% +\let\firstmark\botmark +} +\else +\message{Sorry, autofilo.sty works only with LaTeX2e} +\fi +% \end{macrocode} +% Set some global parameters. +% \begin{macrocode} +\headheight=0pt +\headsep=0pt +\footskip=0pt +\marginparwidth=0pt +\marginparsep=0pt +\pagestyle{empty} +\parindent=0pt +\raggedbottom +\columnseprule=0.0pt% +\raggedright +% \end{macrocode} +% Some option definitions. +% \begin{macrocode} +\define@key{opt}{pageheight}{% + \af@textheight=#1\relax} +\define@key{opt}{pagewidth}{% + \af@halftextwidth=#1\relax} +\define@key{opt}{columnsep}{% + \columnsep=#1\relax} +\define@key{opt}{punchcluster}{% + \af@punchcluster=#1} +\define@key{opt}{punchgroups}{% + \af@punchgroups=#1} +\define@key{opt}{interspace}{% + \af@interspace=#1} +\define@key{opt}{intraspace}{% + \af@intraspace=#1} +\define@key{opt}{grip}{% + \af@grip=#1} +\define@key{opt}{punchmargin}{% + \af@punchmargin=#1} +\define@key{opt}{punchpoints}{% + \af@punchsize=#1} +\define@key{opt}{topspace}{% + \af@topmargin=#1} +\define@key{opt}{bottomspace}{% + \af@bottommargin=#1} +\define@key{opt}{jawspread}{% + \af@jawspread=#1} +\define@key{opt}{jawline}{% + \af@jawline=#1} +% \end{macrocode} +% The default values for the options. +% \begin{macrocode} +\af@textheight=172mm +\af@halftextwidth=95mm +\columnsep=14pt +\af@punchcluster=3 +\af@punchgroups=2 +\af@interspace=51.25mm +\af@intraspace=19.25mm +\af@grip=5mm +\af@punchmargin=2mm +\af@punchsize=15 +\af@topmargin=2pt +\af@bottommargin=0pt\relax +\af@jawline=0.4pt% +% \end{macrocode} +% The remaining dimensions must be calculated inside +% the landscape environment. We define that now. +% \begin{macrocode} +\def\autofilo#1{% + \setkeys{opt}{#1}% + \oddsidemargin=-1in\relax% + \af@textwidth\paperwidth% + \advance\af@textwidth by-\af@textheight% + \divide\af@textwidth by2\relax% + \advance\oddsidemargin by\af@textwidth% + \evensidemargin=-1in\relax% + \advance\evensidemargin by\af@textwidth% + \topmargin=-1in\relax% + \af@textwidth\paperheight% + \advance\af@textwidth by-\af@halftextwidth% + \advance\af@textwidth by-\af@halftextwidth% + \divide\af@textwidth by2\relax% + \advance\topmargin by\af@textwidth\relax% + \landscape% + \af@halfjawspread\af@jawspread% + \divide\af@halfjawspread by2\relax% + \af@punchwidth=\af@punchsize pt% + \af@halfpunchwidth\af@punchwidth% + \divide\af@halfpunchwidth by2% + \textheight\af@textheight% + \advance\textheight by-\af@topmargin% + \advance\textheight by-\af@bottommargin% + \af@textwidth\af@halftextwidth% + \multiply\af@textwidth by2\relax% + \textwidth=\af@textwidth% + \advance\textwidth by-2\af@punchwidth% + \advance\textwidth by-2\af@grip% + \advance\textwidth by-2\af@punchmargin% + \af@marginrel\af@grip% + \advance\af@marginrel by\af@punchmargin% + \advance\af@marginrel by\af@punchwidth% + \vsize\textheight% + \hsize\textwidth% + \@colroom\vsize% + \@colht\vsize% + \if@usequadruplecolumn% + \quadruplecolumn% + \else% + \twocolumn% + \fi} +% \end{macrocode} +% The end of the environment is a simple thing. +% \begin{macrocode} +\def\endautofilo{% + \endlandscape} +%</style> +% \end{macrocode} +% \Finale \PrintChanges + + + + + diff --git a/Master/texmf-dist/source/latex/calendar/bigdemo.tgz b/Master/texmf-dist/source/latex/calendar/bigdemo.tgz Binary files differnew file mode 100644 index 00000000000..4f130a83493 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/bigdemo.tgz diff --git a/Master/texmf-dist/source/latex/calendar/caldemos.dtx b/Master/texmf-dist/source/latex/calendar/caldemos.dtx new file mode 100644 index 00000000000..6947f02f599 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/caldemos.dtx @@ -0,0 +1,212 @@ +%\iffalse +% +% file: demos.dtx +% 1996-1997 by Frank Bennett. All rights reserved. +% +% Unlike the rest of the files in this package, these files +% can be freely modified in any way you like. +% +%\fi +% +% \iffalse +% +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{caldemos.dtx} +\end{document} +%</driver> +%\fi +% +% \setcounter{StandardModuleDepth}{1} +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \CheckSum{70} +% +%\iffalse +% Source tree moved under RCS +% --------------------------- +% caldemos.dtx,v +% Revision 2.4 1998/01/16 21:23:26 root +% *** empty log message *** +% +% Revision 2.3 1997/11/26 11:14:51 bennett +% *** empty log message *** +% +% Revision 2.2 1997/11/07 10:44:05 root +% Release code. +% +% Revision 2.1.1.3 1997/11/06 09:36:41 root +% Eliminated list inclusions from demoyrly.texx +% +% Revision 2.1.1.2 1997/11/04 14:47:18 root +% Fixed pinpoint dates in "every other" demo (if I remember this +% one correctly). +% +% Revision 2.1.1.1 1997/11/04 05:06:07 root +% Development branch +% +% Revision 2.1 1997/11/01 15:15:52 bennett +% Release code. +% +% Revision 1.2 1997/10/29 20:05:06 bennett +% *** empty log message *** +% +% Revision 1.1 1997/10/29 08:17:52 root +% Initial revision +% +%\fi +% +% \StopEventually{\PrintIndex} +% +% \begin{macrocode} +%<*evntlist> +\documentclass{article} +\usepackage{evntlist} +\begin{document} +\begin{eventlist} + {} + {demolist,demoaptr,demoevtr} + january 1 1997 to january 3 1997 +\end{eventlist} +\end{document} +%</evntlist> +%<*hlist> +\documentclass{article} +\usepackage{hlist} +\begin{document} +\begin{htmllist} + {outputfile=demohlst.htm} + {demolist,demoaptr,demoevtr} + january 1 1997 to january 3 1997 +\end{htmllist} +\end{document} +%</hlist> +%<*hmonth> +\documentclass{article} +\usepackage{hmonth} +\begin{document} +\begin{htmlmonth} + {outputfile=demohmth.htm} + {demolist,demoaptr,demoevtr} + january 1997 +\end{htmlmonth} +\end{document} +%</hmonth> +%<*hml> +\documentclass{article} +\usepackage{hml} +\begin{document} +\begin{htmlmonthlist} + {outputfile=demohml.htm} + {demolist,demoaptr,demoevtr} + january 1997 +\end{htmlmonthlist} +\end{document} +%</hml> +%<*monthly> +\documentclass[a4paper]{article} +\usepackage{monthly} +\usepackage{margins} +\usepackage{lscape} +% \usepackage{color} +\parindent=0pt +\begin{document} +\margins{1.5cm} +\begin{landscape} +\begin{monthly} + {} + {demolist,demoaptr,demoevtr} + january 1997 +\end{monthly} +\end{landscape} +\end{document} +%</monthly> +%<*timesht> +\documentclass[a4paper]{article} +% \usepackage{color} +\usepackage{timesht} +\usepackage{margins} +\begin{document} +\margins{1.5cm} +\begin{timesheet} + {leftright=3/5} + {demolist,demoaptr,demoevtr} + january 1 1997 to january 3 1997 +\end{timesheet} +\end{document} +%</timesht> +%<*timetabl> +\documentclass[a4paper]{article} +\usepackage{timetabl} +% \usepackage{color} +\usepackage{margins} +\begin{document} +\margins{1.5cm} +\begin{timetable} + {title=Our Amazing Eclectic Conference} + {demolist,demoaptr,demoevtr} + january 1 1997 to january 3 1997 +\end{timetable} +\end{document} +%</timetabl> +%<*weekly> +\documentclass[a4paper]{weekly} +% \usepackage{color} +\begin{document} +\begin{weekly} + {} + {demolist,demoaptr,demoevtr} + january 1 1997 to january 3 1997 +\end{weekly} +\end{document} +%</weekly> +%<*yearly> +\documentclass[a4paper]{article} +\usepackage{yearly} +% \usepackage{color} +\parindent=0pt\relax +\begin{document} +\begin{yearly} + {} + {} + 1997 +\end{yearly} +\end{document} +%</yearly> +%<*1997> +January 1 1997 to December 31 1997 {The year 1997} +%</1997> +%<*appts> +jan 1 1997 16:00 {Nancy} [Call Nancy to confirm] +jan 1 1997 18:00-20:00 {Dinner} [New Year Dinner] +%</appts> +%<*apptsr> +range demo1997 {Current year} +every Monday 14:00-16:00 {Monday meeting} +every other Wednesday from 1 January 1997 10:00 {Wednesday call} +every 3 10:00-13:00 {Koffee klatch} +every first Tuesday 13:00-15:00 {Study group} +%</apptsr> +%<*demolist> +list demoevt {A separate list of events} +list demoapt {A separate list of appointments} +%</demolist> +%<*events> +jan 1 1997 {New Year} [New Year's Day] +%</events> +%<*eventsr> +range demo1997 +every Monday {Monday event} +every other friday from 10 january 1997 {Alternate Monday} +every 3 {Third of month} +every first Tuesday {First Tuesday} +%</eventsr> +% \end{macrocode} +% \Finale \PrintChanges + + diff --git a/Master/texmf-dist/source/latex/calendar/calendar.dtx b/Master/texmf-dist/source/latex/calendar/calendar.dtx new file mode 100644 index 00000000000..827b8752f1b --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/calendar.dtx @@ -0,0 +1,1975 @@ +%\iffalse +% +% File calendar.dtx +% Copyright (C) 1996, 1997 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(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 Calendar a more powerful, +% friendlier, and altogether more thrilling package, please contact me on +% fb@soas.ac.uk +% +%<*dtx> + \ProvidesFile{calendar.dtx} +%</dtx> +%<style>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<style>\ProvidesPackage{calendar} +%<style> [1998/01/17 18:14:52 3.1.1.1 Calendar engine (Frank Bennett)] +% \fi +% +% \def\fileversion{3.1.1.1} +% \def\filedate{1998/01/17 18:14:52} +% +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +%\usepackage[dvips]{color} +%\CodelineIndex +%\EnableCrossrefs +%\RecordChanges +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{calendar.dtx} +\end{document} +%</driver> +% \fi +% +% \changes{v0.01}{1996/11/10}{Initial Version} +% \changes{v0.02}{1996/11/11}{Replaced \TeX{} newcount with \LaTeXe{} +% newcounter, and changed counters accordingly.} +% \changes{v0.02}{1996/11/11} +% {Incorporated higher maths functions into an option declaration +% in the main file (was loaded from a separate file in original +% \TeX{} version.)} +% \changes{v0.03}{1996/11/12}{Complete re-draft of recursing routines, +% with documentation.} +% \changes{v0.03}{1996/11/12}{Drafting of the sort engine.} +% \changes{v0.03}{1996/11/12}{Picked up some more counters that +% hadn't been converted to \LaTeXe format.} +% \changes{v0.03}{1996/11/12}{Wholesale cutting of old recursing +% and formatting routines. The package is now a background engine; +% it knows nothing about printing anymore.} +% \changes{v0.04}{1996/11/17}{Introduction of parsing routines +% and reorganization of entire package.} +% \changes{v0.05}{1996/11/25}{Completed new parsing routines and finished +% debugging of same.} +% \changes{v0.05}{1996/11/25}{Completed sorting routines and finished +% debugging of same.} +% \changes{v0.06}{1996/11/27}{Added support for indicating a range of +% dates in an input file, and for declaring recursive entries.} +% \changes{v0.07}{1996/11/27}{Minor alterations to make the package +% work for the timesheets demo. Another alpha release.} +% \changes{v0.08}{1996/11/27}{No changes to this file; but the +% README shipped to CTAN was for Nelson Beebe's makeindex. Ah, +% the wonders of automation...} +% \changes{v0.09}{1996/11/29}{Added maths routines for weekly +% and monthly recursion. Nearly finished!} +% \changes{v0.10}{1996/11/29}{Various bug fixes.} +% \changes{v0.10}{1996/11/29}{Added routines for handling comments +% in CLD files. Added demonstration files and comments thereto.} +% \changes{v0.11}{1996/12/04}{Enhanced input and parsing routine. +% Now handles entries across multiple lines, even with par, and does +% not make characters active outside of the parsed text.} +% \changes{v0.11}{1996/12/04}{Provided a check to prevent multiple +% input of data files. Necessary to provide support for groups +% of lists.} +% \changes{v0.11}{1996/12/06}{Further work on the initial input +% code, to provide for groups of lists and groups of groups. +% This portion of the code is now complete.} +% \changes{v0.11}{1996/12/07}{Code clean-up in the date parsing +% routine; the code must be reasonably transparent if it is +% to be used as a general date parsing engine in the package.} +% \changes{v0.12}{1996/12/15}{Complete redraft commenced following the +% removal of the overword and dates code to separate +% eponymous packages. Recursive interface macro completed and +% first cut of debugging done. Released with the Thumbnail demo.} +% \changes{v1.0}{1996/12/26}{Far too many changes to document here. +% Finished through to final, hopefully stable form, and packaged +% with demonstration sub-packages for CTAN release.} +% \changes{v1.11}{1997/01/07}{Moved LoadClass declaration from +% bottom of the timesht.cls file to the top, so that margin +% adjustments would not be overwritten and options would take effect.} +% \changes{v1.11}{1997/01/07}{Added newpage to group break in timesheets style +% file.} +% \changes{v1.12}{1997/01/18}{Fixed bug in the timesheets package that often caused +% one line in any *.cld entry spanning a range of times to appear in the wrong place. +% The ending, rather than the starting minutes of the range were used to calculate +% the current time position within the timesheet. Oops. This bug was reported by Miroslav Novak.} +% \changes{v1.12}{1997/01/18}{Added code to correct another infelicity pointed +% out by Miroslav Novak; the appearance of an item description line in timesheet +% boxes where the ending time of the range for the item +% is the starting time of the range in the box.} +% \changes{v1.13}{1997/01/30}{Began work on improved +% documentation. No promises that this will happen quickly\ldots} +% \changes{v1.13}{1997/02/01}{Added color package to timesheets demo file.} +% \changes{v1.13}{1997/02/01}{Added reference to need for color package +% to documentation.} +% \changes{v1.14}{1997/02/12}{Corrected an error lurking in cal@text@init +% (which turned out to be unused code --- the error cropped up when +% the code was extracted for explicit invocation in the Monthly style) +% that swallowed all event text when color was not in force, and gave +% rise to a fatal error otherwise. Oops.} +% \changes{v1.14}{1997/02/16}{Caught initialization of blank (but +% non-empty) entries in \texttt{cal@print@format}.} +% \changes{v1.14}{1997/02/20}{Cut subpackages from this file; +% too many packages now to for this to be manageable.} +% \changes{v1.14}{1997/02/21}{Eliminated erroneous use of +% cal@read for inputting *.eve files.} +% \changes{v1.14}{1997/02/21}{Eliminated extraneous argument +% to PackageWarning.} +% \changes{v1.14}{1997/02/21}{Added comment chars to the end +% of exported *.eve file event entries.} +% \changes{v1.14}{1997/02/21}{Added initalization of exception +% list and cal@append instruction to load events drawn from +% an *.eve file into memory. We now have phases of the moon.} +% \changes{v1.14}{1997/02/21}{Not a change, but a note of a bug. +% A function such as moon.cld should be allowed to dynamically +% change a function, and have the change register in the +% theshorttext or thelongtext macros as the function recurses. +% But the moon.cld phases only change on export, not during +% the first run.} +% \changes{v1.14}{1997/02/22}{Added cal@dates@base and the +% \texttt{z} incrementing option. This gives us vertical +% date columns without much work. For use in a conference +% style package for Miroslav Novak.} +% \changes{v1.14}{1997/02/23}{Added quick but very ugly +% patch to allow non-printing text to be dropped on DVI +% at the beginning of a subgroup.} +% \changes{v1.14}{1997/03/01}{Made a number of variable assignments +% global to prevent buildup in \TeX{}'s save space. Job +% is not finished, but reliability has improved.} +% \changes{v1.14}{1997/03/01}{Merged a large number of changes +% into this ".dtx" file from the "*.sty" file.} +% \changes{v1.14}{1997/03/01}{Cut superfluous documentation +% from this file, and edited the remainder.} +% \changes{v1.15}{1997/03/08}{Fixed bug in \texttt{cal@@@print@items} +% that suppressed entries for a single time falling at the top +% of a selected range of times.} +% \changes{v1.16}{1997/05/19}{Minor changes to pass through language +% options to the \texttt{dates} package.} +% \changes{v1.17}{1997/10/18}{New public release of all styles +% and modules incorporating global bug-fixes.} +% \changes{v1.18}{1997/10/25}{Eliminated need for bogus entries +% to protect against reads past end of file. } +% \changes{v1.19}{1997/10/26}{One more cross-nesting, of \cs{cal@offset}, +% tracked down and eliminated.} +%\iffalse +% Source tree moved under RCS +% --------------------------- +% calendar.dtx,v +% Revision 3.1.1.1 1998/01/17 18:14:52 root +% Release code, checksum verified +% +% Revision 3.1 1998/01/17 16:59:04 root +% Release code +% +% Revision 2.2 1997/11/07 10:44:05 root +% Release code. +% +% Revision 2.1.1.2 1997/11/05 12:38:40 root +% Changed RAN to rAN. +% +% Revision 2.1.1.1 1997/11/04 05:06:07 root +% Development branch +% +% Revision 2.1 1997/11/01 15:14:56 bennett +% Release code. +% +% Revision 1.10 1997/11/01 14:28:10 root +% Eliminated \enditall's from the package. +% +% Revision 1.9 1997/11/01 12:56:27 root +% Added assignment to new counter \dates@range@limit. +% +% Revision 1.8 1997/10/31 21:56:23 root +% Added hardwired \dates@requiremonthtrue immediately before +% \cal@input. +% +% Revision 1.7 1997/10/29 20:06:34 bennett +% *** empty log message *** +% +% Revision 1.6 1997/10/29 17:21:40 root +% Further change affecting subgroup breaks? +% +% Revision 1.5 1997/10/29 16:52:21 root +% Moved use of subgroup@setup to the right location (oops). +% +% Revision 1.4 1997/10/29 16:39:42 root +% Added subgroup@setup to begin@subgroup, to guard against +% starting the second and later pages of a timesheet with +% the last time from the previous page. Thanks to Edward +% Czilli for reporting this bug. +% +% Revision 1.3 1997/10/29 13:47:57 root +% Restored date checking after discovering that it works +% correctly if files are extracted from RCS using the -kv +% option. +% +% Revision 1.2 1997/10/29 11:47:37 root +% Eliminated optional date specification from RequirePackage{dates} +% +% Revision 1.1 1997/10/29 08:17:52 root +% Initial revision +% +%\fi +% +% +% \title{Designer's Guide to the Calendar +% package\thanks{This file is version number +% \fileversion{}. It was last revised on +% \filedate.}} +% +% \author{Frank G. Bennett, Jr.} +% +% \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 tools for creating +% customized calendars using \LaTeXe. +% \end{abstract} +% +% +% \CheckSum{1460} +% +% \section{Overview and Exhortation} +% +% Think of this package as the Music Minus One +% of the scheduling trade. It provides a standard +% interface for drafting calendars, +% but leaves you in control of the style and +% content of the finished product. +% The calendar style generator included +% in this package can be +% used to create simple lists of events, as well +% as daily, weekly, monthly and yearly calendars in a variety of +% formats. Calendars can be ground into DVI, +% or can be exported in an arbitrary list or table formatting +% language such as HTML, or delimited +% ASCII text. +% While the format of calendars is +% pretty much up to you, all calendars created +% using the Calendar package inherit a number of +% useful features, among which are: +% +% \begin{itemize} +% \item Access to external lists of events +% and appointments written in a user-friendly syntax. +% \item Selective printing of long or short descriptions of +% events and appointments according to the list +% from which they originate or, in the case of appointments, +% according to their starting time. +% \item Built-in recursive entries such as "every" "monday" +% or "Every" "second" "Wednesday", governed by a range. +% \item An extensible interface within list files +% for defining calculable dates within a range +% by reference to a mathematical formula. +% \item ``Stopping'' of recursive entries by reference +% to a list of holidays. +% \item Colour-coding of lists and groups of lists +% for the readable presentation of complex schedules. +% Colours may be associated with individual lists, +% or with entire groups of lists. +% \end{itemize} +% +% On top of this, all calendar styles have a uniform +% user interface. For examples, please see the +% files included in the "styles" subdirectory +% in or near the filespace from which you retrieved +% this file. +% +% Finally, the Calendar package has the virtue of +% being chilled, if not yet completely frozen. +% While there will doubtless +% be minor bug fixes and enhancements in future +% releases, this package is intended to be a finished +% and stable platform on which to build calendar +% styles. It will not move out from underneath +% your work. And if you draft a calendar style +% and publish it on CTAN, others will be able to +% put it straight to work on their own local lists +% of events. +% +% ************ +% The documentation to this package explains how +% to define your own calendar formats. There are many +% possibilities, but here are a few ideas: +% +% \begin{itemize} +% \item Web maintainers +% can provide a current view of upcoming events formatted +% with a tabular calendar at the top, the dates of +% which are linked to events for that day. +% \item Filofax +% calendars can be produced which contain institutional +% data and personal appointments on a per-user basis. +% \item Scheduling conflicts or common free times can be identified by producing +% concordance calendars that lay the daily schedules +% of several members of staff alongside one another. +% \item Timesheets with pre-printed diary entries can be +% produced. +% \item Consolidated academic timetables can be +% produced. +% \item To simplify the maintenance of lists, a +% Web site may want to produce a forms interface +% for the distributed creation and management of lists. This +% task is greatly simplified by the fact that the +% syntax for entries is flexible and human-readable. +% \item Users at a Web site can be given direct control over +% calendar content, by running \LaTeX{} and "dvips" from a +% CGI behind a click-box and radio-button interface. +% \end{itemize} +% +% All of these applications can be supported directly +% by the package as it stands. All that is required +% is to define appropriate calendar formats. +% Classes and packages +% that define new calendar formats contain only the +% essential commands which define their structure. +% +% The source of the Calendar package and related +% files is located in +% the CTAN archives under: +% +% \begin{quote} +% "macros/latex/contrib/supported/calendar" +% \end{quote} +% +% If you design a new calendar format, please upload +% it to the CTAN "/incoming" directory at "ftp.tex.ac.uk" +% and send the site maintainers a note (see the file +% "README.uploads" for their contact details) asking +% them to place it in the "styles" subdirectory +% of the Calendar package filespace. It is best +% to send your calendar format as a "*.dtx" file, with +% documentation on how to use it (see the existing +% packages for model documentation). +% If you design a CGI or other front-end +% that calls on a style or manages +% database entries, please send that as well, for placement +% in the "tools" subdirectory. That way, anyone interested in +% using Calendar will find everything that is available in one +% place, and the utility of the package will be greatly +% enhanced. +% +% I do not have time at present to write a +% readable and well-presented guide to the style +% drafting process. If you want to draft +% your own style, your best bet is to read +% through the commentary and code of an +% existing calendar style, and modify it +% to suit your needs. +% Feel free to write me +% on "fb@soas.ac.uk" if you have any questions +% or comments. +% +%\StopEventually{\PrintIndex} +% +% \section{The Macros} +% +% The Dates and Keyval packages will be used. +% +% \begin{macrocode} +%<*style> +\DeclareOption{english}{\PassOptionsToPackage{\CurrentOption}{dates}} +\DeclareOption{german}{\PassOptionsToPackage{\CurrentOption}{dates}} +\ProcessOptions +\RequirePackage{dates}[1997/10/29] +\RequirePackage{keyval} +% \end{macrocode} +% +% \subsection{The Calendar Formatter} +% +% \begin{macro}{\newcalendar} +% \begin{macro}{\@newcalendar} +% +% This is the business end of the package. The +% calendar-defining front end is spread across +% two macros to allow us to use more than +% nine arguments. The second through ninth given +% to the first macro are stored in a macro that +% is expanded in the second. +% +% (the macro defined just above newcalendar is used +% to parse the increment field) +% +% \begin{macrocode} +\def\cal@parseincrement#1#2#{% + \def\cal@incr{#1}% + \def\cal@subgroup@setup{#2}}% +\long\def\newcalendar#1#2#3#4#5#6#7#8#9{% + \expandafter\def\csname cal@#1@bridge\endcsname{% + \def\cal@output{#2}% + \def\cal@first@weekday{#3}% + \def\cal@group@length{#4}% + \def\cal@subgroup@length{#5}% + \def\cal@item@sep@real{#6}% + \cal@parseincrement#7{}% + \def\cal@header{#8}% + \def\cal@footer{#9}}% + \@newcalendar{#1}} +% \end{macrocode} +% +% This defines the start and finish macros for an +% environment, which will be invoked using "\begin" +% and "\end". The head macro just expands the head +% matter, grabs its first and only argument to a +% variable for future reference, and invokes the +% "\dateread" command in order to read the date +% text entered as the content of the environment. +% The "\dateread" command will expire when it hits +% the "\end" at the bottom of the enviroment. +% +% \begin{macrocode} +\long\def\@newcalendar#1#2#3#4#5#6#7#8#9{% + \expandafter\def\csname#1\endcsname##1##2{% + #4% + \gdef\cal@optionslist{##1}% + \setkeys{opt}{##1}% + \gdef\cal@files{##2}% + \dateread{}}% +% \end{macrocode} +% +% The tail macro for the environment will start +% by setting up the starting and ending dates +% for our calendar. Step one is to set a subrange +% start and end (which "\dateread" sets if "to" is +% used in the date text) if none is found. The +% second step is to set the current date to be the +% start of the subrange derived from the date text, +% and generate human-readable register data for +% future reference. We then set the overall range for +% the calendar to the subrange dates. +% +% The next step is to expand the front matter given +% in the calendar definition, after which we expand +% the material contained in the second through ninth +% arguments given to the first macro. Then a series +% of other toggles and macros are defined. +% +% (We also set the date base, for the zigzag algorithm) +% +% \begin{macrocode} + \expandafter\def\csname end#1\endcsname{\relax% + \ifnum\dates@subrange@start=0% + \dates@subrange@start\dates@date% + \dates@subrange@end\dates@date% + \fi% + \global\dates@date\dates@subrange@start% + \caldate% + \cal@date@base\dates@date% + \cal@range@start\dates@subrange@start% + \cal@range@end\dates@subrange@end% + #5% + \dates@range@limit\cal@range@end% + \csname cal@#1@bridge\endcsname% + \def\cal@groupbreak{#2}% + \def\cal@subgroupbreak{#3}% + \long\def\cal@entry@sep{#6}% + \def\cal@item@init{#7}% + \def\cal@entry@init{#8}% + \long\def\cal@item@text{#9}% +% \end{macrocode} +% +% We catch colors if the color package is not loaded. +% +% \begin{macrocode} + \@ifundefined{color}% + {\let\textcolor\@gobble% + \let\colorbox\@gobble}% + {}% +% \end{macrocode +% +% +% We then input the content of the event files given +% as the argument to the environment, if any files exist +% for processing. +% +% \begin{macrocode} + \ifcat$\cal@files$% + \else% + \dates@requiremonthtrue% + \dates@requiredaytrue% + \expandafter\cal@input\cal@files,,\end% + \fi% +% \end{macrocode} +% +% Then we sort everything. +% +% \begin{macrocode} + \cal@sorts% +% \end{macrocode} +% +% We set the date to the bottom of the range again, +% and set the registers. +% +% \begin{macrocode} + \global\dates@date\cal@range@start% + \caldate% +% \end{macrocode} +% +% Finally, we produce the calendar text. +% +% \begin{macrocode} + \cal@top}}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{Input and Export for Event Lists} +% +% \begin{macro}{\cal@input} +% \begin{macro}{\cal@append} +% \begin{macro}{\cal@list@append} +% \begin{macro}{\cal@list@init} +% \begin{macro}{\cal@read} +% +% This is the input routine. It starts by setting +% up to loop itself. Then it checks to see if the +% list is empty, and sets up to quit if it is. +% If there is an item in the list, it first +% puts the remainder of the items onto the list for +% future reference. Then the input file is defined +% to be the first item. Then it checks to see +% if a freeze file exists. If it does, it is input, +% and the data file is ignored. The engine number +% counter is also incremented. If the file does not +% exist, we check for a list file. If one is found, +% we increment the engine counter, and turn off +% freezing --- this will be turned on in the file +% itself if a request is found there. Then we +% just input the file for scanning. We follow the +% text in the file with a meaningless entry as +% a buffer, and a command that shuts off the +% macro that gobbles up entries. +% +% \begin{macrocode} +\def\cal@check@colon#1:#2#{% + \def\dates@arg@a{#1}% + \def\dates@arg@b{#2}} +\def\cal@input#1,#2,\end{% + \ifcat$#1$% + \let\cal@input@next\relax% + \global\let\cal@files\relax% + \else% + \advance\cal@engine by 1% + \cal@check@colon#1:{}% + \ifcat$\dates@arg@b$% + \expandafter\edef\csname cal@\the\cal@engine @color\endcsname{}% + \xdef\cal@color{}% + \else% + \expandafter\dates@strip@colon\dates@arg@b% + \expandafter\edef% + \csname cal@\the\cal@engine @color\endcsname{\dates@arg@b}% + \gdef\cal@color{:\dates@arg@b}% + \fi% + \xdef\cal@input@file{\dates@arg@a}% + \let\cal@input@next\cal@input% + \xdef\cal@files{#2,,\noexpand\end}% + \IfFileExists{\cal@input@file.eve}% + {\PackageWarning{Calendar}% + {Using freeze file \cal@input@file.eve}% + \expandafter\ifx\csname\cal@input@file @cal@engine\endcsname% + \relax% + \@@input\cal@input@file.eve\relax% + \fi}% + {\IfFileExists{\cal@input@file.cld}% + {\expandafter\ifx% + \csname\cal@input@file @cal@engine\endcsname% + \relax% + \cal@dofreezefalse% + \gdef\cal@exceptionlist{}% + \expandafter\cal@read% + \@@input\cal@input@file.cld\relax{}% + \ifcal@dofreeze% + \immediate\closeout\cal@freeze@file% + \fi% + \fi}% + {\@missingfileerror{\cal@input@file}{cld}}}% + \fi% + \expandafter\edef% + \csname\cal@input@file @cal@engine\endcsname{\the\cal@engine}% + \expandafter\cal@input@next\cal@files} +\def\cal@input@next@default{\expandafter\cal@input@clone\cal@files} +% \end{macrocode} +% +% This is the handler used to put date information +% into memory and, optionally, to write data to +% a freeze file. The chain of nested conditions +% is explained step by step. +% +% \begin{macrocode} +\def\cal@append{% +% \end{macrocode} +% +% \textit{If we are looking at a list of holidays, we build +% an exceptions list only.} +% +% \begin{macrocode} + \ifcal@holidays% + \cal@except% +% \end{macrocode} +% +% \textit{Otherwise we are looking at dates for use in the calendar. +% We check first for a matching exception date, and block all +% action if one is found ("\cal@checkexception" sets the condition +% that follows).} +% +% \begin{macrocode} + \else% + \cal@checkexception% + \ifcal@useentry% +% \end{macrocode} +% +% \textit{If we are working on a range file, export to a freeze file +% is blocked.} +% +% \begin{macrocode} + \ifcal@noexport% +% \end{macrocode} +% +% \textit{We only export to a freeze file if specifically requested +% to do so. But if freezing is requested, we export all non-range +% items, regardless of the range used for the calendar.} +% +% \begin{macrocode} + \else% + \ifcal@dofreeze% + \cal@freeze% + \fi% + \fi% +% \end{macrocode} +% +% \textit{The remainder of our conditions pertain to the loading of +% data into memory. Range data is loaded, but only once, +% so we use a separate condition to block action here.} +% +% \begin{macrocode} + \ifcal@noload% + \else% +% \end{macrocode} +% +% \textit{If the current date is outside the range for +% Memory store is only performed +% for items within our overall date range for this +% calendar. Having this data in memory +% would do no affirmative harm, but it is dead weight +% since we'll not be using it.} +% +% \begin{macrocode} + \ifnum\dates@date<\cal@range@start% + \else% + \ifnum\dates@date>\cal@range@end% + \else% + \cal@list@init{events}% + \cal@list@init{appointments}\relax% +% \end{macrocode} +% +% \textit{We build separate lists for events and appointments.} +% +% \begin{macrocode} + \ifnum\dates@time@start=0% + \cal@list@append{events}% + \else% + \cal@list@append{appointments}% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi} +% \end{macrocode} +% +% This appends to the selected list type for the +% current date. It grabs the list content, if any, +% to a register. Then it defines the list to be +% itself plus the new set of details. +% +% \begin{macrocode} +\def\cal@list@append#1{% + \cal@reg@a=% + \expandafter\expandafter\expandafter{% + \csname\the\dates@date @#1\endcsname}% + \cal@reg@b\expandafter{\theshorttext}% + \cal@reg@c\expandafter{\thelongtext}% + \expandafter\edef% + \csname\the\dates@date @#1\endcsname{% + \the\cal@reg@a% + \noexpand\cal@delim% + {\the\dates@time@start}% + {\the\dates@time@end}% +% \end{macrocode} +% +% The no-export toggle is set whenever the ends of a range are being +% loaded. We use that here to fiddle the engine number for +% these entries. This is necessary to prevent color from being +% applied to them. +% +% \begin{macrocode} + {\ifcal@noexport% + 0% + \else% + \the\cal@engine% + \fi}% + {\the\cal@reg@b}% + {\the\cal@reg@c}}}% +% \end{macrocode} +% +% This is the list initializer. We first +% check to see if there is an existing +% list, and initialize it if it is new. +% +% \begin{macrocode} +\def\cal@list@init#1{% + \expandafter\ifx% + \csname\the\dates@date @#1\endcsname% + \relax% + \expandafter\def% + \csname\the\dates@date @#1\endcsname% + {}% + \fi} +% \end{macrocode} +% +% This is the file scanner. The input handler +% can be redefined. The default at start-up is +% to handle list files by putting them into memory. +% +% \begin{macrocode} +\def\cal@read{% + \dateread{\cal@append}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Sorting Routines} +% +% \begin{macro}{\cal@sorts} +% \begin{macro}{\cal@@sorts} +% \begin{macro}{\cal@@sorts@exit} +% \begin{macro}{\cal@@sort@init} +% +% This is the front end for sorting all items in +% memory. We step through the range day by day, +% and execute the sort routine on any lists that +% are found. One could avoid processing the empty +% days by loading all items into a single list, but +% a linear sort on a large number of items can be +% very slow, both because the work done in a linear +% sort grows geometrically, and because the sorting +% alogorithm requires more comparisons. +% On balance, this is a faster approach +% in most cases. +% +% We start by setting the date to be the start of +% the range, and do a "\let" that will set up +% recursion in the next macro in the chain. We then +% execute that macro. +% +% \begin{macrocode} +\def\cal@sorts{% + \global\dates@date\cal@range@start% + \let\cal@@sorts@next\cal@@sorts% + \cal@@sorts} +% \end{macrocode} +% +% The following will die when we hit the end of the range. +% Otherwise, it will look to see if there is something +% in a list for the current date in the events or appointment +% macros, and execute a sort of each if required. +% +% \begin{macrocode} +\def\cal@@sorts{\relax% + \ifnum\dates@date>\cal@range@end% + \let\cal@@sorts@next\cal@@sorts@exit% + \else% + \expandafter\ifx% + \csname\the\dates@date @events\endcsname\relax% + \else% + \cal@sort{\the\dates@date @events}% + \fi% + \expandafter\ifx% + \csname\the\dates@date @appointments\endcsname\relax% + \else% + \cal@sort{\the\dates@date @appointments}% + \fi% + \global\advance\dates@date by 1% + \fi% + \cal@@sorts@next} +% \end{macrocode} +% +% When we finish all of the sorting work, we restore the date +% to the start of the range, and we're ready to make a calendar! +% +% \begin{macrocode} +\def\cal@@sorts@exit{% + \global\dates@date\cal@range@start% + \caldate} +% \end{macrocode} +% +% This is used to initialize a list for sorting. It +% simply appends an entry with a time of minus one +% to the end of the primary working list. +% +% \begin{macrocode} +\def\cal@sort@init{% + \cal@sort@A=-1% + \cal@sort@B=0% + \cal@sort@C=0% + \cal@sort@D{}% + \cal@sort@E{}% + \global\let\cal@sort@new\cal@sort@list% + \cal@appendright% + \let\cal@sort@list\cal@sort@new% + \gdef\cal@sort@new{}% + \cal@sort@passonetrue} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cal@sort} +% \begin{macro}{\cal@@sort} +% \begin{macro}{\cal@appendright} +% \begin{macro}{\cal@sort@swap} +% +% This is the front end for sorting individual lists +% of items. It takes a single +% list macro name as its argument, invokes sorting on that +% list macro, and sets it to be the sorted form. The sorting +% setup here is designed to be easy to follow. It is probably +% not the most efficient way of sorting, but the size of lists +% is small (probably about ten items at the upper end), +% so speed is not really an issue. +% +% The name of the list is given as text, to keep the code +% where this is invoked more easily readable. +% +% \begin{macrocode} +\def\cal@sort#1{% + \expandafter\let\expandafter\cal@sort@list\csname#1\endcsname% + \cal@sort@init% + \global\let\cal@delim\cal@@sort% + \cal@sort@list% + \expandafter\let\csname#1\endcsname\cal@sort@new} +% \end{macrocode} +% This is the sort engine itself. Our data in memory consists of +% a list macro in groups of five items each. We will +% use this list under the name of "\cal@sort@list", and a working +% sort list for export under the name of "\cal@sort@new". +% +% We begin +% by grabbing the items to registers. +% +% \begin{macrocode} +\def\cal@@sort#1#2#3#4#5{% + \cal@sort@a=#1% + \cal@sort@b=#2% + \cal@sort@c=#3% + \cal@sort@d{#4}% + \cal@sort@e{#5}% +% \end{macrocode} +% +% Our default action is to do nothing when we finish +% with each sorting comparison; processing will be passed +% to the next delimited item in the list. +% +% \begin{macrocode} + \let\cal@@sort@next\relax% +% \end{macrocode} +% +% Every list for sorting is assumed to end in an entry with a +% time of minus one. When this is encountered, we export +% the last held item, and just expire if there was no change +% in the list. +% +% set the new list to be "\cal@sort@list", or we perform +% some actions to prepare for rerunning the list. +% +% \begin{macrocode} + \ifnum\cal@sort@a=-1\relax% + \message{.}% +% \cal@sort@swap% ... ? + \cal@appendright% + \ifcal@nosortchange% +% \end{macrocode} +% +% If we are to rerun the list, we reset the change toggle +% and the pass toggle. Then we export the held item, +% swap, and export the existing end-of-list marker. +% Then we set next to be the new list, and blank the +% new list to prevent geometric progression. +% +% \begin{macrocode} + \else% + \cal@nosortchangetrue% + \cal@sort@passonetrue% +% \cal@appendright% + \cal@sort@swap% + \cal@appendright% + \let\cal@@sort@next\cal@sort@new% + \gdef\cal@sort@new{}% + \fi% +% \end{macrocode} +% +% If are not at the end of the list, we start here. +% If this is the first pass, we do nothing. Otherwise +% we perform a series of comparisons. +% +% \begin{macrocode} + \else% + \ifcal@sort@passone% + \else% +% \end{macrocode} +% +% The time held is larger than the existing time. +% We need to change the order of the list, so we say so. +% We swap and export the smaller item. +% +% \begin{macrocode} + \ifnum\cal@sort@A>\cal@sort@a\relax% + \cal@nosortchangefalse% + \cal@sort@swap% + \cal@appendright% +% \end{macrocode} +% +% The time held is less than or equal to the existing time.\footnote{We also +% need to keep engine numbers in sequence. But the +% engine held must be less than the existing engine +% because they are loaded in sequence. We therefore +% do not need to check the next level.} +% \changes{1996/12/25}{v1.2}{Cut out a check for equal +% values in the sort comparison, and eliminated an erroneous +% swap action.} +% +% \begin{macrocode} + \else% +% \ifnum\cal@sort@A=\cal@sort@a\relax% + \cal@appendright% +% \begin{macrocode} +% +% The time held was less than the existing time. +% +% \begin{macrocode} +% \else% +% \cal@appendright% +% \fi% + \fi% + \fi% +% \end{macrocode} +% +% Swap registers. The current small registers were not exported +% to the new list, and are used as the large registers in the +% next pass. +% +% \begin{macrocode} + \cal@sort@swap% + \cal@sort@passonefalse% + \fi% + \cal@@sort@next} +% \end{macrocode} +% +% This simply appends to the end of the export list. +% +% \begin{macrocode} +\def\cal@appendright{% + \cal@reg@a\expandafter{\cal@sort@new}% + \xdef\cal@sort@new{% + \the\cal@reg@a% + \noexpand\cal@delim% + {\the\cal@sort@A}% + {\the\cal@sort@B}% + {\the\cal@sort@C}% + {\the\cal@sort@D}% + {\the\cal@sort@E}}} +% \end{macrocode} +% +% This swaps the large and small registers (trust me). +% +% \begin{macrocode} +\def\cal@sort@swap{% + \cal@count@a\cal@sort@a% + \cal@sort@a\cal@sort@A% + \cal@sort@A\cal@count@a% + \cal@count@a\cal@sort@b% + \cal@sort@b\cal@sort@B% + \cal@sort@B\cal@count@a% + \cal@count@a\cal@sort@c% + \cal@sort@c\cal@sort@C% + \cal@sort@C\cal@count@a% + \cal@reg@a\expandafter{\the\cal@sort@d}% + \cal@sort@d\expandafter{\the\cal@sort@D}% + \cal@sort@D\expandafter{\the\cal@reg@a}% + \cal@reg@a\expandafter{\the\cal@sort@e}% + \cal@sort@e\expandafter{\the\cal@sort@E}% + \cal@sort@E\expandafter{\the\cal@reg@a}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{The Calendar Generator} +% +% The following is run at the start of table generation only. +% After adjusting the global range for the table, +% it sets up the limiting counters for lines and groups. +% It also sets up a counter that tracks the number of items +% in a line and another that tracks the number of items +% in a group, +% and sets counters indicating the day on which +% each line will start and finish. It then outputs the +% headers and chains to the first macro in the loop. +% +% \begin{macrocode} +\def\cal@top{\relax% + \ifnum\tracingdates>0% + \message{^^J\themonth}% + \fi% + \let\cal@add@date@item\cal@add@date@item@default% + \advance\cal@range@end by 1% + \global\cal@subgroup@count0% + \global\cal@group@count0% + \cal@subgroup@len\cal@subgroup@length% + \advance\cal@subgroup@len by -1\relax% + \global\cal@group@len\cal@group@length% +% \advance\cal@group@len by -1\relax% + \cal@first@weekd\cal@first@weekday\relax% + \ifnum\cal@first@weekd=0% + \cal@last@weekd=6% + \else% + \cal@last@weekd\cal@first@weekd% + \advance\cal@last@weekd by -1% + \fi% + \cal@subgroup@setup% + \cal@output{\cal@header}\cal@begin@subgroup} +% \end{macrocode} +% +% The following begins every line in the table. +% It zeros the line item counter, then +% checks to see if we are ready to finish the table. +% If we are not finished, it checks to see if we have +% finished a group. If so, it puts the name of the new month +% on the terminal, resets the line and group counters, +% and grabs the group length afresh (this can change if, +% say, the group is a month). It then puts down a subfooter +% (left out in the routine that feeds into this, so that +% nothing will intervene between it and the foot), a footer +% and a new header. It then either pads or goes straight +% to input, as appropriate. +% If we are not at the end of a group, it puts down the start of a line. +% It then either starts the padding routine or goes straight +% to the item insertion routine. +% If we were ready to finish, +% it puts down a final line ending and footer, then dies. +% +% \begin{macrocode} +\def\cal@begin@subgroup{% + \global\cal@subgroup@count=0% + \global\def\cal@item@sep{}% + \ifnum\dates@date<\cal@range@end\relax% + \ifnum\cal@group@count=\cal@group@len\relax% + \ifnum\tracingdates>0% + \message{^^J\themonth}% + \fi% + \global\cal@group@count=0% + \global\cal@group@len\cal@group@length% + \cal@subgroup@setup% + \cal@output{\cal@groupbreak}\relax% + \ifnum\cal@first@weekd<7% + \let\next\cal@pad@start% + \else% + \let\next\cal@add@date@item% + \fi% + \else% + \ifnum\cal@first@weekd<7\relax% + \let\next\cal@pad@start% + \else% + \let\next\cal@add@date@item% + \fi% + \fi% + \else% + \cal@output{\cal@footer}% + \let\next\relax% + \fi% + \next} +% \end{macrocode} +% +% This adds a date item. It starts by checking to +% see if we are at the end of a group. It then either +% selects padding or a new line, as requested. +% If this is not the end of a group, we check to see +% if it is the end of a line. If so, it puts out a +% subfooter, but only if we're not going to be finishing +% the whole table. (The same treatment should be given +% to groups, come to think of it --- so there's at least +% one known bug here). If we're not at the end of a line, +% we place the item separator (which might be asleep), +% then let it wake up. This is followed by the item +% text and updates to the date and counters. +% +% \begin{macrocode} +\def\cal@add@date@item@default{\relax% + \ifnum\cal@group@count=\cal@group@len\relax% + \ifnum\cal@first@weekd<7% + \let\next\cal@pad@end% + \else% + \let\next\cal@begin@subgroup% + \fi% + \if\cal@incr G% + \global\advance\dates@date by 1% + \caldate% + \fi% + \if\cal@incr z% + \global\advance\dates@date by1% + \fi% + \else\relax% + \ifnum\cal@subgroup@count>\cal@subgroup@len\relax% + \if\cal@incr z% + \global\dates@date\cal@date@base% +% \global\advance\dates@date by-1% + \fi% + \ifnum\dates@date<\cal@range@end% + \if\cal@incr S% + \global\advance\dates@date by1% + \caldate% + \fi% + \cal@subgroup@setup% + \cal@output{\cal@subgroupbreak}% + \fi% + \let\next\cal@begin@subgroup% + \else% + \cal@output{\cal@item@sep}% + \global\def\cal@item@sep{\cal@item@sep@real}\relax% + \ifnum\tracingdates>0% + \message{\theday}% + \fi% + \cal@item@init% + \cal@output{\cal@item@text}% + \if\cal@incr I% + \global\advance\dates@date by 1% + \caldate% + \fi% + \if\cal@incr z% + \global\advance\dates@date by 1% + \caldate% + \fi% + \global\advance\cal@subgroup@count by 1\relax% + \global\advance\cal@group@count by 1\relax% + \let\next\cal@add@date@item% + \fi% + \fi% + \next} +% \end{macrocode} +% +% This pads out a line if the current date is later +% than the day that should start a table. +% +% It then calculates an offset that will be used +% by the padding loop, restoring the current date +% after the figure has been determined. +% +% \begin{macrocode} +\def\cal@pad@start{% + \cal@temp@count\dates@date% + \bgroup% + \global\cal@offset=\dates@date% + \prevday\cal@first@weekd% + \global\advance\cal@offset by -\dates@date% + \egroup% + \global\dates@date\cal@temp@count% + \cal@pad@@start} +% \end{macrocode} +% +% This is the padding loop. It moves to the beginning of +% the next line +% if padding is unnecessary or has been completed, +% putting the item separator to sleep as it does so. +% Otherwise, it wakes up the separator, +% puts it down, and increments +% the group and line counters. +% +% \begin{macrocode} +\def\cal@pad@@start{\relax% + \ifnum\cal@offset=0\relax% + \global\def\cal@item@sep{}% + \let\next\cal@add@date@item% + \else% + \global\def\cal@item@sep{\cal@item@sep@real}% + \cal@output{\cal@item@sep}% + \global\advance\cal@offset by -1\relax% + \global\advance\cal@subgroup@count by 1\relax% + \let\next\cal@pad@@start% + \fi% + \next} +% \end{macrocode} +% +% This pads a line to the ending day of the week. +% It calculates the offset, +% being careful not to let it hit an absurd value. +% +% \begin{macrocode} +\def\cal@pad@end{% + \cal@temp@count\dates@date% + \bgroup% + \global\cal@offset=\dates@date\relax% + \nextday\cal@last@weekd% + \advance\dates@date by -\cal@offset% + \global\cal@offset\dates@date\relax% + \ifnum\cal@offset=6% + \global\cal@offset=0% + \else% + \global\advance\cal@offset by 1% + \fi% + \egroup% + \global\dates@date\cal@temp@count% + \cal@pad@@end} +% \end{macrocode} +% +% If the offset is zero, there is no (longer) need for +% padding, and we go back to see if it's okay to start +% another line. Otherwise we output an item separator +% and iterate. +% +% \begin{macrocode} +\def\cal@pad@@end{\relax% + \ifnum\cal@offset=0\relax% + \let\next\cal@begin@subgroup% + \else% + \cal@output{\cal@item@sep}% + \global\advance\cal@offset by -1% + \global\advance\cal@subgroup@count by 1\relax% + \let\next\cal@pad@@end% + \fi% + \next} +% \end{macrocode} +% +% \subsection{Event Macros} +% +% The macros in this section are used to place text in the +% finished calendar. They are used by designers with +% the "\newcalendar" formatting macro. +% +% +% We provide several macros for conditional execution +% of text and color. The first two make rough decisions +% about an entire list of items, and are intended for +% use in tiny calendars in which specific text relating +% to events is not included. +% +% \begin{macro}{\ifanyitem} +% +% This executes one of two arguments depending on whether +% there is an event or appointment associated with the +% current date. We'll use this for small calendars +% on black and white printers, to boldface text +% showing that there is something significant about +% the date. +% +% \begin{macrocode} +\def\ifanyitem#1#2{% + \gdef\cal@temp{#1}% + \expandafter\ifx% + \csname\the\dates@date @events\endcsname% + \relax% + \expandafter\ifx% + \csname\the\dates@date @appointments\endcsname% + \relax% + \gdef\cal@temp{#2}% + \fi% + \fi% + \let\next\cal@temp% + \next} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\getanycolor} +% \begin{macro}{\get@calcolor} +% \begin{macro}{\calcolor} +% +% The next extracts a colour +% associated with a date. The color is returned in +% "\calcolor". +% +% \begin{macrocode} +\def\getanycolor{% + \gdef\calcolor{}% + \global\let\cal@delim\get@anycolor% + \csname\the\dates@date @events\endcsname% + \csname\the\dates@date @appointments\endcsname} +% \end{macrocode} +% +% The following is executed on each item in the list. +% When a color is found, we stick with that; the +% order of lists fed to the calendar will determine +% priority. +% \changes{v0.12}{1996/12/21}{First attempt at color +% coding --- it works!} +% +% \begin{macrocode} +\def\get@anycolor#1#2#3#4#5{% + \ifcat$\calcolor$% + \expandafter\ifx% + \csname cal@#3@color\endcsname% + \relax% + \else% + \xdef\calcolor{\csname cal@#3@color\endcsname}% + \fi% + \fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% Next, we have macros for working with lists. The set here +% sets up for the execution of a list, and dumps the list into the +% DVI hopper. Any list found will formatted using +% "\thecaltext", which the user may wish to redefine. +% +% If options are given to the command, only matching +% entries will be printed. +% +% We permit the selection of +% appointments and events by time, and +% by engine number.\footnote{The latter feature will allow +% the creation of concordance calendars that lay +% schedules side by side on the page. It should be +% possible, with minor enhancements to the Calendar +% package itself, to produce a schedule concordance +% that formats itself to the number of top-level lists +% fed to it. Really terrific if you have a use for it\ldots} +% +% We begin by hunting for options. +% +% \begin{macrocode} +\def\cal@get@events{% + \def\theevents{}% + \gdef\cal@entry@macro{\theevents}% + \expandafter\let% + \expandafter\cal@dumplist\csname\the\dates@date @events\endcsname% + \cal@print@items} +\def\cal@get@appointments{% + \gdef\theappointments{}% + \gdef\cal@entry@macro{\theappointments}% + \expandafter\let% + \expandafter\cal@dumplist% + \csname\the\dates@date @appointments\endcsname% + \cal@print@items} +\def\cal@print@items{% + \cal@sort@passonetrue% + \@ifnextchar[% + {\cal@@print@items}% + {\cal@@print@items[-1/-1]}} +\def\cal@@print@items#1[#2/#3]{% + \cal@select@start=#2% + \cal@select@end=#3% + \@ifnextchar[% + {\cal@@@print@items}% + {\cal@@@print@items[-1]}} +\def\cal@@@print@items#1[#2]{% + \cal@engine@limit=#2% + \global\let\cal@delim\cal@print@format% + \cal@dumplist} +% \end{macrocode} +% +% I'm sure there is a more clever way to do this, +% but I can't think of it tonight. If no value +% is given for an option, it becomes irrelevant +% to the decision of whether or not to print. Otherwise, +% a match for its value is required. +% +% \begin{macrocode} +\def\cal@print@format#1#2#3#4#5{\relax% + \ifcat$#4$% + \else% + \def\theshorttext{#4}% + \ifcat$#5$% + \let\thelongtext\theshorttext% + \else% + \def\thelongtext{#5}% + \fi% + \global\dates@time@start#1\relax% + \global\dates@time@end#2\relax% + \mod{60}\dates@time@start\cal@minutes@start% + \cal@hours@start\dates@three% + \divide\cal@hours@start by60% + \mod{60}\dates@time@end\cal@minutes@end% + \cal@hours@end\dates@three% + \divide\cal@hours@end by60% + \ifnum\cal@minutes@start<10% + \xdef\cal@minutes@start@mac{% + 0\the\cal@minutes@start}% + \else% + \xdef\cal@minutes@start@mac{% + \the\cal@minutes@start}% + \fi% + \ifnum\cal@minutes@end<10% + \xdef\cal@minutes@end@mac{% + 0\the\cal@minutes@end}% + \else% + \xdef\cal@minutes@end@mac{% + \the\cal@minutes@end}% + \fi% + \xdef\cal@appt@start@text{% + \the\cal@hours@start:\cal@minutes@start@mac}% + \xdef\cal@appt@end@text{% + \the\cal@hours@end:\cal@minutes@end@mac}% + \cal@doeventfalse% + \cal@doapptfalse\relax% + \ifnum\cal@engine@limit>-1\relax% + \ifnum#3=\cal@engine@limit% + \cal@doeventtrue% + \fi% + \else% + \cal@doeventtrue% + \fi\relax% + \ifnum\cal@select@start>-1\relax% +% +% We eliminate anything that is outside or just +% touches the time slot we're dealing with. +% + \ifnum\dates@time@start<\cal@select@end% + \ifnum\dates@time@end>\cal@select@start% + \cal@doappttrue% +% +% Ha! But just-touching entries that are pinpoint +% times are okay. +% + \else + \ifnum\dates@time@end=\cal@select@start% + \ifnum\dates@time@start=\dates@time@end% + \cal@doappttrue% + \fi% + \fi% + \fi% + \fi% + \else% + \cal@doappttrue% + \fi% + \ifcal@doappt% + \ifcal@doevent% + \xdef\calcolor{\csname cal@#3@color\endcsname}% + \ifcal@sort@passone% + \cal@reg@a{}% + \else% + \cal@reg@a\expandafter{\cal@entry@sep}% + \fi% + \cal@times@init% + \global\let\cal@textcolor\relax% + \cal@entry@init% + \global% + \global\let\cal@textcolor\cal@textcolor@default% + \cal@reg@b\expandafter{\cal@entry@text}% + \cal@reg@c% + \expandafter\expandafter% + \expandafter{\cal@entry@macro}% + \expandafter\xdef\cal@entry@macro{% + \the\cal@reg@c% + \the\cal@reg@a% + \the\cal@reg@b}% + \cal@sort@passonefalse% + \fi% + \fi% + \fi} +% \end{macrocode} +% +% This macro is used to initialize the values of +% text-literal macros "\thetimestart" and "\thetimeend". +% +% \begin{macrocode} +\def\cal@times@init{% + \mod{60}\dates@time@start\dates@one% + \dates@three\dates@time@start% + \divide\dates@three by 60% + \ifnum\dates@one<10\relax% + \xdef\cal@temp{0\the\dates@one}% + \else% + \xdef\cal@temp{\the\dates@one}% + \fi% + \xdef\thetimestart{\the\dates@three:\cal@temp}% + \mod{60}\dates@time@end\dates@one% + \dates@three\dates@time@end% + \divide\dates@three by 60% + \ifnum\dates@one<10\relax% + \xdef\cal@temp{0\the\dates@one}% + \else% + \xdef\cal@temp{\the\dates@one}% + \fi% + \xdef\thetimeend{\the\dates@three:\cal@temp}} +% \end{macrocode} +% +% And last but not least, we have the default macros used +% to print the text. Users may want to season this one +% to taste, but it should serve for most purposes. +% We need to define two macros. One always goes to DVI, +% and can contain non-printable stuff. The other goes +% may be routed to an external file, and should only +% contain things that expand to text, as nearly as possible. +% +% \begin{macrocode} +\def\cal@textcolor@default#1#2{% + \@ifundefined{color} + {\ifcat$#1$#2\else\textbf{#2}\fi} + {\ifcat$#1$#2\else\textcolor{#1}{#2}\fi}} +\global\let\cal@textcolor\cal@textcolor@default +% \end{macrocode} +% +% \subsection{Parser Customizations} +% +% This section contains macros that are used to alter +% the behaviour of the "\dateread" macro. Two new commands +% are introduced, "freeze" and "range". The first sets a toggle +% that will cause pre-processed dates to be exported to +% a freeze file for the list being imported. The second +% sets a range for the current import file by referring to +% a separate import file containing the range information. +% +% \begin{macro}{\fremac} +% \begin{macro}{\cal@freeze} +% \begin{macro}{\event} +% +% The first set is pretty simple. Users must be cautioned, however, +% that they should only use this macro at the \textit{top} of a +% file to be frozen, in order to catch all of the data it contains. +% A patch could probably be applied to kill the parser if +% "\fremac" occurs after the first argument is read. Later, later! +% +% \begin{macrocode} +\def\fremac{% + \immediate\openout\cal@freeze@file=\cal@input@file.eve\relax + \cal@dofreezetrue% +} +% \end{macrocode} +% +% The following macro is used to export text if the +% "\cal@dofreeze" toggle is on. +% +% \begin{macrocode} +{\catcode`\%=12\xdef\cal@percent{%}} +\def\cal@freeze{% + \immediate\write\cal@freeze@file\relax% + {\string\event% + {\the\dates@date}% + {\the\dates@time@start}% + {\the\dates@time@end}% + {\theshorttext}% + {\thelongtext}\cal@percent}} +% \end{macrocode} +% +% +% Frozen export files contain "\event" macros, the arguments to +% which contain frozen data. The "\event" macro loads date items +% into memory via the same handler used to import fresh-cooked +% data. We don't set the engine number from the file, because +% we've already set the figure for this run. +% +% \begin{macrocode} +\def\event#1#2#3#4#5{% + \global\dates@date=#1\relax% + \global\dates@time@start=#2\relax% + \global\dates@time@end=#3\relax% + \def\theshorttext{#4}% + \def\thelongtext{#5}% + \cal@append} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\ranmac} +% \begin{macro}{\cal@@@read@ranmac} +% \begin{macro}{\cal@get@range} +% \begin{macro}{\cal@get@@range} +% \begin{macro}{\rANmac} +% +% This set of macros fetches a file containing +% ranges (or other dates, although that would not +% be wise) into the current file. +% We need to snatch the word immediately following the +% command. We do this by diverting the flow of the +% date parsing routines, as documented in the Dates +% package. +% +% \begin{macrocode} +\def\ranmac{% + \global\let\dates@@@read\cal@@@read@ranmac}% +% \end{macrocode} +% +% The following will grab the very next word after +% "range", and input that file immediately, so that +% the currently-running dates parser can pass over +% it. We look forward for a brace; if we +% find one, it means that the user put a braced +% argument after the range as a comment. +% +% \begin{macrocode} +\def\cal@@@read@ranmac{% + \global\let\dates@@@read\dates@@@read@default% + \@ifoverword\dates@serious@brace% + {\expandafter\cal@get@range\@gobble}% + {\cal@get@range}% + {\message{This can't happen.}}} +% \end{macrocode} +% +% The following two macros grab the range into the +% current parsing process. The name of the file +% is expanded first, then the "\@@input" is expanded, +% then the parser proceeds without knowing that +% the text it sees came from elsewhere. +% +% \begin{macrocode} +\def\cal@get@range{% + \cal@noexporttrue% + \expandafter\ifx% + \csname\@overword @range@loaded\endcsname% + \relax% + \expandafter\def% + \csname\@overword @range@loaded\endcsname{% + 1}% + \else% + \cal@noloadtrue% + \fi% + \IfFileExists{\@overword.cld}% + {\expandafter\cal@get@@range\@overword.cld rAN }% + {\@missingfileerror{\@overword}{cld}}} +% \end{macrocode} +% +% We need a single macro that grabs stuff. +% +% \begin{macrocode} +\def\cal@get@@range{% + \expandafter\dates@read\@@input} +% \end{macrocode} +% +% We need to prevent the range data from being +% loaded into memory multiple times. We also +% never want to export this data to a freeze +% file; there would be no tidy means of determining +% which range data had been loaded and which +% not. +% +% We accomplish these effects +% by checking whether this range has been +% loaded previously, and toggling +% "\ifcal@noload" to true in the above +% macro if it has. We also toggle "\ifcal@noexport" +% to true. We then plant +% a macro after the imported text that will +% restore this functionality in "\cal@append". +% An all-caps word +% in the user text will be lower-cased, so this +% will not cause confusion. +% +% In a future release, the entry of ranges directly +% into a list file should probably be prevented; +% freezing several lists containing a literal range +% would introduce precisely the problem referred to +% in the first paragraph of this comment. +% +% The reset for "\cal@holidays" supports the modified +% behaviour required by the holiday option immediately +% below. +% +% \begin{macrocode} +\def\rANmac{% + \cal@holidaysfalse% + \cal@noloadfalse\cal@noexportfalse} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\holmac} +% \begin{macro}{\cal@except} +% \begin{macro}{\cal@checkexception} +% \begin{macro}{\cal@@checkexception} +% +% Some lists should ignore entries that fall on a holiday. +% This is a property of the list, and so is governed by +% a list of holidays called at the top of the list itself; +% the user writing a calendar document does not need or +% want control over holidays. +% +% We accomplish this by importing a holidays list into the +% document, using the routines above. However, we +% modify the action for the parser so that it builds an +% exceptions list. This action is built into the +% "\cal@append" macro. +% +% \begin{macrocode} +\def\holmac{% + \cal@holidaystrue% + \global\let\dates@@@read\cal@@@read@ranmac}% +% \end{macrocode} +% +% The "\cal@append" macro will call the following macro +% to build an exceptions list. +% +% \begin{macrocode} +\def\cal@except{% + \cal@reg@a\expandafter{\cal@exceptionlist}% + \xdef\cal@exceptionlist{% + \noexpand\cal@delim{\the\dates@date}\the\cal@reg@a}} +% \end{macrocode} +% +% This sets to false if an entry exists on the exception list, +% otherwise true. +% +% \begin{macrocode} +\def\cal@checkexception{% + \cal@useentrytrue% + \global\let\cal@delim\cal@@checkexception% + \cal@exceptionlist} +% \end{macrocode} +% +% This sets the condition, via the above macro, by checking each +% item in the list. +% +% \begin{macrocode} +\def\cal@@checkexception#1{\relax% + \ifnum\dates@date=#1\relax\cal@useentryfalse\fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\lismac} +% +% We allow nested lists. We avoid nested input by placing the +% name of the file onto the input list, so that the input +% routine will pick it up during tail recursion. Nonetheless +% we want the colors of susidiary lists to be governed by +% the color at the top level, so we put the last-defined color onto the +% list as well. +% +% \begin{macrocode} +\def\lismac{% + \global\let\dates@@@read\cal@pass@list} +% \end{macrocode} +% +% We need a little gadget to safely extract the contents of the +% file list. +% +% \begin{macrocode} +\def\cal@grablist#1\end{% + \def\cal@grabbedlist{#1}} +% \end{macrocode} +% +% This just does the passing and returns control to "\dates@@@read". +% +% \begin{macrocode} +\def\cal@pass@list{% + \expandafter\cal@grablist\cal@files% + \global\let\dates@@@read\dates@@@read@default% + \@ifoverword\dates@serious@brace% + {\xdef\cal@files{% + \@overword\cal@color,\cal@grabbedlist\noexpand\end}% + \expandafter\dates@read\@gobble}% + {\message{I don't think I'm supposed to do this}% + \xdef\cal@files{% + \@overword\cal@color,\cal@grabbedlist\noexpand\end}}% + {\message{This can't happen}}} +% \end{macrocode} +%\end{macro} +% +% \subsection{Initializations} +% +% Before any of this runs, we need the following registers, +% macros and conditionals. +% +% \begin{macrocode} +\newcount\cal@first@weekd +\newcount\cal@range@start +\newcount\cal@range@end +\newcount\cal@temp@count +\newcount\cal@last@weekd +\newcount\cal@subgroup@len +\newcount\cal@offset +\newcount\cal@subgroup@count +\newcount\cal@group@count +\newcount\cal@group@len +\newcount\cal@engine +\newcount\cal@engine@limit +\newcount\cal@select@start +\newcount\cal@select@end +\newcount\cal@hours@start +\newcount\cal@minutes@start +\newcount\cal@hours@end +\newcount\cal@minutes@end +\newcount\tracingdates +\tracingdates=1 +\def\cal@sort@new{} +\newtoks\cal@reg@a +\newtoks\cal@reg@b +\newtoks\cal@reg@c +\newcount\cal@sort@A +\newcount\cal@sort@B +\newcount\cal@sort@C +\newtoks\cal@sort@D +\newtoks\cal@sort@E +\newcount\cal@sort@a +\newcount\cal@sort@b +\newcount\cal@sort@c +\newtoks\cal@sort@d +\newtoks\cal@sort@e +\newcount\cal@count@a +\newwrite\cal@freeze@file +\newif\ifcal@sort@passone +\newif\ifcal@nosortchange +\newif\ifcal@dofreeze +\newif\ifcal@noload +\newif\ifcal@noexport +\newif\ifcal@holidays +\newif\ifcal@useentry +\newif\ifcal@doevent +\newif\ifcal@doappt +\def\cal@insert#1{#1} +\expandafter\edef\csname cal@0@color\endcsname{black} +\def\theappointments{} +\def\theevents{} +\def\cal@exceptionlist{} +\newcount\cal@date@base +%</style> +% \end{macrocode} +% +%\iffalse +% \section{The Installation File} +% \begin{macrocode} +%<*installer> +\def\batchfile{calendar.ins} +\input docstrip.tex + +\keepsilent + +\preamble + +This file is part of the Calendar 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 Calendar a more powerful, +friendlier, and better package, please contact me on +`fb' at soas.ac.uk + +\endpreamble + +\postamble +\endpostamble + +\generate{\file{calendar.sty} {\from{calendar.dtx}{style}} +} + +\Msg{***********************************************************} +\Msg{*} +\Msg{* To finish the installation, you have to move the following} +\Msg{* files into a directory searched by TeX:} +\Msg{*} +\Msg{* \space\space calendar.sty} +\Msg{*} +\Msg{* You will also need to have the following packages} +\Msg{* installed on your system before using this package} +\Msg{* or printing its documentation:} +\Msg{*} +\Msg{* \space\space overword.dtx} +\Msg{* \space\space dates.dtx} +\Msg{*} +\Msg{***********************************************************} + +%</installer> +% \end{macrocode} +%\fi +% \Finale \PrintChanges diff --git a/Master/texmf-dist/source/latex/calendar/dates.dtx b/Master/texmf-dist/source/latex/calendar/dates.dtx new file mode 100644 index 00000000000..5cc1205b089 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/dates.dtx @@ -0,0 +1,2630 @@ +%\iffalse +% +% File dates.dtx +% Copyright (C) 1996, 1997 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(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 this a more powerful, +% friendlier, and altogether more thrilling package, please contact me on +% fb@soas.ac.uk +% +%<style>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<style>\ProvidesPackage{dates} +%<style> [1998/01/17 17:12:39 3.1 Dates parsing support (Frank Bennett)] +%\fi +% +% \def\fileversion{3.1} +% \def\filedate{1998/01/17 17:12:39} +% +%\iffalse +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\RecordChanges +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{dates.dtx} +\end{document} +%</driver> +%\fi +% +% \changes{v1.0}{1996/12/10}{Initial version separated from calendar.dtx} +% \changes{v1.0}{1996/12/12}{Overhauled to provide error handling and +% various other features} +% \changes{v1.0}{1996/12/14}{Adapted the plain \TeX{} code for the phases +% of the moon and used it to set it up a function item in a list. It works!} +% \changes{v1.0}{1996/12/14}{Tidied up some sloppiness in the handling of groups. +% No active characters now appear in braced text, and functions no longer +% require square braces. Documentation updated to this effect.} +% \changes{v1.0}{1996/12/15}{Modified toXmac to allow no-frills ranges.} +% \changes{v1.1}{1996/12/21}{Added handler for multiple enditall's.} +% \changes{v1.1}{1996/12/27}{Minor bug fixes for final release with the +% Calendar package.} +% \changes{v1.2}{1997/01/18}{Changed gdef of characters in capsdown to +% plain def, so that diacritics and maths will not be screwed up +% by calendar. Capsdown state is fixed by xdef immediately +% before group enclosing the capsdown; definition is in force +% only just before and just after the high-speed read of the +% argument.} +% \changes{v1.2}{1997/01/18}{Fixed a bug that the above fix produced +% in the handling of function definitions.} +% \changes{v1.3}{1997/02/17}{Added code to support recursive dates +% falling on exactly the same day of the month in every month. +% Perhaps such dates should be permitted to conditionally shift to a nearby +% day in the event of a holiday. Perhaps not.} +% \changes{v1.4}{1997/03/01}{Large number of variable made +% global, to prevent consumption of \TeX{} save space during +% large runs. Task not yet complete, but hardiness much +% improved.} +% \changes{v1.4}{1997/03/01}{Cleanup of documentation; cut out +% all user-level instructions in favour of a cross-reference +% to user-level packages.} +% \changes{v1.4}{1997/03/02}{Inserted fix for broken \texttt{othmac} support.} +% \changes{v1.5}{1997/03/06}{Added initialization \texttt{let} to +% definition of \texttt{daymac} to fix a bug reported by Miroslav +% Novak.} +% \changes{v1.5}{1997/03/06}{Fixed algorithm for ending subranges +% in recursive entries --- was ending one day too soon always.} +% \changes{v1.6}{1997/05/19}{Added language option. Initial language +% support covers English and Japanese.} +% \changes{v1.6}{1997/05/20}{German support added. Thanks due to +% Christian Horn.} +% \changes {v1.7}{1997/06/10}{Removed Japanese option --- far too +% cumbersome to maintain.} +% \changes{v1.8}{1997/10/18}{New public release of all styles +% and modules incorporating global bug-fixes.} +% \changes{v1.9}{1997/10/24}{Eliminated the final (touch wood!) +% cross-nested variable bug. Should run find on small \TeX's now.} +% \changes{v1.10}{1997/10/25}{Eliminated need for bogus entries +% to protect against reads past end of file. } +% \changes{v1.11}{1997/10/26}{Added support for anniversaries.} +% +%\iffalse +% Source tree moved under RCS +% --------------------------- +% dates.dtx,v +% Revision 3.1 1998/01/17 17:12:39 root +% Release code +% +% Revision 2.15 1998/01/17 06:10:58 root +% *** empty log message *** +% +% Revision 2.14 1998/01/17 04:54:44 root +% *** empty log message *** +% +% Revision 2.13 1998/01/16 11:41:21 root +% *** empty log message *** +% +% Revision 2.12 1998/01/16 11:39:57 root +% *** empty log message *** +% +% Revision 2.11 1998/01/16 11:18:23 root +% *** empty log message *** +% +% Revision 2.10 1998/01/16 11:00:58 root +% *** empty log message *** +% +% Revision 2.9 1998/01/16 09:26:26 root +% *** empty log message *** +% +% Revision 2.8 1998/01/16 09:03:04 root +% *** empty log message *** +% +% Revision 2.7 1998/01/15 23:34:12 root +% *** empty log message *** +% +% Revision 2.6 1998/01/15 23:30:14 root +% *** empty log message *** +% +% Revision 2.5 1998/01/15 21:42:28 root +% *** empty log message *** +% +% Revision 2.4 1998/01/15 21:38:26 root +% Trivial change. +% +% Revision 2.3 1998/01/15 21:35:30 root +% First shot at proper language support. +% +% Revision 2.2.1.1 1997/11/07 11:16:06 root +% Eliminated \@gobble from \dates@@@read@@function. +% +% Revision 2.2 1997/11/07 10:44:05 root +% Release code. +% +% Revision 2.1.1.22 1997/11/05 07:40:27 root +% Confirming a string of changes implementing multi-argument +% (aka multi-lingual) support. +% +% Revision 2.1.1.21 1997/11/05 07:37:09 root +% *** empty log message *** +% +% Revision 2.1.1.20 1997/11/05 07:35:42 root +% *** empty log message *** +% +% Revision 2.1.1.19 1997/11/05 07:19:49 root +% *** empty log message *** +% +% Revision 2.1.1.18 1997/11/05 07:14:39 root +% *** empty log message *** +% +% Revision 2.1.1.17 1997/11/05 07:06:09 root +% *** empty log message *** +% +% Revision 2.1.1.16 1997/11/05 06:55:18 root +% *** empty log message *** +% +% Revision 2.1.1.15 1997/11/05 06:46:48 root +% *** empty log message *** +% +% Revision 2.1.1.14 1997/11/05 06:44:42 root +% *** empty log message *** +% +% Revision 2.1.1.13 1997/11/05 06:43:27 root +% *** empty log message *** +% +% Revision 2.1.1.12 1997/11/05 06:41:21 root +% *** empty log message *** +% +% Revision 2.1.1.11 1997/11/05 06:37:42 root +% Backed off from adding new macro. Trying nesting of +% \@ifnextnparchar. +% +% Revision 2.1.1.10 1997/11/05 06:29:43 root +% Added calls to new macro \@ififnextnparchar, to cope +% with possibility of bent brace without following square +% brace. +% +% Revision 2.1.1.9 1997/11/04 21:29:48 root +% Added prototype code for picking up extra entries +% +% Revision 2.1.1.8 1997/11/04 19:52:15 root +% Moved the assignment to \dates@date to the top of +% \dates@init@weekly. Careless error. +% +% Revision 2.1.1.7 1997/11/04 14:57:40 root +% Fixed local assignments of \dates@date and \dates@catch +% accidentally included in patch code. +% +% Revision 2.1.1.6 1997/11/04 14:45:10 root +% Re-applied patches to cope with the common recursive entries, +% now that the code for "every other" has made it necessary to +% move the assignment to \dates@date out of the common code +% for recursive entries. +% +% Revision 2.1.1.5 1997/11/04 08:25:42 root +% Fixed silly typing error in fix just applied. +% +% Revision 2.1.1.4 1997/11/04 08:23:08 root +% Moved downcasing code directly into \dates@execute +% +% Revision 2.1.1.3 1997/11/04 07:39:27 root +% Added missing ` to \dates@downcase +% +% Revision 2.1.1.2 1997/11/04 07:33:08 root +% Eliminated \capsdown from the code, installed new routine +% based on character constants and \cs{ifcase}. +% +% Revision 2.1.1.1 1997/11/04 05:06:07 root +% Development branch +% +% Revision 2.1 1997/11/01 15:08:09 bennett +% Release code. +% +% Revision 1.17.0.8 1997/11/01 14:29:11 root +% *** empty log message *** +% +% Revision 1.17.0.7 1997/11/01 13:28:54 root +% Range limit trap suspended for the present; this needs careful +% consideration, so that the "freeze" declaration is not rendered +% useless or unpredictable. +% +% Revision 1.17.0.6 1997/11/01 12:50:18 root +% Alterations to recursion routines broke anniversaries. Rewritten. +% Also added optional counter \dates@range@limit, which cuts off +% recursive entries to save processing time. +% +% Revision 1.17.0.5 1997/11/01 11:38:52 root +% Fixed obvious error in initialization routine before testing; +% if the pinpoint date is greater than the beginning of the +% subrange, we just use that as the starting point. +% +% Revision 1.17.0.4 1997/11/01 11:34:41 root +% First draft of new "every other week" function. "Other" +% invokes a terminating macro that expects a pinpoint date. +% This is then used as the base for every-other-week jumps. +% +% Revision 1.17.0.3 1997/11/01 11:13:35 root +% Moved setting of \dates@date in recursive entries from the +% generic opener \dates@read@exit@recurse into each of the +% alternative recursive definitions. This gives us better +% control; it allows us to use a pinpoint date as a starting date +% for recursive processing. +% +% Revision 1.17.0.2 1997/11/01 10:52:56 root +% Incorporated fix for encounters with \end; we no longer +% need to gobble anything after the parsed text. +% +% Revision 1.17.0.1 1997/11/01 06:39:29 root +% Cut enditalls. +% +% Revision 1.17 1997/11/01 06:29:27 root +% New revision branch established to play with the elimination +% of \enditall's from the code. +% +% Revision 1.16 1997/10/31 21:28:07 root +% *** empty log message *** +% +% Revision 1.15 1997/10/31 21:13:53 root +% *** empty log message *** +% +% Revision 1.14 1997/10/31 20:47:16 root +% Moved date-validation code from \dates@fix to +% \dates@read@exit@default where it belongs. +% +% Revision 1.13 1997/10/31 19:35:20 root +% Eliminated \message's used to trace the problem with the +% streamlined date conversion code just introduced. +% +% Revision 1.12 1997/10/31 19:32:42 root +% Fixed egregious bug involving the use of \dates@day for two +% completely unrelated purposes. With this fix, the more +% streamlined use of but one invocation of either \caldate or +% \dates@fix works. +% +% Revision 1.11 1997/10/31 18:51:19 root +% *** empty log message *** +% +% Revision 1.10 1997/10/31 18:29:43 root +% Eliminated what appeared to be unnecessary use of +% \dates@monthnameget from previous revision. Caused an error, +% but this may not have been the source of that error. +% +% Revision 1.9 1997/10/31 18:23:06 root +% Added \dates@getmonthname and \dates@getdayname to the definition +% of \dates@fix. This eliminates the need for running \caldate +% after \dates@fix, and will further reduce the processing burden. +% +% Revision 1.8 1997/10/31 18:01:23 root +% Finalized changes eliminating one use of \dates@capsdown. +% Also made further changes to documentation, and added +% (or rather changed) the name of \dates@@@@read@function +% and the following macro to \dates@@@read... to help make +% things a little easier to follow. +% +% Revision 1.7 1997/10/31 17:39:05 root +% Restored use of @default prefix for \dates@read. Also +% trying the elimination of one instance of \dates@capsdown. +% If this works, it will eliminate a great deal of clutter +% in save space. +% +% Revision 1.6 1997/10/31 11:18:55 root +% Further documentation updates and what I thought were trivial +% changes to the code. The trivial changes seem, however, to +% have broken the "list" declaration. +% +% Revision 1.5 1997/10/31 09:00:27 root +% First phase of combing through documentation. +% +% Revision 1.4 1997/10/29 20:08:04 bennett +% *** empty log message *** +% +% Revision 1.3 1997/10/29 13:50:13 root +% Restored use of date checking, after discovering that it +% works correctly if files are extracted using the -kv +% option. +% +% Revision 1.2 1997/10/29 11:47:37 root +% Eliminated optional date specification from RequirePackage{overword} +% +% Revision 1.1 1997/10/29 08:17:52 root +% Initial revision +% +%\fi +% +% \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} +% +% \title{User's Guide to the Dates package\thanks{This file is version number +% \fileversion{}. It was last revised on +% \filedate.}} +% +% \author{Frank G. Bennett, Jr.\thanks{The code contained in this file just +% provides a smart \LaTeXe front end to +% the \texttt{calendar} macros for \TeX{} that I +% found on CTAN. The \TeX{} macros work quite +% well, but lack any documentation. Their provenance is also a +% mystery. If anyone can tell me who wrote them, I will gladly +% include an acknowledgement in this documentation.}} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \begin{abstract} +% \noindent This package provides macros for the parsing of dates +% using \LaTeXe{}. +% \end{abstract} +% +% \CheckSum{1916} +% +% \section{Introduction} +% +% This package provides a macro, "\dateread", that can +% be used to parse date strings, either individually +% or recursively. The macro expects a human-readable +% syntax, which it converts into an integer (a ``long +% date'') that can +% be more easily used for some types of computation. +% A set of companion macros and token registers +% is also provided for +% converting long dates into human-readable form. +% +% Dates may be specified either individually, +% or as recursive dates within a range. +% The human-readable syntax for two +% types of recursive date are built +% into the package, but an interface for writing +% specialized extensions in native \LaTeX{} is also provided. +% The handling of parsed dates is also within +% user control; it is defined in a +% single argument fed to "\dateread" when it is invoked +% in front of a list of dates. +% +% This package was +% developed as one of the building blocks of +% the "calendar" package, but is released as a separate +% chunk of code because the date parsing task is a function +% discrete from the work of building a calendar from +% constituent blocks of information (which is the +% main task of the Calendar package proper). +% +% For a description of the syntax understood by +% the parser, and examples of how it can be +% extended, please see the Calendar package and +% the documentation for its associated style +% files. The documentation here is not intended +% for end users; it is provided for reference by +% style designers who might wish to use +% the parser in their own packages. +% +% \section{Calling the Parser} +% +% Printing of +% variable text (such as the text of the date) is +% done by passing that information through to the argument +% to the "\dateread" macro. +% This argument is an action that will be performed +% once after each date in the list is read. The +% date and the description text may be included by +% using the appropriate commands. These are: +% +% \begin{tabular}{ll} +% "\theyear" & The year (four digits).\\ +% "\themonth" & The full name of the month.\\ +% "\theshortmonth" & The name of the month (3 characters).\\ +% "\themonthnumber" & The number of the month.\\ +% "\theday" & The day of the month.\\ +% "\thetimestart" & Starting time for an item.\\ +% "\thetimeend" & Ending time for an item.\\ +% "\theweekday" & The name of the day of the week.\\ +% "\theshortweekday" & Abbreviated day of the week (3 characters).\\ +% "\theshorttext" & The text describing the date.\\ +% "\thelongtext" & A longer description of the date.\\ +% "\thelongdate" & The long date (an integer).\\ +% "\thedays" & The maximum number of days this month.\\ +% \end{tabular} +% +% You can also call up information using lower-level +% registers and macros that contain date-related +% information. If you need to do this, you're +% on your own; please have a look at the code. +% +% The demonstration file included in this package +% lists dates on the terminal using the "\message" +% command. In a more serious application, text can +% be printed, stored to registers or boxes, or +% sent in pre-processed form to an external file. +% +% The following is a valid invocation of the +% macro: +% +% \begin{quote} +% \begin{verbatim} +% \dateread{% +% \message{% +% \theweekday, % +% \theday\space% +% \themonthname\space% +% \theyear}} +% % +% % The list of dates to be parsed +% % +% June 15 1997 {Summer Holiday Begins} +% September 25 1997 {Summer Holiday Ends} +% January 1 1997 {First day of January} +% February 18 1997 {Frank's Birthday} +% Every Monday at 2:00 {Go to the Beach} +% Every 20 {20th day of the month} +% % +% % The end of the list. +% % +% \relax{} +% \end{verbatim} +% \end{quote} +% +% A style package that uses the date parser +% should of course conceal stretches of code +% like that above from the end user. If lists +% of dates are maintained in separate files, you +% can do something like the following, +% +% \begin{quote} +% \begin{verbatim} +% \def\readinput{% +% \dateread{\message{\theweekday^^J}}} +% +% \def\inputandread{% +% \expandafter\readinput% +% \@@input \filename\relax{} +% } +% \end{verbatim} +% \end{quote} +% +% \noindent where "\filename" contains the name of a file +% to be read. One would confirm the existence +% of the file, then run "\inputandread". +% +% \section{Extending the Parser} +% +% \label{analyze} +% When the parser is used in a package, it may be +% necessary to modify its behaviour to perform +% special actions in the course of processing. +% For example, you may want to provide a facility +% for setting the range in files containing +% recursive dates from a single file so that, +% say, an academic schedule can be moved forward +% to the next year without a lot of typing. +% This kind of effect can be achieved by defining a +% word which diverts processing to a macro that +% performs the desired action before continuing +% to digest the list of dates. +% +% The flow of processing can be diverted at two +% points: +% +% \begin{enumerate} +% \item Immediately after a word is read; +% or +% \item Immediately after a date and its +% text have been digested. +% \end{enumerate} +% +% The parser can be +% re-entered in any of three states: +% +% \begin{enumerate} +% \item One that +% looks for the next word in a date string; +% \item One that digests the description text; or +% \item One +% that completes the processing of a date +% entry and its text. +% \end{enumerate} +% +% Each of the exit points and reentry states is +% associated with a macro name. Diversion is +% accomplished by defining a word that "\let"s the +% exit macro name be the user's own macro. Reentry +% is accomplished in the user's macro by ending +% with the appropriate macro name. The names +% the macros to use as exit points are, +% in the order of the first list above: +% +% \begin{enumerate} +% \item "\dates@@@read" +% \item "\dates@read@exit" +% \end{enumerate} +% +% The names of macros to use for reentry +% states are: +% +% \begin{enumerate} +% \item "\dates@@@read@default" +% \item "\dates@@@@read@default" +% \item "\dates@read@exit@default" +% \end{enumerate} +% +% An extension therefore consists of a user-defined +% macro, and a user-defined word that invokes +% "\let" as appropriate. Words should be padded +% to exactly three characters using "X", and should +% be appended with the suffix "mac". The following +% defines a word, "if", which sets a toggle and +% continues parsing a date: +% +% \begin{quote} +% \begin{verbatim} +% \newif\ifusedif +% +% \def\myownmacro{% +% \usediftrue% +% \dates@@@read@default} +% +% \def\ifXmac{% +% \let\dates@@@read=\myownmacro} +% \end{verbatim} +% \end{quote} +% +% This is the same method used in the package +% itself to provide recursive dates and the +% function entry type; see the code commentary section +% for less trivial examples. +% +% \subsection{Using the Argument Text} +% +% When dates are read they are unsorted, so text should not +% be exported directly by \cs{dates@action} (let alone +% dropped on DVI) +% unless you have a filter for sorting +% the text after \TeX{} exits. In normal use, +% events should be sorted and selected +% in memory after they are read, by other code in the +% package calling "dates.sty". The Calendar package +% is an example of how this can be done. +% +%\StopEventually{\PrintIndex} +% +% \section{The Macros} +% +% \begin{macrocode} +%<*style> +\newcount\dates@one +\newcount\dates@two +\newcount\dates@langnum +\newtoks\dates@reg@a +\newtoks\dates@reg@b +\newtoks\dates@reg@c +\def\DeclareCalendarLanguage#1#2#3#4#5{ + \advance\dates@two by1\relax% + \expandafter\edef\csname dates@#1@langnum\endcsname{\the\dates@two}% + \ifnum\dates@two=1\relax\def\dates@default@language{#1}\fi% + \DeclareOption{#1}{% + \expandafter\expandafter\expandafter% + \dates@langnum\csname dates@#1@langnum\endcsname\relax% + \dates@buildcase{1}{\theweekday}{\dates@weekd}#2{}% + \dates@buildcase{1}{\theshortweekday}{\dates@weekd}#3{}% + \dates@buildcase{0}{\themonth}{\dates@month}#4{}% + \dates@buildcase{0}{\theshortmonth}{\dates@month}#5{}}} +\def\dates@buildcase#1#2#3{% + \dates@one=#1\relax% + \dates@reg@c={#3}% + \gdef\dates@temp@a{#2}% + \dates@reg@a={}% + \dates@reg@b={}% + \def\dates@temp@c{}% + \dates@@buildcase} +\def\dates@@buildcase#1{% + \ifcat$#1$% + \let\next\dates@@@buildcase% + \else% + \let\next\dates@@buildcase% + \dates@reg@a={\or#1}% + \dates@reg@b=\expandafter{\dates@temp@c}% + \edef\dates@temp@c{\the\dates@reg@b\the\dates@reg@a} + \fi% + \next} +\def\dates@@@buildcase{% + \ifnum\dates@one=0\relax% + \dates@reg@a=\expandafter{\dates@temp@c}% + \else% + \dates@reg@a=\expandafter\expandafter\expandafter% + {\expandafter\@gobble\dates@temp@c}% + \fi% + \expandafter\edef\dates@temp@a{% + \noexpand\ifcase\the\dates@reg@c% + \the\dates@reg@a% + \noexpand\fi}} +% \end{macrocode} +% Load some useful code. +% \begin{macrocode} +\RequirePackage{overword}[1997/10/29] +\InputIfFileExists{dates.cfg}{}{} +\@ifundefined{theweekday}{% + \DeclareCalendarLanguage{english} + {{Sun}{Mon}{Tue}{Wed}{Thu}{Fri}{Sat}} + {{Sunday}{Monday}{Tuesday}{Wednesday}{Thursday}{Friday}{Saturday}} + {{Jan}{Feb}{Mar}{Apr}{May}{Jun}{Jul}{Aug}{Sep}{Oct}{Nov}{Dec}} + {{January}{February}{March}{April}{May}{June}{July}{August}{September} + {October}{November}{December}}} + {} +\ExecuteOptions{\dates@default@language} +\ProcessOptions +% \end{macrocode} +% +% \subsection{The Engine Core} +% +% \begin{macro}{\dateread} +% The top-level interface macro \cs{dateread} starts by setting "\dates@action" +% to be its first argument. It then initializes +% variables that are zeroed only at the start of a run +% of dates, and passes control to the next macro in the chain, +% \cs{dates@read}. +% \begin{macrocode} +\long\gdef\dateread#1{% + \gdef\dates@action{#1}% + \gdef\dates@subranges{}% + \dates@subrange@start=0% + \dates@subrange@end=0% + \dates@read@default} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\date@read} +% The next macro continues with initialization, +% zeroing and blanking variables that need to +% be reset each time a new date is read. The reason +% for the \texttt{@default} extension is explained below. +% \begin{macrocode} +\long\gdef\dates@read@default{% + \global\dates@time@start=0% + \global\dates@time@end=0% + \setyear{1900}% + \global\dates@month=0% + \global\dates@day=0% + \global\dates@weekd@target=7% + \gdef\theshorttext{}% + \gdef\thelongtext{}% +% \end{macrocode} +% \textit{The action, whatever the user has chosen it to be, +% can be suppressed by toggling the following condition, +% but the default here (as in life) is to do things.} +% \begin{macrocode} + \global\dates@suppressfalse% +% \end{macrocode} +% \textit{Recursive entries will define the following two macros, +% but initially we want them to be firmly turned off.} +% \begin{macrocode} + \global\let\dates@init\relax% + \global\let\dates@increment\relax% +% \end{macrocode} +% \textit{The following assignments put the parsing machinery +% into its default state. The first and the third macros below +% have \texttt{@default} values not to allow modification of +% parsing behaviour at these points, but because these two +% macros are \cs{relax}ed to bring parsing to a halt when +% desired.} +% \begin{macrocode} + \global\let\dates@read=\dates@read@default% + \global\let\dates@@@read=\dates@@@read@default% + \global\let\dates@@@@read=\dates@@@@read@default% + \global\let\dates@read@exit=\dates@read@exit@default% +% \end{macrocode} +% \textit{We open a group, and make uppercase characters active +% locally inside it. We use an invocation of \cs{@ifnextnparchar} +% to look for the next character. If that is \cs{end}, +% then we close the group we've just opened, and that's +% that. This sudden-death condition will seldom be satisfied +% (you would need an \cs{end} immediately after \cs{dateread} +% with no intervening date, or a date complete with braced +% argument(s) followed immediately by \cs{end}), but the condition will +% be trapped and handled if it does occur.} +% +% \textit{Apart from this, we look for a match to \cs{dates@serious@brace}. +% It will be spotted in most cases +% by the last invocation of \cs{@ifoverword} in parsing the +% date (re which see below). The only case in which it will +% need to be caught here is where there is no date at all, +% but an immediate curly brace.} +% +% \textit{Thus, we will almost always be proceeding +% on the middle, ``fail'' condition to the next macro in +% the parsing chain, \cs{dates@@read}.} +% +% \textit{Apart from +% handling possible if slightly weird error conditions, this +% look forward will close a file, if one has been opened +% to provide the list read by \cs{dateread} (see \texttt{calendar.dtx}, +% again, for a real-world example) and its text content has +% been exhausted.} +% \begin{macrocode} + \bgroup% + \@ifnextnparchar\dates@serious@brace% + {\message{This should never happen}}% + {\dates@@read}% + {\egroup}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\date@@read} +% We grab everything up to the next brace. This +% will ordinarily be a single date, but it could be a +% range as well. The text for parsing is \cs{xdef}ed, +% after first \cs{let}ting \cs{end} \cs{relax}. +% The \cs{relax}ed \cs{end} will expand to itself +% (I think they call this a ``quark''?) when \cs{xdef}ed. +% Then we end the current group, which +% will restore the definition +% of \cs{end}, whatever it may happen to be. +% +% We then place a space after the argument text to be +% sure we have one there, and +% run the next macro, \cs{dates@@@read}, in front of +% it. +% \begin{macrocode} +\long\def\dates@@read#1#{% + \let\end\relax% + \xdef\cal@temp{#1 }% + \egroup% + \expandafter\dates@@@read\cal@temp} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\date@@@read} +% The \cs{dates@@@read@default} macro recursively +% picks through the argument text word by word +% using the \cs{@ifoverword} macro provided by the +% \texttt{overword} package. Through the subsequent macro +% "\dates@analyze", the definitions of +% "\dates@@@read" and of "\dates@read@exit" +% may be altered to achieve special effects. Any hooks that +% redefine these functions should chain to +% their default definitions. +% +% The \cs{@ifoverword} macro looks for \cs{dates@serious@brace} +% that we just placed after the scanned date string +% between us and the curly brace. +% +% This is one +% of several macros in the parsing chain that can +% be replaced with an alternative definition to +% accomplish special effects. +% In this code, the default +% definitions of such macros bear the root name with +% suffix "@default". Special definitions bear the root name +% with a descriptive suffix. +% \begin{macrocode} +\def\dates@@@read@default{% +% \end{macrocode} +% \textit{If this macro has been called, we carefully be +% sure it's set as the default under the root name too.} +% \begin{macrocode} + \global\let\dates@@@read\dates@@@read@default% + \@ifoverword\dates@serious@brace% +% \end{macrocode} +% \textit{If there is a match, we're at the end of the +% string. We send the word we've collected to \cs{dates@analyze}, +% and chain to the next +% processing macro, \cs{dates@@@@read}, when it exits.} +% \begin{macrocode} + {\expandafter\dates@analyze\@overword{}% + \dates@@@@read}% +% \end{macrocode} +% \textit{If the next token after the word we have just absorbed +% is not a brace (and not \cs{end}), then we send the +% absorbed word to \cs{dates@analyze} and reinvoke the +% current macro.} +% \begin{macrocode} + {\expandafter\dates@analyze\@overword{}% + \dates@@@read}% +% \end{macrocode} +% \textit{If we have hit \cs{end}, we want to recover gracefully, +% completing our work before expiring so that the \cs{end} +% can take effect.} +% +% \textit{The first thing we do is send the absorbed word to +% \cs{dates@analyze}. Then we invoke \cs{dates@read@exit} to +% process the date (calculating the long date, and performing +% the action specified in the argument to \cs{dateread}) --- +% after first relaxing \cs{dates@read}, so that the +% \cs{dates@read@exit} macro will occur only once.} +% \begin{macrocode} + {\expandafter\dates@analyze\@overword{}% + \ifnum\dates@year>0\relax% + \let\dates@read\relax% + \dates@read@exit% + \fi}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\dates@@@@read} +% The following will read arguments (one mandatory +% argument in curly braces, one optional one in square +% braces) and save them for +% use as text descriptions applying to the date. +% After the arguments are stored, we +% chain to the exit routine that will perform the action +% that the user gave to "\dateread". +% +% The macro is defined with a \texttt{@default} suffix, +% not because alternative processing is to be spliced in here, +% but because one method of ending recursive parsing +% is to \cs{let} this macro \cs{relax}. +% +% The effect we want to accomplish is to allow +% users to put any legal text, including square +% braces, inside \textrm{either} the curly braces marking +% the mandatory argument, \textrm{or} the square braces +% marking the optional argument. The usual \LaTeX{} method +% of doing this, looking for a common or garden square brace +% with \cs{@ifnextchar} and then chaining to a +% macro that uses square braces as delimiters, +% will not accomplish this purpose; with that approach, +% \textrm{any} square brace, regardless of nesting level, +% will end the argument. +% +% We need instead to see square braces as grouping characters. +% This will make them disappear when the text is expanded, but +% at least things won't blow up. +% +% To get ready for the optional argument (which comes \textrm{after} +% this macro), we set the open square brace to be a grouping +% character like "{". We can't use this directly as an argument +% (because \TeX{} will try to keep reading +% text until it finds the matching brace), so we \cs{let} +% a macro have this token's value. The \cs{let} is +% global because the value of "{" is global. +% Then we use the funny brace macro inside the +% definition as a match text for a square brace. This +% works because the \cs{@ifnextnparchar} macro also works +% with \cs{let} (well, \cs{futurelet}, which amounts to the +% same thing in this context), resulting in an internal +% ``funny brace'' macro used for the comparison. +% All of this jiggery-pokery is necessary because +% the "\futurelet" command (used by "\@ifnextnparchar") will stamp +% a category code on the brace when it sees it, even though +% \TeX{} won't yet read the character itself in for processing. +% \begin{macrocode} +\bgroup + \catcode`\[=1 + \global\let\dates@funny@brace=[ + \catcode`\<=1 + \global\let\dates@bent@brace=< +\egroup +\gdef\dates@@@@read@default#1{% +% \end{macrocode} +% We reset any alternative definitions that are accidentally +% in force, and save the text of the mandatory argument +% to its macro for future reference. +% \begin{macrocode} + \global\let\dates@@@@read\dates@@@@read@default% + \global\let\dates@@@read\dates@@@read@default% + \dates@textcount1% + \def\theshorttext{#1}% + \ifnum\dates@textcount=\dates@langnum\relax% + \gdef\thelongtext{}% + \fi% +% \end{macrocode} +% Here is where the funny brace macro referred to above +% comes into play. We change the catcodes so that +% square-brace-enclosed text will be interpreted as +% a single argument. Then we look for a brace. If +% a brace is found, we invoke \cs{dates@@@@@read} +% to read and store the text. If not, we cut off the +% special category code for square braces and +% call the macro that interprets dates (since we already +% know that we've finished with a date, and have grabbed +% the mandatory text. Likewise, if we see an \cs{end} +% out there (i.e. there was a curly-brace-enclosed +% mandatory argument right after the date, but it's +% followed immediately by \cs{end}), we also process +% the digested date before proceeding. Note that the +% \cs{end} in this event will be caught by the lookahead +% machinery at the top of the parsing chain the next time +% around, causing macro recursion to terminate. +% \begin{macrocode} + \bgroup% + \catcode`\[=1\catcode`\]=2\relax% + \catcode`\<=1\catcode`\>=2\relax% + \@ifnextnparchar\dates@funny@brace% + {\dates@@@@@read}% + {\global\let\thelongtext\theshorttext% + \@ifnextnparchar\dates@bent@brace% + {\dates@@@@read@bent}% + {\egroup% + \dates@read@exit}% + {\message{This can't happen}}}% + {\egroup% + \dates@read@exit}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\dates@@@@@read} +% The optional argument uses bog-standard \LaTeX{} +% option syntax. The only wrinkle is in the +% catcode changes invoked within a group in the +% macro above. These are cut off by an \cs{egroup} here. +% Apart from that, we just grab the text to a macro, +% and call the macro that does the final processing +% of the date and text information. +% \begin{macrocode} +\def\dates@@@@@read#1{% + \egroup% + \ifnum\dates@textcount=1\relax + \gdef\thelongtext{#1}% + \else% + \ifnum\dates@textcount=\dates@langnum\relax% + \gdef\thelongtext{#1}% + \fi% + \fi% + \bgroup% + \catcode`\<=1\catcode`\>=2\relax% + \@ifnextnparchar\dates@bent@brace% + {\dates@@@@read@bent}% + {\egroup% + \dates@read@exit}% + {\egroup% + \dates@read@exit}} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\def\dates@@@@read@bent#1{% + \egroup% + \advance\dates@textcount by1\relax% + \ifnum\dates@textcount=\dates@langnum\relax + \def\theshorttext{#1}% + \fi% + \bgroup% + \catcode`\[=1\catcode`\]=2\relax% + \catcode`\<=1\catcode`\>=2\relax% + \@ifnextnparchar\dates@funny@brace% + {\dates@@@@@read}% + {\ifnum\dates@textcount=\dates@langnum\relax% + \gdef\thelongtext{}% + \fi% + \@ifnextnparchar\dates@bent@brace% + {\dates@@@@read@bent}% + {\egroup% + \dates@read@exit}% + {\message{This can't happen}}}% + {\egroup% + \dates@read@exit}} +% \end{macrocode} +% \begin{macro}{\dates@read@exit} +% +% \begin{macrocode} +\def\dates@read@exit@default{% + \dates@verify% + \dates@fix% + \dates@lastdate\dates@date% + \ifdates@suppress@global% + \else% + \ifdates@suppress% + \else% + \dates@action% + \fi% + \fi% + \dates@read} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\dates@verify} +% This macro is used in a few places to verify whether +% all of the necessary date information is present. +% It uses a couple of toggles to allow different bits +% of the address to be confirmed. +% \begin{macrocode} +\def\dates@verify{% + \ifnum\dates@month=0% + \ifdates@requiremonth% + \PackageError{dates}{Missing month.}{}% + \else% + \global\dates@month=1% + \fi% + \fi% + \ifnum\dates@day=0% + \ifdates@requireday% + \PackageError{dates}{Missing day of the month.}{}% + \else% + \global\dates@day=1% + \fi% + \fi% + \ifnum\dates@year=0\relax% + \PackageError{dates}{Missing year in ordinary date.}{}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \subsection{Selective Handling} +% +% There are three points at which special handling can +% be spliced into the parsing routine. The defaults of +% these macros have all been presented above. Below, +% alternative versions internal to the \texttt{dates} +% package itself are set forth. +% +% The following is the default value of "\dates@read@exit". +% It fixes the date, rationalizes the registers +% containing human-readable date information, and +% saves the date for future reference (i.e.~in case +% we need it as the beginning of a range). +% It then performs the action given by the user in the +% argument to "\dateread", and attempts to chain back to continue +% parsing within the presented list of dates. +% +% \subsubsection{Recursive Handling} +% +% \begin{macro}{\dates@read@exit@range} +% +% This is meant to be spliced into the parser immediately +% before the macro: +% +% \begin{quote} +% "\dates@read@exit@default" +% \end{quote} +% +% It is invoked +% by the word "to" in the current date entry. Invoked +% after the text argument describing the current date +% has been grabbed, it begins by rationalizing the machine +% and human readable dates. It then expands the registers +% containing the starting and ending long dates describing +% a range into a list macro. The dates are stepped down one +% and up one day respectively, so that a simple ">" or "<" +% will tell us whether a given date is within a subrange. +% The list macro will later +% be used as a series of bounds +% in the generation of recursive dates and dates +% defined by a function. +% +% \begin{macrocode} +\def\dates@read@exit@range{% + \dates@fix% + \dates@subrange@end\dates@date% + \dates@reg@a=\expandafter{\dates@subranges}% + \xdef\dates@subranges{% + \the\dates@reg@a% + \noexpand\delim{\the\dates@subrange@start}% + {\the\dates@date}}% + \global\let\dates@read@exit\dates@read@exit@default% + \dates@read@exit} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\dates@read@exit@recurse} +% \begin{macro}{\dates@read@exit@@recurse} +% \begin{macro}{\dates@read@exit@@@recurse} +% +% This is the generic routine for generating dates according +% to a recursively invoked formula. It is also intended +% for splicing in in front of the macro: +% +% \begin{quote} +% "\dates@read@exit@default" +% \end{quote} +% +% The first macro in this chain checks +% to be sure that a list of ranges exists. +% It then defines the macro used to delimit the list +% to something that will recurse within a subrange. +% The list macro is then dumped into the document +% for complete expansion. When it finishes, +% control is passed back to the top, so that +% reading can continue through the list of dates. +% +% \begin{macrocode} +\def\dates@read@exit@recurse{% + \expandafter\ifcat\expandafter$\dates@subranges$% + \PackageError{dates}{No range given}% + {You need to specify a range before % + recursive entries and formulae}% + \fi\relax% + \ifx\dates@init\relax% + \ifnum\dates@day>0\relax% + \dates@everymonth@day\dates@day% + \ifnum\dates@month>0\relax% + \dates@everyyear@month\dates@month% + \global\let\dates@init\dates@init@yearly@doy% + \global\let\dates@increment\dates@increment@yearly@doy% + \else% + \global\let\dates@init\dates@init@monthly@dom% + \global\let\dates@increment\dates@increment@monthly@dom% + \fi% + \else% + \PackageError{dates}{Incomplete recursive entry}% + {You need to specify a day of the week or a day of % + the month or something for entries beginning with % + the word Every.} + \fi% + \fi% + \global\let\delim\dates@read@exit@@recurse% + \dates@subranges% + \dates@read} +% \end{macrocode} +% +% This is the macro to which "\delim" is set above. +% It sets up registers with the top and bottom boundaries +% of the range, as given in the list, then sets the +% current date to be the bottom of the range. +% It then executes an (arbitrary) function to find +% the first calculated date above the bottom of the range, +% rationalizes the human-readable date registers, and +% performs the user's requested action. It then chains to +% the macro that will loop until the range is exceeded. +% +% \begin{macrocode} +\def\dates@read@exit@@recurse#1#2{% + \dates@subrange@start#1\relax% + \dates@subrange@end#2\relax% +% \ifnum\dates@subrange@end>\dates@range@limit% +% \dates@subrange@end\dates@range@limit% +% \fi% + \dates@init% + \caldate% + \ifdates@suppress@global% + \else% + \ifdates@suppress% + \else% + \dates@action% + \fi% + \fi% + \let\next\dates@read@exit@@@recurse% + \dates@read@exit@@@recurse} +% \end{macrocode} +% +% This is the macro that does the actual recursion for recursive entries. +% It increments, checks the date, performs the action if appropriate, +% otherwise breaks the loop so that control can pass back to +% "\dates@read@exit@recurse". +% +% \begin{macrocode} +\def\dates@read@exit@@@recurse{% + \dates@increment\relax% + \ifnum\dates@date>\dates@subrange@end\relax% + \let\next\relax% + \else% + \caldate% + \ifdates@suppress@global% + \else% + \ifdates@suppress% + \else% + \dates@action% + \fi% + \fi% + \fi% + \next} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\dates@increment@daily} +% \begin{macrocode} +\def\dates@increment@daily{% + \global\advance\dates@date by 1\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\dates@init@weekly} +% \begin{macro}{\dates@increment@weekly} +% +% The following is the initialization macro for weekly recursion. +% It moves to the first instance of the targetted +% day of the week above the bottom of the subrange. +% +% \begin{macrocode} +\def\dates@init@weekly{% + \global\dates@date\dates@subrange@start% + \mod7\dates@date\dates@weekd% + \dates@three=\dates@weekd@target\relax% + \advance\dates@three by -\dates@weekd\relax% + \ifnum\dates@three<0\relax% + \advance\dates@three by7% + \fi% + \global\advance\dates@date by\dates@three\relax} +\def\dates@init@semiweekly{% + \dates@verify% + \dates@fix% + \ifnum\dates@subrange@start>\dates@date% + \dates@ct@z\dates@subrange@start% + \advance\dates@ct@z by-\dates@date% + \mod{14}\dates@ct@z\dates@catch% + \global\dates@date\dates@subrange@start% + \global\advance\dates@date by\dates@catch% + \fi} +% \end{macrocode} +% +% This is the increment macro used for weekly recursion. +% It just bumps up the date seven days each time it is invoked. +% +% \begin{macrocode} +\def\dates@increment@weekly{% + \global\advance\dates@date by7\relax} +\def\dates@increment@semiweekly{% + \global\advance\dates@date by14\relax} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\dates@init@monthly@dow} +% \begin{macro}{\dates@increment@monthly@dow} +% +% The following is the general initialization macro for finding +% an instance of a day of the week within a month. It begins +% by setting the value of a macro with which it terminates +% to be "\relax", in the hope that a match will be found +% the first time it is invoked. We then move the date +% forward, if necessary, to find the targetted day of the week. +% When this is found, we set the human-readable register +% information according to that long date (including the +% day of the month). Dividing and multiplying by "7" yields +% the largest multiple of "7" that is equal to or less than the +% day of the month. If this is "0", we're in the first week, +% if "7" we're in the second, and so forth. If the value +% of the current day is too low, we move up the date. +% If it is too high, we move to the first day +% of the next month, and request a loop back through +% the same routines. +% +% \begin{macrocode} +\def\dates@init@monthly@dow{% + \global\dates@date\dates@subrange@start% + \dates@init@monthly@@dow} +\def\dates@init@monthly@@dow{% + \let\dates@init@monthly@dow@recurse\relax% + \caldate% + \nextday\dates@weekd@target% + \caldate% + \dates@one\dates@day% + \divide\dates@one by 7\relax% + \multiply\dates@one by 7\relax% + \ifnum\dates@modulo>\dates@one\relax% + \dates@two\dates@modulo% + \advance\dates@two by -\dates@one% + \global\advance\dates@date by \dates@two% + \else% + \ifnum\dates@modulo<\dates@one\relax% + \dates@next@month% + \let\dates@init@monthly@dow@recurse\dates@init@monthly@@dow% + \fi% + \fi% +\dates@init@monthly@dow@recurse} +\def\dates@init@monthly@dom{% + \global\dates@date\dates@subrange@start% + \dates@init@monthly@@dom} +\def\dates@init@monthly@@dom{% + \let\dates@init@monthly@dom@recurse\relax% + \caldate% + \ifnum\dates@day>\dates@everymonth@day% + \dates@next@month% + \let\dates@init@monthly@dom@recurse\dates\init@monthly@@dom% + \else% + \global\dates@day\dates@everymonth@day% + \dates@fix% + \fi% + \dates@init@monthly@dom@recurse} +\def\dates@init@yearly@doy{% + \global\dates@date\dates@subrange@start% + \dates@init@yearly@@doy} +\def\dates@init@yearly@@doy{% + \let\dates@init@yearly@doy@recurse\relax% + \caldate% + \dates@ct@z\dates@day@offset% + \global\dates@day\dates@everymonth@day% + \global\dates@month\dates@everyyear@month% + \dates@fix% + \ifnum\dates@ct@z>\dates@day@offset% + \nextyear% + \dates@fix% + \let\dates@init@yearly@doy@recurse\dates@init@yearly@@doy% + \fi% + \dates@init@yearly@doy@recurse} +% \end{macrocode} +% +% This is the general incrementing macro for monthly entries. +% It's pretty simple; we just move to the first day of the +% next month, then run the initialization macro again to +% find the appropriate date within the month. +% +% \begin{macrocode} +\def\dates@increment@monthly@dow{% + \dates@next@month% + \dates@init@monthly@@dow} +\def\dates@increment@monthly@dom{% + \dates@next@month% + \dates@init@monthly@@dom} +\def\dates@increment@yearly@doy{% + \nextyear% + \global\dates@month=\dates@everyyear@month\relax% + \global\dates@day=\dates@everymonth@day\relax% + \dates@fix% + \dates@init@yearly@@doy} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\dates@@@read@function} +% \begin{macro}{\dates@@@read@@function} +% +% This is designed to be spliced into the parser +% immediately before the macro: +% +% \begin{quote} +% "\dates@@@read@default". +% \end{quote} +% +% It is invoked, like the other special handling routines, +% via the "\dates@execute" hook in the text analyzer +% (see \ref{analyze} for details). It reads two +% arguments immediately following the word that +% triggers it. It stores these for reference. +% The third argument is read after checking to be +% sure that we have reached the end of the parsing +% string, and are looking at the delimiter that +% ends it. Then this is gobbled, and dumped into the +% document so that the definitions it contains will +% take effect. The jiggery-pokery with grouping +% limits the effect of "\makeatletter" to the +% scope of the braces delimiting the user's +% function definition, while the macros he defines +% there can be defined locally. +% +% This third argument should not produce any printed output, and should define, +% at minimum, two macros, the names of which are given as +% the first and second arguments following the invoking +% word in the parsed text. The first of these will +% initialize to the first date conforming to the formula, +% counting from the bottom of a range of dates, and should +% return a long date in "\dates@date". The second should +% increment upward one date from a given date, also returning +% the result in "\dates@date". The demonstration file +% contains a sample of code which calculates the phases of +% the moon. +% +% \begin{macrocode} +\long\def\dates@@@read@function #1 #2 {% + \xdef\dates@init{\csname#1\endcsname}% + \xdef\dates@increment{\csname#2\endcsname}% + \@ifnextnparchar\dates@serious@brace% + {\bgroup% + \makeatletter% + \expandafter\dates@@@read@@function}% + {\PackageError% + {dates}% + {Extra text after function names}% + {The third argument must be in curly braces.}}% + {\relax}} +% \end{macrocode} +% +% \begin{macrocode} +\long\def\dates@@@read@@function#1{% + \long\gdef\dates@temp{#1}% + \egroup% + \dates@temp% + \let\dates@temp\relax% + \dates@@@@read@default} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{The Analyzer} +% +% Human-readable dates are fetched word by word by +% the above routines. The "\dates@@@read@default" +% macro feeds individual words to the analyzer +% described here. +% +% \begin{macro}{dates@analyze} +% +% This +% is a pretty straightforward set of nested +% conditions that will uniquely identify an item +% as a month, a year, a day or a time, and respond +% accordingly. The macro is somewhat long, so +% comments are provided to indicate nesting +% levels and their functions. +% +% \begin{macrocode} +\long\def\dates@analyze#1#2#{% +% \end{macrocode} +% +% \begin{description} +% \item[Level One] Check to see if we're dealing with a number. +% If so, define a macro containing only zero to use in a series of +% parsing checks. +% \end{description} +% +% \begin{macrocode} + \ifcat\noexpand#11% + \def\dates@zero{0}% +% \end{macrocode} +% +% \begin{description} +% \item[Level Two] Check to see if this is not a range of times. +% \end{description} +% +% \begin{macrocode} + \expandafter\dates@check@hyphen\@overword-{}% + \ifx\dates@arg@b\dates@zero% +% \end{macrocode} +% +% \begin{description} +% \item[Level Three] It now looks like this either a lone time or +% an integer. Check to see if it's not a time. (We use "\@overword", +% but it will have the same content as "\dates@arg@a"). +% \end{description} +% +% \begin{macrocode} + \expandafter\dates@check@colon\@overword:{}% + \ifx\dates@arg@b\dates@zero% +% \end{macrocode} +% +% \begin{description} +% \item[Level Four] Alright, so it's an integer. That means it's either a year +% or a day of the month. The instructions require a 4-digit +% year, which is always larger than a day of the month. +% \end{description} +% +% \begin{macrocode} + \expandafter\ifnum\@overword>31% + \setyear{\dates@arg@a}% + \else% + \ifnum\dates@day>0% + \dates@dayerror% + \else% + \global\dates@day=\dates@arg@a% + \fi% + \fi% +% \end{macrocode} +% +% \begin{description} +% \item[Level Three (again)] If the item was a lone time, we set variables +% accordingly. +% \end{description} +% +% \begin{macrocode} + \else% + \expandafter\dates@strip@colon\dates@arg@b% + \global\dates@time@start=\dates@arg@a% + \global\multiply\dates@time@start by 60% + \global\advance\dates@time@start by \dates@arg@b% + \global\dates@time@end=\dates@time@start% + \fi% +% \end{macrocode} +% +% \begin{description} +% \item[Level Two (again)] If it was a range of times, we have the +% extremes of the range in "\dates@arg@a" and "\dates@arg@b". +% We process each so that a colon delimiter is not required, +% but will be recognized if given. Note the "0" in the definition +% of "\dates@check@colon" et al., above; this produces a default of zero +% if this is a bare number with no colon delimiter. +% +% We proceed by first setting aside the contents of "\dates\arg@b" +% so that they will not be overwritten. We then check for the +% existence of a colon and, if one is found, the trailing +% colon left by the test macro is stripped off. We then +% set the time. +% \end{description} +% +% \begin{macrocode} + \else% + \expandafter\dates@strip@hyphen\dates@arg@b% + \let\dates@temp\dates@arg@b% + \expandafter\dates@check@colon\dates@arg@a:{}% + \ifx\dates@arg@b\dates@zero% + \else% + \expandafter\dates@strip@colon\dates@arg@b% + \fi% + \global\dates@time@start=\dates@arg@a\relax% + \global\multiply\dates@time@start by 60\relax% + \global\advance\dates@time@start by \dates@arg@b\relax% +% \end{macrocode} +% +% \begin{description} +% \item[Level Two (continued)] We then do exactly the same thing for the second time +% given. +% \end{description} +% +% \begin{macrocode} + \expandafter\dates@check@colon\dates@temp:{}% + \ifx\dates@arg@b\dates@zero% + \else% + \expandafter\dates@strip@colon\dates@arg@b% + \fi% + \global\dates@time@end=\dates@arg@a\relax% + \global\multiply\dates@time@end by 60\relax% + \global\advance\dates@time@end by \dates@arg@b% + \fi% +% \end{macrocode} +% +% \begin{description} +% \item[Level one (again)] If "\dates@word" does not look like a +% number, then it is handled as text. +% We pass control to a macro that will +% simply execute a macro name derived from the first three +% characters of the word. If it's unknown chaff, it will therefore +% effectively be ignored. This can be used as a hook +% for defining options not included in the "dates" package +% proper. The description of the hooks used by the +% vanilla version of "dates" is given below. +% \end{description} +% +% \begin{macrocode} + \else% + \dates@execute#1#2XXX{}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\dates@execute} +% +% Used as the default action in the analyzer, this just blindly +% executes a macro that may match a day, month or option +% name. If the date string is limited by "\relax{}", +% the macro name "\relax" will be read in as a token +% for interpretation. To prevent unexpected results, +% we therefore convert a leading control sequence to a string +% within "\csname" "\endcsname". We must not give +% the same treatment to non-control-sequence items, +% however, because this would prevent the expansion of +% uppercase characters, which have been read in as active +% characters, to their lowercase counterparts. An "\ifcat" +% is used to choose which action is appropriate. The +% macros invoked by "\dates@execute" never take arguments, +% so they can be expanded within the scope of "\ifcat". +% +% \begin{macrocode} +\def\dates@execute#1#2#3#4#{% + \ifcat#1\relax% + \expandafter\csname% + \string#1#2#3mac\endcsname% + \else% + \global\dates@catch=`#1\relax + \global\advance\dates@catch by-65 + \dates@reg@a=\expandafter{\ifcase\dates@catch + a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or + m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or + y\or z\else #1\fi} + \csname\the\dates@reg@a#2#3mac\endcsname% + \fi}% +% \end{macrocode} +% \end{macro} +% +% \subsection{Fodder for the Analyzer} +% +% As can be gleaned from an examination of "\dates@execute", +% a word is read by executing a macro named using +% its first three letters. We provide definitions +% for a number of such macros here. +% +% \begin{macro}{\evemac} +% +% "Every" sets up for recursion, and for a default of +% incrementing over days of the week. +% +% \begin{macrocode} +\def\evemac{% + \global\let\dates@read@exit=\dates@read@exit@recurse} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\daymac} +% +% The following was suggested by Miroslav Novak, hacked +% together by Frank Bennett in January 1997, but awaited +% final testing while the Timetable package stabilized. +% It was reported to fail by Miroslav on 5 March 1997, +% and a fix was put in place and released by Frank on 6 March. +% +% \begin{macrocode} +\def\daymac{% + \global\let\dates@init=\dates@init@daily% + \global\let\dates@increment=\dates@increment@daily} +\def\dates@init@daily{% + \global\dates@date=\dates@subrange@start} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\othmac} +% +% "Other" will modify the effect of "every" to +% choose every other date within the range, beginning +% with the specified date. The specified date need not +% be within the range. +% \begin{macrocode} +\def\othmac{% + \global\let\dates@init=\dates@init@semiweekly% + \global\let\dates@increment=\dates@increment@semiweekly} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\firmac} +% \begin{macro}{\secmac} +% \begin{macro}{\thimac} +% +% "First", "second" and "third" will set a counter than controls which +% instance of a day of the week within a month should be chosen, +% and modifies the effect of "every" to recurse on that +% instance within every month, within the subrange. +% \begin{macrocode} +\def\firmac{% + \dates@modulo=0% + \global\let\dates@init=\dates@init@monthly@dow% + \global\let\dates@increment=\dates@increment@monthly@dow}% +% +\def\secmac{% + \dates@modulo=7% + \global\let\dates@init=\dates@init@monthly@dow% + \global\let\dates@increment=\dates@increment@monthly@dow}% +% +\def\thimac{% + \dates@modulo=14% + \global\let\dates@init=\dates@init@monthly@dow% + \global\let\dates@increment=\dates@increment@monthly@dow}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\toXmac} +% +% The following responds to "to" in the parsed text. If +% the year is zero, it sets +% the bottom of a range to the last date encountered, and +% lets the exit macro for processing a finished date be +% one which will set the top of the range before performing +% the action specified by the user. +% If the year is greater than zero, we grab the \textit{current} +% date, reset everything to zero, and continue parsing. +% This permits ``no frills'' range designations, as +% in the "calendar" package. +% +% The "X" is appended to +% fill out to three characters. For reasons that I do not +% fully understand, this was necessary to prevent the +% package from exiting within the scope of a group. +% +% \begin{macrocode} +\def\toXmac{\relax% + \ifnum\dates@year=0% + \dates@subrange@start\dates@lastdate% + \else% + \dates@fix% + \dates@subrange@start\dates@date% + \global\dates@month=0% + \global\dates@day=0% + \setyear{1900}% + \fi% + \global\let\dates@read@exit\dates@read@exit@range}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\funmac} +% +% The following causes a function definition to be read +% immediately after the word "function" in the date text. +% +% \begin{macrocode} +\def\funmac{% + \global\let\dates@read@exit=\dates@read@exit@recurse% + \global\let\dates@@@read=\dates@@@read@function} +% \end{macrocode} +% \end{macro} +% +% The following causes the suppression of any action +% in respect of the entry in which it is found. +% +% \begin{macrocode} +\def\remmac{% + \global\dates@suppresstrue} +% \end{macrocode} +% +% \begin{macro}{\janmac} +% \begin{macro}{\jancheckmac} +% +% The months are defined globally using a recursive engine +% that is discarded when the macros have been defined. +% Each month macro first sets a counter to the number of +% days in the month, so that a range check can be performed +% when the date is interpreted. It then checks to +% see if a month has already been selected, and if so +% it forces a fatal error; otherwise, the month counter +% is set to the appropriate value. +% +% \begin{macrocode} +\bgroup + \def\monthdata#1#2#3#4#5\end{% + \expandafter\gdef\csname#2#3#4mac\endcsname{% + \ifnum\dates@month>0% + \dates@montherror% + \else% + \global\dates@month=#1% + \fi}% + \ifcat$#5$\let\next\@gobble\else\let\next\monthdata\fi% + \next#5\end}% +% \end{macrocode} +% +% +% The following does the action generation of month macros. +% \begin{macrocode} + \monthdata1jan2feb3mar4apr5may6jun% + 7jul8aug9sep{10}oct{11}nov{12}dec\end +\egroup +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\monmac} +% +% Days of the week are specified in a similar fashion. +% +% \begin{macrocode} +\bgroup + \def\weekdata#1#2#3#4#5\end{% + \expandafter\gdef\csname #2#3#4mac\endcsname{% + \ifnum\dates@weekd@target<7\relax% + \dates@weekerror% + \else% + \global\dates@weekd@target=#1\relax% + \ifx\dates@init\relax% + \global\let\dates@init\dates@init@weekly% + \fi% + \ifx\dates@increment\relax% + \global\let\dates@increment\dates@increment@weekly% + \fi% + \fi}% + \ifcat$#5$\let\next\@gobble\else\let\next\weekdata\fi% + \next#5\end} + \weekdata0sun1mon2tue3wed4thu5fri6sat\end +\egroup +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\dates@montherror} +% \begin{macro}{\dates@weekerror} +% \begin{macro}{\dates@dayerror} +% +% These three macros are used in the above definitions +% to produce error messages if something is wrong +% with a date. +% +% \begin{macrocode} +\def\dates@montherror{% + \PackageError{dates}{Month multiply defined}{% + You have set the month more than once here.}} +\def\dates@dayerror{% + \PackageError{dates}{Day multiply defined}{% + You have set the day more than once here.}} +\def\dates@weekerror{% + \PackageError{dates}{Week multiply defined}{% + You have set the day of the week more than once here.}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Low-level Bits and Pieces} +% +% \begin{macro}{\dates@capsdown} +% +% The "\lowercase" function provided in \TeX{} does not +% operate in \TeX{}'s mouth, and so cannot be used to +% create lowercase strings for export to a non-DVI +% file or for display on the terminal. +% We can get around this problem by +% making all upper-case characters +% active, and defining them to lowercase themselves. The +% operative definition is "\dates@capsdown". +% The +% grouping culls the bootstrapping definitions used to +% create these macros from memory. A detailed explanation +% these macros is not given here, but they do work. +% Essentially, they function by looping over sets of three +% characters, two uppercase and one lowercase, building a +% macro ("\dates@capsdown") that will make the uppercase +% characters in the list locally active, with the appropriate +% definition. Two uppercase characters are required in the +% list because on is read to identify the character so +% that it can be made active in order, on the second read, +% to take its active form and define it. +% +% \begin{macrocode} +%<*cull> +\bgroup +\dates@reg@a={} +\gdef\dates@capsdown{} +\def\dates@capsactive#1{% + \ifx#1\end% + \let\next\relax% + \else% + \catcode`#1=13% + \let\next\dates@@capsactive% + \fi% + \next} +\def\dates@@capsactive#1#2{% + \dates@reg=\expandafter{% + \dates@capsdown\catcode`#1=13\def#1{#2}}% + \xdef\dates@capsdown{\the\dates@reg}% + \let\next\dates@capsactive% + \next} +\dates@capsactive% + AAaBBbCCcDDdEEeFFfGGgHHhIIiJJjKKk% + LLlMMmNNnOOoPPpQQqRRrSSsTTtUUuVVv% + WWwXXxYYyZZz\end +\egroup +%</cull> +% \end{macrocode} +% \end{macro} +% +% For parsing strings, we use some little +% macros to identify strings that have a colon in +% them (which will be assumed to be a time) +% or a hyphen (assumed to be a range of times), +% and to strip those off where necessary. +% +% \begin{macrocode} +\def\dates@check@colon#1:#2#{% + \def\dates@arg@a{#1}% + \def\dates@arg@b{0#2}} +\def\dates@strip@colon#1:{% + \def\dates@arg@b{#1}} +\def\dates@check@hyphen#1-#2#{% + \def\dates@arg@a{#1}% + \def\dates@arg@b{0#2}} +\def\dates@strip@hyphen#1-{% + \def\dates@arg@b{#1}} +% \end{macrocode} +% +% The following macro is used to terminate +% processing. +% +% \begin{macrocode} +\expandafter\expandafter\expandafter\def% + \expandafter\csname% + \string\relaxXXmac\endcsname{% + \global\let\dates@@@@read\relax} +% \end{macrocode} +% +% +% +% \subsection{Interface Macros for Date Info} +% +% \begin{macro}{\theyear} +% \begin{macro}{\themonth} +% \begin{macro}{\theshortmonth} +% \begin{macro}{\themonthnumber} +% \begin{macro}{\theday} +% \begin{macro}{\theweekday} +% \begin{macro}{\theshortweekday} +% \begin{macro}{\thelongdate} +% \begin{macro}{\themonthdays} +% \begin{macro}{\theshorttext} +% \begin{macro}{\thelongtext} +% +% \label{interface} These macros can be used to include date information +% in the text fed to "\dateread". They do not contain +% unprintable operations, and so can be used to display +% text on the terminal as well as in a document. All +% are updated from the long date by the "\caldate" command. +% The macros "\theshorttext" and "\thelongtext" are +% defined elsewhere on the fly; token registers cannot +% be used for these because they must be allowed to +% expand fully on the terminal. +% +% \begin{macrocode} +\def\theyear{\the\dates@year@full} +% \def\themonth{\the\dates@monthname} +% \def\theshortmonth{\the\dates@monthname} +\def\themonthnumber{\the\dates@month} +\def\theday{\the\dates@day} +% \def\theweekday{\the\dates@dayname} +% \def\theshortweekday{\the\dates@shortweekday} +\def\thelongdate{\the\dates@date} +\def\themonthdays{\the\dates@days} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Maths Functions for Dates} +% +% The following code is an almost direct rip-off of the +% "calendar" macros for plain \TeX{} that are stored on +% CTAN. If anyone knows who the author is, I will be happy +% to include a credit here. I have made scant effort +% to document the code, but it works well. +% +% \begin{macro}{\setyear} +% +% Set the current year. +% +% \begin{macrocode} +\def\setyear#1{\dates@year=#1% + \advance\dates@year by -1900\calculateyearbase} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\nextyear} +% +% Advance by one year +% +% \begin{macrocode} +\def\nextyear{\advance\dates@year by1% + \calculateyearbase} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\dates@next@month} +% Advance by one month. +% +% \begin{macrocode} +\def\dates@next@month{% + \ifnum\dates@month=12% + \advance\dates@year by 1\calculateyearbase% + \global\dates@month=1% + \global\dates@day=1% + \else% + \global\advance\dates@month by 1% + \global\dates@day=1% + \fi% + \dates@fix} +% \end{macrocode} +% \end{macro} +% +% Set the current time zone. +% +% \begin{macro}{\settimezone} +% \begin{macrocode} +\def\settimezone#1{\dates@timezone=#1% + \multiply\dates@timezone by 1000% + \divide\dates@timezone by24} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\calculateyearbase} +% +% Set the "\ifleapyear" toggle. Set "\dates@yearbase" to the number of +% days passed from 1900, Jan 0 to New year's date in the target year. +% +% \begin{macrocode} +\def\calculateyearbase{% + \global\dates@yearbase=-1% + {\dates@ct@z=\dates@year\divide\dates@ct@z by4% + \multiply\dates@ct@z by4\relax% + \ifnum\dates@year=\dates@ct@z% + \global\dates@catch=0% + \else% + \global\dates@catch=1% + \fi}% + \ifcase\dates@catch \leapyeartrue\or% + \leapyearfalse\fi% + {\dates@ct@z=\dates@year\multiply\dates@ct@z% + by1461\advance\dates@ct@z by3% + \divide\dates@ct@z by4% + \global\dates@catch=\dates@ct@z}% + \global\advance\dates@yearbase by\dates@catch\relax% + \ifnum\dates@year=0\global\dates@yearbase=0\leapyearfalse\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\monthdays} +% +% Set the number of days passed at the end of each month in "\dates@day". +% +% \begin{macrocode} +\def\monthdays{% +\global\dates@catch\ifcase\dates@month% + 0\or31\or% + 59\or90\or120\or151\or181\or212\or% + 243\or273\or304\or334\or365\fi% + {\ifleapyear\ifnum\dates@month>1% + \global\advance\dates@catch by1\fi\fi}% +% ??????????? ************ global okay here? + \global\dates@day@offset=\dates@catch} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\dates@fix} +% +% Return the long date of "\dates@month", "\dates@day" in the year "\dates@year" +% in "\dates@date" after checking to be sure that the month and the day +% have been set, if confirmation has been toggled on, and that +% the number of days +% in the month conforms to the constraints of reality. +% +% This can now be invoked by itself; there is no need to follow +% it with \cs{caldate}. +% \begin{macrocode} +\def\dates@fix{% + \dates@year@get% + \dates@monthname@get% + \ifnum\dates@days<\dates@day% + \PackageError{dates}{Day of month out of range}{% + There are only \the\dates@days\space days in % + \themonth, but you have tried^^J% + to specify \the\dates@day.}% + \else% + \global\dates@date=\dates@day{\advance\dates@month by-1% + \monthdays% + \global\advance\dates@date by\dates@day@offset% + \global\advance\dates@date by\dates@yearbase}% + \fi% + \dates@dayname@get} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mod} +% +% Long date "MOD 7" will give the week day. +% Sunday is "0" and Saturday is "6". The base +% number is returned in "\dates@three", +% the mod in "#3". +% +% \begin{macrocode} +\def\mod#1#2#3{\dates@three=#2\relax% + \dates@four=\dates@three% + \divide\dates@three by#1% + \multiply\dates@three by#1% +\advance\dates@four by-\dates@three% + #3=\dates@four} + +\def\dates@year@get{% + \global\dates@year@full\dates@year% + \global\advance\dates@year@full by 1900\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\theweekday} +% +% Set the names of week day (Local). +% +% \begin{macrocode} +\def\dates@dayname@get{\mod7\dates@date\dates@weekd} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caldate} +% +% Gives the usual calendar date for +% a long date in counter "\dates@date". +% Returned in "\dates@day", "\dates@month" and "\dates@year" +% and other registers. See the interface macros above +% under \ref{interface}. +% +% \begin{macrocode} +\def\caldate{\dates@year=\dates@date% + \multiply\dates@year by4\divide\dates@year by1461% + \calculateyearbase% + {\advance\dates@date by-\dates@yearbase\global\dates@month=0% + \loop\monthdays\ifnum\dates@day@offset<\dates@date% + \global\advance\dates@month by1\repeat% + {\advance\dates@month by-1\monthdays% + \advance\dates@date by-\dates@day@offset% + \global\dates@day=\dates@date}}% + \dates@year@get% + \dates@monthname@get% + \dates@dayname@get} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\dates@monthname@get} +% +% This stores the names of the months to registers. +% It is run by "\caldate". The definition here +% is performed in the alternative, depending upon +% the value of the "\dates@language" counter. This +% counter is set in the options section. Packages +% which draw on the Dates package (such as Calendar, +% and the various Calendar style packages) can pass +% the language options down to the Dates package through +% the standard \LaTeXe{} package interface. Because Japanese +% high-bit code may case a non-Japanese version of +% \LaTeXe to fail, we allow for its exclusion here. +% The odd structure of this is necessary to cope with the +% fact that the "\ifcase" function is blind to the nesting +% of case conditions. +% \begin{macrocode} +% Japanese removed. +\def\dates@monthname@get{% + \ifcase\dates@month% + \or% + \global\dates@days=31\relax% + \or% + \ifleapyear% + \global\dates@days=29\relax% + \else% + \global\dates@days=28\relax% + \fi% + \or% + \global\dates@days=31\relax% + \or% + \global\dates@days=30\relax% + \or% + \global\dates@days=31\relax% + \or% + \global\dates@days=30\relax% + \or% + \global\dates@days=31\relax% + \or% + \global\dates@days=31\relax% + \or% + \global\dates@days=30\relax% + \or% + \global\dates@days=31\relax% + \or% + \global\dates@days=30\relax% + \or% + \global\dates@days=31\relax% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\nextday} +% +% Find the next (previous) day after +% (before) "\dates@date" with "\mod7=#1". +% +% \begin{macrocode} +\def\nextday#1{{\dates@ct@z=#1\mod7\dates@date\dates@weekd% + \advance\dates@ct@z by-\dates@weekd\relax% + \ifnum\dates@ct@z<0\advance\dates@ct@z by7\fi% + \global\advance\dates@date by\dates@ct@z}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\prevday} +% +% \begin{macrocode} +\def\prevday#1{\snextday#1% + \global\advance\dates@date by-7} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\snextday} +% +% \begin{macrocode} +\def\snextday#1{\global\advance\dates@date by1% + \nextday#1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sprevday} +% +% \begin{macrocode} +\def\sprevday#1{\global\advance\dates@date by-1% + \prevday#1} +% \end{macrocode} +% \end{macro} +% +% Convert from Julian date and time in +% \date to long date (in local time) +% +% \begin{macrocode} +\def\jdttol{\advance\dates@date by500% +%\message{Ran jdttol^^J}% + \advance\dates@date by\dates@timezone% + \global\divide\dates@date by1000} +% \end{macrocode} +% +% \subsection{Trigonometric Functions} +% +% \begin{macrocode} +\def\sintable#1{\ifcase #1 0\or100\or199% + \or296\or389\or479\or565\or644\or717% + \or783\or841\or891\or932\or964\or985% + \or997\or1000\or992\or974\or946\or909% + \or863\or808\or746\or675\or598\or516% + \or427\or335\or239\or141\or42\or-58% + \or-158\fi} +% \end{macrocode} +% +% Reduces modulo "2\pi" (requires positive +% argument theta): +% "theta := theta" "MOD 2\pi", where +% "theta = count1*10^(-3)" +% +% \begin{macrocode} +\def\twopimod{\count2 =\count1% + \divide\count2 by6284 \count3 =1853% + \count4 =6283\multiply\count3 by\count2% + \multiply\count4 by\count2% + \divide\count3 by10000% + \advance\count3 by\count4% + \advance\count1 by-\count3}% +% \end{macrocode} +% +% "v := sin(theta)", where +% "v = count4*10^(-3)"; +% "theta = count1*10^(-3)" +% theta is reduced "MOD 2\pi" to be +% "0<=theta<2\pi" by "\TWOPIMOD", +% then linear interpolation is performed +% using "\SINTABLE". +% +% \begin{macrocode} +\def\sin{\relax% + \ifnum\count1<0 \signtrue% + \count1=-\count1\else \signfalse\fi% + \loop\ifnum\count1>6284\twopimod\repeat\relax% + \ifnum\count1>3142% + \advance\count1 by-3142% + \ifsign\signfalse\else\signtrue\fi\fi% + \multiply\count1 by10\count3=\count1% + \divide\count3 by1000\count2=\count3% + \multiply\count3 by1000% + \advance\count3 by-\count1 % + \count5 =\sintable{\count2 }% + \count4 =\count5\advance\count2 by1% + \advance\count4 by -\sintable{\count2}% + \multiply\count4 by\count3% + \divide\count4 by1000% + \advance\count4 by\count5% + \ifsign\count4 =-\count4\fi}% +% \end{macrocode} +% +% "v := cos(theta)", where +% "v = count4*10^(-3)"; +% "theta = count1*10^(-3)". +% "\SIN" is evaluated on "pi/2-theta". +% \begin{macrocode} +\def\cos{\advance\count1 by-1571% + \multiply\count1 by-1\sin}% +% \end{macrocode} +% Linear transformation of T giving +% "theta := a*T+b", where +% "T = dates@ct@z*10^(-6)"; +% "theta = count1*10^(-3)"; +% "a = #1*10^3+#2+#3*10^(-3)"; +% "b = #4*10^(-3)" +% +% \begin{macrocode} +\def\lin#1.#2.#3+#4.{\count1=#3% + \count2=#2\count3=#1% + \multiply\count1 by\dates@ct@z% + \multiply\count2 by\dates@ct@z\relax% + \multiply\count3 by\dates@ct@z% + \divide\count1 by1000% + \advance\count1 by\count2% + \divide\count1 by1000% + \advance\count1 by\count3% + \advance\count1 by #4\relax} +% \end{macrocode} +% +% Accumulate value returned by a +% trigonometric function, scaled by +% factor f, into count6: +% "ac := ac+f*v", where +% "ac = count6*10^(-7)" +% "v = value" of "SIN" or "COS =count4*10^(-3)" +% "f = #1*10^(-4)" +% +% \begin{macrocode} +\def\fac#1{\multiply\count4 by #1% + \advance\count6 by\count4} +\def\id{\count4=\count1} % Identity +% \end{macrocode} +% +% \subsection{Initialization} +% +% Before anything further is executed, the following registers +% and macros need to be in place. +% +% \begin{macrocode} +\newcount\dates@textcount +\newcount\dates@ct@z +\newcount\dates@range@limit +\newcount\dates@year +\newcount\dates@timezone +\dates@timezone=0 +\newcount\dates@catch +\newcount\dates@day +\newcount\dates@day@offset +\newcount\dates@everymonth@day +\newcount\dates@everyyear@month +\newcount\dates@month +\newcount\dates@date +\newcount\dates@date@current +\newcount\dates@three +\newcount\dates@four +\newcount\dates@weekd +\newcount\dates@time@start +\newcount\dates@time@end +\newcount\dates@subrange@start +\newcount\dates@subrange@end +\newcount\dates@days +\newcount\dates@lastdate +\newcount\dates@yearbase +\newcount\dates@weekd@target +\newcount\dates@modulo +\newcount\dates@year@full +\newcount\dates@extra@day +\newtoks\dates@reg +\newtoks\dates@dayname +\newtoks\dates@shortweekday +\newtoks\dates@monthname +\newtoks\dates@shortmonthname +\newif\ifdates@requiremonth +\newif\ifdates@requireday +\newif\ifdates@suppress +\newif\ifdates@suppress@global +\newif\ifleapyear +\let\delim\relax +\let\dates@serious@brace={ +\def\dates@empty{} +%</style> +% \end{macrocode} +% +%\iffalse +% +% \section{Demonstration File} +% +% \begin{macrocode} +%<*demo> +\documentclass{minimal} +\usepackage{dates} +\begin{document} + +\makeatletter +% +% We say HI to the user +\message{^^J---------------------------------------------------------} +\message{This is a demonstration file for the LaTeX dates package.} +\message{It will print a number of dates to the terminal.^^J} +\message{The code demonstrated by this package is not intended} +\message{for direct use by humans, so I have not worked very hard} +\message{to make its output look pretty, and it won't actually} +\message{print anything. But if you get a cluttered list of dates} +\message{and no error messages, the package is working for you.} +\message{---------------------------------------------------------} +% +% We invoke the \dateread command. +% +\dateread +% +% We tell it to report a few details to the terminal. +% +{\message{\theshorttext}% + \message{\theday/\the\dates@month/\the\dates@year}% + \ifx\thelongtext\dates@empty% + \else% + \message{\thelongtext}% + \fi} +% +% The following are ranges. +% + december 10 1995 {Start of First Period of Time} +to jan 10 1996 {End of First Period of Time} + december 10 1996 {Start of Second Period of Time} +to jan 10 1997 {End of Second Period of Time} +% +% The following are specific dates (obviously) +% +February 18 1997 {Frank's Next Birthday} + [The best presents come in small packages.^^JIt + would be a terrific present for someone to make + this one smaller.] +February 18 1998 {Frank's Next Birthday But One} +% +% These are a couple of recursive dates. +% +Every Monday {(Monday Coffee)} +Every Third Tuesday {(Third Tuesday Meeting)} +Function moonsinit moonsincrement {% + \global\dates@date=\dates@subrange@start% + \caldate% + \newcount\moonno% + \newif\ifsign% + \def\firstmoon{\moonno=\dates@year + \multiply\moonno by123685 + \divide\moonno by10000 + \multiply\moonno by4\advance\moonno by-1 + \loop\moondate\relax + \ifnum\dates@date<\dates@subrange@start + \advance\moonno by1\repeat} +% Compute date for cycle quarter MOONNO + \def\moondate{{\dates@ct@z=\moonno + \lin 202.126.369+0.\dates@ct@z=\count1 + \count6=0 + \lin 0.2.319+2907.\sin\fac{3} + \divide\count6 by1000 + \lin 365.249.86+7593.\id\fac{1} + \divide\count6 by10\count7 =\count6 + \ifodd\moonno\quarters + \else\fullornew\fi\global\dates@date=\count7} + \jdttol} +% Correction for full and new moon + \def\fullornew{\count6=0 + \lin -393.0.0+0. + \divide\count1 by100000000 + \advance\count6 by\count1 + \lin 0.628.300+6269.\sin + \multiply\count6 by\count4 + \lin -7.-700.-369+ 928.\sin\fac{ -74} + \lin 0. 628. 300+ 6269.\sin\fac{ 1734} + \lin 1. 256. 600+12539.\sin\fac{ 21} + \lin 8. 328. 670+ 5341.\sin\fac{-4068} + \lin 8. 538. 220+-4597.\sin\fac{ 10} + \lin 8. 956. 970+11610.\sin\fac{ -51} + \lin 16. 238. 589+-5526.\sin\fac{ -4} + \lin 16. 657. 340+10682.\sin\fac{ 161} + \lin 16. 866. 890+ 743.\sin\fac{ 104} + \lin 17. 285. 640+16951.\sin\fac{ 50} + \lin 17. 495. 190+ 7013.\sin\fac{ 4} + \lin 24. 986. 10+16023.\sin\fac{ -4} + \lin 25. 195. 560+ 6084.\sin\fac{ -6} + \divide\count6 by10000 + \advance\count7 by\count6 } +% Correction for quarters + \def\quarters{\lin -393.0.0+0. + \divide\count1 by100000000 + \count6 =\count1 \lin 0.628.300+6269. + \sin\multiply\count6 by\count4 + \lin -16. -29. -40+-4413.\sin\fac{ 40} + \lin -7.-700.-369+ 928.\sin\fac{ -47} + \lin -7. -72. -69+ 7198.\sin\fac{ -30} + \lin 0. 628. 300+ 6270.\sin\fac{ 1721} + \lin 1. 256. 600+12539.\sin\fac{ 21} + \lin 8. 328. 670+ 5341.\sin\fac{-6280} + \lin 8. 538. 220+-4598.\sin\fac{ 21} + \lin 8. 956. 970+11611.\sin\fac{ -119} + \lin 16. 238. 589+-5526.\sin\fac{ -4} + \lin 16. 657. 340+10682.\sin\fac{ 89} + \lin 16. 866. 890+ 743.\sin\fac{ 79} + \lin 17. 285. 640+16952.\sin\fac{ 3} + \lin 17. 495. 190+ 7013.\sin\fac{ 3} + \lin 24. 986. 10+16023.\sin\fac{ -4} + \lin 25. 195. 560+ 6085.\sin\fac{ -6} + \count8=\count6\count6=28000 + \lin 628. 300. 373+ 6270.\cos\fac{ -4} + \lin 8. 328. 670+ 5341.\cos\fac{ 3} + \count2=\moonno + \advance\count2 by-1\divide\count2 by2 + \ifodd\count2\multiply\count6 by-1 \fi + \advance\count6 by\count8 + \divide\count6 by10000 + \advance\count7 by\count6 } +% Events for phases. +% Uses PHASE (local). + \def\phase{{\dates@ct@z=\moonno + \count1=\moonno + \divide\dates@ct@z by4\multiply\dates@ct@z by4 + \advance\count1 by-\dates@ct@z\relax + \xdef\themoon{\ifcase\count1 + New Moon\or First Quarter\or + Full Moon\or Last Quarter\fi}}} + \gdef\moonsinit{% + \firstmoon + \global\dates@month=12\global\dates@day=31\dates@fix\global\advance\dates@date by1 + \count1=\dates@date + \moondate + \phase + \caldate} + \gdef\moonsincrement{% + \advance\moonno by 1 + \moondate\phase + \caldate} + } + {\themoon} +\end{document} +%</demo> +% \end{macrocode} +% \section{The Installation File} +% \begin{macrocode} +%<*installer> +\def\batchfile{dates.ins} +\input docstrip.tex + +\keepsilent + +\preamble + +This file is part of the Dates package. +Copyright (C) 1996, 1997 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 this a more powerful, +friendlier, and better package, please contact me on +`fb' at soas.ac.uk + +\endpreamble + +\generate{\file{dates.sty} {\from{dates.dtx}{style}} + } + +\generate{\file{demodate.tex} {\from{dates.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 dates.sty} +\Msg{*} +\Msg{***********************************************************} + +%</installer> +% \end{macrocode} +%\fi +% \Finale \PrintChanges + diff --git a/Master/texmf-dist/source/latex/calendar/demo1997.cld b/Master/texmf-dist/source/latex/calendar/demo1997.cld new file mode 100644 index 00000000000..86b7befb545 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/demo1997.cld @@ -0,0 +1,13 @@ +%% +%% This is file `demo1997.cld', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% caldemos.dtx (with options: `1997') +%% +January 1 1997 to December 31 1997 {The year 1997} + +%% +%% +%% End of file `demo1997.cld'. diff --git a/Master/texmf-dist/source/latex/calendar/demoapt.cld b/Master/texmf-dist/source/latex/calendar/demoapt.cld new file mode 100644 index 00000000000..dfff29c677a --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/demoapt.cld @@ -0,0 +1,14 @@ +%% +%% This is file `demoapt.cld', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% caldemos.dtx (with options: `appts') +%% +jan 1 1997 16:00 {Nancy} [Call Nancy to confirm] +jan 1 1997 18:00-20:00 {Dinner} [New Year Dinner] + +%% +%% +%% End of file `demoapt.cld'. diff --git a/Master/texmf-dist/source/latex/calendar/demoaptr.cld b/Master/texmf-dist/source/latex/calendar/demoaptr.cld new file mode 100644 index 00000000000..622a4f97b6e --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/demoaptr.cld @@ -0,0 +1,17 @@ +%% +%% This is file `demoaptr.cld', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% caldemos.dtx (with options: `apptsr') +%% +range demo1997 {Current year} +every Monday 14:00-16:00 {Monday meeting} +every other Wednesday from 1 January 1997 10:00 {Wednesday call} +every 3 10:00-13:00 {Koffee klatch} +every first Tuesday 13:00-15:00 {Study group} + +%% +%% +%% End of file `demoaptr.cld'. diff --git a/Master/texmf-dist/source/latex/calendar/demoevt.cld b/Master/texmf-dist/source/latex/calendar/demoevt.cld new file mode 100644 index 00000000000..5c72a4382f8 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/demoevt.cld @@ -0,0 +1,13 @@ +%% +%% This is file `demoevt.cld', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% caldemos.dtx (with options: `events') +%% +jan 1 1997 {New Year} [New Year's Day] + +%% +%% +%% End of file `demoevt.cld'. diff --git a/Master/texmf-dist/source/latex/calendar/demoevtr.cld b/Master/texmf-dist/source/latex/calendar/demoevtr.cld new file mode 100644 index 00000000000..091c37ec529 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/demoevtr.cld @@ -0,0 +1,17 @@ +%% +%% This is file `demoevtr.cld', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% caldemos.dtx (with options: `eventsr') +%% +range demo1997 +every Monday {Monday event} +every other friday from 10 january 1997 {Alternate Monday} +every 3 {Third of month} +every first Tuesday {First Tuesday} + +%% +%% +%% End of file `demoevtr.cld'. diff --git a/Master/texmf-dist/source/latex/calendar/demohlst.htm b/Master/texmf-dist/source/latex/calendar/demohlst.htm new file mode 100644 index 00000000000..77e668e0fc4 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/demohlst.htm @@ -0,0 +1,14 @@ +<UL> +<LI><A NAME="35430">1 January 1997</A> +<BR>New Year's Day + <UL> + <LI>10:00 Wednesday call + <LI>16:00 Call Nancy to confirm + <LI>18:00--20:00 New Year Dinner + </UL> +<LI><A NAME="35432">3 January 1997</A> +<BR>Third of month + <UL> + <LI>10:00--13:00 Koffee klatch + </UL> +</UL> diff --git a/Master/texmf-dist/source/latex/calendar/demohml.htm b/Master/texmf-dist/source/latex/calendar/demohml.htm new file mode 100644 index 00000000000..b86fd29f95b --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/demohml.htm @@ -0,0 +1,59 @@ +<pre><B>January</B> + Wed Thu Fri Sat Sun Mon Tue + <A HREF="#35430">1</A> 2 <A HREF="#35432">3</A> 4 5 <A HREF="#35435">6</A> 7 + + 8 9 <A HREF="#35439">10</A> 11 12 <A HREF="#35442">13</A> 14 + + <A HREF="#35444">15</A> 16 17 18 19 <A HREF="#35449">20</A> 21 + + 22 23 <A HREF="#35453">24</A> 25 26 <A HREF="#35456">27</A> 28 + + <A HREF="#35458">29</A> 30 31 + +</pre> +<UL> +<LI><A NAME="35430">1 January 1997</A> +<BR>New Year's Day + <UL> + <LI>10:00 Wednesday call + <LI>16:00 Call Nancy to confirm + <LI>18:00--20:00 New Year Dinner + </UL> +<LI><A NAME="35432">3 January 1997</A> +<BR>Third of month + <UL> + <LI>10:00--13:00 Koffee klatch + </UL> +<LI><A NAME="35435">6 January 1997</A> +<BR>Monday event + <UL> + <LI>14:00--16:00 Monday meeting + </UL> +<LI><A NAME="35439">10 January 1997</A> +<BR>Alternate Monday +<LI><A NAME="35442">13 January 1997</A> +<BR>Monday event + <UL> + <LI>14:00--16:00 Monday meeting + </UL> +<LI><A NAME="35444">15 January 1997</A> + <UL> + <LI>10:00 Wednesday call + </UL> +<LI><A NAME="35449">20 January 1997</A> +<BR>Monday event + <UL> + <LI>14:00--16:00 Monday meeting + </UL> +<LI><A NAME="35453">24 January 1997</A> +<BR>Alternate Monday +<LI><A NAME="35456">27 January 1997</A> +<BR>Monday event + <UL> + <LI>14:00--16:00 Monday meeting + </UL> +<LI><A NAME="35458">29 January 1997</A> + <UL> + <LI>10:00 Wednesday call + </UL> +</UL> diff --git a/Master/texmf-dist/source/latex/calendar/demohmth.htm b/Master/texmf-dist/source/latex/calendar/demohmth.htm new file mode 100644 index 00000000000..6913b9c17b8 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/demohmth.htm @@ -0,0 +1,13 @@ +<pre><B>January</B> + Wed Thu Fri Sat Sun Mon Tue + <A HREF="#35430">1</A> 2 <A HREF="#35432">3</A> 4 5 <A HREF="#35435">6</A> 7 + + 8 9 <A HREF="#35439">10</A> 11 12 <A HREF="#35442">13</A> 14 + + <A HREF="#35444">15</A> 16 17 18 19 <A HREF="#35449">20</A> 21 + + 22 23 <A HREF="#35453">24</A> 25 26 <A HREF="#35456">27</A> 28 + + <A HREF="#35458">29</A> 30 31 + +</pre> diff --git a/Master/texmf-dist/source/latex/calendar/demolist.cld b/Master/texmf-dist/source/latex/calendar/demolist.cld new file mode 100644 index 00000000000..6ebbb65c05e --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/demolist.cld @@ -0,0 +1,14 @@ +%% +%% This is file `demolist.cld', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% caldemos.dtx (with options: `demolist') +%% +list demoevt {A separate list of events} +list demoapt {A separate list of appointments} + +%% +%% +%% End of file `demolist.cld'. diff --git a/Master/texmf-dist/source/latex/calendar/evntlist.dtx b/Master/texmf-dist/source/latex/calendar/evntlist.dtx new file mode 100644 index 00000000000..f2412966ce0 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/evntlist.dtx @@ -0,0 +1,284 @@ +%\iffalse +% +% file: evntlist.dtx +% Copyright (C) 1996-1997 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 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. +% +%\fi +% +% \def\fileversion{2.2} +% \def\filedate{1997/11/07 10:44:05} +% +% \iffalse +% +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{evntlist.dtx} +\end{document} +%</driver> +%\fi +% +%\iffalse +% evntlist.dtx,v +% Revision 3.1.1.1 1998/01/17 18:14:57 root +% Release code, checksum verified +% +% Revision 3.1 1998/01/17 17:12:58 root +% Release code +% +% Revision 1.3 1998/01/16 17:46:34 root +% *** empty log message *** +% +% Revision 1.2 1998/01/15 23:39:20 root +% *** empty log message *** +% +% Revision 1.1 1997/11/26 07:20:12 bennett +% Initial revision +% +%\fi +% +% \title{User's Guide to the Event List +% package\thanks{This file is version number +% \fileversion{}. It was last revised on +% \filedate{}.}} +% +% \author{Frank G. Bennett, Jr.} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \begin{abstract} +% \noindent This package makes a cronological list +% of events. +% \end{abstract} +% +% \CheckSum{133} +% +% Please see the file \texttt{calguide.tex} for details on the +% use of this package. +% +% \StopEventually{\PrintIndex} +% +% \section{The Class File} +% +% \subsection{Preliminaries} +% Use \LaTeXe, and tell the user who we are. +% \begin{macrocode} +%<*style> +\NeedsTeXFormat{LaTeX2e}[1995/06/01] +\ProvidesPackage{evntlist} + [1997/11/07 10:44:05 2.2 Event List (Frank Bennett)] +% \end{macrocode} +% Define some more variables and switches for use in the body +% of the style. +% +% \subsection{Options} +% +% In common with all other packages in the Calendar +% bundle, we +% include some code for declaring languages. +% +% \begin{macrocode} +\input calopts.cfg +\InputIfFileExists{dates.cfg}{}{} +\ProcessOptions +% \end{macrocode} +% +% \subsection{Option Postprocessing} +% +% Now that the options lists are available to us, +% we can start loading packages. The following packages +% are always loaded. +% \begin{macrocode} +\RequirePackage{calendar} +% \end{macrocode} +% The "color" package is only loaded if the user asked +% for it as an option to \sc{documentclass}, or in the +% "weekly.cfg" file. +% \begin{macrocode} + \newif\if@el@noheadyet + \@el@noheadyettrue + \def\el@output#1{\protected@write\@el@outputfile{}{#1}} + \def\el@maybeheader{\if@el@noheadyet% + \begin{itemize}\item\theday\space\themonth\space\theyear\@el@noheadyetfalse\fi} + \def\el@maybeitem{\if@el@noheadyet\else\item\theday\space\themonth\space\theyear% + \fi} +% \end{macrocode} +% +% \subsection{Calendar Setup} +% +% \subsection{Calendar Definition} +% +% The calendar definition itself consists of a single command +% and its associated arguments. +% \begin{macrocode} +\newcalendar% +% \end{macrocode} +% We give the environment a name. +% \begin{macrocode} +{eventlist} +% \end{macrocode} +% We're producing DVI, so we use the standard +% macro for dropping text into the hopper. +% \begin{macrocode} +{\cal@insert} +% \end{macrocode} +% Starting day for the calendar is not fixed here, +% because we don't pad with blank entries. Season to taste. +% Use integers "0" through "6". A value over 7 means no padding. +% \begin{macrocode} +{8} +% \end{macrocode} +% The length of a group is one day. +% \begin{macrocode} +{1} +% \end{macrocode} +% The length of a subgroup is one day. +% \begin{macrocode} +{1} +% \end{macrocode} +% Our delimiter is an \cs{item}. +% \begin{macrocode} +{\relax} +% \end{macrocode} +% Increment the date counter with every item. +% \begin{macrocode} +{I} +% \end{macrocode} +% Define the header. +% \begin{macrocode} +{\relax} +% \end{macrocode} +% We define the end of the calendar. This spits out +% all of the boxes one last time, and closes the page +% formatting environment. +% \begin{macrocode} +{\end{itemize}} +% \end{macrocode} +% We define a way to open a new group. In this case, +% we just relax. +% \begin{macrocode} +{\relax} +% \end{macrocode} +% We define the way to end a subgroup. This spits out +% all of the boxes built for a page of text. +% \begin{macrocode} +{\relax} +% \end{macrocode} +% We set up to require a month and day in the environment typed +% into the user's document. +% \begin{macrocode} +{\dates@requiremonthtrue\dates@requiredaytrue} +% \end{macrocode} +% The next section runs after the calendar dates have been +% scanned from the environment, but before the table is +% opened. +% \textit{Start date.} +% \begin{macrocode} +{\global\dates@date\cal@range@start% + \caldate% +% \end{macrocode} +% \textit{We tell the user where we're starting.} +% \begin{macrocode} + \message{^^JStart: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% +% \end{macrocode} +% \textit{End date.} +% \begin{macrocode} + \global\dates@date\cal@range@end% + \caldate% +% \end{macrocode} +% \textit{We let the user know where we plan to stop.} +% \begin{macrocode} + \message{^^JEnd: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% +% \end{macrocode} +% \textit{We jump back to the starting date and reset the +% human-side values.} +% \begin{macrocode} + \global\dates@date\cal@range@start% + \caldate}% +% \end{macrocode} +% Events are delimited by \cs{item}. +% \begin{macrocode} +{\item}% +% \end{macrocode} +% The next argument is dropped on DVI for each item. +% We use it here to fetch the text of appointments and +% events to the standard list macros, using the +% standard text-fetching commands. Each generates a +% stack delimited by the phrase that was set above. +% \begin{macrocode} +{\cal@get@appointments\cal@get@events}% +% \end{macrocode} +% This sets \cs{cal@entry@text}. It is executed for every +% event or appointment in the database that applies +% to a given item. We differentiate between whole-day events, +% pinpointed events and ranged events. +% \begin{macrocode} +{\relax% + \ifnum\dates@time@start>0\relax% + \ifnum\dates@time@start=\dates@time@end% + \protected@edef\cal@entry@text{% + \thetimestart\space% + \cal@textcolor{\calcolor}{\thelongtext}}% + \else% + \protected@edef\cal@entry@text{% + \thetimestart--\thetimeend\space% + \cal@textcolor{\calcolor}{\thelongtext}}% + \fi% + \else% + \protected@edef\cal@entry@text{% + \cal@textcolor{\calcolor}{\thelongtext}}% + \fi}% +% \end{macrocode} +% Finally ... +% \begin{macrocode} +{\ifcat$\theevents\theappointments$\else% +\el@maybeitem% +\el@maybeheader% +\fi% +\bgroup% +\let\item\par% +\ifcat$\theevents$\else% + \par% + \theevents% +\fi% +\egroup% +\ifcat$\theappointments$\else% +\begin{itemize}% +\item% +\theappointments% +\end{itemize}% +\fi} +%</style> +% \end{macrocode} +% \Finale \PrintChanges diff --git a/Master/texmf-dist/source/latex/calendar/htmlstuf.dtx b/Master/texmf-dist/source/latex/calendar/htmlstuf.dtx new file mode 100644 index 00000000000..0fe88334dbb --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/htmlstuf.dtx @@ -0,0 +1,385 @@ +%\iffalse +% +% file: htmlstuf.dtx +% Copyright (C) 1996-1997 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 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. +% +%\fi +% +% \def\fileversion{3.1.1.1} +% \def\filedate{1998/01/17 18:15:02} +% +% \iffalse +% +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{htmlstuf.dtx} +\end{document} +%</driver> +%\fi +% +%\iffalse +% htmlstuf.dtx,v +% Revision 3.1.1.1 1998/01/17 18:15:02 root +% Release code, checksum verified +% +% Revision 3.1 1998/01/17 17:13:14 root +% Release code +% +% Revision 1.11 1998/01/17 16:48:35 root +% *** empty log message *** +% +% Revision 1.10 1998/01/17 11:07:21 root +% *** empty log message *** +% +% Revision 1.9 1998/01/17 11:05:29 root +% *** empty log message *** +% +% Revision 1.8 1998/01/17 10:48:00 root +% *** empty log message *** +% +% Revision 1.7 1998/01/17 06:14:32 root +% *** empty log message *** +% +% Revision 1.6 1998/01/16 21:33:57 root +% *** empty log message *** +% +% Revision 1.5 1998/01/16 21:16:47 root +% *** empty log message *** +% +% Revision 1.4 1998/01/16 21:09:07 root +% *** empty log message *** +% +% Revision 1.3 1998/01/16 19:16:11 root +% *** empty log message *** +% +% Revision 1.2 1998/01/16 18:40:07 root +% *** empty log message *** +% +%\fi +% +% \title{User's Guide to the HTML Calendar +% package\thanks{This file is version number +% \fileversion{}. It was last revised on +% \filedate{}.}} +% +% \author{Frank G. Bennett, Jr.} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \begin{abstract} +% \noindent This package makes a cronological list +% of events. +% \end{abstract} +% +% \CheckSum{524} +% +% Please see the file \texttt{calguide.tex} for details on the +% use of this package. +% +% \StopEventually{\PrintIndex} +% +% \section{The Class Files} +% +% \subsection{HTML Month} +% \begin{macrocode} +%<*htmlmonth> +\NeedsTeXFormat{LaTeX2e}[1995/06/01] +\ProvidesPackage{hmonth} + [1998/01/17 18:15:02 3.1.1.1 HTML calendar (Frank Bennett)] +\RequirePackage{calendar} +\input calopts.cfg +\InputIfFileExists{dates.cfg}{}{} +\ProcessOptions +\define@key{opt}{title}{% + \def\yrly@title{#1}} +\define@key{opt}{labels}{% + \@storelabels#1,,{}} +\define@key{opt}{firstday}{% + \yrly@firstday=#1} +\define@key{opt}{outputfile}{% + \@ifundefined{html@outputfile} + {\newwrite\html@output + \gdef\html@outputfile{#1}% + \immediate\openout\html@output=\html@outputfile} + {\gdef\hm@temp{#1}% + \ifx\html@outputfile\hm@temp% + \relax% + \else% + \immediate\closeout\html@output% + \gdef\html@outputfile{#1}% + \immediate\openout\html@output=\html@outputfile\relax + \fi}} +\def\yrly@title{\themonth} +\newcount\yrly@firstday +\yrly@firstday=3\relax +\newtoks\yrly@tempreg@a +\newcount\yrly@tempcount +\def\@storelabels{% + \def\yrly@labeltext{}% + \@@storelabels} +\def\@@storelabels#1,#2#{% + \ifcat$#1$% + \yrly@tempreg@a=\expandafter{\yrly@labeltext}% + \edef\yrly@labeltext{\the\yrly@tempreg@a}% + \let\next\@gobble% + \else% + \let\next\@@storelabels% + \yrly@tempreg@a=\expandafter{\yrly@labeltext}% + \protected@edef\yrly@labeltext{\the\yrly@tempreg@a\space#1}% + \fi% + \next#2{}} +\newcount\thumbnails% +\newtoks\hm@line@a% +\def\hm@line{} +\def\hm@writeout#1{% + \edef\hm@temp{#1}% + \immediate\write\html@output{\hm@line\hm@temp}% + \def\hm@line{}} +\def\hm@spaces{\ifcase\hm@spacenum\or\space\or\space\space\or\space\space\space% + \or\space\space\space\space\fi} +\newcount\hm@spacenum +\newcalendar% + {htmlmonth} + {\el@output} + {\yrly@firstday} + {\dates@days} + {7} + {\hm@spaces} + {I} + {<pre><B>\themonth</B>^^J\yrly@labeltext^^J}% + {^^J^^J</pre>} + {\cal@footer% + \cal@header} + {^^J} + {} + {\global\dates@day=1% + \dates@fix% + \cal@range@start\dates@date% + \message{^^JStart: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% + \global\dates@date\cal@range@end% + \caldate% + \global\dates@day\dates@days% + \dates@fix% + \cal@range@end\dates@date% + \message{^^JEnd: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% + \global\dates@date=\cal@range@start% + \caldate% + \@ifundefined{yrly@labeltext}{% + \def\yrly@defaultlabels{}% + \yrly@tempcount=1% + \global\advance\dates@date by-\dates@weekd% + \global\advance\dates@date by\yrly@firstday% + \caldate% + \loop% + \yrly@tempreg@a=\expandafter{\yrly@defaultlabels}% + \edef\yrly@defaultlabels{\the\yrly@tempreg@a\theshortweekday,}% + \ifnum\yrly@tempcount<7% + \global\advance\dates@date by1% + \caldate% + \advance\yrly@tempcount by 1\relax% + \repeat% + \expandafter\@storelabels\yrly@defaultlabels,,{}% + \dates@date\cal@range@start% + \caldate}% + {}% + \def\el@output##1{% + \def\hm@temp{##1}% + \def\hm@temptwo{\cal@groupbreak}% + \ifx\hm@temp\hm@temptwo% + \hm@spacenum=4\relax% + \fi% + \ifnum\cal@subgroup@count>6\relax% + \hm@writeout{##1}% + \else% + \def\hm@temptwo{\cal@footer}% + \ifx\hm@temp\hm@temptwo% + \hm@writeout{##1}% + \else% + \hm@line@a=\expandafter{\hm@line}% + \edef\hm@line{\the\hm@line@a\hm@temp}% + \fi% + \fi}% + \hm@spacenum=4\relax}% + {}% + {\ifnum\dates@day<9\hm@spacenum=3\else\hm@spacenum=2\fi% + \cal@get@appointments\cal@get@events}% + {\protected@edef\cal@entry@text{X}}% + {\ifnum\dates@weekd=\yrly@firstday% + \hm@spaces% + \ifnum\theday=9% + \space\space% + \fi% + \else% + \ifnum\dates@day=1% + \space\hm@spaces% + \fi% + \fi% + \ifcat$\theappointments\theevents$% + \else% + <A HREF="\expandafter\@gobble\string\#\the\dates@date">% + \fi% + \theday% + \ifcat$\theappointments\theevents$% + \else% + </A>% + \fi} +%</htmlmonth> +% \end{macrocode} +% +% \subsection{HTML Event List} +% +% \begin{macrocode} +%<*htmlevent> +\NeedsTeXFormat{LaTeX2e}[1995/06/01] +\ProvidesPackage{hlist} + [1997/11/07 10:44:05 2.2 HTML Event List (Frank Bennett)] +\input calopts.cfg +\InputIfFileExists{dates.cfg}{}{} +\ProcessOptions +\ProcessOptions +\RequirePackage{calendar} +\define@key{opt}{textnum}{% + \dates@textnum=#1\relax} +\define@key{opt}{outputfile}{% + \@ifundefined{html@outputfile} + {\newwrite\html@output% + \gdef\html@outputfile{#1}% + \immediate\openout\html@output=\html@outputfile} + {\gdef\el@temp{#1}% + \ifx\html@outputfile\el@temp% + \relax% + \else% + \immediate\closeout\html@output% + \gdef\html@outputfile{#1}% + \immediate\openout\html@output=\html@outputfile\relax% + \fi}} +\def\el@item{<LI><A NAME="\the\dates@date">\theday\space\themonth\space\theyear</A>} +\newcalendar% +{htmllist} +{\el@output} +{8} +{1} +{1} +{} +{I} +{<UL>} +{</UL>} +{} +{} +{\dates@requiremonthtrue\dates@requiredaytrue} +{\global\dates@date\cal@range@start% + \caldate% + \message{^^JStart: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% + \global\dates@date\cal@range@end% + \caldate% + \message{^^JEnd: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% + \global\dates@date\cal@range@start% + \caldate% + \def\el@output##1{\ifcat$##1$\else\immediate\write\html@output{##1}\fi}}% +{}% +{\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{% + ^^J\space\space\space\space<LI>\thetimestart\space% + \thelongtext}% + \else% + \protected@edef\cal@entry@text{% + ^^J\space\space\space\space<LI>\thetimestart--\thetimeend\space% + \thelongtext}% + \fi% + \else% + \protected@edef\cal@entry@text{% + ^^J<BR>\thelongtext}% + \fi}% +{\ifcat$\theevents\theappointments$\else% +\el@item% +\fi% +\ifcat$\theevents$\else% + \theevents% +\fi% +\ifcat$\theappointments$\else% + ^^J\space\space\space\space<UL>% + \theappointments% + ^^J\space\space\space\space</UL>% +\fi} +%</htmlevent> +% \end{macrocode} +% \subsection{HTML Month and Event List} +% \begin{macrocode} +%<*htmlmonthevent> +\NeedsTeXFormat{LaTeX2e}[1995/06/01] +\ProvidesPackage{hml} + [1997/11/06 07:33:21 2.1.1.6 HTML calendar (Frank Bennett)] +\RequirePackage{hmonth} +\RequirePackage{hlist} +\newtoks\hml@one +\newtoks\hml@two +\def\htmlmonthlist#1#2{% + \hml@one={#1} + \hml@two={#2} + \dateread{}} +\def\endhtmlmonthlist{% + \ifnum\dates@subrange@start=0% + \dates@subrange@start\dates@date% + \dates@subrange@end\dates@date% + \fi% + \global\dates@date\dates@subrange@start% + \global\dates@day=1\relax% + \dates@fix% + \cal@range@start\dates@date% + \global\dates@date\dates@subrange@end% + \caldate% + \global\dates@day\dates@days% + \dates@fix% + \cal@range@end\dates@date% + \global\dates@date=\cal@range@start + \caldate + \edef\hml@start{\theday\space\themonth\space\theyear\space} + \global\dates@date=\cal@range@end + \caldate + \edef\hml@end{\theday\space\themonth\space\theyear} + \edef\hml@range{\hml@start to \hml@end\space} + \edef\hml@htmlmonth{\noexpand\begin{htmlmonth}{\the\hml@one}{\the\hml@two}} + \edef\hml@htmllist{\noexpand\begin{htmllist}{\the\hml@one}{\the\hml@two}} + \expandafter\hml@htmlmonth\hml@range\end{htmlmonth} + \expandafter\hml@htmllist\hml@range\end{htmllist}x} +%<*htmlmonthevent> +% \end{macrocode} +% \Finale \PrintChanges + diff --git a/Master/texmf-dist/source/latex/calendar/mkaddr.Frank b/Master/texmf-dist/source/latex/calendar/mkaddr.Frank new file mode 100644 index 00000000000..4ffee077445 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/mkaddr.Frank @@ -0,0 +1,20 @@ +\documentclass{filoaddr} +\begin{document} +\begin{addresses}{% + topmargin=2cm, + rightmargin=3cm, + pageheight=172mm, + pagewidth=95mm, + columnsep=14pt, + punchcluster=3, + punchgroups=2, + interspace=51.25mm, + intraspace=19.25mm, + grip=5mm, + punchmargin=2mm, + punchpoints=15, + topspace=2pt, + bottomspace=1.5cm} +%%BODY%% +\end{addresses} +\end{document} diff --git a/Master/texmf-dist/source/latex/calendar/mkaddr.dtx b/Master/texmf-dist/source/latex/calendar/mkaddr.dtx new file mode 100644 index 00000000000..b88c19364be --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/mkaddr.dtx @@ -0,0 +1,579 @@ +%\iffalse +% +% file: mkaddr.dtx +% +% This file is distributed as-is, with no warranty whatsoever. +% Out of courtesy to others, please do not distribute the +% files contained in this file separately, but always +% together with this file and the documentation it contains. +% +%\fi +% +% \def\fileversion{3.1.1.1} +% \def\filedate{1998/01/17 18:15:06} +% +% \iffalse +% +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{mkaddr.dtx} +\end{document} +%</driver> +%\fi +% +%\iffalse +% Source tree moved under RCS +% --------------------------- +% mkaddr.dtx,v +% Revision 3.1.1.1 1998/01/17 18:15:06 root +% Release code, checksum verified +% +% Revision 3.1 1998/01/17 17:13:48 root +% Release code +% +% Revision 2.3 1997/12/06 21:15:31 root +% *** empty log message *** +% +% Revision 2.2 1997/11/07 10:44:05 root +% Release code. +% +% Revision 2.1.1.1 1997/11/04 05:06:07 root +% Development branch +% +% Revision 2.1 1997/11/01 14:58:44 bennett +% Release code. +% +% Revision 1.1 1997/10/29 08:17:52 root +% Initial revision +% +%\fi +% +% +% \title{The \texttt{mkaddr} Tcl script\thanks{This file is version number +% \fileversion{}. It was last revised on +% \filedate{}.}} +% +% \author{Frank G. Bennett, Jr.} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \begin{abstract} +% \noindent The utilities in this bundle +% can be used together to generate address lists from +% a database in the format used by the marvellous BBDB database +% for Emacs. +% \end{abstract} +% +% \CheckSum{392} +% +% \section{Installation and Use} +% +% The script is designed for use on a Unix system (if +% you haven't already moved to Linux, you might consider +% joining the gathering). You will need to have Emacs installed +% on your system. You will also need the BBDB extensions, +% which produce and maintain a database file, ".bbdb", +% in your home directory. You should also have the +% AUC\TeX{} extensions to Emacs installed, for editing, compiling, +% previewing and printing \LaTeX{} documents. You will +% also need "dvips" and, if (like me) you don't have +% access to a PostScript printer, "ghostscript" --- or +% some other combination of printing gear for which +% page rotation is supported in the "graphics" bundle. Your +% \TeX{} system will need the files in the "graphics" +% bundle, and the "autofilo" package from the "calendar" +% bundle for making filofax page frames. +% +% In your \texttt{/etc} directory, +% you will need a format file or files. Each should +% have the name "addresses", followed by an extension. +% The extension(s) will be used by the first mandatory +% option to the script. On my system, I have two +% format files, "mkaddr.Frank" and "mkaddr.Mieko", +% which produce pages suitable for my own and my wife's +% diary, respectively. Each file is simply a \LaTeX{} +% document, with "%%BODY%%" where the list of addresses +% should be inserted. An example is given below. Note +% that you will need to edit the script to reflect the +% names of your format files. +% +% The ".bbdb" database is designed for use with email +% systems, adding entries for your correspondents on +% the fly as mail is received. To make it easier to add entries for +% people with whom you have not corresponded by email, you +% may want to add a suitable chunk of elisp to your +% ".emacs" file. A chunk of such code is given below. +% It sets your "f12" key to add a new entry, prompting +% for details. Edit to taste (especially note the +% "[M]" and "[F]"; you will want to change these. +% +% Flags for extracting data from the list should be +% put into the "Notes:" field, in square braces. +% +% Extract everything, edit and install the script, +% install the style, +% and install one or more format files. +% Run the script and read the instructions. On my system, +% the command "mkaddr Frank [AaBb] [F]" will make a +% file "mkaddr.tex" in the current directory, formatted +% as specified in the format file "\etc\mkaddr.Frank", +% containing all entries beginning with "A" or "a", +% or "B" or "b", and flagged with "[F]". Run the +% file through \LaTeX{} and "dvips", and you have an address list. +% +% +% \StopEventually{\PrintIndex} +% +% \section{Sample Format File} +% \begin{macrocode} +%<*format> +\documentclass{filoaddr} +\begin{document} +\begin{addresses}{% + topmargin=2cm, + rightmargin=3cm, + pageheight=172mm, + pagewidth=95mm, + columnsep=14pt, + punchcluster=3, + punchgroups=2, + interspace=51.25mm, + intraspace=19.25mm, + grip=5mm, + punchmargin=2mm, + punchpoints=15, + topspace=2pt, + bottomspace=1.5cm} +%%BODY%% +\end{addresses} +\end{document} +%</format> +% \end{macrocode} +% +% \section{Elisp for \texttt{.emacs}} +% +% \begin{macrocode} +%<*elisp> +;; Essential add-on for BBDB +(defun bbdb-create-external () + "Prompt for and create a record. Hacked from bbdb-read-new-record." + (interactive) + (let ((name (bbdb-read-string "Name: ")) + (company (bbdb-read-string "Company: ")) + (net (bbdb-split (bbdb-read-string "Network Address: ") ",")) + (addrs + (let (L L-tail str addr) + (while + (not + (string= + "" + (setq str + (bbdb-read-string + "Address Description [RET when no more addrs]: ")))) + (setq addr (make-vector bbdb-address-length nil)) + (bbdb-record-edit-address addr str) + (if L + (progn (setcdr L-tail (cons addr nil)) + (setq L-tail (cdr L-tail))) + (setq L (cons addr nil) + L-tail L))) + L)) + (phones + (let (L L-tail str) + (while + (not + (string= + "" + (setq str + (bbdb-read-string + "Phone Location [RET when no more phones]: ")))) + (let* ((phonelist + (bbdb-error-retry + (bbdb-parse-phone-number + (read-string + "Phone: " + (and + bbdb-default-area-code + (format "(%03d) " bbdb-default-area-code)))))) + (phone (apply 'vector str + (if (= 3 (length phonelist)) + (nconc phonelist '(0)) + phonelist)))) + (if L + (progn (setcdr L-tail (cons phone nil)) + (setq L-tail (cdr L-tail))) + (setq L (cons phone nil) + L-tail L)))) + L)) + (notes (bbdb-read-string "Additional Comments: " "[M][F]"))) + (if (string= company "") (setq company nil)) + (if (string= name "") (setq name nil)) + (if (string= notes "") (setq notes nil)) + (bbdb-display-records + (list + (bbdb-create-internal name company net addrs phones notes))))) + +(global-set-key [f12] 'bbdb-create-external) +%</elisp> +% \end{macrocode} +% +% \section{The Script} +% +% You must edit this file for your system. Search +% especially for instances of "Frank" and "Mieko". +% +% \begin{macrocode} +%<*script> +#!/usr/local/bin/tclsh +if {[catch "kanji defaultInputCode EUC" errormsg]}\ + {puts "Running $argv0 without Japanese support." + puts "For Japanese support, you need to use a Japanized" + puts "Tcl interpreter.\n"}\ + {} +# This script parses a database in the format used by +# the Insidious Big Brother Database for Emacs. It can +# be adapted to output LaTeX lists of contents and so forth. +set format [lindex $argv 0] +set range [lindex $argv 1] +set condition [lindex $argv 2] +set usage "Usage is: $argv0 \<SIZE\> \[<RANGE>\] \[<CONDITION>\]\ +\n(Square braces are literal)\ +\n(\<SIZE\> is one of \"Mieko\" or \"Frank\")" +if {[string match $format "Mieko"]+\ + [string match $format "Frank"]==0}\ + {puts "$usage"; exit}\ + {} +if {[regexp {\[.*\]} $condition ignore]==0}\ + {puts "$usage"; exit}\ + {} +if {[regexp {\[.*\]} $range ignore]==0}\ + {puts "$usage"; exit}\ + {} +puts "Creating LaTeX2e file mkaddr.tex ..." +regexp {\[(.*)\]} $condition ignore condition +set condition "\\\[$condition\\\]" +set ifh [open "/home/bennett/.bbdb"] +set ofh [open "./mkaddr.tex" w+] +set counter 0 +set temp "" +# Let's grab the content of a header file +set header [open "/etc/mkaddr.$format" r] +while 1 { + if {[gets $header line] == -1} break + if {[string match $line "%%BODY%%"]} break + puts $ofh $line +} +while 1 { + if {[gets $ifh line] == -1} break + regsub -all {([ "])\\"} $line {\1``} line + regsub -all {\\"([^A-Za-z])} $line {''\1} line + regsub -all {\\n} $line { } line + regsub -all {([^\])%} $line {\1\\%} line + regsub -all {([^\])&} $line {\1\\\&} line +set fn nil +set ln nil +set aka nil +set co nil +set ph nil +set ad nil +set net nil +set op nil + regexp { +*(nil|\"[^"]*\")\ ++(nil|\"[^"]*\")\ ++(nil|\(\".*\"\))\ ++(nil|\"[^"]*\")\ ++(nil|\(\[.*\]\))\ ++(nil|\(\[.*\]\))\ ++(nil|\(\".*\"\))\ ++(nil|\(\(.*\)\)|\"[^"]*\")\ ++nil} $line ignore fn ln aka co ph ad net op +# +# Make lone first names into lone last names +if {[string match $ln "nil"]}\ + {set ln $fn + set fn nil}\ + {} +# Check that we're in the range specified +if {[regexp "\"$range" $ln ignore]}\ + {}\ + {if {[string match $ln nil]}\ + {if {[regexp "\"$range" $co ignore]}\ + {}\ + {continue}}\ + {continue}} +# +# Fish out the notes field so we can check whether this +# record matches the specified conditions +set tempone "" +set temptwo "" +regexp {\(notes \. \"([^"]*)\"|\"([^"]*)\"$} $op \ + ignore tempone temptwo +if {[string match $temptwo ""]} \ + {set notes $tempone} \ + {set notes $temptwo} +if {[string match "*$condition*" $notes]} {} {continue} +# +# Are all three names missing? If so, skip it. + if { [expr 3 == \ + [string match $fn "nil"]+\ + [string match $ln "nil"]+\ + [string match $co "nil"]] }\ + {}\ + { +# Each entry is put in a parbox to keep it on one page. +# The parbox opens with a vskip to make a little room +# at the top of the page and between entries. +puts $ofh "\\entry\{%" +# Are both the first and last name missing? If so, +# we skip that line. + set counter [expr $counter + 1] + if { [expr 2 == \ + [string match $fn "nil"]+\ + [string match $ln "nil"]] }\ + {}\ + {regexp {\"(.*)\"} $fn ignore fn + regexp {\"(.*)\"} $ln ignore ln +puts -nonewline "$fn $ln" + set ln " \\textbf\{$ln\}" + puts $ofh "$fn$ln\\\\"} +# Is the company name missing? If so, we'll +# skip that line. + if { [string match $co "nil"] }\ + {}\ + {regexp {\"(.*)\"} $co ignore co + puts $ofh "\\textbf\{$co\}\\\\" + puts -nonewline $co} +puts "" +# Spit out any telephone numbers for this entry. +if {[string match $ph nil]} {set ph ""} {} +regexp {\((\[.*\])\)} $ph ignore ph +while {[string match $ph ""] == 0} { + set temp "" + regexp {\[([^]]*)\](.*)} $ph ignore temp ph + regexp {\"([^"]*)\" *\"([^"]*)\"} $temp ignore temp number + puts -nonewline $ofh " \{\\small $number ($temp)\}" + if {[string match $ph ""] == 0}\ + {puts $ofh "\\\\"}\ + {if {[string match $ad nil]+[string match $net nil]==2}\ + {puts $ofh ""}\ + {puts $ofh "\\\\"}} + } +# Spit out any addresses for this entry. +if {[string match $ad nil]} {set ad ""} {} +while {[string match $ad ""] == 0} { + set temp "" + set lineone "" + set linetwo "" + set linethree "" + set city "" + set state "" + set zip "" + set bridge "" + regexp {\(\[([^]]*)\](.*)\)} $ad ignore ad temp + regexp {\"([^"]*)\"\ ++\"([^"]*)\"\ ++\"([^"]*)\"\ ++\"([^"]*)\"\ ++\"([^"]*)\"\ ++\"([^"]*)\"\ ++([0-9]*)} $ad ignore ad lineone linetwo linethree city state zip +if {$zip == 0} {set zip ""} {} +set comp [expr [string match $city ""]+[string match $state ""]] +if {$comp==2}\ + {}\ + {if {$comp==1}\ + {set bridge " " + set zip " $zip"}\ + {if {$comp==0}\ + {set bridge ", " + set zip " $zip"}\ + {}}} + puts $ofh " \\address\{$ad\}\{\%" + if {[string match $lineone ""]}\ + {puts $ofh "\\mygobble"}\ + {puts $ofh " $lineone"} + if {[string match $linetwo ""]}\ + {}\ + {puts $ofh " \\\\$linetwo"} + if {[string match $linethree ""]}\ + {}\ + {puts $ofh " \\\\$linethree"} + if {[string match "$city$state$zip" ""]}\ + {}\ + {puts $ofh " \\\\$city$bridge$state$zip"} + puts $ofh " \}" + set ad $temp + } +# Spit out any email addresses associated with this person +if {[string match $net nil]} {set net ""} {} +regexp {\((\".*\")\)} $net ignore net +while {[string match $net ""] == 0} { + set temp "" + regexp {\"([^"]*)\"(.*)} $net ignore net temp + puts -nonewline $ofh "\\url\{$net\}" + set net $temp + if {[string match $net ""] == 0} {puts $ofh "\\\\"} {puts $ofh ""} + } +puts $ofh "\}\n" +} +} +# Once everything's finished, we send along the footer +while 1 { + if {[gets $header line] == -1} break + puts $ofh $line +} +puts "Done." +exit +%</script> +% \end{macrocode} +% +% \section{\LaTeX{} Style} +% We use this to simplify the format file. +% \begin{macrocode} +%<*style> +\NeedsTeXFormat{LaTeX2e}[1995/06/01] +\ProvidesClass{filoaddr} + [1998/01/17 18:15:06 3.1.1.1 Filofax address pages (Frank Bennett)] +\DeclareOption{fourcolumn}% + {\PassOptionsToPackage{\CurrentOption}{autofilo}} +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} +\ProcessOptions +\LoadClass{article} +\RequirePackage{rotating} +\RequirePackage{url} +% \end{macrocode} +% Some variables. +% \begin{macrocode} +\def\mygobble#1{} +\newlength\templen +\newlength\mytemplength +\newlength\descheight +\newlength\myparwidth +\newlength\descwidth +\newlength\biggerwidth +\newlength\myentryheight +\newlength\myparheight +\newlength\mylinewidth +% \end{macrocode} +% Define a macro to format each entry. +% \begin{macrocode} +\def\entry#1{% +\vbox{% +\vskip2pt +\topline +\vskip 2pt +\parbox{\linewidth}{% +\raggedright% +\small#1} +\vskip 1pt +\bottomline}} +% \end{macrocode} +% The above macro requires a couple of line-building +% macros. +% \begin{macrocode} +\def\topline{% + \vbox to0pt{% + \hbox to\linewidth{% + \hskip-2.4pt% + \vrule width0.4pt height0pt depth7pt% + \vrule width\mylinewidth depth0.4pt height0pt% + \vrule width0.4pt height0pt depth7pt\hskip-2.4pt}% + \vskip-7pt}} +\def\bottomline{% + \vbox to0pt{% + \vskip-7pt + \hbox to\linewidth{% + \hskip-2.4pt% + \vrule width0.4pt height7pt depth0pt% + \vrule width\mylinewidth depth0.4pt height0pt% + \vrule width0.4pt height7pt depth0pt% + \hskip-2.4pt}}} +% \end{macrocode} +% Define a macro to format addresses. +% \begin{macrocode} +\def\address#1#2{% + \settoheight\myparheight{\vbox{% + \boxmaxdepth0pt% + \parbox{\myparwidth}{\raggedright #2}}}% + \settowidth\descwidth{\small\textbf{#1}}% + \ifnum\descwidth>\myparheight\biggerwidth\descwidth\else% + \biggerwidth\myparheight\fi% + \vbox{\vskip3pt% + \hbox to\linewidth{% + \hskip3pt% + \vbox to\biggerwidth{% + \vfil% + \hbox to\descheight{% + \begin{sideways}{\small\textbf{#1}}\end{sideways}% + \hfil}% + \vfil}% + \hskip2pt% + \vbox to\biggerwidth{% + \vfil% + \hbox to\myparwidth{% + \parbox{\myparwidth}{\raggedright #2}}% + \vfil}}}} +% \end{macrocode} +% Define an environment that creates frames and sets up +% variables for use in the macros we have just defined. +% \begin{macrocode} +\def\addresses#1{% + \autofilo{#1} + \settoheight\descheight{\vbox{\boxmaxdepth0pt{\small\textbf{Yy}}}} + \myparwidth\linewidth% + \advance\myparwidth by-\descheight\relax% + \advance\myparwidth by-5pt\relax% + \mylinewidth\linewidth + \advance\mylinewidth by4pt\relax} +\def\endaddresses{\endautofilo} +%</style> +% \end{macrocode} +%\iffalse +% \begin{macrocode} +%<*installer> +\def\batchfile{mkaddr.ins} +\input docstrip.tex + +\keepsilent + +\preamble +\endpreamble + +\postamble +\endpostamble + +\def\WritePreamble#1{} +\def\WritePostamble#1{} + +\generate{\file{mkaddr.Frank}{\from{mkaddr.dtx}{format}} + \file{mkaddr.tcl}{\from{mkaddr.dtx}{script}} + \file{.emacs.for.bbdb}{\from{mkaddr.dtx}{elisp}} + \file{filoaddr.sty}{\from{mkaddr.dtx}{style}} + } + +\Msg{***********************************************************} +\Msg{*} +\Msg{* To finish the installation, you have to move the following} +\Msg{* file into you executable search path:} +\Msg{*} +\Msg{* \space\space mkaddr} +\Msg{*} +\Msg{* And you have to move the following file into the search} +\Msg{* used by TeX:} +\Msg{*} +\Msg{* \space\space filoaddr.sty} +\Msg{*} +\Msg{***********************************************************} +%</installer> +% \end{macrocode} +%\fi +% \Finale \PrintChanges diff --git a/Master/texmf-dist/source/latex/calendar/mkaddr.tcl b/Master/texmf-dist/source/latex/calendar/mkaddr.tcl new file mode 100644 index 00000000000..05bd464c816 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/mkaddr.tcl @@ -0,0 +1,201 @@ +#!/usr/local/bin/tclsh +if {[catch "kanji defaultInputCode EUC" errormsg]}\ + {puts "Running $argv0 without Japanese support." + puts "For Japanese support, you need to use a Japanized" + puts "Tcl interpreter.\n"}\ + {} +# This script parses a database in the format used by +# the Insidious Big Brother Database for Emacs. It can +# be adapted to output LaTeX lists of contents and so forth. +set format [lindex $argv 0] +set range [lindex $argv 1] +set condition [lindex $argv 2] +set usage "Usage is: $argv0 \<SIZE\> \[<RANGE>\] \[<CONDITION>\]\ +\n(Square braces are literal)\ +\n(\<SIZE\> is one of \"Mieko\" or \"Frank\")" +if {[string match $format "Mieko"]+\ + [string match $format "Frank"]==0}\ + {puts "$usage"; exit}\ + {} +if {[regexp {\[.*\]} $condition ignore]==0}\ + {puts "$usage"; exit}\ + {} +if {[regexp {\[.*\]} $range ignore]==0}\ + {puts "$usage"; exit}\ + {} +puts "Creating LaTeX2e file mkaddr.tex ..." +regexp {\[(.*)\]} $condition ignore condition +set condition "\\\[$condition\\\]" +set ifh [open "/home/bennett/.bbdb"] +set ofh [open "./mkaddr.tex" w+] +set counter 0 +set temp "" +# Let's grab the content of a header file +set header [open "/etc/mkaddr.$format" r] +while 1 { + if {[gets $header line] == -1} break + if {[string match $line "%%BODY%%"]} break + puts $ofh $line +} +while 1 { + if {[gets $ifh line] == -1} break + regsub -all {([ "])\\"} $line {\1``} line + regsub -all {\\"([^A-Za-z])} $line {''\1} line + regsub -all {\\n} $line { } line + regsub -all {([^\])%} $line {\1\\%} line + regsub -all {([^\])&} $line {\1\\\&} line +set fn nil +set ln nil +set aka nil +set co nil +set ph nil +set ad nil +set net nil +set op nil + regexp { +*(nil|\"[^"]*\")\ ++(nil|\"[^"]*\")\ ++(nil|\(\".*\"\))\ ++(nil|\"[^"]*\")\ ++(nil|\(\[.*\]\))\ ++(nil|\(\[.*\]\))\ ++(nil|\(\".*\"\))\ ++(nil|\(\(.*\)\)|\"[^"]*\")\ ++nil} $line ignore fn ln aka co ph ad net op +# +# Make lone first names into lone last names +if {[string match $ln "nil"]}\ + {set ln $fn + set fn nil}\ + {} +# Check that we're in the range specified +if {[regexp "\"$range" $ln ignore]}\ + {}\ + {if {[string match $ln nil]}\ + {if {[regexp "\"$range" $co ignore]}\ + {}\ + {continue}}\ + {continue}} +# +# Fish out the notes field so we can check whether this +# record matches the specified conditions +set tempone "" +set temptwo "" +regexp {\(notes \. \"([^"]*)\"|\"([^"]*)\"$} $op \ + ignore tempone temptwo +if {[string match $temptwo ""]} \ + {set notes $tempone} \ + {set notes $temptwo} +if {[string match "*$condition*" $notes]} {} {continue} +# +# Are all three names missing? If so, skip it. + if { [expr 3 == \ + [string match $fn "nil"]+\ + [string match $ln "nil"]+\ + [string match $co "nil"]] }\ + {}\ + { +# Each entry is put in a parbox to keep it on one page. +# The parbox opens with a vskip to make a little room +# at the top of the page and between entries. +puts $ofh "\\entry\{%" +# Are both the first and last name missing? If so, +# we skip that line. + set counter [expr $counter + 1] + if { [expr 2 == \ + [string match $fn "nil"]+\ + [string match $ln "nil"]] }\ + {}\ + {regexp {\"(.*)\"} $fn ignore fn + regexp {\"(.*)\"} $ln ignore ln +puts -nonewline "$fn $ln" + set ln " \\textbf\{$ln\}" + puts $ofh "$fn$ln\\\\"} +# Is the company name missing? If so, we'll +# skip that line. + if { [string match $co "nil"] }\ + {}\ + {regexp {\"(.*)\"} $co ignore co + puts $ofh "\\textbf\{$co\}\\\\" + puts -nonewline $co} +puts "" +# Spit out any telephone numbers for this entry. +if {[string match $ph nil]} {set ph ""} {} +regexp {\((\[.*\])\)} $ph ignore ph +while {[string match $ph ""] == 0} { + set temp "" + regexp {\[([^]]*)\](.*)} $ph ignore temp ph + regexp {\"([^"]*)\" *\"([^"]*)\"} $temp ignore temp number + puts -nonewline $ofh " \{\\small $number ($temp)\}" + if {[string match $ph ""] == 0}\ + {puts $ofh "\\\\"}\ + {if {[string match $ad nil]+[string match $net nil]==2}\ + {puts $ofh ""}\ + {puts $ofh "\\\\"}} + } +# Spit out any addresses for this entry. +if {[string match $ad nil]} {set ad ""} {} +while {[string match $ad ""] == 0} { + set temp "" + set lineone "" + set linetwo "" + set linethree "" + set city "" + set state "" + set zip "" + set bridge "" + regexp {\(\[([^]]*)\](.*)\)} $ad ignore ad temp + regexp {\"([^"]*)\"\ ++\"([^"]*)\"\ ++\"([^"]*)\"\ ++\"([^"]*)\"\ ++\"([^"]*)\"\ ++\"([^"]*)\"\ ++([0-9]*)} $ad ignore ad lineone linetwo linethree city state zip +if {$zip == 0} {set zip ""} {} +set comp [expr [string match $city ""]+[string match $state ""]] +if {$comp==2}\ + {}\ + {if {$comp==1}\ + {set bridge " " + set zip " $zip"}\ + {if {$comp==0}\ + {set bridge ", " + set zip " $zip"}\ + {}}} + puts $ofh " \\address\{$ad\}\{\%" + if {[string match $lineone ""]}\ + {puts $ofh "\\mygobble"}\ + {puts $ofh " $lineone"} + if {[string match $linetwo ""]}\ + {}\ + {puts $ofh " \\\\$linetwo"} + if {[string match $linethree ""]}\ + {}\ + {puts $ofh " \\\\$linethree"} + if {[string match "$city$state$zip" ""]}\ + {}\ + {puts $ofh " \\\\$city$bridge$state$zip"} + puts $ofh " \}" + set ad $temp + } +# Spit out any email addresses associated with this person +if {[string match $net nil]} {set net ""} {} +regexp {\((\".*\")\)} $net ignore net +while {[string match $net ""] == 0} { + set temp "" + regexp {\"([^"]*)\"(.*)} $net ignore net temp + puts -nonewline $ofh "\\url\{$net\}" + set net $temp + if {[string match $net ""] == 0} {puts $ofh "\\\\"} {puts $ofh ""} + } +puts $ofh "\}\n" +} +} +# Once everything's finished, we send along the footer +while 1 { + if {[gets $header line] == -1} break + puts $ofh $line +} +puts "Done." +exit diff --git a/Master/texmf-dist/source/latex/calendar/monthly.dtx b/Master/texmf-dist/source/latex/calendar/monthly.dtx new file mode 100644 index 00000000000..22dbb1ec360 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/monthly.dtx @@ -0,0 +1,565 @@ +%\iffalse +% +% file: monthly.dtx +% Copyright (C) 1996-1997 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 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. +% +%\fi +% +% \def\fileversion{3.1.1.1} +% \def\filedate{1998/01/17 18:15:10} +% +% \iffalse +% +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{monthly.dtx} +\end{document} +%</driver> +%\fi +% +% \changes{v1.0}{1996/02/15}{Initial Version} +% \changes{v1.0}{1997/02/17}{Style now stable enough to +% justify recording changes. Added protection for definition +% of cal@entry@text. It is now possible to put a pound +% sign in front of entries. A change to the +% dates module allows entries on the same day each +% month. So we can now record standing charges against +% bank accounts. Oh joy.} +% \changes{v1.0}{1997/02/20}{First release version. +% Merged all code into the class file. +% Thanks to Robin Fairbairns for +% his help on the vertical sizing of +% tables, and to David Carlisle for pointing out +% the \texttt{protected@edef} command.} +% \changes{v1.1}{1997/03/01}{Modified stacking method +% for items to permit line wrapping. Code could be more +% concise and clear, but it runs well enough.} +% \changes{v1.1}{1997/03/01}{Adapted documentation from +% the Timetable package.} +% \changes{v1.2}{1997/05/12}{Page formatting is now handled +% through the \texttt{geometry} package. Landscaping can +% also handled through \texttt{geometry}, as suggested by +% Christian Horn. Faulty linespacing has now been fixed. +% Documentation has also been improved.} +% \changes{v1.3}{1997/05/19}{Support is now provided for Japanese +% as well as English calendars. There is no support for Imperial +% dates; users have to put these in by hand using the \texttt{title} +% option, if Imperial dates are required. The changes principally +% affected the Dates package.} +% \changes{v1.3}{1997/05/20}{Fixed bug in \texttt{firstday} option. +% Labels were not shifting with the calendar start day. +% Thanks due to Miroslav Novak for reporting this bug.} +% \changes{v1.3}{1997/05/20}{Added German support. Thanks due to +% Christian Horn.} +% \changes{v1.4}{1997/05/29}{Amended documentation, including +% a description of a proper set of options for handling page +% orientation and layout. Still need to do the coding, though.} +% \changes{v1.4}{1997/05/29}{Completed coding of orientation +% and layout options. Pretty simple, once the strategy was +% clear.} +% \changes{v1.4}{1997/05/30}{Added linklandscape option and +% added documentation on the new method of handling format +% and orientation.} +% \changes{v1.4}{1997/06/02}{Tidied up the way rotation and +% page layout options are reconciled.} +% \changes{v1.4}{1997/06/02}{Added \cs{noindent} to suppress +% indentation internally.} +% \changes{v1.4}{1997/06/03}{Generalized code for setting page +% sizes and adjusting typefaces. Also added automatic selection +% of abbreviated day names for narrow calendars. Ready for +% final release.} +% \changes{v1.4}{1997/06/06}{Major rearrangements were needed to +% fix problems with page formatting and rotation, reported by +% Christian Horn.} +% \changes{v1.5}{1997/06/09}{Further improvements to calendar +% sizing. An over-wide margin with B4 paper continues to cause +% problems. Could Japanese B4 paper be a different size?} +% \changes{v1.6}{1997/10/18}{New public release of all styles +% and modules incorporating global bug-fixes.} +% +%\iffalse +% Source tree moved under RCS +% --------------------------- +% monthly.dtx,v +% Revision 3.1.1.1 1998/01/17 18:15:10 root +% Release code, checksum verified +% +% Revision 3.1 1998/01/17 17:14:10 root +% Release code +% +% Revision 2.8 1998/01/17 15:36:01 root +% *** empty log message *** +% +% Revision 2.7 1998/01/17 15:34:30 root +% *** empty log message *** +% +% Revision 2.6 1998/01/17 11:31:00 root +% *** empty log message *** +% +% Revision 2.5 1998/01/16 17:05:53 root +% *** empty log message *** +% +% Revision 2.4 1998/01/16 09:14:25 root +% *** empty log message *** +% +% Revision 2.3 1998/01/16 08:04:38 root +% *** empty log message *** +% +% Revision 2.2 1997/11/07 10:44:05 root +% Release code. +% +% Revision 2.1.1.1 1997/11/04 05:06:07 root +% Development branch +% +% Revision 2.1 1997/11/01 14:56:45 bennett +% Release code. +% +% Revision 1.1 1997/10/29 08:17:52 root +% Initial revision +% +%\fi +% +% \title{User's Guide to the Monthly Calendar +% package\thanks{This file is version number +% \fileversion{}. It was last revised on +% \filedate{}.}} +% +% \author{Frank G. Bennett, Jr.} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \CheckSum{381} +% +% Please see the file \texttt{calguide.tex} for documentation +% on this calendar style. +% +% \StopEventually{\PrintIndex} +% +% \section{The Class File} +% +% \subsection{Preliminaries} +% +% Use \LaTeXe, and tell the user who we are. +% +% \begin{macrocode} +%<*class> +\NeedsTeXFormat{LaTeX2e}[1995/06/01] +\ProvidesPackage{monthly} + [1998/01/17 18:15:10 3.1.1.1 Monthly Calendar (Frank Bennett)] +% \end{macrocode} +% Define some more variables and switches for use in the body +% of the style. +% \begin{macrocode} +\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} +% \end{macrocode} +% +% \subsection{Options} +% +% In common with all other packages in the Calendar +% bundle, we include options for all of the drivers supported +% by the color package and the graphics package, and +% include some code for declaring languages. +% +% \begin{macrocode} +\input calopts.cfg +\InputIfFileExists{dates.cfg}{}{} +\ProcessOptions +% \end{macrocode} +% +% \subsection{Option Postprocessing} +% +% Now that the options lists are available to us, +% we can start loading packages. The following packages +% are always loaded, and always with the same options. +% \begin{macrocode} +\RequirePackage{array}[1996/06/14] +\RequirePackage{calendar} +% \end{macrocode} +% Next, we set the dimensions +% of the table that will contain the calendar. +% \begin{macrocode} + \def\mon@settableheight{% + \setlength{\mon@vh}{\vsize}% + \addtolength{\mon@vh}{-0.001pt}}% + \def\mon@settablewidth{% + \setlength{\mon@tablewidth}{\hsize}}% +% \end{macrocode} +% Typefaces, and abbreviated day names versus full day names +% are selected by options. +% \begin{macrocode} + +% \end{macrocode} +% +% \subsection{Calendar Setup} +% +% Define some key values for use by the calendar environment. +% \begin{macrocode} +\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% +% \end{macrocode} +% Define a utility macro for use by the \texttt{labels} key. +% This stores a comma-delimited list of labels to a single +% macro, which can then be used as a line in the table +% environment that makes up the calendar. +% \begin{macrocode} +\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}% + \fi% + \next#2{}} +% \end{macrocode} +% Define default values for the environment keys. The title is set +% inside the scope of \cs{newcalendar} +% \begin{macrocode} +\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% +% \end{macrocode} +% +% \subsection{Calendar Definition} +% +% The calendar definition itself consists of a single command +% and its associated arguments. +% \begin{macrocode} +\newcalendar% +% \end{macrocode} +% We give the environment a name. +% \begin{macrocode} +{monthly} +% \end{macrocode} +% We're producing DVI, so we use the standard +% macro for dropping text into the hopper. +% \begin{macrocode} +{\cal@insert} +% \end{macrocode} +% We start the calendar on Sunday. Season to taste. +% Use integers "0" through "6". +% \begin{macrocode} +{\mon@firstday} +% \end{macrocode} +% The length of a group is the length of the month. +% \begin{macrocode} +{\dates@days} +% \end{macrocode} +% The length of a subgroup is one week. +% \begin{macrocode} +{7} +% \end{macrocode} +% The delimiter to go before every item but the first +% is a table separator. +% \begin{macrocode} +{&} +% \end{macrocode} +% Increment the date counter with every item. +% \begin{macrocode} +{I} +% \end{macrocode} +% Define the header. The macro inserted here is defined +% below, in the block of code run after the date is read, +% and before the table is opened. +% \begin{macrocode} +{\mon@header} +% \end{macrocode} +% We define the end of the calendar. +% \begin{macrocode} +{\\\hline\end{tabular}} +% \end{macrocode} +% We define a way to open a new group. +% \begin{macrocode} +{\cal@footer\newpage\cal@header} +% \end{macrocode} +% We define the way to end a subgroup. In this case, +% we want to start a new line and lay down a rule. +% \begin{macrocode} +{\\\hline} +% \end{macrocode} +% We set up to require a month in the environment typed +% into the user's document. +% \begin{macrocode} +{\dates@requiremonthtrue} +% \end{macrocode} +% The next section runs after the calendar dates have been +% scanned from the environment, but before the table is +% opened. +% \textit{Whatever month was (last) indicated in the environment +% section of the calendar, we want to start on the first +% day, and make a calendar for one month only. We accomplish +% this by adjusting the human-side date, and pushing the +% result through to the long date with \texttt{dates@fix}. +% We then readjust the human side data with \texttt{caldate}. +% This puts us on the first day of the month, and we +% set the counter \texttt{cal@range@start} to this long date.} +% +% \begin{macrocode} +{\dates@day=1% + \dates@fix% + \caldate% + \cal@range@start\dates@date% +% \end{macrocode} +% \textit{We tell the user where we're starting.} +% \begin{macrocode} + \message{^^JStart: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% +% \end{macrocode} +% \textit{Then we jump to the last day of the last +% month in the range given by the user, and +% do the same readjustment with \texttt{dates@fix} and +% \texttt{caldate}. We set the end of the range to this +% value.} +% \begin{macrocode} + \dates@date\cal@range@end% + \caldate% + \dates@day\dates@days% + \dates@fix% + \caldate% + \cal@range@end\dates@date% +% \end{macrocode} +% \textit{We let the user know where we plan to stop.} +% \begin{macrocode} + \message{^^JEnd: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% +% \end{macrocode} +% \textit{We jump back to the starting date and reset the +% human-side values.} +% \begin{macrocode} + \dates@date=\cal@range@start% + \caldate% +% \end{macrocode} +% \textit{Now that the date adjustments have been taken care of, +% it's time to figure out the size of the calendar. We start by +% getting some initial sizes from the height and width of the +% text area of the current page.} +% \begin{macrocode} + \mon@settablewidth% + \mon@settableheight% +% \end{macrocode} +% \textit{We add \cs{extrarowheight} to prim up the headings a little. +% We will still get text touching lines with \cs{Huge} typefaces, +% but this is better than nothing.} +% \begin{macrocode} +% \setlength{\extrarowheight}{3pt}% +% \end{macrocode} +% \textit{Fetch the full height of the title to heightlessboxes.} +% \begin{macrocode} + \settoheight{\mon@templen}{\vbox{\boxmaxdepth=0pt% + \begin{tabular}{c}% + \mon@titletype% + \the\dates@monthname% + \end{tabular}}}% + \setlength{\mon@heightlessboxes}{\mon@templen}% +% \end{macrocode} +% \textit{Fetch the full height of the day labels to heightlessboxes.} +% \begin{macrocode} + \settoheight{\mon@templen}{\vbox{\boxmaxdepth=0pt% + \begin{tabular}{c}% + \mon@daynametype% + Monday% + \end{tabular}}}% + \addtolength{\mon@heightlessboxes}{\mon@templen}% +% \end{macrocode} +% \textit{Add 10 $\times$ the rule width and the space between double-rules +% to heightlessboxes.} +% \begin{macrocode} + \addtolength{\mon@heightlessboxes}{10\arrayrulewidth}% + \addtolength{\mon@heightlessboxes}{\doublerulesep}% +% \end{macrocode} +% \textit{Finally, we make some adjustments that I arrived +% at by trial and error; I have no idea why these particular +% measurements work. If anyone wants to improve this, be my +% guest. I have run out of patience on this one.} +% \begin{macrocode} + \addtolength{\mon@heightlessboxes}{\mon@adjustment}% + \addtolength{\mon@heightlessboxes}{2pt}% +% \end{macrocode} +% \textit{The height of the boxes is the full width of +% the text minus heightlessboxes. Divide +% by 6 for the height of an individual box.} +% \begin{macrocode} + \addtolength{\mon@vh}{-\mon@heightlessboxes}% + \divide\mon@vh by6% +% \end{macrocode} +% \textit{The width is simpler. We have 8 rules, and +% a total of 14 gaps between text and rules. +% Add it all up, subtract the total from textheight, +% divide by 7 and Thunderbirds are Go.} +% \begin{macrocode} + \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% +% \end{macrocode} +% \textit{Well, almost go. We need to build the header macro. +% Our first step is to create the default labels, +% if the user has not specified any.} +% \begin{macrocode} + \@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}% + {}% +% \end{macrocode} +% \textit{Then we define the header itself.} +% \begin{macrocode} + \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}}% +% \end{macrocode} +% Events are delimited by \cs{newline}. +% \begin{macrocode} +{\par}% +% \end{macrocode} +% The next argument is dropped on DVI for each item. +% We use it here to fetch the text of appointments and +% events to the standard list macros, using the +% standard text-fetching commands. Each generates a +% stack delimited by the phrase that was set above. +% \begin{macrocode} +{\cal@get@appointments\cal@get@events}% +% \end{macrocode} +% This sets \cs{cal@entry@text}. It is executed for every +% event or appointment in the database that applies +% to a given item. We differentiate between whole-day events, +% pinpointed events and ranged events. +% \begin{macrocode} +{\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}% +% \end{macrocode} +% Finally we tell the style how to create the +% text for each item (which is an individual date +% box in this case). We use \texttt{vbox} to make +% the height static. +% Thanks are due to Christian Horn for forwarding a +% handwritten sample of a tabular environment, demonstrating +% that an error in the linespacing was \textit{not} produced +% by \LaTeXe's internals. In the end, the problem turned out +% to be due to grouping; \LaTeX{}, I now remember, sets +% linespacing according to the typeface in force at the end +% of a paragraph or parbox. +% \begin{macrocode} +{\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}}% +%</class> +% \end{macrocode} +% \Finale \PrintChanges diff --git a/Master/texmf-dist/source/latex/calendar/overword.dtx b/Master/texmf-dist/source/latex/calendar/overword.dtx new file mode 100644 index 00000000000..b92b610a2f8 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/overword.dtx @@ -0,0 +1,344 @@ +%\iffalse +% +% File overword.dtx +% Copyright (C) 1996, 1997 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(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 this a more powerful, +% friendlier, and altogether more thrilling package, please contact me on +% fb@soas.ac.uk +% +%<style>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<style>\ProvidesPackage{overword} +%<style> [1998/01/17 18:15:15 3.1.1.1 Overword parsing support (Frank Bennett)] +% \fi +% +% \def\fileversion{3.1.1.1} +% \def\filedate{1998/01/17 18:15:15} +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{overword.dtx} +\end{document} +%</driver> +% \fi +% +% \changes{v1.0}{1996/11/10}{Initial version separated from calendar.dtx} +% \changes{v1.1}{1996/11/10}{Fixed error in the installation file.} +% \changes{v1.2}{1997/01/09}{Added @preoverwordspace, for use with Camel 1.0s.} +% \changes{v1.3}{1997/03/01}{Trivial change to documentation.} +% \changes{v1.4}{1997/03/04}{Put \texttt{iffalse} around installation +% file section of \texttt{dtx} file.} +% \changes{v1.5}{1997/10/05}{Changed local use of \cs{let} re \cs{@overword} +% tp global, to avoid cross-nested local and global assignments.} +% \changes{v1.6}{1997/10/18}{New public release of all styles +% and modules incorporating global bug-fixes.} +% +%\iffalse +% Source tree moved under RCS +% --------------------------- +% overword.dtx,v +% Revision 3.1.1.1 1998/01/17 18:15:15 root +% Release code, checksum verified +% +% Revision 3.1 1998/01/17 17:14:24 root +% Release code +% +% Revision 2.3 1998/01/16 11:59:18 root +% *** empty log message *** +% +% Revision 2.2 1997/11/07 10:44:05 root +% Release code. +% +% Revision 2.1.1.1 1997/11/04 05:06:07 root +% Development branch +% +% Revision 2.1 1997/11/01 14:55:51 bennett +% Release code. +% +% Revision 1.5 1997/10/30 20:27:21 root +% Trivial changes to the demo file. +% +% Revision 1.4 1997/10/30 08:15:14 root +% Added a note in the documentation describing the \@ifnextnparchar +% macro. +% +% Revision 1.3 1997/10/29 21:20:29 root +% Eliminated what looked like a needless gdef of preoverwordspace +% in @ifoverword. +% +% Revision 1.2 1997/10/29 20:10:35 bennett +% *** empty log message *** +% +% Revision 1.1 1997/10/29 08:17:52 root +% Initial revision +% +%\fi +% +% \title{User's Guide to the Overword package\thanks{This file is version number +% \fileversion{}. It was last revised on +% \filedate.}} +% +% \author{Frank G. Bennett, Jr.} +% +% \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 two low-level macros for the parsing of text +% using \LaTeXe{}. +% \end{abstract} +% +% +% \CheckSum{143} +% +% \section{Using the macros} +% +% This package provides two macros which can be used as +% building blocks for the parsing of text. It forms +% part of the Calendar package, but is written as +% a discrete module that may be used in other packages +% as well. +% +% The "\@ifoverword" macro takes four arguments. These +% are, in order: a token to match; a text to expand when +% a match is found; a text to expand if the match is +% not found; and a text to expand if the macro encounters +% "\end". This last is required to allow macros to be +% built which will react gracefully when the end of an +% environment or a document is encountered. +% +% This macro hops over word units (delimited by a space or spaces, +% any number of return characters being treated as a space), +% and expands text according to what it finds on the other side. +% Within the text arguments, "\@overword" can be used to +% insert the word that has been gobbled. The expanded +% text can contain the name of the macro that invokes +% "\@ifoverword". +% Note that "\@overword" is relaxed at each invocation of +% the macro. This can be used to detect whether the macro +% has encountered an "\end" immediately after itself or +% beyond a word, and thereby exit cleanly in either case. +% +% The file "demo.tex" contains a sample of the use of this macro. +% This can be used as a model for building text-parsing loops. +% +% The \cs{@ifnextnparchar} macro serves the same purpose as +% \cs{@ifnextchar} except that, like \cs{@ifoverword}, it is +% indifferent to \cs{par} (if it encounters one, it will +% gobble it and look at the next token following it). +% And like \cs{@ifoverword}, it +% takes a text to expand when the next token is \cs{end} +% as its fourth argument, to help +% protect against accidental attempts to read past the end +% of the file. +% +%\StopEventually{\PrintIndex} +% +% \begin{macro}{\@ifoverword} +% \begin{macrocode} +%<*style> +\long\def\@ifoverword#1#2#3#4{% + \let\reserved@a=#1% + \def\reserved@d{#4}\def\reserved@b{#2}\def\reserved@c{#3}% + \global\let\@overword\relax% + \futurelet\@let@token\@ifowd} +\long\def\@ifowd{% + \ifx\@let@token\@sptoken% + \gdef\@preoverwordspace{ }% + \let\reserved@e\@xifowd% + \else% + \ifx\@let@token\end% + \let\reserved@e\reserved@d% + \else% + \ifx\@let@token\par% + \let\reserved@e\@xifpargobble% + \else% + \long\def\reserved@e##1 {\long\gdef\@overword{##1}\@@ifowd}% + \fi% + \fi% + \fi% + \reserved@e} +\long\def\@xifpargobble#1{\futurelet\@let@token\@ifowd} +\def\:{\@xifowd} \expandafter\def\: {\futurelet\@let@token\@ifowd} +\def\@@ifowd{\futurelet\@let@token\@ifnparnch} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@ifnextnparchar} +% \begin{macrocode} +\long\def\@ifnextnparchar#1#2#3#4{% + \let\reserved@a=#1% + \def\reserved@b{#2}\def\reserved@c{#3}\def\reserved@d{#4}% + \futurelet\@let@token\@ifnparnch} +\long\def\@ifnparnch{% + \ifx\@let@token\@sptoken% + \let\reserved@e\@xifnparnch% + \else% + \ifx\@let@token\end% + \let\reserved@e\reserved@d% + \else% + \ifx\@let@token\par% + \let\reserved@e\@xifpargobblench% + \else% + \ifx\@let@token\reserved@a% + \let\reserved@e\reserved@b% + \else% + \let\reserved@e\reserved@c% + \fi% + \fi% + \fi% + \fi% + \reserved@e} +\long\def\@xifpargobblench#1{\futurelet\@let@token\@ifnparnch} +\def\:{\@xifnparnch} +\expandafter\def\: {\futurelet\@let@token\@ifnparnch} +%</style> +% \end{macrocode} +% \end{macro} +%\iffalse +% \section{Demo file} +% +% \begin{macrocode} +%<*demo> +\documentclass{minimal} +\usepackage{overword} + +\begin{document} + +\makeatletter + +\newtoks\registerone +\newtoks\registertwo +\def\list{} + +\def\stashonright{% + \registerone=\expandafter{\@overword} + \registertwo=\expandafter{\list} + \edef\list{% + \noexpand\\{\the\registerone}\the\registertwo}} + +\def\showlist{% + \def\\##1{\message{##1}} + \message{\space\space -> } + \list + \message{^^J}} + +\def\readlistagain{% + \def\\##1{ ##1 } + \edef\listtext{\list} +\message{\listtext} + \expandafter\store\listtext\enditall} + +\def\storeandshow{% + \@ifoverword\enditall + {\message{Ran into \string\enditall!^^J} + \stashonright + \expandafter\showlist\@gobble} + {\stashonright + \storeandshow} + {\message{Ran into \string\end!^^J} + \stashonright + \showlist}} + +\message{^^J----------------------------------------------------------------------} +\message{This file demonstrates the operation of the Overword package for LaTeX} +\message{Ordinarily, TeX reads and inteprets printable characters one by one.} +\message{With this package, it is possible to read input word by word. This} +\message{capability makes it possible to design user interfaces which are more} +\message{intuitive to users. The Calendar bundle is one example of such an} +\message{interface. Below, a phrase is printed to the terminal twice, once in} +\message{reverse word order, and once in re-reversed (normal) word order. Each} +\message{message is triggered by a control sequence found just beyond the last} +\message{word read --- \string\enditall in the first instance, \string\end\space in the second.} +\message{This file produces no printed output.} +\message{^^J----------------------------------------------------------------------} + +\storeandshow This is a demonstration of the overword package \enditall + +\let\listclone\list +\def\list{} +\def\\#1{ #1 } +\edef\listtext{\listclone} +\expandafter\storeandshow\listtext + +\end{document} +%</demo> +% \end{macrocode} +%\fi +% \Finale \PrintChanges diff --git a/Master/texmf-dist/source/latex/calendar/plotutil.dtx b/Master/texmf-dist/source/latex/calendar/plotutil.dtx new file mode 100644 index 00000000000..11fa3fef28b --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/plotutil.dtx @@ -0,0 +1,78 @@ +%\iffalse +% +% This is a set of utilities that I have used in London +% to print large files to an HP 6xx series plotter. +% At least the way I use it, this plotter handles the top +% margin in a bizzare way that requires some preprocessing +% to get things into a predictable location on the physical +% page. I don't provide any documentation here, because the +% chances are good that my problems were one-off problems. +% But it you, too, have trouble with HP 6xx series plotters +% and dvips, I will be happy to explain how this stuff works +% together (if I can remember). +% +%\fi +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{plotutil.dtx} +\end{document} +%</driver> +% \fi +% +% \CheckSum{77} +% +%\StopEventually{\PrintIndex} +% +% \begin{macrocode} +%<*script> +#!/bin/bash +JOBNAME=`basename ${*##* } .dvi` +if [ $# -gt 1 ] ; then + OPTIONS=${*% *} +else + OPTIONS="" +fi +echo ------------------------------------------------------------------- +echo : Calculating offset value +HEIGHT=`cat ./$JOBNAME.hps | sed -e s/.*PageSize\ \\\[[0-9]*\ \\\\\([0-9]*\\\\\)\\\].*/\\\1/` +OFFSET=795 +echo : Offset base figure is ${OFFSET}pt +PT_OFFSET=`echo $OFFSET $HEIGHT-p|dc|sed s/-/_/` +echo : Required offset in points is ${PT_OFFSET}pt +CM_OFFSET=`echo 2k$PT_OFFSET 72.27/2.54*p|dc` +echo : Setting offset to ${CM_OFFSET}cm +echo : ... +echo : God only knows why this process is necessary. +echo : \$\#\&\^\"\=\$\%\@ +echo ------------------------------------------------------------------- +echo dvips $OPTIONS -P372hpplotq -O 2.1cm,${CM_OFFSET}cm -h ./$JOBNAME.hps -o $JOBNAME.ps $JOBNAME.dvi +dvips $OPTIONS -P372hpplotq -O 2.1cm,${CM_OFFSET}cm -h ./$JOBNAME.hps -o $JOBNAME.ps $JOBNAME.dvi +echo Wrote PostScript\(TM\) output to $JOBNAME.ps \(I think\). +%</script> +% \end{macrocode} +% +% \begin{macrocode} +%<*style> +\NeedsTeXFormat{LaTeX2e}[1995/06/01] +\ProvidesPackage{hpplotsz} + [1997/11/07 Custom page sizes with HP 6xx series plotters (Frank Bennett)] +\newlength\hps@templen +\newwrite\hps@pagesizeheader +\newcount\hps@orientation +\def\hps@@strip#1.#2\end{#1} +\def\hps@strip#1{\expandafter\hps@@strip\the#1\end} +\def\sethpplotsize{% + \ifnum\hsize>\vsize\hps@orientation=3\else\hps@orientation=0\fi + \immediate\openout\hps@pagesizeheader=./\jobname.hps + \immediate\write\hps@pagesizeheader{% + <</PageSize [\hps@strip\paperwidth\space\hps@strip\paperheight] /Orientation \the\hps@orientation>>setpagedevice} + \immediate\closeout\hps@pagesizeheader} +%</style> +% \end{macrocode} +% \Finale \PrintChanges diff --git a/Master/texmf-dist/source/latex/calendar/timesht.dtx b/Master/texmf-dist/source/latex/calendar/timesht.dtx new file mode 100644 index 00000000000..407b20ab454 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/timesht.dtx @@ -0,0 +1,688 @@ +%\iffalse +% +% file: timesht.dtx +% Copyright (C) 1996-1997 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 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. +% +%\fi +% +% \def\fileversion{3.1.1.1} +% \def\filedate{1998/01/17 18:15:23} +% +% \iffalse +% +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{timesht.dtx} +\end{document} +%</driver> +%\fi +% +% \changes{v1.1}{1997/02/26}{Redraft of original Timesheets +% package, using Timetable package as a model.} +% \changes{v1.2}{1997/10/18}{New public release of all styles +% and modules incorporating global bug-fixes.} +% +%\iffalse +% Source tree moved under RCS +% --------------------------- +% timesht.dtx,v +% Revision 3.1.1.1 1998/01/17 18:15:23 root +% Release code, checksum verified +% +% Revision 3.1 1998/01/17 17:15:05 root +% Release code +% +% Revision 2.15 1998/01/17 11:54:43 root +% *** empty log message *** +% +% Revision 2.14 1998/01/17 11:48:41 root +% *** empty log message *** +% +% Revision 2.13 1998/01/17 10:27:17 root +% *** empty log message *** +% +% Revision 2.12 1998/01/17 10:25:29 root +% *** empty log message *** +% +% Revision 2.11 1998/01/17 04:42:57 root +% *** empty log message *** +% +% Revision 2.10 1998/01/16 20:42:51 root +% *** empty log message *** +% +% Revision 2.9 1998/01/16 17:10:16 root +% *** empty log message *** +% +% Revision 2.8 1997/12/06 09:04:25 root +% Finished elimination of landscape code, eliminated superfluous brace. +% +% Revision 2.7 1997/12/06 09:01:41 root +% Initialized tms@blocklist to empty macro. +% +% Revision 2.6 1997/12/06 08:54:55 root +% Changed docstrip label from class to package. +% +% Revision 2.5 1997/12/06 08:32:41 root +% Disable paragraph indenting inside calendar environment. +% +% Revision 2.4 1997/12/06 08:27:43 root +% Converted to style from class. +% +% Revision 2.3 1997/12/04 19:32:22 bennett +% Added typeface variables for appointments having only a +% single time. +% +% Revision 2.2 1997/11/07 10:44:05 root +% Release code. +% +% Revision 2.1.1.3 1997/11/05 06:21:56 root +% Superfluous brace in new definition. +% +% Revision 2.1.1.2 1997/11/05 06:17:14 root +% Hooked up title parameter following report fro, +% +% from Edward Czilli. +% +% Revision 2.1.1.1 1997/11/04 05:06:07 root +% Development branch +% +% Revision 2.1 1997/11/01 14:47:16 bennett +% Release code. +% +% Revision 1.7 1997/10/30 20:25:58 root +% Moved \extrarowheight so that it is only invoked once, when +% the table is first opened. +% +% Revision 1.6 1997/10/30 13:46:59 root +% Moved reset of counter, in the code for the group-closing +% footer, above the closing \\\hline to avoid leftovers on +% the following line. +% +% Revision 1.5 1997/10/30 12:38:13 root +% Changed use of \@newline to \par, to avoid weird errors arising +% from LaTeX for reasons I do not fully understand. +% +% Revision 1.4 1997/10/30 12:31:50 root +% Put \relax after the option text setting blockminutes. +% +% Revision 1.3 1997/10/29 20:13:36 bennett +% *** empty log message *** +% +% Revision 1.2 1997/10/29 17:18:39 root +% Added reset of block counter on end of subgroup, to make +% underlining between blocks position correctly on second +% and subsequent pages. +% +% Revision 1.1 1997/10/29 08:17:52 root +% Initial revision +% +%\fi +% +% \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.} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \CheckSum{598} +% +% \section{Note} +% +% Documentation for this package is contained in the file +% \texttt{calguide.tex}. +% +%\StopEventually{\PrintIndex} +% +% \section{The Class File} +% +% Preliminaries. +% +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e}[1995/06/01] +\ProvidesPackage{timesht} + [1998/01/17 18:15:23 3.1.1.1 Timesheet (Frank Bennett)] +% \end{macrocode} +% +% Initialize all registers and if statements to be +% used by this class. +% +% \begin{macrocode} +\newif\iftms@usetimes +\tms@usetimestrue +\newlength\tms@tablewidth +\newlength{\tms@hw} +\newlength{\tms@templen} +\newlength{\tms@widthlessboxes} +\newlength{\tms@timetextlen} +\newtoks\tms@tempreg@a +\newtoks\tms@tempreg@b +\newcount\tms@tempcount +\newcount\tms@start +\newcount\tms@end +\newcount\tms@minuteblocks +\newcount\tms@boxes +\newcount\tms@days +\newcount\tms@blocks +\newcount\tms@time@start +\newcount\tms@time@end +\newcount\tms@hours@start +\newcount\tms@minutes@start +\newcount\tms@hours@end +\newcount\tms@minutes@end +\newcount\tms@minute@base +\newlength{\tms@numlen} +\newcount\tms@rightprop +\newcount\tms@leftprop +\newcount\tms@groupblocks +\newcount\tms@groupblockcount +\tms@groupblockcount=1% +\newlength{\tms@colonlen} +\newlength{\tms@dashlen} +\newlength{\tms@leftlen} +\newlength{\tms@rightlen} +\tms@leftprop=1% +\tms@rightprop=1% +% \end{macrocode} +% Language setup. +% \begin{macrocode} +\input calopts.cfg +\InputIfFileExists{dates.cfg}{}{} +\ProcessOptions +% \end{macrocode} +% +% Load a bunch of useful packages. +% +% \begin{macrocode} +\RequirePackage{longtable} +\RequirePackage{array}[1996/06/14] +\RequirePackage{calendar} +\RequirePackage{keyval} +% \end{macrocode} +% +% Turn off the listing of days in the Calendar style. +% It only works well for monthly calendars. +% +% \begin{macrocode} +\tracingdates=0% +% \end{macrocode} +% +% Set up a list of options for the Calendar style engine +% to use with the "keyval" parser. +% +% \begin{macrocode} +\define@key{opt}{leftspace}{\setlength{\LTleft}{#1}} +\define@key{opt}{rightspace}{\setlength{\LTright}{#1}} +\define@key{opt}{width}{\setlength{\tms@tablewidth}{#1}} +\define@key{opt}{title}{\def\tms@title{#1}} +\define@key{opt}{start}{\@settime\tms@start#1{}} +\define@key{opt}{end}{\@settime\tms@end#1{}} +\define@key{opt}{blockminutes}{\tms@minuteblocks=#1\relax} +\define@key{opt}{blockgroup}{\tms@groupblocks=#1\relax} +\define@key{opt}{leftright}{\tms@extractprops#1{}} +\define@key{opt}{titletype}{\def\tms@titletype##1{{#1{##1}}}} +\define@key{opt}{labeltype}{\def\tms@labeltype##1{{#1{##1}}}} +\define@key{opt}{timelabeltype}{\def\tms@timelabeltype##1{{#1{##1}}}} +\define@key{opt}{timeitemtype}{\def\tms@timeitemtype##1{{#1{##1}}}} +\define@key{opt}{itemtype}{\def\tms@itemtype##1{{#1{##1}}}} +\define@key{opt}{notimes}[f]{\tms@usetimesfalse} +% \end{macrocode} +% +% Before setting default values, +% provide a set of parsing macros for use in scanning +% some of the options fed to the "keyval" parser. +% Doing this here allows us to specify the defaults in a +% human readable syntax. +% +% \begin{macrocode} +\def\tms@extractprops#1/#2#{% + \tms@leftprop=#1\tms@rightprop=#2} +\def\@settime#1#2:#3#{% + \tms@tempcount=#2% + \multiply\tms@tempcount by60% + \advance\tms@tempcount by#3% + \global#1\tms@tempcount} +\def\@splitblocks#1-#2#{% + \def\@blockstarttext{#1}% + \def\@blockendtext{#2}} +\def\@setblocks#1,#2#{% + \ifcat$#1$% + \let\next\@gobble% + \else% + \let\next\@setblocks% + \global\advance\tms@blocks by 1% + \@splitblocks#1{}% + \expandafter\@settime% + \expandafter\tms@time@start\@blockstarttext{}% + \expandafter\@settime% + \expandafter\tms@time@end\@blockendtext{}% + \let\tms@tempmac\tms@blocklist% + \edef\tms@blocklist{% + \tms@tempmac\the\tms@time@start-\the\tms@time@end,}% + \fi% + \next#2{}} +\def\tms@chopblock#1-#2,#3#{% + \global\tms@time@start=#1% + \global\tms@time@end=#2% + \gdef\tms@blocklist{#3}}% +\def\tms@labellist{}% +\def\@extractlabels#1,#2#{% + \ifcat$#1$% + \tms@tempreg@a=\expandafter{\tms@labellist}% + \edef\tms@label##1{% + \noexpand\ifcase##1\the\tms@tempreg@a\noexpand\fi}% + \let\next\@gobble% + \else% + \let\next\@extractlabels% + \let\tms@tempmac\tms@labellist% + \expandafter\def% + \expandafter\tms@labellist% + \expandafter{% + \tms@tempmac\or #1}% + \fi% + \next#2{}} +% \end{macrocode} +% +% Set up default values for the "keyval" options. +% +% \begin{macrocode} +\def\tms@titletype#1{{\Large\bfseries#1}}% +\def\tms@labeltype#1{{\large\bfseries#1}}% +\def\tms@timelabeltype#1{{\bfseries#1}} +\def\tms@timeitemtype#1{{\large#1}} +\def\tms@itemtype#1{{\small#1}} +\def\tms@title{\themonth\space\theday,\space\theyear} +\@settime\tms@start8:00{} +\@settime\tms@end17:00{} +\tms@minuteblocks=15\relax% +\def\tms@blocklist{}% +\def\tms@label#1{\themonth\space\theday}% +\tms@groupblocks=4\relax% +\tms@extractprops4/5{} +% \end{macrocode} +% +% +% Define the calendar. As for all Calendar styles, +% this is done using "\newcalendar" with 17 arguments. +% +% \begin{macrocode} +\newcalendar% +% \end{macrocode} +% +% Name the new calendar environment. +% +% \begin{macrocode} +{timesheet} +% \end{macrocode} +% +% Select an off-the-shelf macro for printing +% that will dump printable +% items on DVI. +% +% \begin{macrocode} +{\cal@insert} +% \end{macrocode} +% +% Be indifferent to the starting day of the week. +% ("0" through "6" specify Sunday through Saturday). +% +% \begin{macrocode} +{7} +% \end{macrocode} +% +% Set the number of items in a group (time blocks) +% +% \begin{macrocode} +{\tms@blocks} +% \end{macrocode} +% +% Set the number of items in a subgroup (one block). +% +% \begin{macrocode} +{1} +% \end{macrocode} +% +% Use ampersand table separator before all items +% but the first in a subgroup (never used, b/c only one item). +% +% \begin{macrocode} +{&} +% \end{macrocode} +% +% Increment the date at the end of every group, and sneak +% in a post-increment recalculation for the time labels. +% +% \begin{macrocode} +{G\tms@gettimes} +% \end{macrocode} +% +% Specify the header. This has to be built on the fly +% in the Timesheet style, to give control over width +% to the user. So just give the +% name of the macro here. +% \begin{macrocode} +{\tms@header} +% \end{macrocode} +% +% Specify the tail of the table. +% +% \begin{macrocode} +{&% + \global\tms@groupblockcount=1\relax% + \\\hline% + \end{longtable}}% +% \end{macrocode} +% +% How to end a group. +% +% \begin{macrocode} +{\cal@footer\newpage\cal@header} +% \end{macrocode} +% +% Specify how to break the end of a subgroup. +% In this case, we end the table line and add +% a time block that must be generated on the fly. +% +% The new "\\*" form in "longtable" seems to have no +% impact here. Rats. +% +% \begin{macrocode} +{&% + \ifnum\tms@groupblockcount<\tms@groupblocks% + \\*\cline{1-4}% + \global\advance\tms@groupblockcount by1\relax% + \else% + \\\hline% + \global\tms@groupblockcount=1\relax% + \fi% + \tms@timecoltext} +% \end{macrocode} +% Next is code to be run before the calendar options +% are digested and the controlling date is read. +% +% \textit{Set a couple of Calendar toggles before +% scanning the date contained in the "timesheet" +% environment.} +% \begin{macrocode} +{\dates@requiremonthtrue\dates@requiredaytrue +% \end{macrocode} +% \textit{Set default width of table.} +% \begin{macrocode} + \setlength{\tms@tablewidth}{\textwidth} +% \end{macrocode} +% \textit{Initialize \cs{tms@blocklist} to \texttt{nil}.} +% \begin{macrocode} + \def\tms@blocklist{}} +% \end{macrocode} +% +% "\cal@range@start", "\cal@range@end" and "\dates@date" +% are all set internally, so we just provide information +% here. Remember to adjust human-readable dates with +% "\caldate" when changing "\dates@date", and +% long dates with "\dates@fix" when adjusting +% the human readable stuff. +% +% \begin{macrocode} +{\message{^^JStart: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% + \dates@date\cal@range@end% + \caldate% + \message{^^JEnd: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% + \dates@date\cal@range@start% + \caldate% +% \end{macrocode} +% +% \textit{Set the number of blocks and the number of blocks in a group.} +% +% \begin{macrocode} +\relax% +\tms@blocks\tms@end% +\advance\tms@blocks by-\tms@start% +\divide\tms@blocks by\tms@minuteblocks% +% \end{macrocode} +% +% \textit{Prepare an algorithm to derive the start and +% end time of a block from the value of the +% counter \texttt{cal@group@count} and set values in +% \texttt{tms@time@start}, \texttt{tms@time@end} +% and \texttt{tms@timecoltext}.} +% +% \begin{macrocode} + \def\tms@gettimes{% + \ifcat$\tms@blocklist$% + \tms@time@start\cal@group@count% + \multiply\tms@time@start by\tms@minuteblocks% + \global\advance\tms@time@start by\tms@start% + \tms@time@end\tms@time@start% + \global\advance\tms@time@end by\tms@minuteblocks% + \else% + \expandafter\tms@chopblock\tms@blocklist-,{}% + \fi% + \mod{60}\tms@time@start\tms@minutes@start% + \tms@hours@start\dates@three% + \divide\tms@hours@start by60% + \mod{60}\tms@time@end\tms@minutes@end% + \tms@hours@end\dates@three% + \divide\tms@hours@end by60% + \ifnum\tms@minutes@start<10% + \edef\tms@minutes@start@mac{0\the\tms@minutes@start}% + \else% + \edef\tms@minutes@start@mac{\the\tms@minutes@start}% + \fi% + \ifnum\tms@minutes@end<10% + \edef\tms@minutes@end@mac{0\the\tms@minutes@end}% + \else% + \edef\tms@minutes@end@mac{\the\tms@minutes@end}% + \fi% + \xdef\tms@timecoltext{% + \noexpand\tms@timelabeltype{\the\tms@hours@start}&% + \noexpand\tms@timelabeltype{\tms@minutes@start@mac}&% + \noexpand\tms@timelabeltype{\the\tms@hours@end}&% + \noexpand\tms@timelabeltype{\tms@minutes@end@mac}&}}% +% \end{macrocode} +% +% \textit{Set the dimensions of the table. We don't have +% to worry about the vertical dimensions; we leave that +% to longtable.} +% +% \textit{First let the user know what we're planning to do.} +% +% \begin{macrocode} +\message{Package Timesheet: % + setting table \the\tms@tablewidth\space in width.^^J}% +% \end{macrocode} +% +% \textit{The rules surrounding the first (time) column.} +% +% \begin{macrocode} + \setlength{\tms@widthlessboxes}{2\arrayrulewidth}% +% \end{macrocode} +% +% \textit{The rules at the end of the text columns.} +% +% \begin{macrocode} + \addtolength{\tms@widthlessboxes}{3\arrayrulewidth}% + \addtolength{\tms@widthlessboxes}{\doublerulesep}% +% \end{macrocode} +% +% \textit{The space between the rules and the neighbouring text.} +% +% \begin{macrocode} + \addtolength{\tms@widthlessboxes}{6\tabcolsep}% +% \end{macrocode} +% +% \textit{The width of the time text.} +% +% \begin{macrocode} + \settowidth{\tms@numlen}{\tms@timelabeltype{99}}% + \settowidth{\tms@colonlen}{\tms@timelabeltype{:}}% + \settowidth{\tms@dashlen}{\tms@timelabeltype{\ --\ }}% + \addtolength{\tms@widthlessboxes}{4\tms@numlen}% + \addtolength{\tms@widthlessboxes}{2\tms@colonlen}% + \addtolength{\tms@widthlessboxes}{\tms@dashlen}% +% \end{macrocode} +% +% \textit{Everything else is for the text columns.} +% +% \begin{macrocode} + \tms@tempcount\tms@leftprop% + \advance\tms@tempcount by\tms@rightprop% +% + \setlength{\tms@templen}{\tms@tablewidth}% + \addtolength{\tms@templen}{-\tms@widthlessboxes}% +% + \tms@leftlen\tms@templen% + \divide\tms@leftlen by\tms@tempcount% + \global\multiply\tms@leftlen by\tms@leftprop% +% + \tms@rightlen\tms@templen% + \divide\tms@rightlen by\tms@tempcount% + \global\multiply\tms@rightlen by\tms@rightprop% +% \end{macrocode} +% +% \textit{Prepare the macro that will generate a table +% header with an appropriate number of columns +% in appropriate sizes.} +% +% \begin{macrocode} + \tms@tempcount\tms@days% + \advance\tms@tempcount by1% + \protected@edef\tms@header{% + \noexpand\begin{longtable}{% + |>{\hfill}% + m{\the\tms@numlen}% + @{\tms@timelabeltype{:}}% + m{\the\tms@numlen}% + @{\tms@timelabeltype{\ --\ }}% + >{\hfill}% + m{\the\tms@numlen}% + @{\tms@timelabeltype{:}}% + m{\the\tms@numlen}% + |% + m{\the\tms@leftlen}||% + m{\the\tms@rightlen}|}% + \noexpand\multicolumn{6}{c}% + {\tms@titletype{\noexpand\tms@title}}% + \\% + \noexpand\multicolumn{4}{l}{}% + &% + \noexpand\multicolumn{1}{c}{\textbf{Plan}}&% + \noexpand\multicolumn{1}{c}{\textbf{Action}}% + \noexpand\\\noexpand\hline% + \noexpand\endhead% + \noexpand\tms@timecoltext}% + \extrarowheight=3pt} +% \end{macrocode} +% +% Specify the divider to be placed between entries +% within a timesheet box. +% +% \begin{macrocode} +{\par\smallskip}% +% \end{macrocode} +% +% Use the standard Calendar item-fetching macros to +% grab classes of items. We only need appointments +% (things with a time associated with them) in this case, +% and we specify the range of the current box to +% limit the entries that are grabbed for current use. +% +% \begin{macrocode} +{\cal@get@appointments[\tms@time@start/\tms@time@end]}% +% \end{macrocode} +% +% Prepare macro text that will set the text to +% "\longtext" on the first entry, and "\shorttext" +% with braces thereafter. +% +% \begin{macrocode} +{\relax% + \ifnum\dates@time@start>0\relax% +% \end{macrocode} +% +% \textit{We print a short entry for anything that starts +% outside the slot we are dealing with.} +% +% \begin{macrocode} + \ifnum\dates@time@start<\tms@time@start% + \protected@edef\cal@entry@text{% + \noexpand\parbox{\the\tms@leftlen}{\noexpand\raggedright% + \noexpand\tms@itemtype{% + \noexpand$\noexpand<\noexpand$% + \theshorttext, to \cal@appt@end@text% + \noexpand$\noexpand>\noexpand$}}}% +% \end{macrocode} +% +% \textit{All other conforming entries get the long text.} +% +% \begin{macrocode} + \else% + \ifnum\dates@time@start<\dates@time@end% + \protected@edef\cal@entry@text{% + \noexpand\parbox{\the\tms@leftlen}{\noexpand\raggedright% + \iftms@usetimes% + \noexpand\tms@timeitemtype{% + \cal@appt@start@text% + --% + \cal@appt@end@text}% + \space% + \fi% + \noexpand\tms@itemtype{% + \thelongtext}}}% + \else% + \protected@edef\cal@entry@text{% + \noexpand\parbox{\the\tms@leftlen}{\noexpand\raggedright% + \iftms@usetimes% + \noexpand\tms@timeitemtype{% + \cal@appt@start@text}% + \space% + \fi% + \tms@itemtype{\thelongtext}}}% + \fi% + \fi% + \fi}% +% \end{macrocode} +% +% Chuck the assembled stack of appointments into +% the box. +% +% \begin{macrocode} +{\theappointments} +\message{Done loading style} +% \end{macrocode} +%</package> +% \Finale \PrintChanges diff --git a/Master/texmf-dist/source/latex/calendar/timetabl.dtx b/Master/texmf-dist/source/latex/calendar/timetabl.dtx new file mode 100644 index 00000000000..3d20d67f876 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/timetabl.dtx @@ -0,0 +1,772 @@ +%\iffalse +% +% file: timetabl.dtx +% Copyright (C) 1996-1997 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 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. +% +%\fi +% +% \def\fileversion{3.1.1.1} +% \def\filedate{1998/01/17 18:15:28} +% +% \iffalse +% +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{timetabl.dtx} +\end{document} +%</driver> +%\fi +% +% \changes{v1.0}{1997/02/26}{First release version, implementing +% a suggestion from Miroslav Novak.} +% \changes{v1.1}{1997/03/08}{Added \cs{protected@edef} to labels +% definition, so my wife's birthday can be indicated in color +% in our travel itinerary\ldots but it didn't work. Colors +% in labels come up with an empty color. Problem occurs only if the +% \cs{textcolor} command is at the start of the label, so +% this is probably do to an unnecessary \cs{expandafter}.} +% \changes{v1.1}{1997/03/08}{Added time type declaration to +% pinpoint times for consistency.} +% \changes{v1.2}{1997/05/15}{Merged improved preliminary matter from +% the revised monthly.dtx package.} +% \changes{v1.3}{1997/09/24}{Oops. Seem to have released without +% completing the changes. File now works again. Converted to +% package (from class) in the process.} +% \changes{v1.4}{1997/10/18}{New public release of all styles +% and modules incorporating global bug-fixes.} +% +%\iffalse +% Source tree moved under RCS +% --------------------------- +% timetabl.dtx,v +% Revision 3.1.1.1 1998/01/17 18:15:28 root +% Release code, checksum verified +% +% Revision 3.1 1998/01/17 17:15:17 root +% Release code +% +% Revision 2.5 1998/01/16 17:41:30 root +% *** empty log message *** +% +% Revision 2.4 1998/01/15 10:20:31 root +% Two typos: vline changed to vrule, and labelstrutbuf now +% set using W, not the actual text. +% +% Revision 2.3 1997/11/26 07:49:48 bennett +% Fixed typeface options, added footer, provided new option +% to stretch label height, added color support. +% +% Revision 2.2 1997/11/07 10:44:05 root +% Release code. +% +% Revision 2.1.1.4 1997/11/07 08:45:09 root +% Added documentation for the new "notimes" option. Wrote +% documentation notes for existing options that were unexplained. +% +% Revision 2.1.1.3 1997/11/07 08:11:13 root +% Further changes to implement selective inclusion of times. +% Fixed error in option definitions controlling typeface +% selection. +% +% Revision 2.1.1.2 1997/11/07 03:23:22 root +% Added code to suppress times in entries if desired. +% +% Revision 2.1.1.1 1997/11/04 05:06:07 root +% Development branch +% +% Revision 2.1 1997/11/01 14:51:25 bennett +% Release code. +% +% Revision 1.2 1997/10/29 19:54:57 bennett +% Fixed error in RCS variable 1998/01/17 18:15:28 in the ProvidesPackage +% declaration. +% +% Revision 1.1 1997/10/29 08:17:52 root +% Initial revision +% +%\fi +% +% \title{User's Guide to the Timetable +% package\thanks{This file is version number +% \fileversion{}. It was last revised on +% \filedate{}.}} +% +% \author{Frank G. Bennett, Jr.} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \CheckSum{641} +% +% Please see the file \texttt{calguide.tex} for details on +% the use of this package. +% +%\StopEventually{\PrintIndex} +% +% \subsection{The Package File} +% +% Load a bunch of useful code. +% +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e}[1995/06/01] +\ProvidesPackage{timetabl} + [1998/01/17 18:15:28 3.1.1.1 Timetable (Frank Bennett)] +% \end{macrocode} +% Define a few boolean switches, which are needed to process +% the style options. +% \begin{macrocode} +\newif\ifttbl@usecolor +\newif\ifttbl@verbose +% \end{macrocode} +% Define some more variables and switches for use in the body +% of the style. +% \begin{macrocode} +\newlength\ttbl@tablewidth +\newlength{\ttbl@hw} +\newlength{\ttbl@templen} +\newlength{\ttbl@widthlessboxes} +\newlength{\ttbl@timetextlen} +\newtoks\ttbl@tempreg@a +\newtoks\ttbl@tempreg@b +\newcount\ttbl@tempcount +\newcount\ttbl@start +\newcount\ttbl@end +\newcount\ttbl@minuteblocks +\newcount\ttbl@boxes +\newcount\ttbl@days +\newcount\ttbl@blocks +\newcount\ttbl@time@start +\newcount\ttbl@time@end +\newcount\ttbl@hours@start +\newcount\ttbl@minutes@start +\newcount\ttbl@hours@end +\newcount\ttbl@minutes@end +\newcount\ttbl@minute@base +% \end{macrocode} +% +% \subsection{Options} +% +% We include the language support offered to all styles in the bundle. +% \begin{macrocode} +\input calopts.cfg +\InputIfFileExists{dates.cfg}{}{} +\ProcessOptions +% \end{macrocode} +% +% \subsection{Option Postprocessing} +% +% Now that the options lists are available to us, +% we can start loading packages. The following packages +% are always loaded, and always with the same options. +% \begin{macrocode} +\RequirePackage{array}[1996/06/14] +\RequirePackage{calendar} +\RequirePackage{longtable} +\RequirePackage{rotating} +% \end{macrocode} +% We get ready to set the dimensions +% of the table that will contain the calendar?? +% \begin{macrocode} + \def\ttbl@settablewidth{% + \setlength{\ttbl@tablewidth}{\hsize}}% +% \end{macrocode} +% Turn off the listing of days in the Calendar style. +% It only works well for monthly calendars. +% \begin{macrocode} +\tracingdates=0% +% \end{macrocode} +% Set up a list of options for the Calendar style engine +% to use with the "keyval" parser. +% \begin{macrocode} +\define@key{opt}{leftspace}{\setlength{\LTleft}{#1}} +\define@key{opt}{rightspace}{\setlength{\LTright}{#1}} +\define@key{opt}{width}{\setlength{\ttbl@tablewidth}{#1}} +\define@key{opt}{title}{\def\ttbl@title{#1}} +\define@key{opt}{start}{\@settime\ttbl@start#1{}} +\define@key{opt}{end}{\@settime\ttbl@end#1{}} +\define@key{opt}{blockminutes}{\ttbl@minuteblocks=#1} +\define@key{opt}{blocks}{\@setblocks#1,,{}} +\define@key{opt}{labels}{\@extractlabels#1,,{}} +\define@key{opt}{timeitemface}{\def\ttbl@timeitemface##1{{#1{##1}}}} +\define@key{opt}{timelabelface}{\def\ttbl@timelabelface##1{{#1{##1}}}} +\define@key{opt}{itemface}{\def\ttbl@itemface##1{{#1{##1}}}} +\define@key{opt}{titleface}{\def\ttbl@titleface##1{{#1{##1}}}} +\define@key{opt}{labelface}{\def\ttbl@labelface##1{{#1{##1}}}} +\define@key{opt}{notimes}[f]{\@ttbl@usetimesfalse} +\define@key{opt}{footer}{\def\ttbl@foot{#1}} +\define@key{opt}{extralabelheight}{\ttbl@extralabelheight=#1} +\newlength\ttbl@extralabelheight +\newlength\ttbl@labelstrut% +\newlength\ttbl@labelstrutbuf% +% \end{macrocode} +% +% Before setting default values, +% provide a set of parsing macros for use in scanning +% some of the options fed to the "keyval" parser. +% Doing this here allows us to specify the defaults in a +% human readable syntax. +% +% \begin{macrocode} +\def\@settime#1#2:#3#{% + \ttbl@tempcount=#2% + \multiply\ttbl@tempcount by60% + \advance\ttbl@tempcount by#3% + \global#1\ttbl@tempcount} +\def\@splitblocks#1-#2#{% + \def\@blockstarttext{#1}% + \def\@blockendtext{#2}} +\def\@setblocks#1,#2#{% + \ifcat$#1$% + \let\next\@gobble% + \else% + \let\next\@setblocks% + \global\advance\ttbl@blocks by 1% + \@splitblocks#1{}% + \expandafter\@settime% + \expandafter\ttbl@time@start\@blockstarttext{}% + \expandafter\@settime% + \expandafter\ttbl@time@end\@blockendtext{}% + \let\ttbl@tempmac\ttbl@blocklist% + \edef\ttbl@blocklist{% + \ttbl@tempmac\the\ttbl@time@start-\the\ttbl@time@end,}% + \fi% + \next#2{}} +\def\ttbl@chopblock#1-#2,#3#{% + \global\ttbl@time@start=#1% + \global\ttbl@time@end=#2% + \gdef\ttbl@blocklist{#3}}% +\def\ttbl@labellist{}% +\def\@extractlabels#1,#2#{% + \ifcat$#1$% + \ttbl@tempreg@a=\expandafter{\ttbl@labellist}% + \edef\ttbl@label##1{% + \noexpand\ifcase##1\the\ttbl@tempreg@a\noexpand\fi}% + \let\next\@gobble% + \else% + \let\next\@extractlabels% + \let\ttbl@tempmac\ttbl@labellist% + \expandafter\def% + \expandafter\ttbl@labellist% + \expandafter{% + \ttbl@tempmac\or #1}% + \fi% + \next#2{}} +% \end{macrocode} +% +% Set up default values for the "keyval" options. +% +% \begin{macrocode} +\def\ttbl@title{Conference Schedule} +\@settime\ttbl@start8:00{} +\@settime\ttbl@end17:00{} +\ttbl@minuteblocks=60% +\def\ttbl@blocklist{}% +\def\ttbl@label#1{\themonth\space\theday}% +\def\ttbl@timeitemface#1{{\small{#1}}}% +\def\ttbl@timelabelface#1{{\small\textbf{#1}}}% +\def\ttbl@itemface#1{{\small\textit{#1}}}% +\def\ttbl@titleface#1{{\large\textbf{#1}}}% +\def\ttbl@labelface#1{{\textbf{#1}}}% +\newif\if@ttbl@usetimes% +\@ttbl@usetimestrue% +\def\ttbl@foot{}% +% \end{macrocode} +% +% +% Define the calendar. As for all Calendar styles, +% this is done using "\newcalendar" with 17 arguments. +% +% \begin{macrocode} +\newcalendar% +% \end{macrocode} +% +% Name the new calendar environment. +% +% \begin{macrocode} +{timetable} +% \end{macrocode} +% +% Select an off-the-shelf macro for printing +% that will dump printable +% items on DVI. +% +% \begin{macrocode} +{\cal@insert} +% \end{macrocode} +% +% Be indifferent to the starting day of the week. +% ("0" through "6" specify Sunday through Saturday). +% +% \begin{macrocode} +{7} +% \end{macrocode} +% +% Set the number of items in a group (the whole timetable, in this case). +% +% \begin{macrocode} +{\ttbl@boxes} +% \end{macrocode} +% +% Set the number of items in a subgroup (a line, in this case). +% +% \begin{macrocode} +{\ttbl@days} +% \end{macrocode} +% +% Use the ampersand table separator before all items +% but the first in a subgroup. +% +% \begin{macrocode} +{&} +% \end{macrocode} +% +% Select a zigzig algorithm that increments the +% day at each item, and jumps back to the start +% day at the end of each subgroup. The use of +% "\ttbl@gettimes" here is unsightly, but for the time +% being this gives us a way to sneak in a non-printing +% calculation in advance of the first item in a new +% subgroup. +% +% \begin{macrocode} +{z\ttbl@gettimes} +% \end{macrocode} +% +% Specify the header. This has to be built on the fly +% in the Timetable style, since all of the sizes +% are determined from user options. So just give the +% name of the macro here. +% \begin{macrocode} +{\extrarowheight=3pt\ttbl@header} +% \end{macrocode} +% +% Specify the tail of the table. Remember to terminate +% landscape if it was requested. +% +% \begin{macrocode} +{\\\hline\end{longtable}}% +% \end{macrocode} +% +% This will never be used in this style, because our +% text consists of a single group. +% +% \begin{macrocode} +{\cal@footer\newpage\cal@header} +% \end{macrocode} +% +% Specify how to break the end of a subgroup. +% In this case, we end the table line and add +% a time block that must be generated on the fly. +% +% \begin{macrocode} +{\\\hline\ttbl@timecoltext} +% \end{macrocode} +% +% Set a couple of Calendar toggles before +% scanning the date contained in the "timetable" +% environment. +% +% \begin{macrocode} +{\dates@requiremonthtrue\dates@requiredaytrue} +% \end{macrocode} +% +% "\cal@range@start", "\cal@range@end" and "\dates@date" +% are all set internally, so we just provide information +% here. Remember to adjust human-readable dates with +% "\caldate" when changing "\dates@date", and +% long dates with "\dates@fix" when adjusting +% the human readable stuff. +% +% \begin{macrocode} +{\message{^^JStart: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% + \dates@date\cal@range@end% + \caldate% + \message{^^JEnd: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% + \dates@date\cal@range@start% + \caldate% +% \end{macrocode} +% +% \textit{Set the length of the conference in \texttt{ttbl@days}.} +% +% \begin{macrocode} + \ttbl@days\cal@range@end% + \advance\ttbl@days by-\cal@range@start% + \advance\ttbl@days by1% +% \end{macrocode} +% +% \textit{Set the number of boxes in a group. The number of +% vertical blocks will already have been set if +% the \texttt{blocks} option was used, so bypass that if +% appropriate.} +% +% \begin{macrocode} +\ifcat$\ttbl@blocklist$% + \ttbl@blocks\ttbl@end% + \advance\ttbl@blocks by-\ttbl@start% + \divide\ttbl@blocks by\ttbl@minuteblocks% +\fi% +\ttbl@boxes\ttbl@blocks% +\multiply\ttbl@boxes by\ttbl@days% +% \end{macrocode} +% +% \textit{Prepare an algorithm to derive the start and +% end time of a block from the value of the +% counter \texttt{cal@group@count} and set values in +% \texttt{ttbl@time@start}, \texttt{ttbl@time@end} +% and \texttt{ttbl@timecoltext}.} +% +% \begin{macrocode} + \def\ttbl@gettimes{% + \ifcat$\ttbl@blocklist$% + \ttbl@time@start\cal@group@count% + \divide\ttbl@time@start by\ttbl@days% + \multiply\ttbl@time@start by\ttbl@minuteblocks% + \global\advance\ttbl@time@start by\ttbl@start% + \ttbl@time@end\ttbl@time@start% + \global\advance\ttbl@time@end by\ttbl@minuteblocks% + \else% + \expandafter\ttbl@chopblock\ttbl@blocklist-,{}% + \fi% + \mod{60}\ttbl@time@start\ttbl@minutes@start% + \ttbl@hours@start\dates@three% + \divide\ttbl@hours@start by60% + \mod{60}\ttbl@time@end\ttbl@minutes@end% + \ttbl@hours@end\dates@three% + \divide\ttbl@hours@end by60% + \ifnum\ttbl@minutes@start<10% + \edef\ttbl@minutes@start@mac{0\the\ttbl@minutes@start}% + \else% + \edef\ttbl@minutes@start@mac{\the\ttbl@minutes@start}% + \fi% + \ifnum\ttbl@minutes@end<10% + \edef\ttbl@minutes@end@mac{0\the\ttbl@minutes@end}% + \else% + \edef\ttbl@minutes@end@mac{\the\ttbl@minutes@end}% + \fi% + \xdef\ttbl@timecoltext{% + \noexpand\vbox{\vfil\vskip4pt% + \noexpand\begin{sideways}% + \noexpand\ttbl@timelabelface{% + \the\ttbl@hours@end:\ttbl@minutes@end@mac% + $\noexpand\leftarrow$% + \the\ttbl@hours@start:\ttbl@minutes@start@mac}% + \noexpand\end{sideways}% + \vfil} + &}}% +% \end{macrocode} +% +% \textit{Set the dimensions of the table. We don't have +% to worry about the vertical dimensions; we leave that +% to longtable.} +% +% \textit{First let the user know what we're planning to do.} +% +% \begin{macrocode} +\ttbl@tablewidth\textwidth% +\message{Package Timetable: % + setting table \the\ttbl@tablewidth\space in width.^^J}% +% \end{macrocode} +% +% \textit{The rules surrounding the first (time) column.} +% +% \begin{macrocode} + \setlength{\ttbl@widthlessboxes}{2\arrayrulewidth}% +% \end{macrocode} +% +% \textit{The rules at the end of the text columns.} +% +% \begin{macrocode} + \addtolength{\ttbl@widthlessboxes}{\ttbl@days\arrayrulewidth}% +% \end{macrocode} +% +% \textit{The space between the rules and the neighbouring text.} +% +% \begin{macrocode} + \addtolength{\ttbl@widthlessboxes}{2\tabcolsep}% + \setlength{\ttbl@templen}{2\tabcolsep}% + \addtolength{\ttbl@widthlessboxes}{\ttbl@days\ttbl@templen}% +% \end{macrocode} +% +% \textit{The width of the time text.} +% +% \begin{macrocode} + \settoheight{\ttbl@timetextlen}{\ttbl@timelabelface{99:99--99:99}}% + \settodepth{\ttbl@templen}{\ttbl@timelabelface{99:99--99:99}}% + \addtolength{\ttbl@timetextlen}{\ttbl@templen}% + \addtolength{\ttbl@widthlessboxes}{\ttbl@timetextlen}% +% \end{macrocode} +% +% \textit{Everything else is for the text columns.} +% +% \begin{macrocode} + \setlength{\ttbl@hw}{\ttbl@tablewidth}% + \addtolength{\ttbl@hw}{-\ttbl@widthlessboxes}% + \divide\ttbl@hw by\ttbl@days% +% \end{macrocode} +% +% \textit{Prepare the macro that will generate a table +% header with an appropriate number of columns +% in appropriate sizes.} +% +% \textit{First we make up a unit in the width of the +% time text, as determined above. We make that +% the first chunk of the format.} +% +% \begin{macrocode} +\edef\ttbl@firstunit{% + m{\the\ttbl@timetextlen}% + \noexpand|}% +\ttbl@tempreg@a=\expandafter{\expandafter|\ttbl@firstunit}% +% \end{macrocode} +% +% \textit{Then we make up a similar chunk, but with the +% length of the day columns, and store it in a register.} +% +% \begin{macrocode} +\edef\ttbl@dayunit{% + m{\the\ttbl@hw}% + \noexpand|}% +\ttbl@tempreg@b=\expandafter{\ttbl@dayunit}% +% \end{macrocode} +% +% \textit{Within a loop, we add the day unit format chunk +% to the format string until we have a chunk for +% each day in the conference.} +% +% \begin{macrocode} +\ttbl@tempcount=1% +\loop% + \edef\ttbl@tempmac{\the\ttbl@tempreg@a\the\ttbl@tempreg@b}% + \ttbl@tempreg@a=\expandafter{\ttbl@tempmac}% +\ifnum\ttbl@tempcount<\ttbl@days% + \advance\ttbl@tempcount by1% +\repeat% +% \end{macrocode} +% +% \textit{Within another loop, we build the labels. +% This is inelegant, but it works. We maintain +% two counters in the loop, since the macro "ttbl@label" +% might be looking for a date or the column number.} +% \begin{macrocode} + \global\settoheight\ttbl@labelstrutbuf{\ttbl@labelface{W}}% + \global\advance\ttbl@labelstrutbuf by\ttbl@extralabelheight\relax% + \ifnum\ttbl@labelstrutbuf>\ttbl@labelstrut% + \global\ttbl@labelstrut\ttbl@labelstrutbuf% + \fi% + \def\ttbl@labeltext{}% + \dates@date=\cal@range@start% + \caldate% + \ttbl@tempcount=1% + \ttbl@tempreg@b={}% + \loop% + \protected@edef\ttbl@labeltext{\the\ttbl@tempreg@b&% + \noexpand\multicolumn{1}{c|}{% + \noexpand\ttbl@labelface{% + \ttbl@label{\ttbl@tempcount}}}}% + \ttbl@tempreg@b=\expandafter{\ttbl@labeltext}% + \ifnum\dates@date<\cal@range@end% + \advance\dates@date by1% + \caldate% + \advance\ttbl@tempcount by1% + \repeat% +% \end{macrocode} +% +% \textit{Reset the starting date.} +% +% \begin{macrocode} + \dates@date\cal@range@start% + \caldate% +% \end{macrocode} +% +% \textit{Then we put the rest of the basic header +% stuff around the string. We use \texttt{protected@edef} +% so that robust commands can be used in the title and +% the labels. Note the conditional use of "landscape".} +% +% \begin{macrocode} + \ttbl@tempcount\ttbl@days% + \advance\ttbl@tempcount by1% + \protected@edef\ttbl@header{% + \noexpand\begin{longtable}{\the\ttbl@tempreg@a}% + \noexpand\multicolumn{\ttbl@tempcount}{c}% + {\noexpand\ttbl@titleface{\ttbl@title}}% + \noexpand\\\noexpand\hline% + \noexpand\vrule width0pt depth 0pt height\ttbl@labelstrut\relax% + \the\ttbl@tempreg@b\noexpand\\% + \noexpand\hline\noexpand\hline\noexpand\endhead% + \ifcat$\ttbl@foot$\else% + \noexpand\multicolumn{\ttbl@tempcount}{l}% + {\noexpand\ttbl@foot}\noexpand\\% + \noexpand\endfoot% + \fi% + \noexpand\ttbl@timecoltext}}% +% \end{macrocode} +% +% Specify the divider to be placed between entries +% within a time\-table box. +% +% \begin{macrocode} +{\par\medskip}% +% \end{macrocode} +% +% Use the standard Calendar item-fetching macros to +% grab classes of items. We only need appointments +% (things with a time associated with them) in this case, +% and we specify the range of the current box to +% limit the entries that are grabbed for current use. +% +% \begin{macrocode} +{\cal@get@appointments[\ttbl@time@start/\ttbl@time@end]}% +% \end{macrocode} +% +% Prepare macro text that will set the text to +% "\longtext" on the first entry, and "\shorttext" +% with braces thereafter. If no "\longtext" +% exists, use the "\shorttext" for everything. +% +% \begin{macrocode} +{\relax% + \ifnum\dates@time@start>0\relax% +% \end{macrocode} +% +% \textit{We print a short entry for anything that starts +% outside the slot we are dealing with.} +% +% \begin{macrocode} + \ifnum\dates@time@start<\ttbl@time@start% + \protected@edef\cal@entry@text{% + \noexpand\cal@textcolor{\calcolor}{% + \noexpand\ttbl@itemface{% + \noexpand$\noexpand<\noexpand$% + \theshorttext\if@ttbl@usetimes, to \cal@appt@end@text\fi% + \noexpand$\noexpand>\noexpand$}}}% +% \end{macrocode} +% +% \textit{All other conforming entries get the long text.} +% +% \begin{macrocode} + \else% + \ifnum\dates@time@start<\dates@time@end% + \protected@edef\cal@entry@text{% + \if@ttbl@usetimes% + \noexpand\ttbl@timeitemface{% + \cal@appt@start@text% + --% + \cal@appt@end@text}% + \space% + \fi% + \noexpand\cal@textcolor{\calcolor}{% + \noexpand\ttbl@itemface{% + \thelongtext}}}% + \else% + \protected@edef\cal@entry@text{% + \if@ttbl@usetimes% + \noexpand\ttbl@timeitemface{% + \cal@appt@start@text}% + \space% + \fi% + \noexpand\cal@textcolor{\calcolor}{% + \noexpand\ttbl@itemface{% + \thelongtext}}}% + \fi% + \fi% + \fi}% +% \end{macrocode} +% +% Chuck the assembled stack of appointments into +% the box. +% +% \begin{macrocode} +{\theappointments} +% \end{macrocode} +%</package> +% +%\iffalse +% +% \section{The Installation File} +% +% \begin{macrocode} +%<*installer> +\def\batchfile{timetabl.ins} +\input docstrip.tex +\keepsilent +\preamble +This file is part of the Calendar package, +Copyright (C) 1996-1997 by 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. +% +\endpreamble + +\generate{\file{timetabl.sty}{\from{timetabl.dtx}{package}} + } + +\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 timetabl.sty} +\Msg{*} +\Msg{***********************************************************} + +%</installer> +% \end{macrocode} +%\fi +% \Finale \PrintChanges + + + diff --git a/Master/texmf-dist/source/latex/calendar/weekly.dtx b/Master/texmf-dist/source/latex/calendar/weekly.dtx new file mode 100644 index 00000000000..26b190ce037 --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/weekly.dtx @@ -0,0 +1,491 @@ +%\iffalse +% +% file: weekly.dtx +% Copyright (C) 1996-1997 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 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. +% +%\fi +% +% \def\fileversion{3.1.1.1} +% \def\filedate{1998/01/17 18:15:32} +% +% \iffalse +% +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{weekly.dtx} +\end{document} +%</driver> +%\fi +% +% \changes{v1.0}{1997/10/18}{New public release of all styles +% and modules incorporating global bug-fixes.} +% +%\iffalse +% Source tree moved under RCS +% --------------------------- +% weekly.dtx,v +% Revision 3.1.1.1 1998/01/17 18:15:32 root +% Release code, checksum verified +% +% Revision 3.1 1998/01/17 17:15:28 root +% Release code +% +% Revision 2.4 1998/01/16 17:07:54 root +% *** empty log message *** +% +% Revision 2.3 1997/12/06 09:52:13 root +% Moved documentation to calguide.tex. +% +% Revision 2.2 1997/11/07 10:44:05 root +% Release code. +% +% Revision 2.1.1.1 1997/11/04 05:06:07 root +% Development branch +% +% Revision 2.1 1997/11/01 14:50:12 bennett +% Release code. +% +% Revision 1.1 1997/10/29 08:17:52 root +% Initial revision +% +%\fi +% +% \title{User's Guide to the Weekly Calendar +% package\thanks{This file is version number +% \fileversion{}. It was last revised on +% \filedate{}.}} +% +% \author{Frank G. Bennett, Jr.} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \CheckSum{343} +% +% \section{Brief Introduction} +% +% Please see the file \texttt{calguide.tex} for documentation +% on this calendar style. +% +% \StopEventually{\PrintIndex} +% +% \section{The Class File} +% +% \subsection{Preliminaries} +% +% Use \LaTeXe, and tell the user who we are. +% +% \begin{macrocode} +%<*class> +\NeedsTeXFormat{LaTeX2e}[1995/06/01] +\ProvidesClass{weekly} + [1998/01/17 18:15:32 3.1.1.1 Weekly Calendar (Frank Bennett)] +% \end{macrocode} +% Define a boolean switch needed to process +% the style options. +% \begin{macrocode} +\newif\ifwk@usecolor +% \end{macrocode} +% Define some more variables and switches for use in the body +% of the style. +% \begin{macrocode} +\newif\ifwk@overthetop +\newcount\wk@firstday +\newcount\wk@tempcount +\newlength\wk@itemheight +\parindent=0pt +% \end{macrocode} +% +% \subsection{Options} +% +% Things like page and type size go to the article class. +% \begin{macrocode} +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} +% \end{macrocode} +% We use the generic language options, the same as other parts +% of the system. +% \begin{macrocode} +\input calopts.cfg +\InputIfFileExists{dates.cfg}{}{} +\ProcessOptions +% \end{macrocode} +% +% \subsection{Option Postprocessing} +% +% Now that the options lists are available to us, +% we can start loading packages. The following packages +% are always loaded. +% \begin{macrocode} +\LoadClass{article} +\RequirePackage{calendar} +\RequirePackage{lscape} +\RequirePackage{multicol} +\RequirePackage{autofilo} +\multicolsep=0pt\relax +% \end{macrocode} +% It is now time to do the final page formatting. +% \begin{macrocode} +\AtBeginDocument{% +% \end{macrocode} +% Eliminate page numbers and indenting. +% \begin{macrocode} + \pagestyle{empty} + \parindent=0pt} +% \end{macrocode} +% +% \subsection{Calendar Setup} +% +% Define some key values for use by the calendar environment. +% \begin{macrocode} +\define@key{opt}{firstday}{% + \wk@firstday=#1} +% \end{macrocode} +% Define default values for the environment keys. +% \begin{macrocode} +\wk@firstday=5% +% \end{macrocode} +% We declare eight boxes, one for each day of the +% week plus an extra. +% \begin{macrocode} +\wk@tempcount=0 +\expandafter\newsavebox\csname wk@box\the\wk@tempcount\endcsname +\loop\advance\wk@tempcount by1\relax +\ifnum\wk@tempcount<8 + \expandafter\newsavebox\csname wk@box\the\wk@tempcount\endcsname +\repeat +% \end{macrocode} +% We need a macro to lay the boxes out on a page. We define +% this now, with parameterized measurements that will be +% determined by the settings given to the environment within +% which this expands. +% \begin{macrocode} +\def\wk@spitoutboxes{% + \wk@tempcount=-1\relax% + \loop\advance\wk@tempcount by1\relax% + \ifnum\wk@tempcount<3\relax% + \hbox to\linewidth{% + \expandafter\usebox\csname wk@box\the\wk@tempcount\endcsname}% + \repeat% + \hbox to\linewidth{\vbox to\wk@itemheight{% + \hrule width\linewidth height0.4pt depth0pt% + \hbox to\linewidth{\hfil}\vfill}}% + \wk@tempcount=2\relax% + \loop\advance\wk@tempcount by1\relax% + \ifnum\wk@tempcount<7\relax% + \hbox to\linewidth{% + \expandafter\usebox\csname wk@box\the\wk@tempcount\endcsname}% + \repeat}% +% \end{macrocode} +% \textit{We define a macro that calculates the height of the date boxes. +% The value of \cs{normallineskip} sneaks in between +% stacked \cs{hbox}es, so we need to account for that.} +% \begin{macrocode} +\def\wk@getitemheight{% + \setlength\wk@itemheight\textheight\relax% + \addtolength\wk@itemheight{-4pt}% + \addtolength\wk@itemheight{-5\normallineskip}% + \divide\wk@itemheight by4\relax}% +% \end{macrocode} +% +% \subsection{Calendar Definition} +% +% The calendar definition itself consists of a single command +% and its associated arguments. +% \begin{macrocode} +\newcalendar% +% \end{macrocode} +% We give the environment a name. +% \begin{macrocode} +{weekly} +% \end{macrocode} +% We're producing DVI, so we use the standard +% macro for dropping text into the hopper. +% \begin{macrocode} +{\cal@insert} +% \end{macrocode} +% Starting day for the calendar is not fixed here, +% because we don't pad with blank entries. Season to taste. +% Use integers "0" through "6". A value over 7 means no padding. +% \begin{macrocode} +{8} +% \end{macrocode} +% The length of a group is one day. +% \begin{macrocode} +{7} +% \end{macrocode} +% The length of a subgroup is seven days. +% \begin{macrocode} +{7} +% \end{macrocode} +% We don't need delimiters between output items, since +% we're just building boxes. +% \begin{macrocode} +{\relax} +% \end{macrocode} +% Increment the date counter with every item. +% \begin{macrocode} +{I} +% \end{macrocode} +% Define the header. +% \begin{macrocode} +{\expandafter\autofilo\expandafter{\cal@optionslist}\wk@getitemheight} +% \end{macrocode} +% We define the end of the calendar. This spits out +% all of the boxes one last time, and closes the page +% formatting environment. +% \begin{macrocode} +{\wk@spitoutboxes\endautofilo} +% \end{macrocode} +% We define a way to open a new group. In this case, +% we just relax. +% \begin{macrocode} +{\wk@spitoutboxes} +% \end{macrocode} +% We define the way to end a subgroup. This spits out +% all of the boxes built for a page of text. +% \begin{macrocode} +{\relax} +% \end{macrocode} +% We set up to require a month and day in the environment typed +% into the user's document. +% \begin{macrocode} +{\dates@requiremonthtrue\dates@requiredaytrue} +% \end{macrocode} +% The next section runs after the calendar dates have been +% scanned from the environment, but before the table is +% opened. +% \textit{We step back, if necessary, from the designated +% first date to reach the starting day for pages. (Default +% is Friday.)} +% +% \begin{macrocode} +{\global\dates@date\cal@range@start% + \prevday\wk@firstday% + \cal@range@start\dates@date% + \caldate% +% \end{macrocode} +% \textit{We tell the user where we're starting.} +% \begin{macrocode} + \message{^^JStart: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% +% \end{macrocode} +% \textit{Then we jump forward, again if necessary, +% to the next day just before the starting day of +% the week.} +% \begin{macrocode} + \global\dates@date\cal@range@end% + \caldate% + \advance\wk@firstday by-1% + \ifnum\wk@firstday=7\wk@firstday=0\fi% + \nextday\wk@firstday% + \caldate% + \cal@range@end\dates@date% +% \end{macrocode} +% \textit{We let the user know where we plan to stop.} +% \begin{macrocode} + \message{^^JEnd: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% +% \end{macrocode} +% \textit{We jump back to the starting date and reset the +% human-side values.} +% \begin{macrocode} + \global\dates@date=\cal@range@start% + \caldate}% +% \end{macrocode} +% Events are delimited by \cs{par}. +% \begin{macrocode} +{\par}% +% \end{macrocode} +% The next argument is dropped on DVI for each item. +% We use it here to fetch the text of appointments and +% events to the standard list macros, using the +% standard text-fetching commands. Each generates a +% stack delimited by the phrase that was set above. +% \begin{macrocode} +{\cal@get@appointments\cal@get@events}% +% \end{macrocode} +% This sets \cs{cal@entry@text}. It is executed for every +% event or appointment in the database that applies +% to a given item. We differentiate between whole-day events, +% pinpointed events and ranged events. +% \begin{macrocode} +{\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}% +% \end{macrocode} +% Finally we tell the style how to create the +% text for each item. +% We stash the text in each of the numbered boxes, +% for extraction at the end of each group and at the +% end of the run. In the event of an overfull \cs{vbox}, we +% retry with two columns of text in a last-ditch attempt +% to squeze everything in. +% \begin{macrocode} +{\global\wk@overthetopfalse% + \expandafter\sbox\csname wk@box\the\cal@subgroup@count\endcsname{% + \vbox to\wk@itemheight{\hbox{\parbox{\linewidth}{% +\hrule width\linewidth% +\vskip1pt\relax% +\ifnum\cal@subgroup@count<3\relax% + \textbf{\theweekday\hfill% + \theday\space\themonth\space\theyear}\par% +\else% + \textbf{\theday\space\themonth\space\theyear\hfill% + \theweekday}\par% +\fi% +\vskip0.5pt\relax% +\hrule width\linewidth% +\vskip1pt\relax% + \raggedright\small% + \ifcat$\theevents$% + \else% + \theevents\par% + \fi% + \ifcat$\theappointments$% + \else% + \theappointments% + \fi}% parbox +}% hbox +\vfill}% vbox +\ifnum\badness=1000000\relax\global\wk@overthetoptrue\fi% +}% sbox +\ifwk@overthetop% + \message{Resetting this date in two-columns.}% +\expandafter\sbox\csname wk@box\the\cal@subgroup@count\endcsname{% + \vbox to\wk@itemheight{\hbox{\parbox{\linewidth}{% +\hrule width\linewidth% +\vskip1pt\relax% +\ifnum\cal@subgroup@count<3\relax% + \textbf{\theweekday\hfill% + \theday\space\themonth\space\theyear}\par% +\else% + \textbf{\theday\space\themonth\space\theyear\hfill% + \theweekday}\par% +\fi% +\vskip0.5pt\relax% +\hrule width\linewidth% +\vskip1pt\relax% + \raggedright\small% + \begin{multicols}{2}% + \ifcat$\theevents$% + \else% + \theevents\par% + \fi% + \ifcat$\theappointments$% + \else% + \theappointments% + \fi% + \end{multicols}% +}% parbox +}% hbox +\vfill}% vbox +}% sbox +\fi% + \advance\wk@tempcount by1\relax% + \ifnum\wk@tempcount>6\relax% + \wk@tempcount=0\relax% + \fi} +%</class> +% \end{macrocode} +% +%\iffalse +% \begin{macrocode} +%<*installer> +\def\batchfile{weekly.ins} +\input docstrip.tex + +\keepsilent + +\preamble +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. +------------------------------------------ + +\endpreamble + +\generate{\file{weekly.cls}{\from{weekly.dtx}{class}} + } + +\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 weekly.sty} +\Msg{*} +\Msg{***********************************************************} + +%</installer> +% \end{macrocode} +%\fi +% \Finale \PrintChanges + + + + + diff --git a/Master/texmf-dist/source/latex/calendar/yearly.dtx b/Master/texmf-dist/source/latex/calendar/yearly.dtx new file mode 100644 index 00000000000..ea01432c9df --- /dev/null +++ b/Master/texmf-dist/source/latex/calendar/yearly.dtx @@ -0,0 +1,340 @@ +%\iffalse +% +% File yearly.dtx +% Copyright (C) 1996 by Frank Bennett. All rights reserved. +% +% This sub-package is provided for demonstration +% purposes. Please feel free to edit it in any way whatsoever, +% but do not distribute it in an altered condition to others +% without permission. +% +% 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 +% +%<*dtx> + \ProvidesFile{yearly.dtx} +%</dtx> +%<style,class>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<style>\ProvidesPackage{yearly} +%<style> [1997/11/06 07:33:21 2.1.1.6 Trivial yearly calendar (Frank Bennett)] +% \fi +% +% \def\fileversion{2.1.1.6} +% \def\filedate{1997/11/06 07:33:21} +% +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +%\CodelineIndex +%\EnableCrossrefs +\begin{document} +\OnlyDescription % Comment out for implementation details +\DocInput{yearly.dtx} +\end{document} +%</driver> +% \fi +% +% \changes{v1.0}{1996/12/26}{Initial Version} +% \changes{v1.1}{1997/10/18}{New public release of all styles +% and modules incorporating global bug-fixes.} +% +%\iffalse +% Source tree moved under RCS +% --------------------------- +% yearly.dtx,v +% Revision 2.1.1.6 1997/11/06 07:33:21 root +% Changed \yrly@theweekday to \theweekday. +% +% Revision 2.1.1.5 1997/11/06 07:31:25 root +% Changed erroneous reference to \mon@firstday to +% \yrly@firstday +% +% Revision 2.1.1.4 1997/11/06 07:30:04 root +% Added declaration of \yrly@firstday +% +% Revision 2.1.1.3 1997/11/06 07:27:56 root +% Second round of changes necessary to hook up the three new +% options. +% +% Revision 2.1.1.2 1997/11/06 07:19:47 root +% First draft of changes to introduce firstday, labels and +% title options. +% +% Revision 2.1.1.1 1997/11/04 05:06:07 root +% Development branch +% +% Revision 2.1 1997/11/01 14:43:45 bennett +% Release code. +% +% Revision 1.3 1997/10/29 20:15:54 bennett +% *** empty log message *** +% +% Revision 1.2 1997/10/29 15:41:56 root +% Globalized assignments to dates@date, dates@day and dates@month. +% Apparently save size overflow problems persist with the demo +% of this style on small systems. Drat. +% +% Revision 1.1 1997/10/29 08:17:52 root +% Initial revision +% +%\fi +% +% \title{User's Guide to the Yearly Calendar package\thanks{This file is version number +% \fileversion{}. It was last revised on +% \filedate{}.}} +% +% \author{Frank G. Bennett, Jr.} +% +% \maketitle +% +% \setcounter{StandardModuleDepth}{1} +% \DeleteShortVerb{\|} +% \MakeShortVerb{\"} +% +% \begin{abstract} +% \noindent This package makes a yearly calendar +% on one side of A4. +% \end{abstract} +% +% +% \CheckSum{171} +% +% Please see the file \texttt{calguide.tex} for documentation +% on this calendar style. +% +%\StopEventually{\PrintIndex} +% +% \section{The Macros} +% We use the usual language options. +% \begin{macrocode} +\input calopts.cfg +\InputIfFileExists{dates.cfg}{}{} +\ProcessOptions +% \end{macrocode} +% Load some useful code. +% \begin{macrocode} +%<*style> +\RequirePackage{calendar} +% \end{macrocode} +% Define some key values for use by the calendar environment. +% \begin{macrocode} +\define@key{opt}{title}{% + \def\yrly@title{#1}} +\define@key{opt}{labels}{% + \@storelabels#1,,{}} +\define@key{opt}{firstday}{% + \yrly@firstday=#1} +\def\yrly@title{\theyear} +\newcount\yrly@firstday +\yrly@firstday=0\relax +% \end{macrocode} +% Define a utility macro for use by the \texttt{labels} key. +% This stores a comma-delimited list of labels to a single +% macro, which can then be used as a line in the table +% environment that makes up the calendar. +% \begin{macrocode} +\newtoks\yrly@tempreg@a +\newcount\yrly@tempcount +\def\@storelabels{% + \def\yrly@labeltext{}% + \@@storelabels} +\def\@@storelabels#1,#2#{% + \ifcat$#1$% + \yrly@tempreg@a=\expandafter\expandafter\expandafter{% + \expandafter\@gobble\yrly@labeltext}% + \edef\yrly@labeltext{\the\yrly@tempreg@a}% + \let\next\@gobble% + \else% + \let\next\@@storelabels% + \yrly@tempreg@a=\expandafter{\yrly@labeltext}% + \protected@edef\yrly@labeltext{\the\yrly@tempreg@a}% + \fi% + \next#2{}} +% \end{macrocode} +% The environment is defined using "\newcalendar" and 17 arguments. +% \begin{macrocode} +\newcalendar% +% \end{macrocode} +% The name to be used in calling the calendar style. +% \begin{macrocode} + {yearly} +% \end{macrocode} +% A command or group of commands used to print. This should end in a command +% that takes one argument. +% If we're making DVI, +% we need to use the command "\cal@insert" to strip away the braces that surround this +% in the Calendar style internals. +% \begin{macrocode} + {\cal@insert} +% \end{macrocode} +% First day. +% This is expressed as an integer. +% Sunday is "0", Saturday is "6". Set this to "7" or more to +% start the calendar and each line without any padding to +% line up the day of the week. +% \begin{macrocode} + {\yrly@firstday} +% \end{macrocode} +% Group Length. +% This is an integer, or a macro that expands to an integer. +% The table generator will increment a group counter by 1 +% each time a new ``item'' is output. It is set to 0 every +% time a new group is started. +% +% \begin{macrocode} + {\dates@days} +% \end{macrocode} +% Subgroup length. +% This may be an integer or a macro that expands to an integer. +% The table generator will increment a subgroup counter by 1 +% each time a new ``item'' is output. It is set to 0 every +% time a new subgroup is started. +% \begin{macrocode} + {7} +% \end{macrocode} +% Item separator. +% The item separator is placed before every item in the table +% but the first in a subgroup. +% \begin{macrocode} + {&} +% \end{macrocode} +% Increment event. +% The date can be incremented after every item, every subgroup +% or every group. The letters I, S and G carry these meanings, +% respective. +% \begin{macrocode} + {I} +% \end{macrocode} +% Calendar header. +% Text to issue at the start of a calendar. +% You can call on this elsewhere under the nickname +% "\cal@header" +% \begin{macrocode} + {\begin{tabular}[t]{ccccccc}% + \multicolumn{7}{c}{\textbf{\themonth}}\\\hline% + \yrly@labeltext\\\hline}% +% \end{macrocode} +% +% \subsubsection{Calendar Footer} +% Commands and text for the end of the calendar. You +% can call on this in other macros as "\cal@footer". +% +% \begin{macrocode} + {\end{tabular}} +% \end{macrocode} +% +% \subsubsection{Group Break} +% This is issued at the end of every group but the last. +% +% \begin{macrocode} + {\cal@footer% + \ifodd\thumbnails% + \\% + \else% + \rule{0.25in}{0pt}% + \fi% + \advance\thumbnails by 1% + \cal@header} +% \end{macrocode} +% +% \subsubsection{Sub-group Break} +% This is issed at the end of every subgroup but the last +% one in a calendar or a group. +% +% \begin{macrocode} + {\\} +% \end{macrocode} +% +% \subsubsection{Range Initialization} +% Preliminary macros to run before scanning the +% overall range go here. +% +% \begin{macrocode} + {} +% \end{macrocode} +% +% \subsubsection{Range Postprocessing} +% These commands massage the date scanned for use in the +% current calendar. +% +% \begin{macrocode} + {\global\dates@month=1% + \global\dates@day=1% + \dates@fix% + \cal@range@start\dates@date% + \message{^^JStart: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% + \global\dates@month=12% + \global\dates@day=31% + \dates@fix% + \caldate% + \cal@range@end\dates@date% + \message{^^JEnd: \theshortweekday\space% + \theday\space\theshortmonth\space\theyear}% + \global\dates@date=\cal@range@start% + \caldate% + \addtolength{\tabcolsep}{-0.5\tabcolsep}% + \newcount\thumbnails% + \@ifundefined{yrly@labeltext}{% + \def\yrly@defaultlabels{}% + \yrly@tempcount=1% + \global\advance\dates@date by-\dates@weekd% + \global\advance\dates@date by\yrly@firstday% + \caldate% + \loop% + \yrly@tempreg@a=\expandafter{\yrly@defaultlabels}% + \edef\yrly@defaultlabels{\the\yrly@tempreg@a\theshortweekday,}% + \ifnum\yrly@tempcount<7% + \global\advance\dates@date by1% + \caldate% + \advance\yrly@tempcount by 1\relax% + \repeat% + \expandafter\@storelabels\yrly@defaultlabels,,{}% + \dates@date\cal@range@start% + \caldate}% + {}% + \yrly@title\par\bigskip}% +% \end{macrocode} +% +% \subsubsection{Entry Separator} +% This is placed before every entry but the first in a list. +% +% \begin{macrocode} + {}% +% \end{macrocode} +% +% \subsubsection{Item Initialization} +% Commands that set registers and perform other non-printable +% operations on a date by date basis should go here. This can be used to prepare +% chunks of extractable text to place in a calendar that +% is not being sent to DVI output. +% +% \begin{macrocode} + {\getanycolor}% +% \end{macrocode} +% +% \subsubsection{Entry Initialization} +% Commands that are dumped on DVI to define the +% macro "\cal@entry@text" for every event entry +% that matches the conditions, if any, given to +% "\cal@get@appointments" or "\cal@get@events". +% The content of this macro is then assembled with +% other matching items in "\theappointments" +% and "\theevents", so that it can be dropped +% into the Item Text field as literal text. And +% voil\`a, we can write HTML in \LaTeX. +% +% \begin{macrocode} + {}% +% \end{macrocode} +% +% \subsubsection{Item Text} +% And at last, that note we've been looking for! +% +% \begin{macrocode} + {\cal@textcolor{\calcolor}{\theday}} +%</style> +% \end{macrocode} +% \Finale \PrintChanges |