[comp.lang.c] A C program for a Calendar in LaTeX.

naras@stat.fsu.edu (B. Narasimhan) (11/28/89)

/* This is "lxcal.c", a C program to produce a Calendar in LaTeX. No 
 * claim whatsoever is made regrading this code or the calendar-design. 
 * Note that no error checking is done.
 * The calendar is printed on a 11in by 8.5in paper. Use your favorite
 * DVI2PS with the landsacpe option.
 * I found this to be a useful programming exercise both in C and LaTeX. 
 * Comments, suggestions and reports regarding bugs are welcome. 

 * Author:        B. Narasimhan 
 *                Dept. of Statistics 
                  Florida State Univesrity
 *                Tallahassee, FL 32306. 
 *                E-mail: naras@stat.fsu.edu
 * I wish to thank 
 *                William Poser 
 *                Dept. of Linguistics 
 *                Stanford University 
 * who provided the string handling routines I needed, including a new
 * "itoa" and the person (I don't know the name) who posted the 
 * day_of_week algorithm on the net.
 * Usage: lxcal [input_file] [output_file]
 *
 * Input should be as follows:
   YEAR MONTH                   - Integers
   DAY_NO                       - Integer
   \begin{itemize}
       \item Item_1 \\
       \item Item_2 \\
       ......
       \item Item_N \\
   \end{itemize}
   %                              
   ANOTHER DAY_NO               - Integer
   \begin{itemize}
   ....
   \end{itemize}
   %
 * and so on. The % is important. This preempts the use of %. Can anyone
 * out there change this to %% instead? I tried the usual tricks and for 
 * some reason they all bombed and I am not willing to spend more time on
 * this now. 
 */
 /* AN EXERCISE [M15]: This is a wrap-around calendar with 5 rows. 
    Some time in the future the last row will be empty, i.e.
    February will have 28 days with the Ist day beginning on a Sunday.
    Which is the earliest year when this happens? Can you
    characterize those years (at least during your lifetime) ?
 */


#include <stdio.h>
#include <string.h>
#define CNULL ( ( char *) 0)
#define MAXLEN 1000

static char *month_name[] = {
                      "", "JANUARY", "FEBRUARY", "MARCH", "APRIL",
                      "MAY", "JUNE", "JULY", "AUGUST",
                      "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"
                      };
