[comp.text] 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!      |
------------------------------------------------------------------------------

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

nspl@olivee.olivetti.com (Riccardo Mazza) (11/29/89)

I found the calendar program as posted by Mr. Narasimhan
quite useful. For those of you in Europe who have a4 paper,
I would suggest to make the following changes:
    * 81pt vboxes changed to 75pt, so the calendar fits on the page, vertically.
    * 1.30in changed to 1.40in to fill out the page horizontally and allow
      for larger non-postscript fonts.

I do not have a postscript printer, so I changed the \newfont's to \font's,
using Zap Humanistic fonts (dont ask me for them, you have to buy them).
Unfortunately, the zap 6 points are larger than their postscript equivalents,
so other than changing 1.30in to 1.40in, I also changed the
tabcolsep from .6em to .53em.

Suggestions to whoever has some spare time:

Lets write it all in TeX (LaTeX), instead of using a C-preprocessor.
Don't see any reason why it should be difficult using these fine
sources as a starting point.

Thanks again to the author.

Jon Zaid
    uunet!amdahl!oliveb!iconet!tom!cgrp

jbw@unix.cis.pitt.edu (Jingbai Wang) (11/30/89)

In article <5798@ubc-cs.UUCP> halliday@cheddar.cc.ubc.ca (Laura Halliday) writes:
>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


Of course, of course. A calender does not have to be in Adobe Helvetica and 
TimesRoman fonts. However, the user can easily replace them by, e.g., 

\newfont{\hb}{cmb10 at 12pt}
(etc...)
\newfont{\trsix}{cmr6}

For those who have some special versions of dvi2ps, such as mine from
june.cs.washington.edu under ~/tex as w_dvi2ps or even better ~/tmp as
dvi2ps.tar.Z, those Abobe fonts are all supported. A piece of good news 
is that a hacker called Kevin has successfully produced a merged version
of dvi2ps from various versions. Even though I did not find too much of
my features of w_dvi2ps in Kevin's version (which I think was derived from
pdvi2ps from june.cs.washington.edu), I do encourage and support such work.

The dvips40~42 available from labrea.standford.edu (which has been down
for a while now, they are working on it), does not support Adobe fonts
the same way, and you may have to modify the font definitions as 
\newfont{\hb}{Helvetica-Bold at 12pt}
(etc...)
\newfont{\trsix}{Times-Roman at 6pt}

Unfortunately, this kind of scheme (of dvips) is not portable to UNIX System V
and DOS, since System V only buys file length of 14 characters and DOS 8. 
Another drawback of new dvips is that it attempts to solve the missing PK font
file problem by envoking Metafont, and I feel it to be inefficient and 
not generalizable. Since to generate Metafont, you need mf84 setup on your
site, and you need all the *.mf file handy. In this aspect, my version of
dvi2ps displays the unique advantage of doing best substitution and scaling 
the font to the exact size (as specified in TeX) by PostScript scaling.


JB Wang
jwang@pittvms.bitnet
jbw@cisunx.UUCP

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

jbw@unix.cis.pitt.edu (Jingbai  Wang) writes:
> The dvips40~42 available from labrea.standford.edu (which has been down
> for a while now, they are working on it), does not support Adobe fonts
> the same way, and you may have to modify the font definitions as 
> \newfont{\hb}{Helvetica-Bold at 12pt}
> (etc...)
> \newfont{\trsix}{Times-Roman at 6pt}
> Unfortunately, this kind of scheme is not portable to UNIX System V
> and DOS, since System V only buys file length of 14 characters and DOS 8. 

Actually, dvips does indeed support the aliasing the other drivers do, so you
can indeed use h-bol instead of Helvetica-Bold if you are working on an
ancient relic of a machine.  Simply place the alias following the PostScript
font name in psfonts.map.

Sorry labrea has been down for so long; wish I could do something about it.
Get dvips421 when you do get it . . .

> Another drawback of dvips is that it attempts to solve the missing PK font
> file problem by envoking Metafont, and I feel it to be inefficient and 
> not generalizable. Since to generate Metafont, you need mf84 setup on your
> site, and you need all the *.mf file handy. In this aspect, my version of
> dvi2ps displays the unique advantage of doing best substitution and scaling 
> the font to the exact size (as specified in TeX) by PostScript scaling.

But until you've had the freedom to specify `scaled 7000' and watch everything
work beautifully, you haven't lived . . .

