diff options
author | Karl Berry <karl@freefriends.org> | 2008-12-21 22:48:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-12-21 22:48:17 +0000 |
commit | c1c65830c3e1f49ca1a80f0f0a76bb777be9373c (patch) | |
tree | 917dde72c4423313bb2e9e9850521fc83519b35a /Master/texmf-dist/tex/latex/termcal | |
parent | 714b3ac11ccf450b0ec5c35e742cfbca6051951c (diff) |
new (ancient) latex package termcal (19dec08)
git-svn-id: svn://tug.org/texlive/trunk@11677 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/termcal')
-rw-r--r-- | Master/texmf-dist/tex/latex/termcal/termcal.sty | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/termcal/termcal.sty b/Master/texmf-dist/tex/latex/termcal/termcal.sty new file mode 100644 index 00000000000..41b5c609145 --- /dev/null +++ b/Master/texmf-dist/tex/latex/termcal/termcal.sty @@ -0,0 +1,169 @@ +%% +%% This is file `termcal.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% termcal.dtx (with options: `package') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from termcal.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file termcal.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +\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} + + +\newcommand{\calprintdate}{% + \ifnewmonth\framebox{\monthname\ \ordinaldate}% + \else \ordinaldate\fi + } +\newcommand{\calprintclass}{\textbf{\small\theclassnum}} +\ProvidesPackage{termcal}[\filedate\space\fileversion\space + Latex2e package to print a Term calendar] +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{longtable} +\RequirePackage{ifthen} +\newlength{\calboxdepth}\setlength\calboxdepth{1in} +\newlength\calwidth\setlength\calwidth{\textwidth} +\newlength{\ca@boxwidth} %% set by \endcalendar +\newcounter{ca@dpw} +\newcounter{ca@numwks} %% weeks in calendar +\newcounter{ca@wknum} +\newtoks\ca@doaweek +\newtoks\ca@doweeks +\newtoks\ca@colhead +\newif\ifca@chead +\newenvironment{calendar}[2]% + {% + \setcounter{ca@numwks}{#2} + \setdate{#1} + \setcounter{ca@dpw}{0} + \setcounter{classnum}{1} + } + { + \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}} + \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 + \begin{longtable}[l] + {|*{\theca@dpw}{p{\ca@boxwidth}|}@{}}% + \hline + \the\ca@doweeks + \end{longtable} + } +\newcommand\addtotoks[2]{#1\expandafter{\the#1#2}} +\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 +} +\newif\ifca@fday +\newcommand\skipday{\addtotoks\ca@doaweek{\advancedate}} +\newcounter{classnum} +\let\ca@normbs=\\ +\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 + \hbox to \hsize{\calprintdate\hfill\ifclassday\calprintclass\fi} + \vspace{2pt} + \begingroup + \let\\=\ca@normbs + \raggedright + \sloppy + + \the\weeklytext\par + \csname\curdate text\endcsname + \ifclassday\csname C\theclassnum text\endcsname + \stepcounter{classnum}\fi + \endgroup + }} + \global\newmonthfalse + \advancedate +} +\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} +\newcommand\options[1]{\ca@addmacro{#1options}} +\newif\ifclassday +\newcommand{\classday}{\classdaytrue} +\newcommand{\noclassday}{\classdayfalse} +\newtoks\weeklytext +\newcommand\caltext[2]{\ca@addmacro{#1text}{#2\par}} +\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}} + \newcounter{date} + \newcounter{month} + \newcounter{year} +\newcommand\curdate{\arabic{month}/\arabic{date}/\arabic{year}} +\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} +\newcommand\advancedate{\stepcounter{date} + \ifnum\thedate>\monthlength\relax + \addtocounter{date}{-\monthlength}\advancemonth\fi} +\newif\ifnewmonth\newmonthtrue +\newcommand\advancemonth{% + \global\newmonthtrue\stepcounter{month} + \ifnum\c@month>12 + \stepcounter{year}\setleap\setcounter{month}1\fi} + \newif\ifleap +\newcommand\setleap{% + \@tempcnta=\c@year + \divide\@tempcnta by 4 \multiply\@tempcnta by 4 + \ifnum\@tempcnta=\c@year\global\leaptrue + \else\global\leapfalse\fi} +\newcommand\monthlength{% + \ifcase\c@month\or31\or\ifleap29\else28\fi + \or31\or30\or31\or30\or31\or31\or30\or31\or30\or31\fi% + \relax} +\newcommand\setdate[1]{\setdate@#1!} +\def\setdate@#1/#2/#3!{ + \setcounter{month}{#1} + \setcounter{date}{#2} + \setcounter{year}{#3} + \global\newmonthtrue\setleap} +\newcommand\ordinaldate{\ordinal{\c@date}} +\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} +\endinput +%% +%% End of file `termcal.sty'. |