; TeX output 1997.02.06:1358sowDtGGcmr17User's7tGuidetotheCalendarpacqkage!", cmsy10gXQ cmr12FVrankG.Bennett,Jr.2K cmsy8y,bFVebruary6,1997*?!Kt : cmbx9Abstract,poo cmr9This?pac9k|rageprovidestoAolsforcreatingcustomizedcalendarsusing bL5Aacmr6A TuAEXc.25" cmmi9"u. ϒI Nff cmbx121aLIntros3ductionIK`y cmr10ThisF=packqagescreatesamacro,w!6284\twopimod\repeatI23XdD\ifnum\count1>3142I24XdD\advance\count1by-3142I25XdD\ifsign\signfalse\else\signtrue\fi\fiI26XdD\multiply\count1 s,by10\count3=\count1I27XdD\divide\count3 s,by1000\count2=\count3I28XdD\multiply\count3 s,by1000I29XdD\advance\count3 s,by-\count1I30XdD\count5=\sintable{\count2}I31XdD\count4=\count5\advance\count2 s,by1I32XdD\advance\count4 s,by-\sintable{\count2}I33XdD\multiply\count4 s,by\count3I34XdD\divide\count4 s,by1000I35XdD\advance\count4 s,by\count5I36XdD\ifsign\count4=-\count4\fi}Iv?:=cos(theta),qwhere9!v=count4*10^(-3);theta=count1*10^(-3). \SIN IisUUevqaluatedonpi/2-theta.I37S\def\Cos{\advance\count1 s,by-1571I38XdD\multiply\count1 s,by-1\Sin}ILinear :transformationofT (givingtheta?:=a*T+b,where :T=count0*10^(-6); Itheta?=count1*10^(-3);UUa=#1*10^3+#2+#3*10^(-3);b=#4*10^(-3)I39S\def\lin#1.#2.#3+#4.{\count1=#3I40XdD\count2=#2\count3=#1I41XdD\multiply\count1by\count0I42XdD\multiply\count2by\count0I43XdD\multiply\count3by\count0I44XdD\divide\count1by1000I45XdD\advance\count1by\count2I46XdD\divide\count1by1000I47XdD\advance\count1by\count3I48XdD\advance\count1by#4}IAccumulate/vqaluereturnedbyatrigonometricfunction,{scaledbyfactorf, Iinto count6:8ac?:=ac+f*v,P;whereac=count6*10^(-7)v=valueofSINڲorICOS?=count4*10^(-3)UUf=#1*10^(-4) I49S\def\fac#1{\multiply\count4 s,by#1I50XdD\advance\count6 s,by\count4}I51S\def\id{\count4=\count1} s,%IdentityI52S}2 .soI53S\ProcessOptionsI2.2gFirstruncommandsuTICreateUUatoggleto agleapyears.I54S cmsy9h$ow cmss9st9yle[i I55S\newif\ifleapyearICreateUUsomecounters.I56S\newcounter{date}I57S\newcounter{weekd}I58S\newcounter{Year}I59S\newcounter{yearbase}I60S\newcounter{Month}I61S\newcounter{Day}I62S\newcounter{catch}I63S\newcounter{timezone}ICreateUUacoupleofshorthandmacros,tokeeptheinterfaceconsistent.I64S\def\theyear{19\the\c@Year}I65S\def\theday{\the\c@Day}IInitializeUUthetimezoneto0.I66S\setcounter{timezone}{0}y\setyearI67S\def\setyear#1{\c@Year=#1I68XdD\advance\c@Yearby-1900\calculateyearbase}$\nextyearI69S\def\nextyear{\advance\c@Yearby1I70XdD\calculateyearbase}b\settimezoneI71S\def\settimezone#1{\c@timezone=#1I72XdD\multiply\c@timezoneby1000I73XdD\divide\c@timezoneby24}9\calculateyearbaseISetwthe\ifleapyeartoggle.Q(Set\c@yearbasetothenumbGerwofdayspassedfrom I1900,UUJan0toNewyear'sdateinthetargetyear.I74S\def\calculateyearbase{%I75XdD\c@yearbase=-1I76XdD{\count0=\c@Year\divide\count0by4I77XdD\multiply\count0by4I78XdD\ifnum\c@Year=\count0I79XdD\global\c@catch=0\else\global\c@catch=1\fi}%I80XdD\ifcase\c@catch\leapyeartrue\orI81]\leapyearfalse\fiI82XdD{\count0=\c@Year\multiply\count0I83XdDby1461\advance\count0by3I84XdD\divide\count0by4I85XdD\global\c@catch=\count0}%I86XdD\advance\c@yearbaseby\c@catchI87XdD\ifnum\c@Year=0\c@yearbase=0\leapyearfalse\fi}3so\monthdaysISetUUthenumbGerUUofdayspassedattheendofeachmonthin\c@Day. I88S\def\monthdays{\global I89XdD\c@catch=\ifcase\c@Month0\or31\orI90]59\or90\or120\or151\or181\or212\orI91]243\or273\or304\or334\or365\fiI92XdD{\ifleapyear\ifnum\c@Month>1I93]\global\advance\c@catchby1\fi\fi}%I94XdD\c@Day=\c@catch}>"\daynoIReturnUUthelongdateof\c@Month,\c@Dayintheyear\c@Yearin\c@date.I95S\def\dayno{\c@date=\c@Day{\advanceI96XdD\c@Monthby-1\monthdaysI97XdD\advance\c@dateby\c@DayI98XdD\global\advance\c@dateby\c@yearbase}}>y\weekdayILongqjdateMODqc7givestheweekday*.Sundayis0andSaturdayis6.(Thiswas ItheUUdoGcumentationtotheoriginal le.qNotsurewhatitmeans.)I99S\def\weekday{{\count0=\c@date\relaxE100XdD\count1=\count0\divide\count0by7E101XdD\multiply\count0by7E102S\advance\count1by-\count0E103XdD\global\c@weekd=\count1}}> L\theweekdayINameUUofweekday(LoGcal).E104S\def\theweekday{\weekdayE105XdD\ifcase\c@weekdE106XdDSunday\orMonday\orTuesday\orE107XdDWednesday\orThursday\orFriday\orE108XdDSaturday\fi}> \theshortweekdayI(LoGcal)E109S\def\theshortweekday{\weekdayE110XdD\ifcase\c@weekdSun\orMon\orTue\orE111]Wed\orThu\orFri\orSat\fi}>y\caldateIGives 0theusualcalendardateforalongdateincounter\c@date.YReturnedin I\c@Day,UU\c@Monthand\c@YearE112S\def\caldate{\c@Year=\c@dateE113XdD\multiply\c@Yearby4\divide\c@Yearby1461E114XdD\calculateyearbaseE115XdD{\advance\c@dateby-\c@yearbase\c@Month=0E116XdD\loop\monthdays\ifnum\c@Day<\c@dateE117XdD\global\advance\c@Monthby1\repeatE118XdD{\advance\c@Monthby-1\monthdaysE119XdD\advance\c@dateby-\c@DayE120XdD\global\c@Day=\c@date}}}>$\themonthINameUUofmonth\c@Month.q(LoGcal)E121S\def\themonth{\ifcase\c@MonthE122XdD\orJanuary\orFebruary\orMarch\orE123XdDApril\orMay\orJune\orJuly\orE124XdDAugust\orSeptember\orOctober\orE125XdDNovember\orDecember\fi}4soy\nextdayIFindUUthenext(previous)dayafter(bGefore)\c@datewith\weekday=#1. 'E126S\def\nextday#1{{\count0=#1\weekday E127XdD\advance\count0by-\c@weekdE128XdD\ifnum\count0<0\advance\count0by7\fiE129XdD\global\advance\c@dateby\count0}}1ty\prevdayE130S\def\prevday#1{\snextday#1E131XdD\advance\c@dateby-7}1t$\snextdayE132S\def\snextday#1{\advance\c@dateby1E133XdD\nextday#1}1t$\sprevdayE134S\def\sprevday#1{\advance\c@dateby-1E135XdD\prevday#1}1tb\beginevents \endeventsI\beginevents...\endeventsµcontainscontrolsequenceslike\eventor\evdayor IsequencesUUgeneratingthesecommands.E136S\newwrite\evefileE137S\def\beginevents{%E138XdD\immediate\openoutE139XdD\evefile=\jobname.eve\relax}vME140S\def\endevents{\immediate\closeoutE141XdD\evefile\end}1t"\eventE142S\newtoks\evetextE143S\def\event#1/#2[#3]{\evetext={#3}%E144XdD\c@Day=#1\c@Month=#2\daynoE145XdD\evday[\the\evetext]}1t"\evdayE146S\def\evday[#1]{\immediate\write\evefile{%E147XdD\string\evententry{\the\c@date}{#1}}}1t L\thecaldateE148S\def\thecaldate{\the\c@Day/\the\c@Month}'|\muteE149S\def\mute{\def\thecaldate{}}퍍I2.3gSecondruncommandsuTIW*eUUneedafewcounters.E150S\newcount\currentdate E151S\newcount\lastdateE152S\newcount\nextdate'IW*eUUalsoneedafewtoggles.E153S\newif\ifdoing@dayE154S\newif\ifholy5*so'|\holyE155S\def\holy{\global\holytrue}'|\uptoE156S\def\upto#1{\nextdate=#1 E157XdD\loop\advance\currentdateby1\relaxE158]\ifnum\currentdate<\nextdateE159]\begin@day\end@day\repeat} L\evententryIThismacroisinvokedonceforeveryeventexpGortedtothejobname.eve lebythe Iselecteddatecalculationenginescontainedinthevqarious*.cle les.S TheinvoGca-Itions|8oGccurafter\begin@dayhasbeeninvoked|8onceby\makeagenda.)i\begin@dayIsetsx\ifdoing@daytotrue,sothistoggleissetonwhentheimpGorttakesplace.IAfterztheimpGort,C\end@dayisinvoked,whichzturnso \ifdoing@day.;7\uptoIthenuproGducesemptytemplatesuntilthecurrentdateishit,}andthemacrothenIdumpsthemessagetextbGeforecalling\end@day.M-ProcessingisthenpassedtotheInextzientryinthejobname.eve le.ThismethoGdwasinheritedfromtheoriginalITU>'ExXPpackqage.p.Itassumesthattheeventslistedinthejobname.eve lewillbGeinIlinear@order.CItthereforedoGesnotlenditselftousewithmultipleevent les.CT*oIovercomethislimitation,wewillneedtostoretheeventdatesinalistmacrothatIcanthenbGesortedbeforeproducingtheprintedoutput, callingmacrosnamedforIeachUUeventdateandtheeventsenginefromwhichitwasgenerated.E160S\def\evententry#1#2{\unskipIIfB6thedateestablishedfortheeventB6inthecurrentyearfallsafterthelastdateinItheUUproGcessingrange,donothingatall.E161XdD\ifnum#1>\lastdate\elseIIfthedateestablishedfallsbGeforetheearliestdateintherange,donothingatall.E162]\ifnum\currentdate<#1IThefollowingloGokslikeabugtome,althoughIcouldbGemissingsomething.zIt IappGears8thatifthevery rstdateintherangeisaneventdate,qtheeventwillIbGe#skipped.s1Otherwise,though,wedoasingleblankentry*,thenrollforwardIwithEblankentriesuntilthecurrenteventdategivenasthe rstargumenttoI\evententryUUisreached.E163ap\ifdoing@day\end@day\fi E164]\upto{#1}\fiIWhenthathappGens,\currentdatewillnaturallybeamatch.3/ThebugreferredtoIabGove,ifitisabug,mightbGeaddressedbyeliminatingtheinitializing\begin@dayIfromthe\makeagendamacro.ItwouldthenbGeprovidedbythecoGdebelow,IimmediatelyUUbGeforetheoutputoftheeventUUtext.E165XdD\ifnum\currentdate=#1 E166]\ifdoing@day\else\begin@day\fiE167]#2\par\fi\fi}\begin@dayE168S\def\begin@day{\doing@daytrueE169XdD\c@date=\currentdate\caldateE170XdD\message{<\thecaldate}\beginday}62Gsoy\end@dayE171S\def\end@day{\endday\doing@dayfalse E172XdD\global\holyfalse\message{>}} L\makeagendaIThisx}isthebusinessendoftheTU>'ExXmacros.@Ifanappropriatestyleisfedtothis ImacroUUafterinvokingUU\setyear,acalendarwillbGegenerated.E173S\def\makeagenda#1{\input#1.sty\relaxE174XdD\begin@day\input\jobname.eve\relaxE175XdD\evententry{\the\lastdate}{}\end@dayE176XdD\epilog\end}\makeemptyIDoUUnotreadeventsE177S\def\makeempty{\begin@dayE178XdD\evententry{\the\lastdate}{}\end@day}\ParseDateIBreakziupadateinthe rstandsecondargumentsto\everydayintoitscompGo- Inentsin\c@Year,\c@Monthand\c@Day,andsetthecorrespGondinglongdateinI\c@date.E179S\def\ParseDate#1{\@ParseDate#1\end}E180S\def\@ParseDate#1/#2/#3\end{\setyear{#1}\c@Month=#2\c@Day=#3\dayno}$\everydayISet\currentdateand\lastdatetosetthebGoundariesofiterationandde neIthebracketingmacros\begindayand\endday.wInitiateiterationbyinvokingI\makeempty.E181S\def\everyday#1#2#3{\ParseDate{#1}\currentdate=\c@date%E182]\ParseDate{#2}\lastdate=\c@date%E183]\def\beginday{#3}%E184]\def\endday{}\makeempty}E185Sh=st9yle[i!čI3aLTheffInstallationFileE186Shinstaller"iE187S\def\batchfile{calendar.ins}E188S\inputdocstrip.texE189E190S\keepsilentE191E192S\preambleE193E194SThisfileispartoftheCalendarpackage.E195SCopyright(C)1996FrankBennett,Jr.E196SAllrightsreserved.E197S------------------------------------------E198SThisisageneratedfile.E199E200SIMPORTANTNOTICE:E201E202SYouarenotallowedtochangethisfile. s,YoumayhowevercopyE203SthisfiletoafilewithadifferentnameandthenchangetheE204Scopyif(a)youdonotchargeforthemodifiedcode,(b)youE205Sacknowledgetheauthor(s)inthenewfile,ifit7?fsoE206Sisdistributedtoothers,and(c)youattachthesesame E207Sconditionstothenewfile.E208E209SYouarenotallowedtodistributethisfilealone. s,YouarenotE210SallowedtotakemoneyforthedistributionoruseofthisfileE211S(orachangedversion)exceptforanominalchargeforcopyingE212Setc.E213E214SYouareallowedtodistributethisfileundertheconditionthatE215Sitisdistributedwithallofitscontents,intact.E216E217SForerrorreports,orofferstohelpmakeCalendaramorepowerful,E218Sfriendlier,andbetterpackage,pleasecontactmeonE219S`fb'atsoas.ac.ukE220E221S\endpreambleE222E223S\generateFile{calendar.sty},{t}{\from{calendar.dtx}{style}}E224E225S\Msg{***********************************************************}E226S\Msg{*}E227S\Msg{*Tofinishtheinstallation,youhavetomovethefollowing}E228S\Msg{*fileintoadirectorysearchedbyTeX:}E229S\Msg{*}E230S\Msg{*\space\spacecalendar.sty}E231S\Msg{*}E232S\Msg{***********************************************************}E233S}E234Sh=installer"i8IY; $ow cmss9#ߤN cmtt9"N cmbx12!