My main beef is that so many people use the `find closest size' as a normal
style, yielding wildly varying results at different sites and with different
drivers.  All over I see people saying `cmr10 at 18truept' or some such, and
getting widely-spaced small letters on one printer, slightly jagged
approximations on a second, blank spaces instead of characters on a third,
and no output at all on a fourth.  It's very fast to create a single font,
and once you do, it's always there . . .

Of course, having the automatic generation also solves the problem of font
storage, since instead of 8M of fonts, you need only (typically) 1M after
extended use . . .

> JB Wang

But I do plan to put in autoscaling for those who need it and don't want
to hassle with MF.  The question is, when?

-tom

chris@mimsy.umd.edu (Chris Torek) (11/30/89)

>>... [a] way of mapping PostScript fonts into LaTeX. `h-bol' is
>>Helvetica Bold. `t-rom' is Times-Roman.

In article <20915@unix.cis.pitt.edu> jbw@unix.cis.pitt.edu (Jingbai Wang)
writes:
>The dvips40~42 available from labrea.standford.edu (which has been down
>for a while now, they are working on it),

It fell into a tar pit in the earthquake :-)

>does not support Adobe fonts the same way, and you may have to modify
>the font definitions as 
>\newfont{\hb}{Helvetica-Bold at 12pt}
>(etc...)
>\newfont{\trsix}{Times-Roman at 6pt}
>
>Unfortunately, this kind of scheme (of dvips) is not portable to UNIX System
>V and DOS, since System V only buys file length of 14 characters and DOS 8. 

These systems are deficient.  I agree with Tom Rokicki in preferring the
long names.  As a compromise, my latest change was to accept both the
long names and the abbreviated versions, depending on the contents of the
TeXPSfonts.map file.  (The installer may omit the short names.)

>Another drawback of new dvips is that it attempts to solve the missing
>PK font file problem by envoking Metafont, and I feel it to be inefficient
>and not generalizable. Since to generate Metafont, you need mf84 setup on
>your site, and you need all the *.mf file handy.

This should be no harder than having TeX82 set up on your site, and
having all the *.tfm files handy.

Although my code does not have an option to invoke Metafont, I do intend
to create one, once I figure out how it should work.  It is, I think,
much more efficient than the alternative, which is to store every font
in every standard magnification for every sort of output device you
have.  It seems much more sensible to use the GF/PK files as a cache
mechanism, so that you only keep on-line the ones you normally use.
(Figure it this way: pk files for all fonts at 300 dpi = ~10 MB; then
the second set for the write-white 300 dpi devices is another 10 MB;
add the set for the 1000 dpi typesetter at, say, ~90 MB, and now we are
using a fair bit of space.)

>In this aspect, my version of dvi2ps displays the unique advantage of
>doing best substitution and scaling the font to the exact size (as
>specified in TeX) by PostScript scaling.

This is not unique: Van Jacobson's dvi2ps does the same thing.  The
results are seriously ugly for most scale factors.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@cs.umd.edu	Path:	uunet!mimsy!chris

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>

msschaa@cs.vu.nl (Schaap MS) (12/07/89)

In article <5798@ubc-cs.UUCP> halliday@cheddar.cc.ubc.ca (Laura Halliday) writes:
>In article <12898@polya.Stanford.EDU> ertem@polya.Stanford.EDU (Tuna Ertemalp) writes:
>
>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.

Please!

Thank you,
Michael
msschaa@cs.vu.nl

ron@woan.austin.ibm.com (Ronald S. Woan) (12/08/89)

In article <4740@draak.cs.vu.nl>, msschaa@cs.vu.nl (Schaap MS) writes:
> >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.
> 
> Please!

For those of us without ftp access, you can mail to the mail server
(archive-server@sun.soe.clarkson.edu) and have it send you information
about its archives and request files. Just use the following in the
command in the message body:

help
index latex-style
path <however you mail to yourself>

It will return with an index of the latex style files and help on how
to get them.

						Ron

+-----All Views Expressed Are My Own And Are Not Necessarily Shared By------+
+------------------------------My Employer----------------------------------+
+ Ronald S. Woan  (IBM VNET)WOAN AT AUSTIN, (AUSTIN)ron@woan.austin.ibm.com +
+ outside of IBM       @cs.utexas.edu:ibmchs!auschs!woan.austin.ibm.com!ron +
+ last resort                                        woan@peyote.cactus.org +