static int no_of_days[2][13] = {
                      {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
                      {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
                      };
static int offsets[] = {0, 0, 3, 3, 6, 1, 4, 6, 2, 5, 7, 3, 5};


char *create_copy(string)
char *string;
/*
 * Copy a string and return a pointer to the new storage allocated
 * to contain it. This function differs from strcpy(3) in that it
 * allocates the necessary storage instead of just copying into
 * storage provided by the caller.
 */
{
   char *new;
   extern char *malloc();
   
   if( (new = malloc( (unsigned) (strlen(string) + 1) ) ) != CNULL){
      strcpy(new,string);
   }
   else fprintf(stderr,"create_copy: malloc error\n");

   return(new);
}

char *copy_cat(string1,string2)
char *string1, *string2;
/*
 * Concatenate the strings in the two arguments, allocating the
 * necessary storage, freeing the storage allocated to the first
 * argument, and returning a pointer to the newly created object.
 * This function is similar to strcat(3) but differs from it in
 * handling the storage allocation as well as in destroying the
 * original first argument.
 */
{
   char *new;
   extern char *malloc();
   extern void free();
   
   
   if( (new = malloc( (unsigned) (strlen(string1) + strlen(string2) + 1) )) != CNULL){
      strcpy(new,string1);
      strcat(new,string2);
      if(string1 != CNULL)	free(string1);
   }
   else fprintf(stderr,"copy_cat: malloc error\n");
   return(new);
}

/*
 * This is a fast subroutine for converting a binary
 * integer into a decimal ASCII string. It is very much
 * like the itoa routine described on p.60 of K&R, but differs
 * from it in several respects. One is the order of arguments.
 * The name of the string in which to write is given first in order
 * to be consistent with sprintf and kindred functions.
 *
 * This algorithm fails on the most negative integer.
 *	 
 */
void itoa(string,k)
char *string;				/* String in which to write */
int k;					/* Integer to convert */
{
   register int temp;
   register char *s;
   register char *p;
   register int n;
   register int q;
   register int r;
   int sign;
   
   n = k;				/* Copy integer into register */
   p = s = string;			/* Copy pointer into registers */
   
   if( (sign = n) < 0) n = -n;	/* Make n positive */
   
   /* Do conversion */

   do {
      q = n / 10;
      r = (q << 3) + (q << 1);	/* Multiply by 10 (8x + 2x = 10x) */
      *s++ = n + '0' - r;
   } while (( n = q) > 0);
   
   if(sign < 0) *s++ = '-';	/* If negative, add sign */
   
   *s = '\0';                  /* Null terminate string */
   
   s--;				/* Point s at last non-null char */
   
   /*
    * Now we reverse the string. When we begin, p points at the first
    * character of the string, s at the last non-null character.
    */

   while(p < s){
      temp = *p;
      *p++ = *s;
      *s-- = temp;
   }

   return;
}

int day_of_week(year,month, day)
int year, month,day;
{
     int dw;
     dw=4+year+((year+3)/4)+offsets[month]+day;
     if( ((year%4) ==0) && (month > 2)) dw++;
     if( (year==0) && (month < 3)) dw++;
     dw=(dw%7);
     return(dw);
}

int days_in_month(year, month)
int year, month;
{
   int leap;

   leap = year%4 == 0 && year%100 !=0 || year%400 == 0;
   return(no_of_days[leap][month]);
}


char *read_event(fpi, p) /* Read LaTeX input and return pointer. */
FILE *fpi;
char *p; 
{
   int i, lenp;
   char s[MAXLEN], *temp_p, *t;

   temp_p = p;
   lenp = strlen(p);
   if ((t = malloc((unsigned) lenp)) != CNULL) {
      for (i = 0; i < lenp - 1; i++)
         t[i] = *temp_p++;
      t[i] = '\0';
      free(p);
      while ((i=fscanf(fpi,"%[^\%]",s)) != 0) {
	 t = copy_cat(t,"    ");
	 t = copy_cat(t, s);
      }
      t = copy_cat(t,"  }");
      i = fscanf(fpi,"%s",s);
   } else
      fprintf(stderr,"read_event: malloc error\n");
   return(t);
}

main(argc, argv)
int argc;
char *argv[];
{
   int year, month, day, result, prev, next, temp, cell_no;
   int days_now, days_prev, days_next, days_next_next;
   int day_one_now, day_one_next, day_one_prev;
   int which_day, next_month, prev_month, prev_month_year, next_month_year;
   int i, j;
   char buffer[10], *p;

   FILE *fpi, *fpo, *fopen();

   struct day_info {
	 int day_no;
	 char *event;
   } list[35];

   if (argc == 1) {
      fpi = stdin;
      fpo = stdout;
   }
   if (argc >= 2)
      if ((fpi = fopen(*++argv, "r")) == NULL) {
	 fprintf(stderr,"lxcal: can't open %s\n",*argv);
         exit(1);
      }
   if (argc >= 3)
      if ((fpo = fopen(*++argv, "w")) == NULL) {
	fprintf(stderr,"lxcal: can't open %s\n",*argv);
        exit(1);
      }
   result = fscanf(fpi,"%d %d", &year, &month);

/* Figure prev_month and prev_month_year, and same for next month. */

   if (month == 1) {
      prev_month = 12;
      prev_month_year = year - 1;
   } else {
      prev_month = month - 1;
      prev_month_year = year;
   }
   if (month == 12) {
      next_month = 1;
      next_month_year = year + 1;
   } else {
      next_month_year = year;
      next_month = month + 1;
   }

/* Figure starting week day in those months. */

   day_one_now = day_of_week(year, month, 1);
   day_one_next = day_of_week(next_month_year, next_month, 1);
   day_one_prev = day_of_week(prev_month_year, prev_month, 1);

/* Figure number of days in those months. */

   days_now = days_in_month( year, month);
   days_prev = days_in_month( prev_month_year, prev_month);
   days_next = days_in_month( next_month_year, next_month);

/* Determine where the sub-calendars for prev and next months go. */

   temp = days_now + day_one_now;
   if (day_one_now == 0 && days_now == 28) {
      prev = 28;
      next = 34;
   } else if ( day_one_now == 0) {
       prev = 33;
       next = 34;
   } else if (temp <= 34) {
       prev = 0;
       next = 34;
   } else if (temp == 35) {
       prev = 0;
       next = 1;
   } else {
       prev = (temp+1)%7;
       next = prev + 1;
   }

/* Mark the corresponding days with negative day_no's. (For output.) */

   list[prev].day_no = -2;
   list[next].day_no = -1;

/* Set the dates. */

   for (i = day_one_now; i < day_one_now + 35; i++) {
      j = i%35;
      if (i >= days_now + day_one_now)
         list[j].day_no = 0;   /* Mark boxes with no day numbers. */
      else
         list[j].day_no = i - day_one_now + 1;
      if (j%7 != 0)
         list[j].event = create_copy("  &\\boxit{\n  }");
      else
         list[j].event = create_copy("   \\boxit{\n  }");
   }

/* Now set about arranging things for the sub-calendars. */

   if (prev%7 == 0)
      list[prev].event = create_copy("   ");  
   else
      list[prev].event = create_copy("  &");
   list[prev].event = copy_cat(list[prev].event,"\\boxcal{\n     \\");
   list[prev].event = copy_cat(list[prev].event,"begin{center}\n        ");
   list[prev].event = copy_cat(list[prev].event, month_name[prev_month]);
   list[prev].event = copy_cat(list[prev].event, " ");
   itoa(buffer, prev_month_year);
   list[prev].event = copy_cat(list[prev].event,buffer);
   list[prev].event = copy_cat(list[prev].event,"\n    \\end{center}\n");
   list[prev].event = copy_cat(list[prev].event,"    \\begin{tabular*}");
   list[prev].event = copy_cat(list[prev].event,"{1.30in}{rrrrrrr}\n");
   list[prev].event = copy_cat(list[prev].event,"    \\hline\n     ");
   list[prev].event = copy_cat(list[prev].event,"S  &M  &T  &W  &T  ");
   list[prev].event = copy_cat(list[prev].event,"&F  &S \\\\\n");
   list[prev].event = copy_cat(list[prev].event,"     \\hline\n");
   for (i = 0; i < days_prev+day_one_prev; i++) {
      if (i%7 == 0)
	 list[prev].event = copy_cat(list[prev].event,"     ");
      else
	 list[prev].event = copy_cat(list[prev].event," &");
      if (i >= day_one_prev) {
         itoa(buffer,i-day_one_prev+1);
         list[prev].event = copy_cat(list[prev].event,buffer);
      }
      if (i%7 == 6)
	 list[prev].event = copy_cat(list[prev].event,"\\\\\n");
   }
   list[prev].event = copy_cat(list[prev].event,"\n     ");
   list[prev].event = copy_cat(list[prev].event,"\\end{tabular*}\n    }");

   if (next%7 == 0)                         
      list[next].event = create_copy("   ");
   else                                     
      list[next].event = create_copy("  &");
   list[next].event = copy_cat(list[next].event,"\\boxcal{\n     \\");
   list[next].event = copy_cat(list[next].event,"begin{center}\n        ");
   list[next].event = copy_cat(list[next].event, month_name[next_month]);
   list[next].event = copy_cat(list[next].event, " ");
   itoa(buffer,next_month_year);
   list[next].event = copy_cat(list[next].event, buffer);
   list[next].event = copy_cat(list[next].event,"\n    \\end{center}\n");
   list[next].event = copy_cat(list[next].event,"    \\begin{tabular*}");
   list[next].event = copy_cat(list[next].event,"{1.30in}{rrrrrrr}\n");
   list[next].event = copy_cat(list[next].event,"    \\hline\n     S");
   list[next].event = copy_cat(list[next].event,"  &M  &T  &W  &T  &F");
   list[next].event = copy_cat(list[next].event,"  &S \\\\\n     \\hline\n");
   for (i = 0; i < days_next+day_one_next; i++) {
      if (i%7 == 0)
	 list[next].event = copy_cat(list[next].event,"     ");
      else
	 list[next].event = copy_cat(list[next].event," &");
      if (i >= day_one_next) {
         itoa(buffer,i-day_one_next+1);
         list[next].event = copy_cat(list[next].event,buffer);
      }
      if (i%7 == 6)
	 list[next].event = copy_cat(list[next].event,"\\\\\n");
   }
   list[next].event = copy_cat(list[next].event,"\n     \\");
   list[next].event = copy_cat(list[next].event,"end{tabular*}\n    }");

/* Read the events for the present month. */

   result = fscanf(fpi,"%d",&which_day);
   while (result != 0 && result != EOF) {
     temp = (which_day + day_one_now +34)%35;
     list[temp].event = read_event(fpi, list[temp].event);
     result = fscanf(fpi,"%d",&which_day);
   }

/* Just print out the LaTeX file! */

   fprintf(fpo,"%s","\% This is a Calendar in LaTeX.\n");
   fprintf(fpo,"%s","\% Author: B. Narasimhan\n");
   fprintf(fpo,"%s","\%         Dept. of Statistics\n");
   fprintf(fpo,"%s","\%         Florida State University\n");
   fprintf(fpo,"%s","\%         Tallahassee, FL 32306-3033\n");
   fprintf(fpo,"%s","\%         Ph. (904)-644-5852\n");
   fprintf(fpo,"%s","\%         E-mail: naras@stat.fsu.edu\n");
   fprintf(fpo,"%s","\% Freely redistributable and modifyable. \n");
   fprintf(fpo,"%s","\% Modifiers and enhancers, please:\n");
   fprintf(fpo,"%s","\%         1. Make sure credit is given to all");
   fprintf(fpo,"%s"," involved\n");
   fprintf(fpo,"%s","\%                   and more importantly,\n");
   fprintf(fpo,"%s","\%         2. Mail me a copy for the sake of");
   fprintf(fpo,"%s"," improving my knowledge.\n" );
   fprintf(fpo,"%s","\%\n");
   fprintf(fpo,"%s","\\documentstyle[12pt]{article}\n");
   fprintf(fpo,"%s","\%\n");
   fprintf(fpo,"%s","\\newcommand{\\boxit}[1]{\\vbox to 81pt{\\");
   fprintf(fpo,"%s","begin{minipage}[b]{1.30in}\n");
   fprintf(fpo,"%s","\\setlength{\\parskip}{0.0in}\n");
   fprintf(fpo,"%s","\\setlength{\\baselineskip}{3.0mm}\n");
   fprintf(fpo,"%s","\\raggedright #1 \\end{minipage}\n");
   fprintf(fpo,"%s","\\vspace{\\fill}}}\n");
   fprintf(fpo,"%s","\%\n");
   fprintf(fpo,"%s","\\newcommand{\\boxcal}[1]{\\vbox to 81pt{\\");
   fprintf(fpo,"%s","begin{minipage}[b]{1.30in}\n");
   fprintf(fpo,"%s","\\setlength{\\arrayrulewidth}{0.01mm} \n");
   fprintf(fpo,"%s","\\renewcommand{\\arraystretch}{0.60} \n");
   fprintf(fpo,"%s","\\trsix\n");
   fprintf(fpo,"%s","\\setlength{\\baselineskip}{1.90mm} \n");
   fprintf(fpo,"%s","\\setlength{\\tabcolsep}{0.6em} \n");
   fprintf(fpo,"%s","#1\\end{minipage}\\vspace{\\fill}}}\n");
   fprintf(fpo,"%s","\%\n");
   fprintf(fpo,"%s","\\setlength{\\topskip}{0.0in}\n");
   fprintf(fpo,"%s","\\setlength{\\headheight}{0.0in}\n");
   fprintf(fpo,"%s","\\setlength{\\headsep}{0.0in}\n");
   fprintf(fpo,"%s","\\setlength{\\footheight}{0.0in}\n");
   fprintf(fpo,"%s","\\setlength{\\footskip}{0.4375in}\n");
   fprintf(fpo,"%s","\\setlength{\\topmargin}{-.5625in}\n");
   fprintf(fpo,"%s","\\setlength{\\oddsidemargin}{-0.65in}\n");
   fprintf(fpo,"%s","\\setlength{\\textwidth}{10.3in}\n");
   fprintf(fpo,"%s","\\setlength{\\textheight}{8.5in}\n");
   fprintf(fpo,"%s","\\newfont{\\hb}{h-bol at 12pt}\n");
   fprintf(fpo,"%s","\\newfont{\\hbbig}{h-bol at 24pt}\n");
   fprintf(fpo,"%s","\\newfont{\\tbeight}{t-bol at 8pt}\n");
   fprintf(fpo,"%s","\\newfont{\\treight}{t-rom at 8pt}\n");
   fprintf(fpo,"%s","\\newfont{\\tbieight}{t-bolita at 8pt}\n");
   fprintf(fpo,"%s","\\newfont{\\tb}{t-bol at 12pt}\n");
   fprintf(fpo,"%s","\\newfont{\\trsix}{t-rom at 6pt}\n");
   fprintf(fpo,"%s","\\pagestyle{empty}\n");
   fprintf(fpo,"%s","\\begin{document}\n");
   fprintf(fpo,"%s","\\treight\n");
   fprintf(fpo,"%s","\\vspace{\\fill}\n");
   fprintf(fpo,"%s","\\begin{center}\n");
   fprintf(fpo,"%s","  {\\hbbig ");
   fprintf(fpo,"%s ",month_name[month]);
   fprintf(fpo," ");
   itoa(buffer, year);
   fprintf(fpo,"%s",buffer);
   fprintf(fpo,"%s","}\n\\end{center}\n");
   fprintf(fpo,"%s","\\begin{tabular}{|p{1.30in}|p{1.30in}|p{1.30in}");
   fprintf(fpo,"%s","|p{1.30in}|p{1.30in}|p{1.30in}|p{1.30in}|}\n");
   fprintf(fpo,"%s","  \\hline\n");
   fprintf(fpo,"%s","  \\multicolumn{1}{|c}{\\hb Sunday}\n");
   fprintf(fpo,"%s","  &\\multicolumn{1}{|c}{\\hb Monday}\n");
   fprintf(fpo,"%s","  &\\multicolumn{1}{|c}{\\hb Tuesday}\n");
   fprintf(fpo,"%s","  &\\multicolumn{1}{|c}{\\hb Wednesday}\n");
   fprintf(fpo,"%s","  &\\multicolumn{1}{|c}{\\hb Thursday}\n");
   fprintf(fpo,"%s","  &\\multicolumn{1}{|c}{\\hb Friday}\n");
   fprintf(fpo,"%s","  &\\multicolumn{1}{|c|}{\\hb Saturday}\n");
   fprintf(fpo,"%s","  \\\\ \n");
   fprintf(fpo,"%s","  \\hline\\hline");

   for (i = 0; i < 5; i++) {
      for (j = 0; j < 7; j++) {
         cell_no = i*7 + j;
	 if (cell_no%7 == 0)
	    fprintf(fpo,"   ");
         else
	    fprintf(fpo,"  &");
	 if (list[cell_no].day_no <= 0 )
	    fprintf(fpo,"\n");
	 else 
           if (cell_no%7 == 6 || list[cell_no].day_no == days_now) {
              fprintf(fpo,"%s","\\multicolumn{1}{|r|}{\\tb ");
              itoa(buffer,list[cell_no].day_no);
              fprintf(fpo,"%s}\n",buffer);
	   }
	   else {
              fprintf(fpo,"%s","\\multicolumn{1}{|r}{\\tb ");
              itoa(buffer,list[cell_no].day_no);
              fprintf(fpo,"%s}\n",buffer);
           }
      }
      fprintf(fpo,"  \\\\\n");

      for (j = 0; j < 7; j++) {
         cell_no = i*7 + j;
         fprintf(fpo,"%s\n",list[cell_no].event);
      }
      fprintf(fpo,"%s","  \\\\\n  \\hline\n");
   } 

/* Close open environments. */

   fprintf(fpo,"%s","\\end{tabular}\n");
   fprintf(fpo,"%s","\\vspace{\\fill}\n");
   fprintf(fpo,"%s","\\end{document}\n");

/* Return heap space. */

   for (i = 0; i < 35; i++)
      free(list[i].event);

/* Close files. */

   fclose(fpi);
   fclose(fpo);
}

Sample input-----------CUT HERE----------
1989 12
4
  \begin{itemize}
     \item Oral Presentation. \\
     \item 6:30pm Dinner date with Brokujam.
  \end{itemize}
%
7                            
  \begin{itemize}            
     \item Mom's Birthday. \\ 
      \item 10:00am Dentist Appointment.
  \end{itemize}              
%                           
30                            
  \begin{itemize}            
     \item Duds Anonymous meeting. \\     
     \item Party till death 
  \end{itemize}              
%                           

dhosek@jarthur.Claremont.EDU (D.A. Hosek) (11/29/89)

Actually, the Calendar problem can be solved entirely in TeX (or LaTeX).
The proof is left to the reader.

-dh


-- 
"Odi et amo, quare id faciam, fortasse requiris?
   nescio, sed fieri sentio et excrucior"          -Catullus
D.A. Hosek.                        UUCP: uunet!jarthur!dhosek
                               Internet: dhosek@hmcvax.claremont.edu

ertem@polya.Stanford.EDU (Tuna Ertemalp) (11/29/89)

The output of lxcal contains the following lines:

\newfont{\hb}{h-bol at 12pt}
\newfont{\hbbig}{h-bol at 24pt}
\newfont{\tbeight}{t-bol at 8pt}
\newfont{\treight}{t-rom at 8pt}
\newfont{\tbieight}{t-bolita at 8pt}
\newfont{\tb}{t-bol at 12pt}
\newfont{\trsix}{t-rom at 6pt}

I don't think these font names are standard; they are not available at
polya.stanford.edu. Does someone (author?) know what these fonts are
called normally?

Have fun
------------------------------------------------------------------------------
| Mr. Tuna Ertemalp        | Manzanita Park 26X      | Small things together |
| Stanford University      | Stanford University     |   form the quality,   |
| Computer Science MS      | Stanford, CA 94305, USA | But quality is not a  |
| Ertem@Cs.Stanford.Edu    | (415) 328-8515          |     small thing!      |
------------------------------------------------------------------------------

ribet@maalox.berkeley.edu (Kenneth A. Ribet) (11/29/89)

In article <12898@polya.Stanford.EDU> ertem@polya.Stanford.EDU (Tuna Ertemalp) writes:
>
>The output of lxcal contains the following lines:
>
>\newfont{\hb}{h-bol at 12pt}
...
>\newfont{\tbieight}{t-bolita at 8pt}
>\newfont{\tb}{t-bol at 12pt}
>\newfont{\trsix}{t-rom at 6pt}
>

>Does someone (author?) know what these fonts are
>called normally?

These are resident postscript fonts in a LaserWriter.  Here is the
list of them (taken from a file called TeXPSfonts.map on this machine):

t-bol		Times-Bold
t-bolita	Times-BoldItalic
t-ita		Times-Italic
t-rom		Times-Roman
t-romsc		Times-SmallCaps		"/Times-Roman SmallCapsFont"
t-obl		Times-Oblique		"/Times-Roman 15.5 ObliqueFont"
t-bolobl	Times-BoldOblique	"/Times-Bold 15 ObliqueFont"
t-itaun		Times-ItalicUnslanted	"/Times-Bold -15.15 ObliqueFont"
t-mathitaTimes-MathItalic	"/Times-Italic /SymbolObl /Symbol 15.15 MathOblique"
ag-book		AvantGarde-Book
ag-bookobl	AvantGarde-BookOblique
ag-demi		AvantGarde-Demi
ag-demiobl	AvantGarde-DemiOblique
ag-booksc	AvantGarde-SmallCaps	"/AvantGarde-Book SmallCapsFont"
b-demi		Bookman-Demi
b-demiita	Bookman-DemiItalic
b-lig		Bookman-Light
b-ligita	Bookman-LightItalic
b-ligsc		Bookman-SmallCaps	"/Bookman-Light SmallCapsFont"
ncs-bol		NewCenturySchlbk-Bold
ncs-bolita	NewCenturySchlbk-BoldItalic
ncs-ita		NewCenturySchlbk-Italic
ncs-rom		NewCenturySchlbk-Roman
ncs-romsc	NewCenturySchlbk-Roman	"/NewCenturySchlbk-Roman SmallCapsFont"
p-bol		Palatino-Bold
p-bolita	Palatino-BoldItalic
p-ita		Palatino-Italic
p-rom		Palatino-Roman
p-romsc		Palatino-SmallCaps	"/Palatino-Roman SmallCapsFont"
p-obl		Palatino-Oblique	"/Palatino-Roman 10 ObliqueFont"
p-bolobl	Palatino-BoldOblique	"/Palatino-Bold 10 ObliqueFont"
zc-medita	ZapfChancery-MediumItalic
zd		ZapfDingbats
c-bol		Courier-Bold
c-bolobl	Courier-BoldOblique
c-obl		Courier-Oblique
c-med		Courier
h-bol		Helvetica-Bold
h-bolobl	Helvetica-BoldOblique
h-obl		Helvetica-Oblique
h-med		Helvetica

>Have fun

Ditto.

>| Mr. Tuna Ertemalp        | Manzanita Park 26X      | Small things together |
>| Stanford University      | Stanford University     |   form the quality,   |
>| Computer Science MS      | Stanford, CA 94305, USA | But quality is not a  |
>| Ertem@Cs.Stanford.Edu    | (415) 328-8515          |     small thing!      |

Ken Ribet  Berkeley Math Dept.  ribet@math.berkeley.edu  ...ucbvax!math!ribet

naras@stat.fsu.edu (B. Narasimhan) (11/29/89)

This is in response to a request for the actual names of the various fonts
used in the program.
I am sorry I forgot to comment on the various fonts used. I have a      
Postscript printer and I have the tfm files for the corresponding fonts.
Anyway, h-bol stands for Helvetica Bold,
        t-bol for Times Bold,
        t-rom for Times Roman and
        t-bolita for Times Bold Italic.
You can certainly change these to your liking.
-B. Narasimhan
naras@stat.fsu.edu

halliday@cheddar.cc.ubc.ca (Laura Halliday) (11/29/89)

In article <12898@polya.Stanford.EDU> ertem@polya.Stanford.EDU (Tuna Ertemalp) writes:
>
>The output of lxcal contains the following lines:
>
>\newfont{\hb}{h-bol at 12pt}
>(etc...)
>\newfont{\trsix}{t-rom at 6pt}
>
>I don't think these font names are standard; they are not available at
>polya.stanford.edu. Does someone (author?) know what these fonts are
>called normally?

(Sorry to disagree, but don't you think comp.text is a better place to 
continue this thread? With that out of the way...)

I know. They're one way of mapping PostScript fonts into LaTeX. `h-bol' is
Helvetica Bold. `t-rom' is Times-Roman.

Obtain a copy of PS-LaTeX from the LaTeX style collection for further details.
You need tfms (readily available), and a dvi2ps that groks PostScript fonts
(many do). 

Oh, before anybody asks, ftp to sun.soe.clarkson.edu, and cd pub/latex-style.
If you can't ftp, there is an email server of some sort. I don't know how 
to use it, but I'm sure somebody can fill us in.

>Have fun

Always!

...laura

rokicki@polya.Stanford.EDU (Tomas G. Rokicki) (11/29/89)

ertem@polya.Stanford.EDU (Tuna Ertemalp) writes:
> The output of lxcal contains the following lines:
> \newfont{\hb}{h-bol at 12pt}
> \newfont{\hbbig}{h-bol at 24pt}
> \newfont{\tbeight}{t-bol at 8pt}
> \newfont{\treight}{t-rom at 8pt}
> \newfont{\tbieight}{t-bolita at 8pt}
> \newfont{\tb}{t-bol at 12pt}
> \newfont{\trsix}{t-rom at 6pt}
> I don't think these font names are standard; they are not available at
> polya.stanford.edu. Does someone (author?) know what these fonts are
> called normally?

The font names above are unfortunate mistakes; the true font names are
probably (and respectively) Helvetica-Bold, Helvetica-Bold,
Times-Bold, Times-Roman, Times-BoldItalic, Times-Bold, and
Times-Roman.  There exist (shudder) machines that can't handle names
quite this long, so crude hacks are occasionally necessary . . .

If necessary, you can replace the fonts with Computer Modern TeX
fonts fairly easily; one might use (respectively):

cmssbx10 at 12pt, cmssbx10 at 24.883pt, cmbx8, cmr8, cmti8, cmbx12, cmr6

If your site can handle long file names, but the `real' PostScript names
don't work, complain to your site administrater.

-tom

mikew@wheeler.wrcr.unr.edu (Mike Whitbeck) (11/29/89)

In article <12898@polya.Stanford.EDU> ertem@polya.Stanford.EDU (Tuna Ertemalp) writes:
|
|The output of lxcal contains the following lines:
|
|\newfont{\hb}{h-bol at 12pt}
|\newfont{\hbbig}{h-bol at 24pt}
|\newfont{\tbeight}{t-bol at 8pt}
|\newfont{\treight}{t-rom at 8pt}
|\newfont{\tbieight}{t-bolita at 8pt}
|\newfont{\tb}{t-bol at 12pt}
|\newfont{\trsix}{t-rom at 6pt}
|
|I don't think these font names are standard; they are not available at
|polya.stanford.edu. Does someone (author?) know what these fonts are
|called normally?
|
|Have fun
|------------------------------------------------------------------------------
|| Mr. Tuna Ertemalp        | Manzanita Park 26X      | Small things together |
|| Stanford University      | Stanford University     |   form the quality,   |
|| Computer Science MS      | Stanford, CA 94305, USA | But quality is not a  |
|| Ertem@Cs.Stanford.Edu    | (415) 328-8515          |     small thing!      |
|------------------------------------------------------------------------------

I just changed these lines in the SOURCE code to  fonts I had:

   fprintf(fpo,"%s","\\newfont{\\hb}{cmbx12}\n");
   fprintf(fpo,"%s","\\newfont{\\hbbig}{cmbx12}\n");
   fprintf(fpo,"%s","\\newfont{\\tbeight}{cmbx8}\n");
   fprintf(fpo,"%s","\\newfont{\\treight}{cmr8}\n");
   fprintf(fpo,"%s","\\newfont{\\tbieight}{cmti8}\n");
   fprintf(fpo,"%s","\\newfont{\\tb}{cmbx12}\n");
   fprintf(fpo,"%s","\\newfont{\\trsix}{cmr5}\n");

You could probably also write an editor (sed) script to manipulate the latex
file produced by the original code. This is a great little program -- I
just cranked out my appointments for December with it on an Imagen
8/300. BTW the 
   \newfont{\\trsix}{cmr5}
is a little large, is there such a thing as a 4.5 pt cm roman? Can I
scale DOWN a 8 or 9 pt roman font?



___________________________________________________________
|Mike Whitbeck             |                              |
|Desert Research Inst.     | mikew@wheeler.wrc.unr.edu    |

cechew@bruce.OZ (Earl Chew) (11/30/89)

From article <778@stat.fsu.edu>, by naras@stat.fsu.edu (B. Narasimhan):
> /* This is "lxcal.c", a C program to produce a Calendar in LaTeX. No 

Here's one that I meant to post ages ago. It's written entirely in TeX/LaTeX.
The following shows how to run it:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Script started on Thu Nov 30 20:45:13 1989
bruce:/tmp/cal.21> latex cal
This is TeX, Version 2.0 for Pyramid OSx (preloaded format=lplain 87.9.18)
(cal.tex
LaTeX Version 2.09 - Released 19 April 1986
(/usr/lib/tex/macros/article.sty
Document Style 'article'. Released 23 September 1985
(/usr/lib/tex/macros/art12.sty)) (/postg/cechew/tex/macros/a4.sty
A4 Page Size. July 1988
) (cal.sty
Calendar Style Version 1.1 May 1989
)
No file cal.aux.
LaTeX Calendar
Year: 1989
Month: jun
(dates.tex) (events.tex) [1] (cal.aux (dates.aux) (events.aux))
Output written on cal.dvi (1 page, 2844 bytes).
Transcript written on cal.log.
bruce:/tmp/cal.22> ^D
script done on Thu Nov 30 20:45:49 1989
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Responding with an empty line at the `Month:' prompt will generate the a
calendar for the entire year. The file dates.tex contains special dates. The
file events.tex contains special dates of a more personal nature.

Enjoy.

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 <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  cal.sty cal.tex dates.tex events.tex
# Wrapped by cechew@bruce on Thu Nov 30 20:41:27 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'cal.sty' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cal.sty'\"
else
echo shar: Extracting \"'cal.sty'\" \(6060 characters\)
sed "s/^X//" >'cal.sty' <<'END_OF_FILE'
X%			Calendar Style
X%
X%		Author: C. E. Chew
X%		Date:	May 1989
X%
X% This style file contains the calendar generating macros for LaTeX.
X% The following macros are defined:
X%
X%	\DayOfWeek	computed the day of week
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% The \dow macro computes the day of the week for a given date.
X% The arguments are:
X%
X%	#1	day 1..31
X%	#2	month 1..12
X%	#3	year
X%
X% The result in returned in \dow with 0=Sunday and 6=Saturday.
X%
X\newcount\dow%				day of week
X\def\DayOfWeek#1#2#3{{%
X\def\Day{\count0 }\def\Month{\count2 }\def\Year{\count4 }\def\Century{\count6 }%
X\Day=#1 \Month=#2 \Year=#3 %
X\advance\Month by-2 %
X\ifnum\Month<1 \advance\Month by12 \advance\Year by-1 \fi%
X\Century=\Year \divide\Century by100 \multiply\Century by-100 %
X\advance\Year by\Century \divide\Century by100 %
X\dow=\Month \multiply\dow by26 \advance\dow by-2 \divide\dow by10 %
X\advance\dow by\Day \advance\dow by\Year%
X\advance\dow by\Century \advance\dow by\Century%
X\divide\Century by-4 \advance\dow by\Century%
X\divide\Year by4 \advance\dow by\Year%
X\count255=\dow \divide\count255 by7 \multiply\count255 by-7 %
X\advance\dow by\count255 %
X\ifnum\dow<0 \advance\Dow by7 \fi%
X\global\dow=\dow%
X}}%
X%
X% The \Calendar macro prints a the calendar for one month on
X% one page. The arguments are:
X%
X%	#1	month 1=January 12=December
X%	#2	year
X%	#3	size of calendar entries --- empty if not required
X%	#4	size of header
X%	#5	format for tabular environment
X%	#6	days of week header, this should be consister with #5
X%		and should probably use \horizontal in place of \hline
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%
X\newcount\ld%			last day in month
X\newcount\td%			today --- first day of month
X\newcount\w%			number of weeks in this month
X\newcount\lc%			number of days in last week
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\def\entrysize{#3}%
X%
X% Determine the size of the digits.
X%
X\setbox0=\hbox{0123456789}%
X\digitheight=1\tabcolsep \advance\digitheight by\ht0 %
X%
X% Remember \baselineskip
X%
X\baseskip=1\baselineskip%
X%
X% Compute the number of days in this month. The result is left in
X% \ld.
X%
X\ifcase#1 %
X\or\def\name{January}\ld=31 %
X\or\def\name{February}\ld=28 %
X   \count0=#2 \divide\count0 by4 \multiply\count0 by4 %
X   \ifnum\count0=#2 \count0=#2 \divide\count0 by100 \multiply\count0 by100 %
X     \ifnum\count0=#2 \count0=#2 \divide\count0 by400 \multiply\count0 by400 %
X       \ifnum\count0=#2 \ld=29 %
X       \fi%
X     \else \ld=29 %
X     \fi%
X   \fi%
X\or\def\name{March}\ld=31 %
X\or\def\name{April}\ld=30 %
X\or\def\name{May}\ld=31 %
X\or\def\name{June}\ld=30 %
X\or\def\name{July}\ld=31 %
X\or\def\name{August}\ld=31 %
X\or\def\name{September}\ld=30 %
X\or\def\name{October}\ld=31 %
X\or\def\name{November}\ld=30 %
X\or\def\name{December}\ld=31 \fi%
X\expandafter\lowercase\expandafter{%
X                       \expandafter\def\expandafter\lname\expandafter{\name}}%
X%\showthe\ld%
X%
X% Compute the day of the week on which the 1st of this month
X% begins. The answer is left in \td with 0=Sunday and 6=Saturday.
X%
X\DayOfWeek{1}{#1}{#2}\td=\dow%
X%
X% Compute the last day in the month. Leave the answer in \lc with
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% within the tabular environment since it introduces empty columns.
X%
X\w=\ld \advance\w by\td \advance\w by6 \divide\w by7 %
X\ifnum\w>0 \def\weeki{\oneweek}\else\def\weeki{}\fi \advance\w by-1 %
X\ifnum\w>0 \def\weekii{\oneweek}\else\def\weekii{}\fi \advance\w by-1 %
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%
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\multiply\td by-1 \advance\td by1 %
X%
X% Process today's date looking for any significant events.
X%
X\def\dotoday{\ifx\entrysize\empty \the\td%
X             \else \vbox to#8{\vrule height\digitheight width0pt depth0pt%
X		   \the\td%
X		   \vfill%
X                   #3\raggedright%
X		   \csname\lname\romannumeral\the\td\endcsname%
X		   \vbox{}%
X		   }\fi}%
X%
X% This macro will process one day of the calendar. It will then
X% advance the day counter.
X%
X\def\oneday{%
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%
X% This macro will process one week of the calendar. This assumes that
X% there will be at least one non-empty day in the week. If this is
X% the last week, only the week up until the last day is printed.
X%
X\def\oneweek{%
X\oneday & \oneday & \oneday & \oneday & \oneday & \oneday & \oneday \\
X#7\ifnum\td>\ld\cline{1-\the\lc}\else\hline\fi\fi%
X}%
X%
X% Set the macro to print horizontal lines
X%
X#7\def\horizontal{\hline}\else\let\horizontal=\empty \fi
X%
X% Print the calendar for this month
X%
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% days. The arguments are:
X%
X%	#1		the month (eg January) --- not case sensitive
X%	#2		the day
X%	#3		text for the event
X%
X\def\date#1#2#3{{\lowercase{\def\ldate{#1}}%
X                \expandafter\gdef\csname\ldate\romannumeral #2 \endcsname{#3}}}%
END_OF_FILE
if test 6060 -ne `wc -c <'cal.sty'`; then
    echo shar: \"'cal.sty'\" unpacked with wrong size!
fi
# end of 'cal.sty'
fi
if test -f 'cal.tex' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cal.tex'\"
else
echo shar: Extracting \"'cal.tex'\" \(3394 characters\)
sed "s/^X//" >'cal.tex' <<'END_OF_FILE'
X%
X%			LaTeX Calendar Driver
X%
X%		Author: C. E. Chew
X%		Date:	May 1989
X%
X% This is the main program for printing out calendars. It provides
X% a user interface for the calendar style. The style file contains
X% the code that actually produces the calendars.
X%
X% The program will prompt for the year and the month. The year should
X% be entered in full (eg 1989). The month should be entered using
X% the first three letters of the month in question, case not being
X% significant (eg aug). Responding with an empty line for the month
X% causes a calendar for the entire year to be printed out.
X%
X% The program will include the file dates.tex which contains significant
X% dates for the year. The user is free to create the file events.tex
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%
X\def\Jan{jan}\def\Feb{feb}\def\Mar{mar}\def\Apr{apr}%
X\def\May{may}\def\Jun{jun}\def\Jul{jul}\def\Aug{aug}%
X\def\Sep{sep}\def\Oct{oct}\def\Nov{nov}\def\Dec{dec}%
X%
X\def\lread{{\endlinechar=-1 \global\read-1 to\line}}%
X%
X\def\advmonth#1{\advance\month by#1 %
X	        \ifnum\month<1 \month=12 \advance\year by-1 \fi%
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                        \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                   \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%
X\message{Year: }\lread \ifx\line\empty \else \newcount\year \year=\line \fi%
X%
X% Read the month. If the line is empty, the calendar for the entire
X% year is printed.
X%
X\newcount\month \loop%
X  \message{Month: }\lread%
X  \ifx\line\empty%
X    \month=-1 %
X  \else%
X    \month=0 %
X    \lowercase\expandafter{%
X	       \expandafter\def\expandafter\line\expandafter{\line}}%
X    \ifx\line\Jan\month=1 \fi \ifx\line\Feb\month=2 \fi%
X    \ifx\line\Mar\month=3 \fi \ifx\line\Apr\month=4 \fi%
X    \ifx\line\May\month=5 \fi \ifx\line\Jun\month=6 \fi%
X    \ifx\line\Jul\month=7 \fi \ifx\line\Aug\month=8 \fi%
X    \ifx\line\Sep\month=9 \fi \ifx\line\Oct\month=10 \fi%
X    \ifx\line\Nov\month=11 \fi \ifx\line\Dec\month=12 \fi%
X  \fi%
X\ifnum\month=0 \repeat%
X%
X\include{dates}%
X\include{events}%
X%
X\ifnum\month=-1 \month=1 \loop \onepage \advance\month by1 %
X			 \ifnum\month<13 \repeat%
X\else \onepage%
X\fi%
X%
X\end{document}
END_OF_FILE
if test 3394 -ne `wc -c <'cal.tex'`; then
    echo shar: \"'cal.tex'\" unpacked with wrong size!
fi
# end of 'cal.tex'
fi
if test -f 'dates.tex' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dates.tex'\"
else
echo shar: Extracting \"'dates.tex'\" \(5556 characters\)
sed "s/^X//" >'dates.tex' <<'END_OF_FILE'
X%
X%			Special Dates File
X%
X% This file should contain special dates. The format is:
X%
X%			\date{month}{day}{text}
X%
X% The name of the month should be typed in full. Case is not significant.
X% It is also possible to do complicated things like computing the days
X% for Easter --- but only if you're a TeXpert.
X%
X% Put a file containing text like this in your current directory when you
X% LaTeX cal.tex. The file will be read in after the year and month are
X% read. The year is available in \year and the number of the month is
X% available in \month. If \month is -1 then the entire year is about
X% to be printed.
X%
X% Patchlevel 1.0
X%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				JANUARY					%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X\date{January}{1}{New Year's Day}%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				FEBRUARY				%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				MARCH					%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				APRIL					%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				MAY					%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				JUNE					%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				JULY					%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				AUGUST					%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				SEPTEMBER				%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				OCTOBER					%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				NOVEMBER				%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				DECEMBER				%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X\date{December}{25}{Christmas Day}%
X\date{December}{26}{Boxing Day}%
X\date{December}{31}{New Year's Eve}%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				EASTER					%
X%									%
X% This algorithm is taken from:						%
X%									%
X%	The Calculation of Easter					%
X%	D. E. Knuth							%
X%	CACM April 1962 p 209						%
X%									%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X{%
X\def\Golden{\count0 }%			year in Mentonic cycle
X\def\Easter{\count0 }%			Easter Sunday
X\def\GrCor{\count2 }%			Gregorian correction
X\def\ClCor{\count4 }%			Clavian correction
X\def\Epact{\count6 }%			age of calendar moon at start of year
X\def\Century{\count6 }%			century
X\def\Extra{\count8 }%			when Sunday occurs in March
X\Golden=\year \divide\Golden by19 \multiply\Golden by-19 %
X\advance\Golden by\year \advance\Golden by1 %
X\ifnum\year>1582 %
X  \Century=\year \divide\Century by100 \advance\Century by1 %
X  \GrCor=\Century \multiply\GrCor by3 \divide\GrCor by-4 \advance\GrCor by12 %
X  \ClCor=\Century \advance\ClCor by-18 \divide\ClCor by-25 %
X  \advance\ClCor by\Century \advance\ClCor by-16 \divide\ClCor by3 %
X  \Extra=\year \multiply\Extra by5 \divide\Extra by4 %
X  \advance\Extra by\GrCor \advance\Extra by-10 %
X  \Epact=\Golden \multiply\Epact by11 \advance\Epact by20 %
X  \advance\Epact by\ClCor \advance\Epact by\GrCor %
X  \count255=\Epact \divide\count255 by30 \multiply\count255 by-30 %
X  \advance\Epact by\count255 %
X  \ifnum\Epact>0 \else \advance\Epact by30 \fi%
X  \ifnum\Epact=25 %
X    \ifnum\Golden>11 %
X      \advance\Epact by1 %
X    \fi%
X  \else%
X    \ifnum\Epact=24 %
X      \advance\Epact by1 %
X    \fi%
X  \fi%
X\else%
X  \Extra=\year \multiply\Extra by5 \divide\Extra by4 %
X  \Epact=\Golden \multiply\Epact by11 \advance\Epact by-4 %
X  \count255=\Epact \divide\count255 by30 \multiply\count255 by-30 %
X  \advance\Epact by\count255 \advance\Epact by1 %
X\fi%
X\Easter=\Epact \multiply\Easter by-1 \advance\Easter by44 %
X\ifnum\Easter<21 %
X  \advance\Easter by30 %
X\fi%
X\advance\Extra by\Easter \count255=\Extra %
X\divide\count255 by7 \multiply\count255 by-7 \advance\Extra by\count255 %
X\multiply\Extra by-1 \advance\Easter by\Extra \advance\Easter by7 %
X\ifnum\Easter>31 %
X  \advance\Easter by-31 %
X  \date{April}{\the\Easter}{Easter}%
X  \advance\Easter by1 %
X  \date{April}{\the\Easter}{Easter Monday}%
X  \advance\Easter by1 %
X  \date{April}{\the\Easter}{Easter Tuesday}%
X  \advance\Easter by-3 %
X  \date{April}{\the\Easter}{Easter Saturday}%
X  \advance\Easter by-1 %
X  \date{April}{\the\Easter}{Easter Friday}%
X\else%
X  \date{March}{\the\Easter}{Easter}%
X  \advance\Easter by1 %
X  \date{March}{\the\Easter}{Easter Monday}%
X  \advance\Easter by1 %
X  \date{March}{\the\Easter}{Easter Tuesday}%
X  \advance\Easter by-3 %
X  \date{March}{\the\Easter}{Easter Saturday}%
X  \advance\Easter by-1 %
X  \date{March}{\the\Easter}{Easter Friday}%
X\fi%
X}%
END_OF_FILE
if test 5556 -ne `wc -c <'dates.tex'`; then
    echo shar: \"'dates.tex'\" unpacked with wrong size!
fi
# end of 'dates.tex'
fi
if test -f 'events.tex' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'events.tex'\"
else
echo shar: Extracting \"'events.tex'\" \(875 characters\)
sed "s/^X//" >'events.tex' <<'END_OF_FILE'
X%
X%			Special Dates File
X%
X% This file should contain special dates. The format is:
X%
X%			\date{month}{day}{text}
X%
X% The name of the month should be typed in full. Case is not significant.
X% It is also possible to do complicated things like computing the days
X% for Easter --- but only if you're a TeXpert.
X%
X% Put a file containing text like this in your current directory when you
X% LaTeX cal.tex. The file will be read in after the year and month are
X% read. The year is available in \year and the number of the month is
X% available in \month. If \month is -1 then the entire year is about
X% to be printed.
X%
X% Patchlevel 1.0
X%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X%				BIRTHDAYS				%
X%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X\date{June}{8}{Stuart's Birthday}%
X\date{December}{28}{Arthur's Birthday}%
END_OF_FILE
if test 875 -ne `wc -c <'events.tex'`; then
    echo shar: \"'events.tex'\" unpacked with wrong size!
fi
# end of 'events.tex'
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
----------------------------------------------------------------------

cml@tove.umd.edu (Christopher Lott) (12/01/89)

Hi,

this LaTeX program is great!  One of the nicest calendars I've
ever seen come from a laser printer :-)

Just one problem:  the file a4.sty doesn't seem to exist in the local
LaTeX macro directory.  On the author's system it is:

   /postg/cechew/tex/macros/a4.sty

Perhaps the author could post this file?  Or someone else, if this
is a well-known macro?

thanks in advance.

chris...
p.s. why is tex source code in comp.lang.c??  Not that I'm really complaining.
cml@tove.umd.edu    Computer Science Dept, U. Maryland at College Park
		    4122 A.V.W.  301-454-8711	<standard disclaimers>