]> code.delx.au - gnu-emacs/blobdiff - lisp/calendar/cal-tex.el
*** empty log message ***
[gnu-emacs] / lisp / calendar / cal-tex.el
index 642a7677d968d80303087a64a768ad8c5564caa2..a67d90c832eada778b5362c422bde534628310e2 100644 (file)
@@ -1,9 +1,11 @@
-;;; cal-tex.el --- calendar functions for printing calendars with LaTeX.
+;;; cal-tex.el --- calendar functions for printing calendars with LaTeX
 
-;; Copyright (C) 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006
+;;   Free Software Foundation, Inc.
 
 ;; Author: Steve Fisk <fisk@bowdoin.edu>
 ;;      Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Calendar, LaTeX
 
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
 ;; This collection of functions implements the creation of LaTeX calendars
 ;; based on the user's holiday choices and diary file.
 
-;;; TO DO
-;;;
-;;;     (*)  Add holidays and diary entries to daily calendar.
-;;;
-;;;     (*)  Add diary entries to weekly calendar functions.
-;;;
-;;;     (*)  Make calendar styles for A4 paper.
-;;;
-;;;     (*)  Make daily and monthly styles Filofax paper.
-;;;
-;;;     (*)  Improve the LaTeX command that produces the boxes in the monthly
-;;;          calendar to eliminate slight gap--what causes it?!
+;; TO DO
+;;
+;;     (*)  Add holidays and diary entries to daily calendar.
+;;
+;;     (*)  Add diary entries to weekly calendar functions.
+;;
+;;     (*)  Make calendar styles for A4 paper.
+;;
+;;     (*)  Make monthly styles Filofax paper.
 
 ;;; Code:
 
 (autoload 'calendar-iso-from-absolute "cal-iso" nil t)
 
 ;;;
-;;; Customizable variables 
+;;; Customizable variables
 ;;;
 
-(defvar cal-tex-which-days '(0 1 2 3 4 5 6)
+(defcustom cal-tex-which-days '(0 1 2 3 4 5 6)
   "*The days of the week that are displayed on the portrait monthly calendar.
 Sunday is 0, Monday is 1, and so on.  The default is to print from Sunday to
 Saturday.  For example, use
 
                     (setq cal-tex-which-days '(1 3 5))
 
-to only print Monday, Wednesday, Friday.")
+to only print Monday, Wednesday, Friday."
+  :type '(repeat integer)
+  :group 'calendar-tex)
 
-(defvar cal-tex-holidays t
+(defcustom cal-tex-holidays t
   "*If t (default), then the holidays are also printed.
-If finding the holidays is too slow, set this to nil.")
+If finding the holidays is too slow, set this to nil."
+  :type 'boolean
+  :group 'calendar-tex)
+
+(defcustom cal-tex-diary nil
+  "*If t, the diary entries are printed in the calendar."
+  :type 'boolean
+  :group 'calendar-tex)
 
-(defvar cal-tex-diary nil
-  "*If t, the diary entries are printed in the calendar.")
+(defcustom cal-tex-rules nil
+  "*If t, pages will be ruled in some styles."
+  :type 'boolean
+  :group 'calendar-tex)
 
-(defvar cal-tex-daily-string
+(defcustom cal-tex-daily-string
   '(let* ((year (extract-calendar-year date))
           (day  (calendar-day-number date))
           (days-remaining (- (calendar-day-number (list 12 31 year)) day)))
@@ -86,37 +97,76 @@ As an example of what you do, setting this to
        (require 'cal-hebrew)
        (calendar-hebrew-date-string date))
 
-will put the Hebrew date at the bottom of each day.")
-
-(defvar cal-tex-buffer "calendar.tex"
-  "*The name for the tex-ed calendar.")
-
-(defvar cal-tex-24 nil
-  "*If t, use a 24 hour clock in the daily calendar.")
-
-(defvar cal-tex-daily-start 8
-  "*The first hour of the daily calendar page.")
-
-(defvar cal-tex-daily-end 20
-  "*The last hour of the daily calendar page.")
+will put the Hebrew date at the bottom of each day."
+  :type 'sexp
+  :group 'calendar-tex)
+
+(defcustom cal-tex-buffer "calendar.tex"
+  "*The name for the tex-ed calendar."
+  :type 'string
+  :group 'calendar-tex)
+
+(defcustom cal-tex-24 nil
+  "*If t, use a 24 hour clock in the daily calendar."
+  :type 'boolean
+  :group 'calendar-tex)
+
+(defcustom cal-tex-daily-start 8
+  "*The first hour of the daily calendar page."
+  :type 'integer
+  :group 'calendar-tex)
+
+(defcustom cal-tex-daily-end 20
+  "*The last hour of the daily calendar page."
+  :type 'integer
+  :group 'calendar-tex)
+
+(defcustom cal-tex-hook nil
+  "*List of functions called after any LaTeX calendar buffer is generated.
+You can use this to do postprocessing on the buffer.  For example, to change
+characters with diacritical marks to their LaTeX equivalents, use
+     (add-hook 'cal-tex-hook
+               '(lambda () (iso-iso2tex (point-min) (point-max))))"
+  :type 'hook
+  :group 'calendar-tex)
+
+(defcustom cal-tex-year-hook nil
+  "*List of functions called after a LaTeX year calendar buffer is generated."
+  :type 'hook
+  :group 'calendar-tex)
+
+(defcustom cal-tex-month-hook nil
+  "*List of functions called after a LaTeX month calendar buffer is generated."
+  :type 'hook
+  :group 'calendar-tex)
+
+(defcustom cal-tex-week-hook nil
+  "*List of functions called after a LaTeX week calendar buffer is generated."
+  :type 'hook
+  :group 'calendar-tex)
+
+(defcustom cal-tex-daily-hook nil
+  "*List of functions called after a LaTeX daily calendar buffer is generated."
+  :type 'hook
+  :group 'calendar-tex)
 
 ;;;
 ;;; Definitions for LaTeX code
 ;;;
 
 (defvar  cal-tex-day-prefix "\\caldate{%s}{%s}"
-  "The initial LaTeX code for a day.  
+  "The initial LaTeX code for a day.
 The holidays, diary entries, bottom string, and the text follow.")
+
 (defvar cal-tex-day-name-format "\\myday{%s}%%"
   "The format for LaTeX code for a day name.  The names are taken from
-calendar-day-name-array.")
+`calendar-day-name-array'.")
 
 (defvar cal-tex-cal-one-month
 "\\def\\calmonth#1#2%
 {\\begin{center}%
 \\Huge\\bf\\uppercase{#1} #2 \\\\[1cm]%
-\\end{center}}% 
+\\end{center}}%
 \\vspace*{-1.5cm}%
 %
 "
@@ -126,7 +176,7 @@ calendar-day-name-array.")
 "\\def\\calmonth#1#2#3#4%
 {\\begin{center}%
 \\Huge\\bf #1 #2---#3 #4\\\\[1cm]%
-\\end{center}}% 
+\\end{center}}%
 \\vspace*{-1.5cm}%
 %
 "
@@ -162,43 +212,34 @@ This definition is the heart of the calendar!")
 
 (defun cal-tex-list-holidays (d1 d2)
   "Generate a list of all holidays from absolute date D1 to D2."
-  (let* ((result nil)
-         (start (calendar-gregorian-from-absolute d1))
-         (start-month (extract-calendar-month start))
-         (start-year (extract-calendar-year start)))
-    (increment-calendar-month start-month start-year 1)
-    (let* ((end (calendar-gregorian-from-absolute d2))
-           (end-month (extract-calendar-month end))
-           (end-year (extract-calendar-year end)))
-      (if (= (extract-calendar-day end) 1)
-          (increment-calendar-month end-month end-year -1))
-      (let* ((s (calendar-absolute-from-gregorian
-                 (list start-month 1 start-year)))
-             (e (calendar-absolute-from-gregorian
-                 (list end-month 1 end-year)))
-             (d s)
-             (never t)
-             (displayed-month start-month)
-             (displayed-year start-year))
-        (while (or never (<= d e))
-          (setq result (append result (calendar-holiday-list)))
-          (setq never nil)
-          (increment-calendar-month displayed-month displayed-year 3)
-          (setq d (calendar-absolute-from-gregorian
-                   (list displayed-month 1 displayed-year))))))
-    (let ((in-range)
-          (p result))
-      (while p
-        (and (car (car p))
-             (let ((a (calendar-absolute-from-gregorian (car (car p)))))
-               (and (<= d1 a) (<= a d2)))
-             (setq in-range (append (list (car p)) in-range)))
-        (setq p (cdr p)))
-      in-range)))
+  (let* ((start (calendar-gregorian-from-absolute d1))
+         (displayed-month (extract-calendar-month start))
+         (displayed-year (extract-calendar-year start))
+         (end (calendar-gregorian-from-absolute d2))
+         (end-month (extract-calendar-month end))
+         (end-year (extract-calendar-year end))
+         (number-of-intervals
+          (1+ (/ (calendar-interval displayed-month displayed-year
+                                    end-month end-year)
+                 3)))
+         (holidays nil)
+         (in-range))
+    (increment-calendar-month displayed-month displayed-year 1)
+    (calendar-for-loop i from 1 to number-of-intervals do
+      (setq holidays (append holidays (calendar-holiday-list)))
+      (increment-calendar-month displayed-month displayed-year 3))
+    (while holidays
+      (and (car (car holidays))
+           (let ((a (calendar-absolute-from-gregorian (car (car holidays)))))
+             (and (<= d1 a) (<= a d2)))
+           (setq in-range (append (list (car holidays)) in-range)))
+      (setq holidays (cdr holidays)))
+    in-range))
 
 (defun cal-tex-list-diary-entries (d1 d2)
   "Generate a list of all diary-entries from absolute date D1 to D2."
-  (let ((diary-display-hook nil))
+  (let ((diary-list-include-blanks nil)
+        (diary-display-hook 'ignore))
     (list-diary-entries
      (calendar-gregorian-from-absolute d1)
      (1+ (- d2 d1)))))
@@ -209,12 +250,14 @@ Preamble Includes initial definitions for various LaTeX commands.
 Optional ARGS are included."
   (set-buffer (get-buffer-create cal-tex-buffer))
   (erase-buffer)
-  (insert "\\documentstyle")
+  (insert "\\documentclass")
   (if args
       (insert "[" args "]"))
   (insert "{article}\n"
           "\\hbadness 20000
+\\hfuzz=1000pt
 \\vbadness 20000
+\\lineskip 0pt
 \\marginparwidth 0pt
 \\oddsidemargin  -2cm
 \\evensidemargin -2cm
@@ -241,14 +284,14 @@ Optional ARGS are included."
 (defun cal-tex-cursor-year (&optional arg)
   "Make a buffer with LaTeX commands for the year cursor is on.
 Optional prefix argument specifies number of years."
-  (interactive "P")
+  (interactive "p")
   (cal-tex-year (extract-calendar-year (calendar-cursor-to-date t))
                 (if arg arg 1)))
 
 (defun cal-tex-cursor-year-landscape (&optional arg)
   "Make a buffer with LaTeX commands for the year cursor is on.
 Optional prefix argument specifies number of years."
-  (interactive "P")
+  (interactive "p")
   (cal-tex-year (extract-calendar-year (calendar-cursor-to-date t))
                 (if arg arg 1)
                 t))
@@ -292,18 +335,20 @@ four months each."
 (defun cal-tex-cursor-filofax-year (&optional arg)
   "Make a Filofax one page yearly calendar of year indicated by cursor.
 Optional parameter specifies number of years."
-  (interactive "P")
+  (interactive "p")
   (let* ((n (if arg arg 1))
          (year (extract-calendar-year (calendar-cursor-to-date t))))
     (cal-tex-preamble "twoside")
     (cal-tex-cmd "\\textwidth 3.25in")
     (cal-tex-cmd "\\textheight 6.5in")
-    (cal-tex-cmd "\\oddsidemargin 1.6in")
-    (cal-tex-cmd "\\evensidemargin 1.55in")
+    (cal-tex-cmd "\\oddsidemargin 1.675in")
+    (cal-tex-cmd "\\evensidemargin 1.675in")
     (cal-tex-cmd "\\topmargin 0pt")
     (cal-tex-cmd "\\headheight -0.875in")
+    (cal-tex-cmd "\\fboxsep 0.5mm")
     (cal-tex-cmd "\\pagestyle{empty}")
     (cal-tex-b-document)
+    (cal-tex-cmd "\\vspace*{0.25in}")
     (calendar-for-loop j from 1 to n do
        (insert (format "\\hfil {\\Large \\bf %s} \\hfil\\\\\n" year))
        (cal-tex-b-center)
@@ -311,10 +356,13 @@ Optional parameter specifies number of years."
        (insert "\n")
        (cal-tex-noindent)
        (cal-tex-nl)
-       (calendar-for-loop i from 1 to 12 do
-          (insert (cal-tex-mini-calendar i year
-                                         (calendar-month-name i)
-                                         "1.05in" ".8in" "tiny")))
+       (let ((month-names; don't use default in case user changed it
+              ["January" "February" "March" "April" "May" "June"
+               "July" "August" "September" "October" "November" "December"]))
+         (calendar-for-loop i from 1 to 12 do
+            (insert (cal-tex-mini-calendar i year
+                                           (aref month-names (1- i))
+                                           "1in" ".9in" "tiny" "0.6mm"))))
        (insert
 "\\noindent\\fbox{\\January}\\fbox{\\February}\\fbox{\\March}\\\\
 \\noindent\\fbox{\\April}\\fbox{\\May}\\fbox{\\June}\\\\
@@ -324,9 +372,10 @@ Optional parameter specifies number of years."
        (cal-tex-e-parbox)
        (cal-tex-e-center)
        (setq year (1+ year))
-       (if (/= j n)
-           (cal-tex-newpage)
-         (cal-tex-end-document))
+       (if (= j n)
+           (cal-tex-end-document)
+         (cal-tex-newpage)
+         (cal-tex-cmd "\\vspace*{0.25in}"))
        (run-hooks 'cal-tex-year-hook))
     (run-hooks 'cal-tex-hook)))
 
@@ -338,7 +387,7 @@ Optional parameter specifies number of years."
   "Make a buffer with LaTeX commands for the month cursor is on.
 Optional prefix argument specifies number of months to be produced.
 The output is in landscape format, one month to a page."
-  (interactive "P")
+  (interactive "p")
   (let* ((n (if arg arg 1))
          (date (calendar-cursor-to-date t))
          (month (extract-calendar-month date))
@@ -399,7 +448,8 @@ The output is in landscape format, one month to a page."
                                       year)))
                                  7)))
              (insert "\\vspace*{-\\cellwidth}\\hspace*{-2\\cellwidth}"
-                     "\\lastmonth\\nextmonth"))
+                     "\\lastmonth\\nextmonth%
+"))
          (if (/= i n)
              (progn
                (run-hooks 'cal-tex-month-hook)
@@ -415,7 +465,7 @@ The output is in landscape format, one month to a page."
   "Make a buffer with LaTeX commands for the month cursor is on.
 Optional prefix argument specifies number of months to be produced.
 Calendar is condensed onto one page."
-  (interactive "P")
+  (interactive "p")
   (let* ((date (calendar-cursor-to-date t))
          (month (extract-calendar-month date))
          (year (extract-calendar-year date))
@@ -455,12 +505,21 @@ Calendar is condensed onto one page."
          (setq other-year year)
          (cal-tex-insert-days month year diary-list holidays
                               cal-tex-day-prefix)
+         (if (= (mod (calendar-absolute-from-gregorian
+                          (list month
+                                (calendar-last-day-of-month month year)
+                                year))
+                         7)
+                6); last day of month was Saturday
+           (progn
+             (cal-tex-hfill)
+             (cal-tex-nl)))
          (increment-calendar-month month year 1))
       (cal-tex-insert-blank-days-at-end end-month end-year cal-tex-day-prefix)
       (cal-tex-end-document)))
   (run-hooks 'cal-tex-hook))
 
-(defun cal-tex-insert-days (month year diary-list holidays day-format) 
+(defun cal-tex-insert-days (month year diary-list holidays day-format)
   "Insert LaTeX commands for a range of days in monthly calendars.
 LaTeX commands are inserted for the days of the MONTH in YEAR.
 Diary entries on DIARY-LIST are included. Holidays on HOLIDAYS are included.
@@ -475,8 +534,8 @@ Each day is formatted using format DAY-FORMAT."
     (calendar-for-loop i from 1 to last do
        (setq date (list month i year))
        (if (memq (calendar-day-of-week date) cal-tex-which-days)
-           (progn 
-             (insert (format day-format (calendar-month-name month) i))
+           (progn
+             (insert (format day-format (cal-tex-month-name month) i))
              (cal-tex-arg (cal-tex-latexify-list diary-list date))
              (cal-tex-arg (cal-tex-latexify-list holidays date))
              (cal-tex-arg (eval cal-tex-daily-string))
@@ -492,20 +551,21 @@ Each day is formatted using format DAY-FORMAT."
   "Insert the names of the days at top of a monthly calendar."
   (calendar-for-loop i from 0 to 6 do
      (if (memq i cal-tex-which-days)
-         (insert (format cal-tex-day-name-format 
-                         (aref calendar-day-name-array 
-                               (mod (+ calendar-week-start-day i) 7)))))
+         (insert (format cal-tex-day-name-format
+                         (cal-tex-LaTeXify-string
+                          (aref calendar-day-name-array
+                                (mod (+ calendar-week-start-day i) 7))))))
      (cal-tex-comment)))
 
 (defun cal-tex-insert-month-header (n month year end-month end-year)
   "Create a title for a calendar.
-A title is inserted for a calendar with N months starting with 
+A title is inserted for a calendar with N months starting with
 MONTH YEAR and ending with END-MONTH END-YEAR."
-  (let ( (month-name (calendar-month-name  month))
-         (end-month-name (calendar-month-name  end-month)))
+  (let ((month-name (cal-tex-month-name  month))
+         (end-month-name (cal-tex-month-name  end-month)))
     (if (= 1 n)
         (insert (format "\\calmonth{%s}{%s}\n\\vspace*{-0.5cm}"
-                month-name year) )       
+                month-name year) )
         (insert (format "\\calmonth{%s}{%s}{%s}{%s}\n\\vspace*{-0.5cm}"
                 month-name year end-month-name end-year))))
   (cal-tex-comment))
@@ -521,7 +581,7 @@ blank, no days are inserted."
                (- (calendar-day-of-week (list month 1 year))
                   calendar-week-start-day)
                7)))
-        (calendar-for-loop i from 0 to (1- blank-days) do 
+        (calendar-for-loop i from 0 to (1- blank-days) do
             (if (memq i cal-tex-which-days)
                 (insert (format day-format " " " ") "{}{}{}{}%\n"))))))
 
@@ -536,7 +596,7 @@ The entry is formatted using DAY-FORMAT."
                (- (calendar-day-of-week (list month last-day year))
                   calendar-week-start-day)
                7)))
-        (calendar-for-loop i from (1+ blank-days) to 6 do 
+        (calendar-for-loop i from (1+ blank-days) to 6 do
            (if (memq i cal-tex-which-days)
                (insert (format day-format "" "") "{}{}{}{}%\n"))))))
 
@@ -573,8 +633,8 @@ in the calendar starting in MONTH YEAR."
 
 (defun cal-tex-number-weeks (month year n)
   "Determine the number of weeks in a range of dates.
-Compute the number of  weeks in the calendar starting with MONTH and YEAR, 
-and lasting N months, including only the days in WHICH-DAYS. As it stands, 
+Compute the number of  weeks in the calendar starting with MONTH and YEAR,
+and lasting N months, including only the days in WHICH-DAYS. As it stands,
 this is only an upper bound."
   (let ((d (list month 1 year)))
     (increment-calendar-month month year (1- n))
@@ -591,12 +651,17 @@ this is only an upper bound."
 ;;; Weekly calendars
 ;;;
 
+(defvar cal-tex-LaTeX-hourbox
+  "\\newcommand{\\hourbox}[2]%
+{\\makebox[2em]{\\rule{0cm}{#2ex}#1}\\rule{3in}{.15mm}}\n"
+  "One hour and a line on the right.")
+
 (defun cal-tex-cursor-week (&optional arg)
   "Make a buffer with LaTeX commands for a two-page one-week calendar.
 It applies to the week that point is in.
 Optional prefix argument specifies number of weeks.
 Holidays are included if `cal-tex-holidays' is t."
-  (interactive "P")
+  (interactive "p")
   (let* ((n (if arg arg 1))
          (date (calendar-gregorian-from-absolute
                 (calendar-dayname-on-or-before
@@ -622,14 +687,14 @@ Holidays are included if `cal-tex-holidays' is t."
        (cal-tex-vspace "-1.5in")
        (cal-tex-b-center)
        (cal-tex-Huge-bf (format "\\uppercase{%s}"
-                                (calendar-month-name month)))
+                                (cal-tex-month-name month)))
        (cal-tex-hspace "2em")
        (cal-tex-Huge-bf (number-to-string year))
        (cal-tex-nl ".5cm")
        (cal-tex-e-center)
        (cal-tex-hspace "-.2in")
        (cal-tex-b-parbox "l" "7in")
-       (calendar-for-loop j from 1 to 7 do 
+       (calendar-for-loop j from 1 to 7 do
           (cal-tex-week-hours date holidays "3.1")
           (setq date (cal-tex-incr-date date)))
        (cal-tex-e-parbox)
@@ -647,7 +712,7 @@ Holidays are included if `cal-tex-holidays' is t."
 It applies to the week that point is in.
 Optional prefix argument specifies number of weeks.
 Holidays are included if `cal-tex-holidays' is t."
-  (interactive "P")
+  (interactive "p")
   (let* ((n (if arg arg 1))
          (date (calendar-gregorian-from-absolute
                 (calendar-dayname-on-or-before
@@ -674,14 +739,14 @@ Holidays are included if `cal-tex-holidays' is t."
        (cal-tex-vspace "-1.5in")
        (cal-tex-b-center)
        (cal-tex-Huge-bf (format "\\uppercase{%s}"
-                                (calendar-month-name month)))
+                                (cal-tex-month-name month)))
        (cal-tex-hspace "2em")
        (cal-tex-Huge-bf (number-to-string year))
        (cal-tex-nl ".5cm")
        (cal-tex-e-center)
        (cal-tex-hspace "-.2in")
        (cal-tex-b-parbox "l" "\\textwidth")
-       (calendar-for-loop j from 1 to 3 do 
+       (calendar-for-loop j from 1 to 3 do
           (cal-tex-week-hours date holidays "5")
           (setq date (cal-tex-incr-date date)))
        (cal-tex-e-parbox)
@@ -709,7 +774,7 @@ Holidays are included if `cal-tex-holidays' is t."
        (insert "}")
        (cal-tex-nl)
        (cal-tex-b-parbox "l" "\\textwidth")
-       (calendar-for-loop j from 4 to 7 do 
+       (calendar-for-loop j from 4 to 7 do
                           (cal-tex-week-hours date holidays "5")
                           (setq date (cal-tex-incr-date date)))
        (cal-tex-e-parbox)
@@ -727,7 +792,7 @@ Holidays are included if `cal-tex-holidays' is t."
 Optional prefix argument specifies number of weeks.
 Diary entries are included if `cal-tex-diary' is t.
 Holidays are included if `cal-tex-holidays' is t."
-  (interactive "P")
+  (interactive "p")
   (let* ((n (if arg arg 1))
          (date (calendar-gregorian-from-absolute
                 (calendar-dayname-on-or-before
@@ -767,15 +832,15 @@ Holidays are included if `cal-tex-holidays' is t."
        (cal-tex-nl ".5cm")
        (cal-tex-e-center)
        (cal-tex-b-parbox "l" "\\textwidth")
-       (calendar-for-loop j from 1 to 7 do 
+       (calendar-for-loop j from 1 to 7 do
           (cal-tex-b-parbox "t" "\\textwidth")
           (cal-tex-b-parbox "t" "\\textwidth")
           (cal-tex-rule "0pt" "\\textwidth" ".2mm")
           (cal-tex-nl)
           (cal-tex-b-parbox "t" "\\textwidth")
-          (cal-tex-large-bf (calendar-day-name date))
+          (cal-tex-large-bf (cal-tex-LaTeXify-string (calendar-day-name date)))
           (insert ", ")
-          (cal-tex-large-bf (calendar-month-name month))
+          (cal-tex-large-bf (cal-tex-month-name month))
           (insert " ")
           (cal-tex-large-bf (number-to-string day))
           (if (not (string= "" (cal-tex-latexify-list holidays date)))
@@ -804,7 +869,7 @@ Holidays are included if `cal-tex-holidays' is t."
           (cal-tex-nl)
           (setq month (extract-calendar-month date))
           (setq year (extract-calendar-year date)))
-       (cal-tex-e-parbox)
+       (cal-tex-e-parbox)
        (if (/= i n)
            (progn
              (run-hooks 'cal-tex-week-hook)
@@ -812,13 +877,8 @@ Holidays are included if `cal-tex-holidays' is t."
     (cal-tex-end-document)
     (run-hooks 'cal-tex-hook)))
 
-(defvar cal-tex-LaTeX-hourbox 
-  "\\newcommand{\\hourbox}[2]%
-{\\makebox[2em]{\\rule{0cm}{#2ex}#1}\\rule{3in}{.15mm}}\n"
-  "One hour and a line on the right.")
-
 (defun cal-tex-week-hours (date holidays height)
-  "Insert hourly entries for DATE with HOLIDAYS, with line height HEIGHT." 
+  "Insert hourly entries for DATE with HOLIDAYS, with line height HEIGHT."
   (let ((month (extract-calendar-month date))
         (day   (extract-calendar-day date))
         (year  (extract-calendar-year date))
@@ -827,9 +887,9 @@ Holidays are included if `cal-tex-holidays' is t."
   (cal-tex-cmd  "\\ \\\\[-.2cm]")
   (cal-tex-cmd "\\noindent")
   (cal-tex-b-parbox "l" "6.8in")
-  (cal-tex-large-bf (calendar-day-name date))
+  (cal-tex-large-bf (cal-tex-LaTeXify-string (calendar-day-name date)))
   (insert ", ")
-  (cal-tex-large-bf (calendar-month-name month))
+  (cal-tex-large-bf (cal-tex-month-name month))
   (insert " ")
   (cal-tex-large-bf (number-to-string day))
   (if (not (string= "" (cal-tex-latexify-list holidays date)))
@@ -858,7 +918,7 @@ Holidays are included if `cal-tex-holidays' is t."
 It applies to the week that point is in, and starts on Monday.
 Optional prefix argument specifies number of weeks.
 Holidays are included if `cal-tex-holidays' is t."
-  (interactive "P")
+  (interactive "p")
   (let* ((n (if arg arg 1))
          (date (calendar-gregorian-from-absolute
                 (calendar-dayname-on-or-before
@@ -896,12 +956,12 @@ Holidays are included if `cal-tex-holidays' is t."
        (day (extract-calendar-day date))
        (month (extract-calendar-month date))
        (year (extract-calendar-year date))
-       (dayname (calendar-day-name date))
+       (dayname (cal-tex-LaTeXify-string (calendar-day-name date)))
        (date1 (cal-tex-incr-date date))
        (day1 (extract-calendar-day date1))
        (month1 (extract-calendar-month date1))
        (year1 (extract-calendar-year date1))
-       (dayname1 (calendar-day-name date1))
+       (dayname1 (cal-tex-LaTeXify-string (calendar-day-name date1)))
        )
     (cal-tex-b-framebox "8cm" "l")
     (cal-tex-b-parbox "b" "7.5cm")
@@ -913,13 +973,14 @@ Holidays are included if `cal-tex-holidays' is t."
          (calendar-for-loop i from 8 to 12 do
             (insert (format "{\\large\\sf %d}\\\\\n" i)))
          (calendar-for-loop i from 1 to 5 do
-            (insert (format "{\\large\\sf %d}\\\\\n" i)))))
+            (insert (format "{\\large\\sf %d}\\\\\n"
+                            (if cal-tex-24 (+ i 12) i))))))
     (cal-tex-nl ".5cm")
     (if weekend
        (progn
          (cal-tex-vspace "1cm")
          (insert "\\ \\vfill")
-         (insert (format "{\\Large\\bf %s,} %s/%s/%s\\\\\n" 
+         (insert (format "{\\Large\\bf %s,} %s/%s/%s\\\\\n"
                          dayname1 month1 day1 year1))
          (cal-tex-rule "0pt" "7.5cm" ".5mm")
          (cal-tex-nl "1.5cm")
@@ -933,7 +994,7 @@ Holidays are included if `cal-tex-holidays' is t."
 Optional prefix argument specifies number of weeks.
 Diary entries are included if `cal-tex-diary' is t.
 Holidays are included if `cal-tex-holidays' is t."
-  (interactive "P")
+  (interactive "p")
   (let* ((n (if arg arg 1))
          (date (calendar-gregorian-from-absolute
                 (calendar-dayname-on-or-before
@@ -993,29 +1054,29 @@ Holidays are included if `cal-tex-holidays' is t."
           (if (= (extract-calendar-month date)
                  (extract-calendar-month d))
               (format "%s %s"
-                      (calendar-month-name
+                      (cal-tex-month-name
                        (extract-calendar-month date))
                       (extract-calendar-year date))
             (if (=  (extract-calendar-year date)
                     (extract-calendar-year d))
                 (format "%s---%s %s"
-                        (calendar-month-name
+                        (cal-tex-month-name
                          (extract-calendar-month date))
-                        (calendar-month-name
+                        (cal-tex-month-name
                          (extract-calendar-month d))
                         (extract-calendar-year date))
               (format "%s %s---%s %s"
-                      (calendar-month-name
+                      (cal-tex-month-name
                        (extract-calendar-month date))
                       (extract-calendar-year date)
-                      (calendar-month-name (extract-calendar-month d))
+                      (cal-tex-month-name (extract-calendar-month d))
                       (extract-calendar-year d))))))
        (insert "%\n")
-       (calendar-for-loop j from 1 to 7 do 
+       (calendar-for-loop j from 1 to 7 do
           (if (= (mod i 2) 1)
               (insert "\\rightday")
             (insert "\\leftday"))
-          (cal-tex-arg (calendar-day-name date))
+          (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
           (cal-tex-arg (int-to-string (extract-calendar-day date)))
           (cal-tex-arg (cal-tex-latexify-list diary-list date))
           (cal-tex-arg (cal-tex-latexify-list holidays date))
@@ -1032,10 +1093,10 @@ Holidays are included if `cal-tex-holidays' is t."
 (defun cal-tex-cursor-filofax-week (&optional arg)
   "One-week-at-a-glance Filofax style calendar for week indicated by cursor.
 Optional prefix argument specifies number of weeks.
-Weeks start on Monday. 
+Weeks start on Monday.
 Diary entries are included if `cal-tex-diary' is t.
 Holidays are included if `cal-tex-holidays' is t."
-  (interactive "P")
+  (interactive "p")
   (let* ((n (if arg arg 1))
          (date (calendar-gregorian-from-absolute
                 (calendar-dayname-on-or-before
@@ -1102,27 +1163,27 @@ Holidays are included if `cal-tex-holidays' is t."
           (if (= (extract-calendar-month date)
                  (extract-calendar-month d))
               (format "%s %s"
-                      (calendar-month-name
+                      (cal-tex-month-name
                        (extract-calendar-month date))
                       (extract-calendar-year date))
             (if (=  (extract-calendar-year date)
                     (extract-calendar-year d))
                 (format "%s---%s %s"
-                        (calendar-month-name
+                        (cal-tex-month-name
                          (extract-calendar-month date))
-                        (calendar-month-name
+                        (cal-tex-month-name
                          (extract-calendar-month d))
                         (extract-calendar-year date))
               (format "%s %s---%s %s"
-                      (calendar-month-name
+                      (cal-tex-month-name
                        (extract-calendar-month date))
                       (extract-calendar-year date)
-                      (calendar-month-name (extract-calendar-month d))
+                      (cal-tex-month-name (extract-calendar-month d))
                       (extract-calendar-year d))))))
        (insert "%\n")
-       (calendar-for-loop j from 1 to 3 do 
+       (calendar-for-loop j from 1 to 3 do
           (insert "\\leftday")
-          (cal-tex-arg (calendar-day-name date))
+          (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
           (cal-tex-arg (int-to-string (extract-calendar-day date)))
           (cal-tex-arg (cal-tex-latexify-list diary-list date))
           (cal-tex-arg (cal-tex-latexify-list holidays date))
@@ -1137,36 +1198,36 @@ Holidays are included if `cal-tex-holidays' is t."
           (if (= (extract-calendar-month date)
                  (extract-calendar-month d))
               (format "%s %s"
-                      (calendar-month-name
+                      (cal-tex-month-name
                        (extract-calendar-month date))
                       (extract-calendar-year date))
             (if (=  (extract-calendar-year date)
                     (extract-calendar-year d))
                 (format "%s---%s %s"
-                        (calendar-month-name
+                        (cal-tex-month-name
                          (extract-calendar-month date))
-                        (calendar-month-name
+                        (cal-tex-month-name
                          (extract-calendar-month d))
                         (extract-calendar-year date))
               (format "%s %s---%s %s"
-                      (calendar-month-name
+                      (cal-tex-month-name
                        (extract-calendar-month date))
                       (extract-calendar-year date)
-                      (calendar-month-name (extract-calendar-month d))
+                      (cal-tex-month-name (extract-calendar-month d))
                       (extract-calendar-year d))))))
        (insert "%\n")
-       (calendar-for-loop j from 1 to 2 do 
+       (calendar-for-loop j from 1 to 2 do
           (insert "\\rightday")
-          (cal-tex-arg (calendar-day-name date))
+          (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
           (cal-tex-arg (int-to-string (extract-calendar-day date)))
           (cal-tex-arg (cal-tex-latexify-list diary-list date))
           (cal-tex-arg (cal-tex-latexify-list holidays date))
           (cal-tex-arg (eval cal-tex-daily-string))
           (insert "%\n")
           (setq date (cal-tex-incr-date date)))
-       (calendar-for-loop j from 1 to 2 do 
+       (calendar-for-loop j from 1 to 2 do
           (insert "\\weekend")
-          (cal-tex-arg (calendar-day-name date))
+          (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
           (cal-tex-arg (int-to-string (extract-calendar-day date)))
           (cal-tex-arg (cal-tex-latexify-list diary-list date))
           (cal-tex-arg (cal-tex-latexify-list holidays date))
@@ -1179,6 +1240,115 @@ Holidays are included if `cal-tex-holidays' is t."
              (cal-tex-newpage))))
     (cal-tex-end-document)
     (run-hooks 'cal-tex-hook)))
+
+(defun cal-tex-cursor-filofax-daily (&optional arg)
+  "Day-per-page Filofax style calendar for week indicated by cursor.
+Optional prefix argument specifies number of weeks.  Weeks start on Monday.
+Diary entries are included if `cal-tex-diary' is t.
+Holidays are included if `cal-tex-holidays' is t.
+Pages are ruled if `cal-tex-rules' is t."
+  (interactive "p")
+  (let* ((n (if arg arg 1))
+         (date (calendar-gregorian-from-absolute
+                (calendar-dayname-on-or-before
+                 1
+                 (calendar-absolute-from-gregorian
+                  (calendar-cursor-to-date t)))))
+         (month (extract-calendar-month date))
+         (year (extract-calendar-year date))
+         (day (extract-calendar-day date))
+         (holidays (if cal-tex-holidays
+                       (cal-tex-list-holidays
+                        (calendar-absolute-from-gregorian date)
+                        (+ (* 7 n)
+                           (calendar-absolute-from-gregorian date)))))
+         (diary-list (if cal-tex-diary
+                         (cal-tex-list-diary-entries
+                          (calendar-absolute-from-gregorian
+                           (list month 1 year))
+                         (+ (* 7 n)
+                            (calendar-absolute-from-gregorian date))))))
+    (cal-tex-preamble "twoside")
+    (cal-tex-cmd "\\textwidth 3.25in")
+    (cal-tex-cmd "\\textheight 6.5in")
+    (cal-tex-cmd "\\oddsidemargin 1.75in")
+    (cal-tex-cmd "\\evensidemargin 1.5in")
+    (cal-tex-cmd "\\topmargin 0pt")
+    (cal-tex-cmd "\\headheight -0.875in")
+    (cal-tex-cmd "\\headsep 0.125in")
+    (cal-tex-cmd "\\footskip .125in")
+    (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]}
+\\long\\def\\rightday#1#2#3{%
+   \\rule{\\textwidth}{0.3pt}\\\\%
+   \\hbox to \\textwidth{%
+     \\vbox {%
+          \\vspace*{2pt}%
+          \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
+          \\hbox to \\textwidth{\\vbox {\\raggedleft \\em #2}}%
+          \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}
+\\long\\def\\weekend#1#2#3{%
+   \\rule{\\textwidth}{0.3pt}\\\\%
+   \\hbox to \\textwidth{%
+     \\vbox {%
+          \\vspace*{2pt}%
+          \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
+          \\hbox to \\textwidth{\\vbox {\\noindent \\em #2}}%
+          \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}
+\\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]}
+\\long\\def\\leftday#1#2#3{%
+   \\rule{\\textwidth}{0.3pt}\\\\%
+   \\hbox to \\textwidth{%
+     \\vbox {%
+          \\vspace*{2pt}%
+          \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
+          \\hbox to \\textwidth{\\vbox {\\noindent \\em #2}}%
+          \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}
+\\newbox\\LineBox
+\\setbox\\LineBox=\\hbox to\\textwidth{%
+\\vrule height.2in width0pt\\leaders\\hrule\\hfill}
+\\def\\linesfill{\\par\\leaders\\copy\\LineBox\\vfill}
+")
+    (cal-tex-b-document)
+    (cal-tex-cmd "\\pagestyle{empty}")
+    (calendar-for-loop i from 1 to n do
+       (calendar-for-loop j from 1 to 5 do
+         (let ((odd (/= 0 (% j 2))))
+           (insert (if odd "\\righthead" "\\lefthead"))
+           (cal-tex-arg (calendar-date-string date))
+           (insert "%\n")
+           (insert (if odd "\\rightday"  "\\leftday")))
+         (cal-tex-arg (cal-tex-latexify-list diary-list date))
+         (cal-tex-arg (cal-tex-latexify-list holidays date "\\\\" t))
+         (cal-tex-arg (eval cal-tex-daily-string))
+         (insert "%\n")
+         (if cal-tex-rules
+             (insert "\\linesfill\n")
+           (insert "\\vfill\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n"))
+         (cal-tex-newpage)
+         (setq date (cal-tex-incr-date date)))
+       (insert "%\n")
+       (calendar-for-loop j from 1 to 2 do
+         (insert "\\lefthead")
+          (cal-tex-arg (calendar-date-string date))
+          (insert "\\weekend")
+          (cal-tex-arg (cal-tex-latexify-list diary-list date))
+          (cal-tex-arg (cal-tex-latexify-list holidays date "\\\\" t))
+          (cal-tex-arg (eval cal-tex-daily-string))
+          (insert "%\n")
+          (if cal-tex-rules
+              (insert "\\linesfill\n")
+            (insert "\\vfill"))
+          (setq date (cal-tex-incr-date date)))
+       (if (not cal-tex-rules)
+          (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n"))
+       (if (/= i n)
+           (progn
+             (run-hooks 'cal-tex-week-hook)
+             (cal-tex-newpage))))
+    (cal-tex-end-document)
+    (run-hooks 'cal-tex-hook)))
+
+
 ;;;
 ;;;  Daily calendars
 ;;;
@@ -1186,7 +1356,7 @@ Holidays are included if `cal-tex-holidays' is t."
 (defun cal-tex-cursor-day (&optional arg)
   "Make a buffer with LaTeX commands for the day cursor is on.
 Optional prefix argument specifies number of days."
-  (interactive "P")
+  (interactive "p")
   (let ((n (if arg arg 1))
         (date (calendar-absolute-from-gregorian (calendar-cursor-to-date t))))
     (cal-tex-preamble "12pt")
@@ -1208,7 +1378,7 @@ Optional prefix argument specifies number of days."
 (defun cal-tex-daily-page (date)
   "Make a calendar page for Gregorian DATE on 8.5 by 11 paper."
   (let* ((hour)
-         (month-name (calendar-month-name (extract-calendar-month date))))
+         (month-name (cal-tex-month-name (extract-calendar-month date))))
     (cal-tex-banner "cal-tex-daily-page")
     (cal-tex-b-makebox "4cm" "l")
     (cal-tex-b-parbox "b" "3.8cm")
@@ -1223,7 +1393,7 @@ Optional prefix argument specifies number of days."
     (cal-tex-e-makebox)
     (cal-tex-hfill)
     (cal-tex-b-makebox "4cm" "r")
-    (cal-tex-bf (calendar-day-name date))
+    (cal-tex-bf (cal-tex-LaTeXify-string (calendar-day-name date)))
     (cal-tex-e-makebox)
     (cal-tex-nl)
     (cal-tex-hspace ".4cm")
@@ -1268,41 +1438,47 @@ Optional prefix argument specifies number of days."
     (cal-tex-hfill)
     (insert "}")
     (cal-tex-banner "end of cal-tex-daily-page")))
-    
+
 ;;;
 ;;;  Mini calendars
 ;;;
 
-(defun cal-tex-mini-calendar (month year name width height &optional size)
+(defun cal-tex-mini-calendar (month year name width height &optional ptsize colsep)
   "Produce mini-calendar for MONTH, YEAR in macro NAME with WIDTH and HEIGHT.
-Optional SIZE gives the point size; scriptsize is the default,"
+Optional PTSIZE gives the point ptsize; scriptsize is the default.  Optional
+COLSEP gives the column separation; 1mm is the default."
   (let* ((blank-days;; at start of month
           (mod
            (- (calendar-day-of-week (list month 1 year))
               calendar-week-start-day)
            7))
-        (last (calendar-last-day-of-month month year))
+          (last (calendar-last-day-of-month month year))
+         (colsep (if colsep colsep "1mm"))
          (str (concat "\\def\\" name "{\\hbox to" width "{%\n"
                       "\\vbox to" height "{%\n"
                       "\\vfil  \\hbox to" width "{%\n"
                       "\\hfil\\"
-                      (if size size "scriptsize")
+                      (if ptsize ptsize "scriptsize")
                       "\\begin{tabular}"
-                      "{@{\\hspace{1mm}}r@{\\hspace{1mm}}r@{\\hspace{1mm}}r@{\\hspace{1mm}}"
-                      "r@{\\hspace{1mm}}r@{\\hspace{1mm}}r@{\\hspace{1mm}}r@{\\hspace{1mm}}}%\n"
+                      "{@{\\hspace{0mm}}r@{\\hspace{" colsep
+                      "}}r@{\\hspace{" colsep "}}r@{\\hspace{" colsep
+                      "}}r@{\\hspace{" colsep "}}r@{\\hspace{" colsep
+                      "}}r@{\\hspace{" colsep "}}r@{\\hspace{0mm}}}%\n"
                       "\\multicolumn{7}{c}{"
-                      (calendar-month-name month)
+                      (cal-tex-month-name month)
                       " "
                       (int-to-string year)
-                      "}\\\\[0.5mm]\n")))
+                      "}\\\\[1mm]\n")))
     (calendar-for-loop i from 0 to 6 do
-      (setq str (concat str
-                        (substring (aref calendar-day-name-array 
-                                         (mod (+ calendar-week-start-day i) 7))
-                                   0 2)
-                        (if (/= i 6)
-                            " & "
-                          "\\\\[0.5mm]\n"))))
+      (setq str
+            (concat str
+                    (cal-tex-LaTeXify-string
+                     (substring (aref calendar-day-name-array
+                                      (mod (+ calendar-week-start-day i) 7))
+                                0 2))
+                    (if (/= i 6)
+                        " & "
+                      "\\\\[0.7mm]\n"))))
     (calendar-for-loop i from 1 to blank-days do
       (setq str (concat str " & ")))
     (calendar-for-loop i from 1 to last do
@@ -1323,19 +1499,26 @@ If optional N is given, the date of N days after DATE."
   (calendar-gregorian-from-absolute
    (+ (if n n 1) (calendar-absolute-from-gregorian date))))
 
-(defun cal-tex-latexify-list (date-list date &optional separator)
-  "Return string with concatenated, LaTeXified entries in DATE_LIST for DATE.
-Use double backslash as a separator unless optional SEPARATOR is given."
-  (mapconcat '(lambda (x) (cal-tex-LaTeXify-string  x))
-             (let ((result)
-                   (p date-list))
-               (while p
-                 (and (car (car p))
-                      (calendar-date-equal date (car (car p)))
-                      (setq result (append (cdr (car p)) result)))
-                 (setq p (cdr p)))
-               result)
-             (if separator separator "\\\\")))
+(defun cal-tex-latexify-list (date-list date &optional separator final-separator)
+  "Return string with concatenated, LaTeXified entries in DATE-LIST for DATE.
+Use double backslash as a separator unless optional SEPARATOR is given.
+If resulting string is not empty, put separator at end if optional
+FINAL-SEPARATOR is t."
+  (let* ((sep (if separator separator "\\\\"))
+         (result
+          (mapconcat '(lambda (x) (cal-tex-LaTeXify-string  x))
+                     (let ((result)
+                           (p date-list))
+                       (while p
+                         (and (car (car p))
+                              (calendar-date-equal date (car (car p)))
+                              (setq result (cons (car (cdr (car p))) result)))
+                         (setq p (cdr p)))
+                       (reverse result))
+                     sep)))
+    (if (and final-separator (not (string-equal result "")))
+          (concat result sep)
+        result)))
 
 (defun cal-tex-previous-month (date)
   "Return the date of the first day in the month previous to DATE."
@@ -1357,12 +1540,12 @@ Use double backslash as a separator unless optional SEPARATOR is given."
 
 (defun cal-tex-end-document ()
   "Finish the LaTeX document.
-Insert the trailer to LaTeX document, pop to LaTeX buffer, add 
+Insert the trailer to LaTeX document, pop to LaTeX buffer, add
 informative header, and run HOOK."
   (cal-tex-e-document)
   (latex-mode)
   (pop-to-buffer cal-tex-buffer)
-  (goto-char (point-min))    
+  (goto-char (point-min))
   (cal-tex-comment "       This buffer was produced by cal-tex.el.")
   (cal-tex-comment "       To print a calendar, type")
   (cal-tex-comment "          M-x tex-buffer RET")
@@ -1371,8 +1554,8 @@ informative header, and run HOOK."
 
 (defun cal-tex-insert-preamble (weeks landscape size &optional append)
   "Initialize the output buffer.
-Select the output buffer, and insert the preamble for a calendar of 
-WEEKS weeks.  Insert code for landscape mode if LANDSCAPE is true. 
+Select the output buffer, and insert the preamble for a calendar of
+WEEKS weeks.  Insert code for landscape mode if LANDSCAPE is true.
 Use pointsize SIZE.  Optional argument APPEND, if t, means add to end of
 without erasing current contents."
   (let ((width "18cm")
@@ -1384,7 +1567,7 @@ without erasing current contents."
     (if (not append)
         (progn
           (cal-tex-preamble size)
-          (if (not landscape) 
+          (if (not landscape)
             (progn
               (cal-tex-cmd "\\oddsidemargin -1.75cm")
               (cal-tex-cmd "\\def\\holidaymult{.06}"))
@@ -1402,16 +1585,16 @@ without erasing current contents."
                     (/ 1.1 (length cal-tex-which-days))))
     (cal-tex-cmd "\\setlength{\\cellheight}" height)
     (insert (format "\\setlength{\\cellheight}{%f\\cellheight}\n"
-                    (/ 1.0 weeks)))              
+                    (/ 1.0 weeks)))
     (cal-tex-cmd "\\ \\par")
     (cal-tex-vspace "-3cm")))
 
 (defvar cal-tex-LaTeX-subst-list
   '(("\"". "``")
     ("\"". "''");; Quote changes meaning when list is reversed.
-    ("@" . "\\verb|@|") 
-    ("&" . "\\&") 
-    ("%" . "\\%") 
+    ("@" . "\\verb|@|")
+    ("&" . "\\&")
+    ("%" . "\\%")
     ("$" . "\\$")
     ("#" . "\\#")
     ("_" . "\\_")
@@ -1438,6 +1621,10 @@ without erasing current contents."
           (setq head (concat head (if pair (cdr pair) ch)))))
       head)))
 
+(defun cal-tex-month-name (month)
+  "The name of MONTH, LaTeXified."
+  (cal-tex-LaTeXify-string (calendar-month-name month)))
+
 (defun cal-tex-hfill () "Insert hfill." (insert "\\hfill"))
 
 (defun cal-tex-newpage () "Insert newpage." (insert "\\newpage%\n"))
@@ -1473,11 +1660,11 @@ without erasing current contents."
 (defun cal-tex-nl (&optional skip comment)
   "End a line with \\.  If SKIP, then add that much spacing.
    Add COMMENT if present"
-  (insert "\\\\")       
-  (if skip 
+  (insert "\\\\")
+  (if skip
       (insert "[" skip "]"))
   (cal-tex-comment comment))
-    
+
 (defun cal-tex-arg (&optional text)
   "Insert optional TEXT surrounded by braces."
   (insert "{")
@@ -1596,4 +1783,5 @@ without erasing current contents."
 
 (provide 'cal-tex)
 
+;;; arch-tag: ca8168a4-5a00-4508-a565-17e3bccce6d0
 ;;; cal-tex.el ends here