summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/termcal
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/termcal
Initial commit
Diffstat (limited to 'macros/latex/contrib/termcal')
-rw-r--r--macros/latex/contrib/termcal/Contents24
-rw-r--r--macros/latex/contrib/termcal/README26
-rw-r--r--macros/latex/contrib/termcal/termcal.dtx695
-rw-r--r--macros/latex/contrib/termcal/termcal.ins5
-rw-r--r--macros/latex/contrib/termcal/termcal.pdfbin0 -> 91666 bytes
5 files changed, 750 insertions, 0 deletions
diff --git a/macros/latex/contrib/termcal/Contents b/macros/latex/contrib/termcal/Contents
new file mode 100644
index 0000000000..066fbee8db
--- /dev/null
+++ b/macros/latex/contrib/termcal/Contents
@@ -0,0 +1,24 @@
+% The package "termcal.sty"
+%
+% This package is intended to print a term calendar for use in
+% planning a class. It has a flexible mechanism for specifying
+% which days of the week are to be included and for inserting text
+% either regularly on the same day each week, or on selected days,
+% or for a series of consecutive days. It also has a flexible
+% mechinism for specifing class and nonclass days. Text may be
+% inserted into consecutive days so that it automatically flows
+% around nonclass days.
+
+
+The tar file includes the following:
+
+termcal.dtx -- source file
+termcal.ins
+
+termcal.sty -- style file, derived from termcal.dtx
+termcal.ind -- index, derived from termcal.dtx
+
+As usual the command "latex termcal.dtx" will print the
+documentation. Since the documentation includes an example of the
+use of the package, the style file "termcal.sty" is needed to print
+the documentation.
diff --git a/macros/latex/contrib/termcal/README b/macros/latex/contrib/termcal/README
new file mode 100644
index 0000000000..bfce081450
--- /dev/null
+++ b/macros/latex/contrib/termcal/README
@@ -0,0 +1,26 @@
+% The package "termcal.sty"
+%
+% This package is intended to print a term calendar for use in
+% planning a class. It has a flexible mechanism for specifying
+% which days of the week are to be included and for inserting text
+% either regularly on the same day each week, or on selected days,
+% or for a series of consecutive days. It also has a flexible
+% mechinism for specifing class and nonclass days. Text may be
+% inserted into consecutive days so that it automatically flows
+% around nonclass days.
+
+
+The tar file includes the following:
+
+termcal.dtx -- source file
+termcal.ins
+
+termcal.sty -- style file, derived from termcal.dtx
+termcal.ind -- index, derived from termcal.dtx
+
+As usual the command "latex termcal.dtx" will print the
+documentation. Since the documentation includes an example of the
+use of the package, the style file "termcal.sty" is needed to print
+the documentation.
+
+License: LPPL version 1 or any later version.
diff --git a/macros/latex/contrib/termcal/termcal.dtx b/macros/latex/contrib/termcal/termcal.dtx
new file mode 100644
index 0000000000..753b846fe3
--- /dev/null
+++ b/macros/latex/contrib/termcal/termcal.dtx
@@ -0,0 +1,695 @@
+% ^^A -*- latex-*-
+% \iffalse
+%<*package>
+\def\RCSID$#1 #2 #3 #4 #5${\def\fileversion{#3}\def\filedate{#4}}
+\RCSID$Id: termcal.dtx,v 1.8 1997/01/11 17:04:40 mitchell Exp $
+\def\docdate{1996/01/10}
+%
+%</package>
+% \fi
+% \DoNotIndex{\@tempcnta,\@tempdima\@tempa,\\,\ ,\begin,\begingroup}
+% \DoNotIndex{\centering,\csname,\def,\divide,\edef,\else,\end,\endcsname}
+% \DoNotIndex{\endhead,\endgroup,\expandafter,\fi,\filedate,\fileversion}
+% \DoNotIndex{\framebox,\global,\hbox,\hfill,\hline,\hsize,\if}
+% \DoNotIndex{\ifcase,\ifnum,\ifx,\ignorespaces,\last@,\last@@}
+% \DoNotIndex{\let,\long,\multiply,\NeedsTeXFormat,\newcommand}
+% \DoNotIndex{\newcounter,\newenvironment,\newif,\newlength}
+% \DoNotIndex{\newtoks,\or,\par,\ProvidesPackage,\raggedright}
+% \DoNotIndex{\relax,\RequirePackage,\scshape,\setcounter}
+% \DoNotIndex{\setlength,\sloppy,\small,\space,\stepcounter,\strut}
+% \DoNotIndex{\the,\toks,\value,\vrule,\vspace,\vtop,\whiledo}
+% \DoNotIndex{\tabcolsep,\textbf,\textwidth}
+% \iffalse
+%<*driver>
+\documentclass[12pt]{article}
+\usepackage{doc}
+\usepackage{termcal}
+\CheckSum{384}
+\EnableCrossrefs
+\CodelineIndex
+%\RecordChanges
+% \setlength{\parindent}{0pt}
+\begin{document}
+ \DocInput{termcal.dtx}
+ \PrintIndex
+\end{document}
+%</driver>
+%<*package>
+% \fi
+%
+% \newcommand\inp[1]{{\it #1}}
+%
+% \MakeShortVerb{\|}
+% \title{Termcal.sty---printing a class calendar\thanks{Version:
+% \fileversion. Date: \filedate. Documentation: \docdate}}
+% \author{Bill Mitchell}
+% \maketitle
+% \begin{abstract}
+% This package is intended to print a term calendar for use in
+% planning a class. It has a flexible mechanism for
+% specifying which days of the week are to be included and for inserting text
+% either regularly on the same day each week, or on selected days,
+% or for a series of consecutive
+% days. It also has a flexible mechinism for specifing class and
+% nonclass days. Text may be inserted into consecutive days so that
+% it
+% automatically flows around nonclass days.
+% \end{abstract}
+% \section{Description} The main command in this package is the
+% |calendar| environment\DescribeEnv{calendar}. Figure~1 shows an
+% example of its use, which might be suitable for a
+% Monday-Wednesday-Friday class with a Thursday recitation in a
+% mercifully short term. The \LaTeX\ input to generate it is given
+% in figure~2.
+%
+% \begin{figure}[!htb]
+% \begin{calendar}{9/26/94}{6}
+% \setlength{\calboxdepth}{.3in}
+%
+% \calday[Monday]{\classday}
+% \skipday
+% \calday[Tuesday]{\classday}
+% \calday[Thursday]{\noclassday}
+% \calday[Friday]{\classday}
+% \skipday\skipday
+%
+% \options{10/31/94}{\noclassday}
+% \caltext{10/31/94}{No Class\\Halloween}
+%
+% \caltext{10/12/94}{Midterm Exam}
+%
+% \caltexton{9}{\S1.2,1.3\\Sorting and disporting}
+% \caltextnext{\S1.3,1,4\\Assembling and dissembling}
+% \caltextnext{}
+% \caltextnext{\S9.9\\Tending and rending}
+% \end{calendar}
+% \caption{Example of the use of the \texttt{calendar} environment}
+% \end{figure}
+% \begin{figure}[!htb]
+% \begin{verbatim}
+% \begin{calendar}{9/26/94}{6}
+% \setlength{\calboxdepth}{.3in}
+%
+% % Description of the Week.
+% \calday[Monday]{\classday} % Monday
+% \skipday % Tuesday (no class)
+% \calday[Tuesday]{\classday} % Wednesday
+% \calday[Thursday]{\noclassday} % Thursday (unnumbered)
+% \calday[Friday]{\classday} % Friday
+% \skipday\skipday % weekend (no class)
+%
+% % Holidays
+% \options{10/31/94}{\noclassday}
+% \caltext{10/31/94}{No Class\\Halloween}
+%
+% % Exams
+% \caltext{10/12/94}{Midterm Exam}
+%
+% % Text on consecutive days
+% % the subject of the 9th lecture
+% \caltexton{9}{\S1.2,1.3\\Sorting and disporting}
+% % the subject of the 10th lecture
+% \caltextnext{\S1.3,1,4\\Assembling and dissembling}
+% \caltextnext{}
+% % the subject of the 12th lecture
+% \caltextnext{\S9.9\\Tending and rending}
+% \end{calendar}
+% \end{verbatim}
+% \caption{\LaTeX\ input for Figure~1}
+% \end{figure}
+%
+% The two arguments to the |calendar| environment are the starting date,
+% in the format |m/d/y|, and the number of weeks to be printed. The
+% contents of the environment describe what is to appear in the
+% calendar. The commands fall into two classes: those which specify
+% what is to be printed on a particular day in each week, and those
+% which specify what is to be printed on specific days during the term.
+%
+% The commands which specify what each week is to look like are
+% |\calday| and
+% |\skipday|.
+% These commands specify the days of the week in order; thus there
+% should be seven of them (athough ten may be prefered for a course
+% covering the French
+% revolution).
+% The macro |\skipday|\DescribeMacro{\skipday}\
+% simply declares that the corresponding day should
+% not be printed in the exam; thus the sample calendar has boxes only
+% for Monday, Wednesday, Thursday, and Friday. The macro
+% |\calday[|\inp{optional~head}|]{|\inp{option~list}|}|
+% \DescribeMacro{\calday}
+% is used to specify a day which is to be printed. The required
+% argument \inp{option~list}
+% is a (possibly empty) list of \TeX\ commands which are executed
+% before the text for that day is printed.
+% It can (at least in principal) include
+% any \LaTeX\ command, but several commands, described below, are
+% provided specifically for this purpose. The optional argument
+% is the text of a heading for that day
+% which will at the top
+% of each page of the calendar.
+
+% \paragraph{Available options.}
+% The macros |\classday|
+% \DescribeMacro{\classday}\DescribeMacro{\noclassday}
+% and |\noclassday| declare that the specified day is, or is not, a
+% class day. Days specified as class days are numbered and can be
+% refered to by their numbers.
+% The command |\weeklytext{|\inp{text}|}| specifies that the
+% \DescribeMacro{\weeklytext}
+% indicated text should appear every week in the box for that day.
+% The \inp{text}
+% may include \TeX\ commands; for example the following could be used
+% to number regular Monday quizes:
+% \begin{verbatim}
+% \weeklytext{\stepcounter{quiznumber} Quiz~\arabic{quiznumber}}
+% \end{verbatim}
+%
+% \paragraph{Options for a specific day} are specified by the command
+% |\options{|\inp{day}|}{|\inp{option list}|}|.
+% \DescribeMacro{\options}
+% The \inp{option~list} argument is exactly the same as for |\calday|. The
+% options added by |\options| are executed after those for |\calday|,
+% and thus may be used to modify or nullify for a specific day the
+% general instructions specified for a particular day of the week.
+% If there no quiz is planned for Halloween then
+% |\options{10/31/94}{\weeklytext{}}| could be used to supress
+% printing the usual weekly message.
+%
+% There are two ways of specifing the \inp{day} argument of
+% |\options|. First, the date may be specified, in the format
+% \texttt{m/d/y}; for example
+% \begin{verbatim}\options{11/11/94}{\noclass}\end{verbatim}
+% specifies, that November 11th, Veterans's day, is not a class day.
+% The second method of specifying the date is by its number:
+% \begin{verbatim}\options{C6}{\weeklytext{}}\end{verbatim}
+% would supress the normal text on the
+% sixth day of class. Of course, only days specified as class days
+% can be addressed in this style.
+%
+% \paragraph{Inserting Text.} There is a similar provision for text to
+% be printed on a specific day,
+% using the command |\caltext|. \DescribeMacro{\caltext} The command
+% \begin{verbatim}\caltext{10/31/94}{Halloween\\No Quiz!} \end{verbatim}
+% will print the indicated
+% message on October 31, and
+% |\caltext{C6}{Hour Exam}|
+% ^^A \begin{verbatim}\caltext{C6}{Hour Exam}\end{verbatim}
+% will
+% print the indicated message on the sixth class day.
+%
+% Two extra commands are provided to simplify the job of entering text for
+% consecutive class days, as in specifying the lecture topic or
+% homework for each day. The command
+% \DescribeMacro{\caltexton}\DescribeMacro{\caltextnext}
+% |\caltexton{|\inp{class day}|}{|\inp{text}|}| specifies a
+% starting day and inserts the
+% indicated text on that day. The command
+% |\caltextnext{|\inp{text}|}| can then be used to print text on
+% successive class days. The command |\caltextnext{}|, with an empty
+% argument, may be used to skip days.
+%
+% \subsection{Modifying the style of the calendar}
+% Several parameters and commands will allow some modfication of the
+% style of the entire calendar. The size of the calendar is specified
+% by |\calboxdepth|\DescribeMacro{\calboxdepth}, which specifies the
+% minimum height of the box for each day, and
+% |\calwidth|\DescribeMacro{\calwidth}\ which specifies the width of the
+% calendar. The defaults are 1~inch for |\calboxdepth| and |\textwidth|
+% for |\calboxwidth|.
+
+% The printing of the date and classnumber in each box is done by the
+% commands |\calprintdate| and |\calprintclass|. The default
+% definitions of these macros are as follows:
+% \begin{macro}{\calprintdate}
+% \begin{macrocode}
+\newcommand{\calprintdate}{%
+ \ifnewmonth\framebox{\monthname\ \ordinaldate}%
+ \else \ordinaldate\fi
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\calprintclass}
+% \begin{macrocode}
+\newcommand{\calprintclass}{\textbf{\small\theclassnum}}
+% \end{macrocode}
+% \end{macro}
+% They may be changed with |\renewcommand|.
+%
+% By default the calendar will automatically be split over several
+% pages. This can be avoided by putting the entire calendar in a
+% |\vbox|. It will normally also be necessary to change |\calboxdepth|
+% so that the calendar will fit on one page.
+%
+% \StopEventually{}
+% \section{The Code}
+% \begin{macrocode}
+\ProvidesPackage{termcal}[\filedate\space\fileversion\space
+ Latex2e package to print a Term calendar]
+\NeedsTeXFormat{LaTeX2e}
+% \end{macrocode}
+% We use the package |longtable| so that the calendar can be split
+% over several pages if desired.
+% \begin{macrocode}
+\RequirePackage{longtable}
+\RequirePackage{ifthen}
+% \end{macrocode}
+% Parameters determining the size of the calendar.
+%
+% \begin{macrocode}
+\newlength{\calboxdepth}\setlength\calboxdepth{1in}
+\newlength\calwidth\setlength\calwidth{\textwidth}
+\newlength{\ca@boxwidth} %% set by \endcalendar
+% \end{macrocode}
+% The following parameters are used to control the construction of the
+% calendar.
+% \begin{macro}{\ca@dpw} The number of days used in a week.
+% \begin{macrocode}
+\newcounter{ca@dpw}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ca@numwks} The number of weeks in the calendar.
+% \begin{macrocode}
+\newcounter{ca@numwks} %% weeks in calendar
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ca@wknum} Used to keep track of the current week.
+% \begin{macrocode}
+\newcounter{ca@wknum}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ca@doaweek} Two token boxes used to build up the
+% basic contents of the calendar. |\ca@doaweek| is built up by
+% |\calday|, and prints a typical week. It will be filled up by the macros
+% |\calday| and |\skipday|.
+% \begin{macrocode}
+\newtoks\ca@doaweek
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ca@doweeks} This will be essentially |ca@numwks| copys
+% of |\ca@doaweek|.
+% \begin{macrocode}
+\newtoks\ca@doweeks
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ca@colhead}\begin{macro}{\ifca@chead} The column
+% headings which appear at the top of every page is collected in the
+% token box |\ca@colhead| by |\calday|. The switch |\ifca@chead| is
+% set to true if any such column heads are specified.
+% \begin{macrocode}
+\newtoks\ca@colhead
+\newif\ifca@chead
+% \end{macrocode}
+% \end{macro}\end{macro}
+% \begin{environment}{calendar}
+% This is the basic environment. The |\calendar| command only saves the
+% parameters and initializes some counters.
+% \begin{macrocode}
+\newenvironment{calendar}[2]%
+ {%
+ \setcounter{ca@numwks}{#2}
+ \setdate{#1}
+ \setcounter{ca@dpw}{0}
+ \setcounter{classnum}{1}
+ }
+% \end{macrocode}
+% \begin{macro}{\endcalendar}
+% The calendar is actually created in the code for |\endcalendar|.
+% It will be printed as a longtable.
+% \begin{macrocode}
+ {
+% \end{macrocode}
+% Since the \texttt{longtable} and
+% \texttt{tabular} environments don't work well with loops in their
+% body, we will build up the body in a token box, |\ca@doweeks|.
+%\begin{macro}{\ca@doweeks}
+% \begin{macrocode}
+ \ifca@chead\ca@doweeks{\the\ca@colhead\endhead\hline\hline}\fi
+ \setcounter{ca@wknum}{0}
+ \whiledo{\value{ca@wknum}<\value{ca@numwks}}%
+ {\stepcounter{ca@wknum}%
+ \addtotoks{\ca@doweeks}{\the\ca@doaweek\\\hline}}
+% \end{macrocode}
+% \end{macro}
+% Now we calculate the widths of the boxes, using a formula from the
+% Latex Companion.
+% \begin{macro}{\ca@boxwidth}
+% \begin{macrocode}
+ \ca@boxwidth=\calwidth
+ \divide\ca@boxwidth by \c@ca@dpw\relax
+ \advance\ca@boxwidth by -2\tabcolsep\relax
+ \setlength\@tempdima\arrayrulewidth\relax
+ \multiply\@tempdima\c@ca@dpw\relax
+ \advance\@tempdima\arrayrulewidth\relax
+ \divide\@tempdima\c@ca@dpw\relax
+ \advance\ca@boxwidth by -\@tempdima\relax
+% \end{macrocode}
+% \end{macro}
+% Now we use the |longtable| environment to print out the calendar.
+% \begin{macrocode}
+ \begin{longtable}[l]
+ {|*{\theca@dpw}{p{\ca@boxwidth}|}@{}}%
+ \hline
+ \the\ca@doweeks
+ \end{longtable}
+ }
+% \end{macrocode}
+% \end{macro} ^^A \endcalendar
+% \end{environment} ^^A calendar
+% \begin{macro}{\addtotoks} The command
+% |\addtotoks{|\inp{token box}|}{|\inp{new tokens}|}| is used to add
+% new tokens at the end of \inp{token box}.
+% \begin{macrocode}
+\newcommand\addtotoks[2]{#1\expandafter{\the#1#2}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\calday}
+% \begin{macro}{\ca@doaweek}
+% \begin{macro}{\ca@colhead}
+% The command |\calday| works by adding
+% commands to the token box |\ca@doaweek|, a copy of which is inserted
+% into |\ca@doweeks| for each week in the calendar.
+% inserted
+% If column headings are specified, then they are put into
+% the token box |\ca@colhead|.
+% \begin{macrocode}
+\ca@doaweek={\stepcounter{ca@wknum}\ignorespaces}
+\newcommand\calday[2][]{\stepcounter{ca@dpw}%
+ \ifca@fday\addtotoks\ca@doaweek{&}\addtotoks\ca@colhead{&}\fi
+ \addtotoks\ca@doaweek{\ca@doaday{#2}}
+ \def\@tempa{#1}\ifx\@tempa\@empty
+ \else\addtotoks\ca@colhead{\strut\scshape\centering #1}\ca@cheadtrue\fi
+ \ca@fdaytrue
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\ifca@fday} True if this is not the first day of the week. This determines whether
+% |&| needs to be added as a
+% separator.
+% \begin{macrocode}
+\newif\ifca@fday
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\skipday}
+% The command |\skipday| simply advances the date without printing
+% anything in the calendar.
+% \begin{macrocode}
+\newcommand\skipday{\addtotoks\ca@doaweek{\advancedate}}
+% \end{macrocode}
+% \end{macro}
+% After a couple of preliminaries, we will define the command
+% |\ca@doaday| which is
+% actually prints out
+% the text for each day of the calendar.
+% \begin{macro}{c@classnum} This is the counter used to keep track of
+% class days. It is initialized to 1 in the beginning of the
+% |calendar| environment.
+% \begin{macrocode}
+\newcounter{classnum}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ca@normbs}
+% The meaning of |\\| is changed by the |longtable| environment.
+% We save its standard meaning so that it can be used
+% in the text to be printed in the calendar boxes.
+% \begin{macrocode}
+\let\ca@normbs=\\
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ca@doaday}
+% The command |\ca@doaday| does the actual printing of the contents of
+% the box for each day.
+% First the options are read, in the following order:
+% options specified in the argument to |\calday|, then options
+% specified by date, and finally
+% options specified by classday.
+% \begin{macrocode}
+\newcommand\ca@doaday[1]{
+ \hbox{\vrule depth \calboxdepth height 0pt width 0pt\vtop{
+ #1% %options specified by |\calday|
+ \csname\curdate options\endcsname% % options specified by date
+ \ifclassday\csname C\theclassnum options\endcsname\fi %by classnumber
+% \end{macrocode}
+% Then the heading is printed.
+% \begin{macrocode}
+ \hbox to \hsize{\calprintdate\hfill\ifclassday\calprintclass\fi}
+ \vspace{2pt}
+% \end{macrocode}
+% Now we are ready to print the text. We do it inside a group in which
+% the normal meaning of |\\| is restored.
+% \begin{macrocode}
+ \begingroup
+ \let\\=\ca@normbs
+ \raggedright
+ \sloppy
+
+ \the\weeklytext\par
+ \csname\curdate text\endcsname
+ \ifclassday\csname C\theclassnum text\endcsname
+ \stepcounter{classnum}\fi
+ \endgroup
+ }}
+% \end{macrocode} Finally we advance the date. The command
+% |\advancedate| will set |\newmonthtrue| if appropriate.
+% \begin{macrocode}
+ \global\newmonthfalse
+ \advancedate
+}
+% \end{macrocode}
+% \end{macro}
+% \subsection{Options}
+% The options and text for the individual days are stored in macros,
+% with names of the form |\|\inp{date}|options| or
+% |\|\inp{date}|text|.
+%
+% \begin{macro}{\ca@addmacro} |\ca@addmacro| is like |\ca@addtoks|,
+% except it works on macros instead of token boxes. The first
+% argument is the name of a
+% macro (without the backslash) and the second is a sequence of
+% tokens to be added to its definition. The definition is taken from
+% the
+% \TeX{}book, exercise 20.15. Note that the spaces in the last line
+% are essential.
+% \begin{macrocode}
+\long\def\ca@addmacro#1#2{
+ \expandafter\ifx\csname#1\endcsname\relax%
+ \expandafter\def\csname#1\endcsname{#2}
+ \else
+ \toks0=
+ \expandafter\expandafter\expandafter{\csname#1\endcsname}
+ \toks2={#2}
+ \expandafter
+ \edef\csname#1\endcsname{\the\toks0 \the\toks2 }\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\options} |\options#1#2| adds the tokens in the second
+% argument to the macro with the name |\csname #1options\endcsname|.
+% \begin{macrocode}
+\newcommand\options[1]{\ca@addmacro{#1options}}
+% \end{macrocode}
+% \end{macro}
+% Now the code for the varions options.
+%
+% \begin{macro}{\ifclassday}
+% \begin{macro}{\classday}\begin{macro}{\noclassday}
+% A switch determines which days are class days.
+% \begin{macrocode}
+\newif\ifclassday
+\newcommand{\classday}{\classdaytrue}
+\newcommand{\noclassday}{\classdayfalse}
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+%
+% \begin{macro}{\weeklytext} This token box holds the standard text
+% for each day of the week. It is filled and immediately used by
+% |\ca@doaday|,
+% inside the hbox containing each calendar day.
+% \begin{macrocode}
+\newtoks\weeklytext
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\caltext}
+% This macro works like |\options| to save the
+% text for a specific day, saving the text in a macro with the name
+% |\csname #1text\endcsname|. We add |\par| after the text, so
+% successive texts for the same day start on separate lines. We use
+% |\par| instead of |\\| since it is harmless if it is unneeded (but
+% requires that |\ca@addmacro| be long).
+% \begin{macrocode}
+\newcommand\caltext[2]{\ca@addmacro{#1text}{#2\par}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\c@textdaycount}\begin{macro}{\caltexton}
+% \begin{macro}{\caltextnext}
+% The commands |\caltexton| and |\caltextnext| use |\caltext| with the
+% day determined by the counter |textdaycount|.
+% \begin{macrocode}
+\newcounter{textdaycount}\setcounter{textdaycount}1
+\newcommand\caltexton[2]{\setcounter{textdaycount}{#1}
+ \caltext{C#1}{#2}}
+\newcommand\caltextnext[1]{\advance\c@textdaycount by 1
+ \caltext{C\thetextdaycount}{#1}}
+% \end{macrocode}
+% \end{macro}\end{macro}\end{macro}
+% \subsection{Macros concerned with date calculations}
+% Now we have a selection of macros which are concerned with
+% calculating the dates in the calendar.
+% \begin{macro}{\c@date} Counter for the day of the month.
+% \begin{macrocode}
+ \newcounter{date}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\c@month} Counter for month (January = 1)
+% \begin{macrocode}
+ \newcounter{month}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\c@year} Counter for year.
+% \begin{macrocode}
+ \newcounter{year}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\curdate}Print out the date.
+% \begin{macrocode}
+\newcommand\curdate{\arabic{month}/\arabic{date}/\arabic{year}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\monthname} Print the name of the Month.
+% \begin{macrocode}
+\newcommand\monthname{\ifcase\c@month\or Jan\or Feb\or Mar\or Apr%
+ \or May\or June\or July\or Aug\or Sep\or Oct%
+ \or Nov\or Dec\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\advancedate} Move the date forward by one day.
+% \begin{macrocode}
+\newcommand\advancedate{\stepcounter{date}
+ \ifnum\thedate>\monthlength\relax
+ \addtocounter{date}{-\monthlength}\advancemonth\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifnewmonth} True if no days have been printed during
+% the current month.
+% \begin{macrocode}
+\newif\ifnewmonth\newmonthtrue
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\advancemonth}
+% \begin{macrocode}
+\newcommand\advancemonth{%
+ \global\newmonthtrue\stepcounter{month}
+ \ifnum\c@month>12
+ \stepcounter{year}\setleap\setcounter{month}1\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ifleap} True if the year is a leap year.
+% \begin{macrocode}
+ \newif\ifleap
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\setleap} Determine whether the year is a leap
+% year. This is valid until 2100, thanks to the 400 year rule.
+% \begin{macrocode}
+\newcommand\setleap{%
+ \@tempcnta=\c@year
+ \divide\@tempcnta by 4 \multiply\@tempcnta by 4
+ \ifnum\@tempcnta=\c@year\global\leaptrue
+ \else\global\leapfalse\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\monthlength} Determine the number of days in the
+% current month.
+% \begin{macrocode}
+\newcommand\monthlength{%
+ \ifcase\c@month\or31\or\ifleap29\else28\fi
+ \or31\or30\or31\or30\or31\or31\or30\or31\or30\or31\fi%
+ \relax}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\setdate} Take argument in the form |m/d/y| and set
+% the counters |month|, |date| and |year|.
+% \begin{macrocode}
+\newcommand\setdate[1]{\setdate@#1!}
+\def\setdate@#1/#2/#3!{
+ \setcounter{month}{#1}
+ \setcounter{date}{#2}
+ \setcounter{year}{#3}
+ \global\newmonthtrue\setleap}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ordinaldate} Print the day of the month as an ordinal.
+% \begin{macrocode}
+\newcommand\ordinaldate{\ordinal{\c@date}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ordinal} Print the contents of a register as ordinal
+% number.
+% \begin{macrocode}
+\newcommand\ordinal[1]{%
+ \let\last@=\relax\let\last@@=\relax
+ \expandafter\@rd\the#1x}
+\newcommand\@rd[1]{\ifx#1x\if\last@@1th\else\@rdend{\last@}\fi\else
+ \let\last@@=\last@\def\last@{#1}#1\expandafter\@rd\fi}
+\newcommand\@rdend[1]{\ifcase#1 th\or st\or nd\or rd\else th\fi}
+% \end{macrocode}
+% \end{macro}
+% \Finale
+%\endinput
+%</package>
+%
+% \iffalse %% don't print this in documentation.
+%<*example>
+\begin{calendar}{9/26/94}{6}
+\setlength{\calboxdepth}{.3in}
+ %% Description of the Week.
+\calday[Monday]{\classday} % Monday
+\skipday % Tuesday (no class)
+\calday[Tuesday]{\classday} % Wednesday
+\calday[Thursday]{\noclassday} % Thursday (unnumbered)
+\calday[Friday]{\classday} % Friday
+\skipday\skipday % weekend (no class)
+ %% Holidays
+\options{10/31/94}{\noclassday}
+\caltext{10/31/94}{No Class\\Halloween}
+ %% Exams
+\caltext{10/12/94}{Midterm Exam}
+ %%%%%%% Text on consecutive days
+ % the subject of the 9th lecture
+\caltexton{9}{\S1.2,1.3\\Sorting and disporting}
+ % the subject of the 10th lecture
+\caltextnext{\S1.3,1,4\\Assembling and dissembling}
+\caltextnext{}
+ % the subject of the 12th lecture
+\caltextnext{\S9.9\\Tending and rending}
+\end{calendar}
+%</example>
+% \fi
+% \endinput
+% $Log: termcal.dtx,v $
+% Revision 1.8 1997/01/11 17:04:40 mitchell
+% Documentation rewritten preprepitory to sending to CTAN
+%
+% Revision 1.7 1997/01/11 00:56:28 mitchell
+% Minor changes to documentation.
+%
+% Revision 1.6 1995/06/15 14:13:05 mitchell
+% Put definition of filedate and fileversion into termcal.sty.
+%
+% Revision 1.5 1995/06/10 16:43:43 mitchell
+% RCS related changes.
+%
+%
+% Revision 1.4 1995/06/10 16:22:20 mitchell
+% Initialized counters, to allow for printing several calendars
+% in a single file.
+%
+% Revision 1.3 1994/08/06 00:57:53 mitchell
+% add Identification stuff.
+%
+% Revision 1.2 1994/08/05 17:22:45 mitchell
+% Added column headings as optional argument to \calday.
+%
+% LocalWords: chead tempdima fday doaday tempa cheadtrue fdaytrue classnum pt
+% LocalWords: normbs addmacro textdaycount Apr Aug Sep Oct Nov tempcnta rdend
diff --git a/macros/latex/contrib/termcal/termcal.ins b/macros/latex/contrib/termcal/termcal.ins
new file mode 100644
index 0000000000..997e00a6ca
--- /dev/null
+++ b/macros/latex/contrib/termcal/termcal.ins
@@ -0,0 +1,5 @@
+\def\filedate{1994/08/07}
+\def\batchfile{termcal.ins}
+\input docstrip.tex
+\generateFile{termcal.sty}{f}{\from{termcal.dtx}{package}}
+\endinput
diff --git a/macros/latex/contrib/termcal/termcal.pdf b/macros/latex/contrib/termcal/termcal.pdf
new file mode 100644
index 0000000000..00435ce142
--- /dev/null
+++ b/macros/latex/contrib/termcal/termcal.pdf
Binary files differ