]> code.delx.au - gnu-emacs/blobdiff - lisp/calendar/cal-tex.el
* lisp/calendar/icalendar.el: Add missing :version tags for new defcustoms.
[gnu-emacs] / lisp / calendar / cal-tex.el
index 5891693282fe001cca83c62dc76d8172059a0eed..e26734a5c580890f451d3c532f7fde62bcdfa29d 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX
 
-;; Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2014 Free Software Foundation, Inc.
 
 ;; Author: Steve Fisk <fisk@bowdoin.edu>
 ;;         Edward M. Reingold <reingold@cs.uiuc.edu>
@@ -37,6 +37,7 @@
 ;; cal-tex-cursor-month
 ;; cal-tex-cursor-week
 ;; cal-tex-cursor-week2
+;; cal-tex-cursor-week2-summary
 ;; cal-tex-cursor-week-iso
 ;; cal-tex-cursor-week-monday
 ;; cal-tex-cursor-filofax-2week
@@ -82,8 +83,6 @@ Setting this to nil may speed up calendar generation."
 
 (defcustom cal-tex-diary nil
   "Non-nil means diary entries are printed in LaTeX calendars that support it.
-At present, this only affects the monthly, filofax, and iso-week
-calendars (i.e. not the yearly, plain weekly, or daily calendars).
 Setting this to nil may speed up calendar generation."
   :type 'boolean
   :group 'calendar-tex)
@@ -371,27 +370,21 @@ landscape mode with three rows of four months each."
 \\footskip 0.125in
 ")))
 
-(defun cal-tex-leftday (height)
-  "Insert LaTeX code for leftday function."
-  (insert "\\long\\def\\leftday#1#2#3#4#5{%
+(defun cal-tex-longday (funcname height)
+  "Insert LaTeX code for a long day function."
+  (insert "\\long\\def\\" funcname "#1#2#3#4#5{%
    \\rule{\\textwidth}{0.3pt}\\\\%
    \\hbox to \\textwidth{%
      \\vbox to " height "{%
-          \\vspace*{2pt}%
-          \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}%
-          \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}%
-          \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}\n"))
-
-(defun cal-tex-rightday (height &optional funcname)
-  "Insert LaTeX code for rightday function."
-  (insert "\\long\\def\\" (or funcname "rightday") "#1#2#3#4#5{%
-   \\rule{\\textwidth}{0.3pt}\\\\%
-   \\hbox to \\textwidth{%
-     \\vbox to " height "{%
-          \\vspace*{2pt}%
-          \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%
-          \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}%
-          \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}\n"))
+       \\vspace*{2pt}%
+       \\hbox to \\textwidth{"
+     (if (string-equal funcname "leftday")
+         "\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}%\n"
+       "\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%\n")
+     "       \\hbox to \\textwidth{\\vbox {\\"
+     (if (string-equal funcname "leftday") "noindent" "raggedleft")
+     " \\footnotesize \\em #4}}%
+       \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}\n"))
 
 (defun cal-tex-shortday (funcname)
   "Insert LaTeX code for a short day function."
@@ -723,11 +716,15 @@ this is only an upper bound."
 ;; TODO respect cal-tex-daily-start,end (see cal-tex-week-hours).
 ;;;###cal-autoload
 (defun cal-tex-cursor-week (&optional n event)
-  "Make a LaTeX calendar buffer for a two-page one-week calendar.
-It applies to the week that point is in.  The optional prefix
-argument N specifies number of weeks (default 1).  The calendar
-shows holidays if `cal-tex-holidays' is non-nil (note that diary
-entries are not shown).  The calendar shows the hours 8-12am, 1-5pm."
+  "Make a one page LaTeX calendar for one week, showing hours of the day.
+There are two columns; with 8-12am in the first and 1-5pm in the second.
+It shows holidays if `cal-tex-holidays' is non-nil.
+It does not show diary entries.
+
+The optional prefix argument N specifies a number of weeks (default 1).
+
+By default, the calendar is for the week at point; the optional
+argument EVENT specifies a different buffer position."
   (interactive (list (prefix-numeric-value current-prefix-arg)
                      last-nonmenu-event))
   (or n (setq n 1))
@@ -774,12 +771,15 @@ entries are not shown).  The calendar shows the hours 8-12am, 1-5pm."
 ;; TODO respect cal-tex-daily-start,end (see cal-tex-week-hours).
 ;;;###cal-autoload
 (defun cal-tex-cursor-week2 (&optional n event)
-  "Make a LaTeX calendar buffer for a two-page one-week calendar.
-It applies to the week that point is in.  Optional prefix
-argument N specifies number of weeks (default 1).  The calendar
-shows holidays if `cal-tex-holidays' is non-nil (note that diary
-entries are not shown).  The calendar shows the hours 8-12am, 1-5pm.
-Optional EVENT indicates a buffer position to use instead of point."
+  "Make a two page LaTeX calendar for one week, showing hours of the day.
+There are two columns; with 8-12am in the first and 1-5pm in the second.
+It shows holidays if `cal-tex-holidays' is non-nil.
+It does not show diary entries.
+
+The optional prefix argument N specifies a number of weeks (default 1).
+
+By default, the calendar is for the week at point; the optional
+argument EVENT specifies a different buffer position."
   (interactive (list (prefix-numeric-value current-prefix-arg)
                      last-nonmenu-event))
   (or n (setq n 1))
@@ -854,12 +854,15 @@ Optional EVENT indicates a buffer position to use instead of point."
 
 ;;;###cal-autoload
 (defun cal-tex-cursor-week-iso (&optional n event)
-  "Make a LaTeX calendar buffer for a one page ISO-style weekly calendar.
-Optional prefix argument N specifies number of weeks (default 1).
-The calendar shows holiday and diary entries if
-`cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil.
-It does not show hours of the day.  Optional EVENT indicates a buffer
-position to use instead of point."
+  "Make a one page LaTeX calendar for one week, in the ISO-style.
+It does not show hours of the day.
+It shows holidays if `cal-tex-holidays' is non-nil.
+It shows diary entries if `cal-tex-diary' is non-nil.
+
+The optional prefix argument N specifies a number of weeks (default 1).
+
+By default, the calendar is for the week at point; the optional
+argument EVENT specifies a different buffer position."
   (interactive (list (prefix-numeric-value current-prefix-arg)
                      last-nonmenu-event))
   (or n (setq n 1))
@@ -982,13 +985,16 @@ shown are hard-coded to 8-12, 13-17."
 ;; TODO respect cal-tex-daily-start,end (see cal-tex-weekly4-box).
 ;;;###cal-autoload
 (defun cal-tex-cursor-week-monday (&optional n event)
-  "Make a LaTeX calendar buffer for a two-page one-week calendar.
-It applies to the week that point is in, and starts on Monday.
-Optional prefix argument N specifies number of weeks (default 1).
-The calendar shows holidays if `cal-tex-holidays' is
-non-nil (note that diary entries are not shown).   The calendar shows
-the hours 8-12am, 1-5pm.  Optional EVENT indicates a buffer position
-to use instead of point."
+  "Make a one page LaTeX calendar for one week, showing hours of the day.
+There are two columns; with M-W in the first and T-S in the second.
+It shows the hours 8-12am and 1-5pm.
+It shows holidays if `cal-tex-holidays' is non-nil.
+It does not show diary entries.
+
+The optional prefix argument N specifies a number of weeks (default 1).
+
+By default, the calendar is for the week at point; the optional
+argument EVENT specifies a different buffer position."
   (interactive (list (prefix-numeric-value current-prefix-arg)
                      last-nonmenu-event))
   (or n (setq n 1))
@@ -1082,12 +1088,12 @@ shown are hard-coded to 8-12, 13-17."
           (cal-tex-preamble "twoside")
           (cal-tex-filofax-paper)
           (insert cal-tex-righthead)
-          (cal-tex-rightday "1.85in")
-          (cal-tex-rightday "0.8in" "weekend")
+          (cal-tex-longday "rightday" "1.85in")
+          (cal-tex-longday "weekend" "0.8in")
           (insert cal-tex-lefthead)
-          (cal-tex-leftday "1.85in"))
-    (cal-tex-preamble "twoside,12pt")
-    (insert "\\textwidth 7in
+          (cal-tex-longday "leftday" "1.85in"))
+      (cal-tex-preamble "twoside,12pt")
+      (insert "\\textwidth 7in
 \\textheight 10.5in
 \\oddsidemargin 0in
 \\evensidemargin 0in
@@ -1096,13 +1102,19 @@ shown are hard-coded to 8-12, 13-17."
 \\headsep 0.125in
 \\footskip .125in
 ")
-    (insert cal-tex-righthead)
-    (cal-tex-rightday "2.75in")
-    (cal-tex-rightday "1.8in" "weekend")
-    (insert cal-tex-lefthead)
-    (cal-tex-leftday "2.75in"))
+      (insert cal-tex-righthead)
+      (cal-tex-longday "rightday" "2.75in")
+      (cal-tex-longday "weekend" "1.8in")
+      (insert cal-tex-lefthead)
+      (cal-tex-longday "leftday" "2.75in"))
     (cal-tex-b-document)
     (cal-tex-cmd "\\pagestyle" "empty")
+    ;; Let's assume this is something to do with twopage documents.
+    ;; It has the downside that we start with a blank page.
+    ;; It doesn't make obvious sense when oddside and evenside margins
+    ;; are the same (non-filofax), but consider the left and right
+    ;; versions of various functions as applicable to even and odd pages.
+    (cal-tex-newpage)
     (dotimes (i n)
       (insert "\\lefthead")
       (cal-tex-arg
@@ -1203,13 +1215,16 @@ shown are hard-coded to 8-12, 13-17."
     (run-hooks 'cal-tex-hook)))
 
 ;;;###cal-autoload
-(defun cal-tex-cursor-week-at-a-glance (&optional n event)
-  "One-week-at-a-glance full page calendar for week indicated by cursor.
-Optional prefix argument N specifies number of weeks (default 1),
-starting on Mondays.  The calendar shows holiday and diary entries
-if `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil.
-It does not show hours of the day.  Optional EVENT indicates a buffer
-position to use instead of point."
+(defun cal-tex-cursor-week2-summary (&optional n event)
+  "Make a two page LaTeX calendar for one week, with optional diary entries.
+It does not show hours of the day.
+It shows holidays if `cal-tex-holidays' is non-nil.
+It shows diary entries if `cal-tex-diary' is non-nil.
+
+The optional prefix argument N specifies a number of weeks (default 1).
+
+By default, the calendar is for the week at point; the optional
+argument EVENT specifies a different buffer position."
   (interactive (list (prefix-numeric-value current-prefix-arg)
                      last-nonmenu-event))
   (cal-tex-weekly-common n event))
@@ -1241,9 +1256,9 @@ Optional EVENT indicates a buffer position to use instead of point."
     (cal-tex-preamble "twoside")
     (cal-tex-filofax-paper)
     (insert cal-tex-righthead)
-    (cal-tex-rightday "0.7in")
+    (cal-tex-longday "rightday" "0.7in")
     (insert cal-tex-lefthead)
-    (cal-tex-leftday "0.7in")
+    (cal-tex-longday "leftday" "0.7in")
     (cal-tex-b-document)
     (cal-tex-cmd "\\pagestyle" "empty")
     (dotimes (i n)