Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!munnari.oz.au!bruce!cechew From: cechew@bruce.OZ (Earl Chew) Newsgroups: comp.text Subject: LaTeX Calendar - Patches Keywords: LaTeX, calendar Message-ID: <1731@bruce.OZ> Date: 4 Dec 89 02:41:06 GMT Organization: Monash Uni. Computer Science, Australia Lines: 297 In response to some requests, here are some patches for the LaTeX calendar. o Use of a4.sty has been removed. Page sizes are hard coded in configuration section for easy editing. o End of month underlining bug fixed. o Six week months possible (edit configuration section). Only the main month will have six rows (6th row containing widow days). The small boxes at the top will have the sixth week folded onto the first so that the boxes are of constant height --- looks a bit ugly otherwise. o Box size for each day of main month can be changed by editing the configuration section. o \clearpage added after each month output. Earl ------------------------------------------------------------------------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'cal.dif' <<'END_OF_FILE' X*** /postg/cechew/tex/cal/cal.sty Thu Nov 30 20:39:21 1989 X--- cal.sty Mon Dec 4 12:47:23 1989 X*************** X*** 10,19 **** X % \Calendar generate a box contained a calendar X % \date mark a date with an event X % X! % Patchlevel 1.0 X % X % Edit History: X % X % 11 Aug 1989 Updated for release X % X \typeout{Calendar Style Version 1.1 May 1989}% X--- 10,20 ---- X % \Calendar generate a box contained a calendar X % \date mark a date with an event X % X! % Patchlevel 1.1 X % X % Edit History: X % X+ % 04-Dec-1989 Corrected \lc computation bug. Allow 6 week months. X % 11 Aug 1989 Updated for release X % X \typeout{Calendar Style Version 1.1 May 1989}% X*************** X*** 58,63 **** X--- 59,65 ---- X % #7 \iftrue to print horizontal lines: this causes \horizontal X % to be defined as \hline or \empty X % #8 height of vbox --- only used if #3 is not empty X+ % #9 \iftrue to print 6 week months X % X \newcount\ld% last day in month X \newcount\td% today --- first day of month X*************** X*** 66,72 **** X \newdimen\baseskip% saved baseline skip X \newdimen\digitheight% how high to make the digits X % X! \def\Calendar#1#2#3#4#5#6#7#8{{% X % X % Remember the size of calendar entries. X % X--- 68,74 ---- X \newdimen\baseskip% saved baseline skip X \newdimen\digitheight% how high to make the digits X % X! \def\Calendar#1#2#3#4#5#6#7#8#9{{% X % X % Remember the size of calendar entries. X % X*************** X*** 118,125 **** X % 1=Sunday 7=Saturday. This enumeration differs from \td since X % \lc is used later for \cline. X % X! \lc=\ld \advance\lc by\td \divide\lc by7 \multiply\lc by-7 % X \advance\lc by\ld \advance\lc by\td% X % X % Compute the number of weeks in the month. This is used to set X % up the \weekx macros. It is not possible to do this on the fly X--- 120,128 ---- X % 1=Sunday 7=Saturday. This enumeration differs from \td since X % \lc is used later for \cline. X % X! \lc=\ld \advance\lc by\td \advance\lc by-1 \divide\lc by7 \multiply\lc by-7 % X \advance\lc by\ld \advance\lc by\td% X+ %\showthe\lc% X % X % Compute the number of weeks in the month. This is used to set X % up the \weekx macros. It is not possible to do this on the fly X*************** X*** 131,136 **** X--- 134,140 ---- X \ifnum\w>0 \def\weekiii{\oneweek}\else\def\weekiii{}\fi \advance\w by-1 % X \ifnum\w>0 \def\weekiv{\oneweek}\else\def\weekiv{}\fi \advance\w by-1 % X \ifnum\w>0 \def\weekv{\oneweek}\else\def\weekv{}\fi \advance\w by-1 % X+ #9\ifnum\w>0 \def\weekvi{\oneweek}\else\def\weekvi{}\fi \advance\w by-1 \fi% X % X % Compute the weekday of the Sunday before the 1st of the month. The X % result not taken mod 7 and will not be positive. X*************** X*** 155,163 **** X \ifnum\td>0 % X \ifnum\td>\ld \multicolumn{1}{}{}\else \dotoday \fi% X \else% X! \global\advance\td by35 % X! \ifnum\td>\ld \else \dotoday \fi% X! \global\advance\td by-35 % X \fi% X \global\advance\td by1 % X }% X--- 159,170 ---- X \ifnum\td>0 % X \ifnum\td>\ld \multicolumn{1}{}{}\else \dotoday \fi% X \else% X! #9% X! \else% X! \global\advance\td by35 % X! \ifnum\td>\ld \else \dotoday \fi% X! \global\advance\td by-35 % X! \fi% X \fi% X \global\advance\td by1 % X }% X*************** X*** 180,186 **** X \begin{tabular}{#5} X \multicolumn{7}{c}{#4 \name\ #2} \\[1\baseskip] \horizontal X #6 X! \weeki \weekii \weekiii \weekiv \weekv X \end{tabular}}} X % X % The \date macro allows the user to declare events on particular X--- 187,193 ---- X \begin{tabular}{#5} X \multicolumn{7}{c}{#4 \name\ #2} \\[1\baseskip] \horizontal X #6 X! \weeki \weekii \weekiii \weekiv \weekv #9 \weekvi \fi X \end{tabular}}} X % X % The \date macro allows the user to declare events on particular Xdiff -c /postg/cechew/tex/cal/cal.tex ./cal.tex X*** /postg/cechew/tex/cal/cal.tex Thu Nov 30 20:39:31 1989 X--- cal.tex Mon Dec 4 13:25:27 1989 X*************** X*** 19,37 **** X % which has the same format as dates.tex. events.tex should contain X % events of a significant and personal nature (eg birthdays). X % X! % Patchlevel 1.0 X % X % Edit History: X % X % 11 Aug 1989 Updated for release X % X! \documentstyle[a4,12pt,cal]{article}% X \pagestyle{empty}% X- % X \oddsidemargin -1in% X \evensidemargin -1in% X \textwidth 8in% X % X \begin{document}% X % X \typeout{LaTeX Calendar}% X--- 19,56 ---- X % which has the same format as dates.tex. events.tex should contain X % events of a significant and personal nature (eg birthdays). X % X! % Patchlevel 1.1 X % X % Edit History: X % X+ % 04-Dec-1989 Add \clearpage in \onepage. Allow 6 week months. X % 11 Aug 1989 Updated for release X % X! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% X! % Configuration Options % X! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% X! \documentstyle[12pt,cal]{article}% X \pagestyle{empty}% X \oddsidemargin -1in% X \evensidemargin -1in% X \textwidth 8in% X+ \textheight 10in% X+ \topmargin 0in% X % X+ % Six week calendar control. Set to \iftrue to generate 6 week X+ % calendar months. Set to \iffalse to fold sixth week onto the X+ % first week of month. X+ % X+ \let\ifsixweek=\iffalse% X+ % X+ % Big month box height. This controls the size of the boxes X+ % used for each day in the main part of the calendar. X+ % X+ \newlength{\dayboxh} \setlength{\dayboxh}{3cm}% X+ \newlength{\dayboxw} \setlength{\dayboxw}{2cm}% X+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% X+ % End Configuration % X+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% X \begin{document}% X % X \typeout{LaTeX Calendar}% X*************** X*** 47,57 **** X \ifnum\month>12 \month=1 \advance\year by1 \fi}% X % X \def\littlemonth{{\tabcolsep=0.75mm% X! \Calendar{\the\month}{\the\year}{}{}{rrrrrrr}{% X! Su & Mo & Tu & We & Th & Fr & Sa \\}{\iffalse}{}}}% X % X \def\bigmonth{\Calendar{\the\month}{\the\year}{\scriptsize}{\Huge}% X! {|p{2cm}|p{2cm}|p{2cm}|p{2cm}|p{2cm}|p{2cm}|p{2cm}|}% X {\multicolumn{1}{|c|}{Sun}&% X \multicolumn{1}{c|}{Mon}&% X \multicolumn{1}{c|}{Tue}&% X--- 66,78 ---- X \ifnum\month>12 \month=1 \advance\year by1 \fi}% X % X \def\littlemonth{{\tabcolsep=0.75mm% X! \Calendar{\the\month}{\the\year}{}{}{rrrrrrr}% X! {Su & Mo & Tu & We & Th & Fr & Sa \\}% X! {\iffalse}{}{\iffalse}}}% X % X \def\bigmonth{\Calendar{\the\month}{\the\year}{\scriptsize}{\Huge}% X! {|p{\dayboxw}|p{\dayboxw}|p{\dayboxw}% X! |p{\dayboxw}|p{\dayboxw}|p{\dayboxw}|p{\dayboxw}|}% X {\multicolumn{1}{|c|}{Sun}&% X \multicolumn{1}{c|}{Mon}&% X \multicolumn{1}{c|}{Tue}&% X*************** X*** 58,64 **** X \multicolumn{1}{c|}{Wed}&% X \multicolumn{1}{c|}{Thu}&% X \multicolumn{1}{c|}{Fri}&% X! \multicolumn{1}{c|}{Sat}\\ \horizontal}{\iftrue}{3cm}}% X % X \def\onepage{\setbox0=\hbox{\bigmonth}% X \centerline{\hbox to\wd0{% X--- 79,86 ---- X \multicolumn{1}{c|}{Wed}&% X \multicolumn{1}{c|}{Thu}&% X \multicolumn{1}{c|}{Fri}&% X! \multicolumn{1}{c|}{Sat}\\ \horizontal}% X! {\iftrue}{\dayboxh}{\ifsixweek}}% X % X \def\onepage{\setbox0=\hbox{\bigmonth}% X \centerline{\hbox to\wd0{% X*************** X*** 65,71 **** X \fbox{\footnotesize\advmonth{-1}\littlemonth}\hfil% X \fbox{\footnotesize\advmonth{1}\littlemonth}}}% X \vspace{1cm}% X! \centerline{\box0}}% X % X % Read the year. If the line is empty, the current year is taken X % to be the default. X--- 87,93 ---- X \fbox{\footnotesize\advmonth{-1}\littlemonth}\hfil% X \fbox{\footnotesize\advmonth{1}\littlemonth}}}% X \vspace{1cm}% X! \centerline{\box0}\clearpage}% X % X % Read the year. If the line is empty, the current year is taken X % to be the default. END_OF_FILE if test 7907 -ne `wc -c <'cal.dif'`; then echo shar: \"'cal.dif'\" unpacked with wrong size! fi # end of 'cal.dif' fi echo shar: End of shell archive. exit 0 ------------------------------------------------------------------------------- -- Earl Chew, Dept of Computer Science, Monash University, Australia 3168 ARPA: cechew%bruce.cs.monash.oz.au@uunet.uu.net ACS : cechew@bruce.oz ---------------------------------------------------------------------- Brought to you by Super Global Mega Corp .com