48.9 PostScript Calendars with pcal
Sometimes you want a hardcopy calendar. You can generate one using cal ( 48.6 ) and an ASCII-to-PostScript filter like pstext ( 43.22 ) , but the resulting calendar is nothing to write home about.
In its default form, pcal just creates a PostScript calendar for the current month. The PostScript commands are written to standard output, so you need to pipe it to lpr for BSD-based systems, or lp for System V-based systems. (Of course, your printer has to be able to print PostScript.) For example:
You'll get a full-page calendar of the current month. The dates for Saturdays and Sundays are printed in gray. To get a different month, you can specify it the same way you would using cal . For a calendar for November 1992, you could do:
For a calendar for the whole year, use the -w option to pcal .
Once you get a chance to see the pcal output, you'll already see how big an improvement it is over just printing the output of the cal program. But pcal also gives you the opportunity to configure your calendars.
pcal looks for a file called .calendar in either your home directory or your current directory. (This is a hidden file ( 16.11 ) because the name starts with a dot.) You can use this file to mark days in the year. For example, you can use it to define particular days as holidays:
1/1 New Year's Day Feb 14 Valentine's Day
But pcal also understands a limited set of relational words as well. For example:
Second Sunday in May Mother's Day 4th thu of nov Thanksgiving
For each of these examples, the given day will have the specified
text written in.
If you use an asterisk (
1/1* New Year's Day Feb 14 Valentine's Day Second Sunday in May Mother's Day 4th thu of nov* Thanksgiving
This means that the day appears in gray on the calendar, like Saturday and Sunday. But more important, it means that pcal will understand that the marked day isn't a working day.
In addition to holidays, you can use pcal to mark things like birthdays and anniversaries.
June 4 My Birthday!!! September 3 Peter's birthday April 1 Mom and Dad's anniversary
Now here's where pcal starts to get useful. You can use pcal to mark meetings you have scheduled:
april 14 Meet with tax attorney at 4:45 last day of october Dr. Jekyll's office, 5:30
Or for regular appointments:
Each Friday of July Leave early for Cape
As you can probably tell by now, the syntax accepted by pcal is very flexible. It's actually much too complicated to be able to explain in full here, but pcal comes with a complete manual page, and pcal -h will give you a list of syntax and command-line options. And if you just wing it, you're likely to come up with syntax that works.
I don't want to leave it at that, though. Let's get on with a few more examples of some of the nicer features.
In place of the name of a month, you can use the
First day of all Send monthly report to boss Each Monday in all Status meeting at 11:30
Now, we used
First workday of all Send monthly report to boss
By default, pcal considers only Saturdays and Sundays to be non-workdays. You add days to this list when you define holidays with asterisks (*) as described previously. 
Another feature of pcal is that you can use the phases of the moon in your date specifications.
2nd full_moon in all Blue moon!
pcal supplies format specifiers for writing more detailed descriptions. For example, suppose you want to be reminded at the beginning of each month to make your monthly schedule. You can make up an entry that reads:
First workday of all Write schedule for %B
The special format specifier
Some other modifiers defined by
Last day of all Pay rent for month of %+B
In our office, we're expected to turn in time sheets for each 2-week period, on the 1st and 16th of each month. We can write:
first workday of all Time sheet due for end of %-B workday on_or_after all 16 Time sheet due for beginning of %B
You can also specify command-line options to
file, using the
opt -n Times-Italic -m
The -n Times-Italic option tells pcal to use the Times Italic font to display the text within the dates. The -m option tells pcal to show the new, half, and full moons in the month.