aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/calendar/cal-tex.el832
2 files changed, 436 insertions, 407 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 370bd3a2e05..4a2e754ecdd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12007-07-24 Glenn Morris <rgm@gnu.org>
2
3 * calendar/cal-tex.el (cal-tex-holidays, cal-tex-diary)
4 (cal-tex-rules, cal-tex-buffer, cal-tex-24)
5 (cal-tex-cursor-month-landscape, cal-tex-cursor-month)
6 (cal-tex-cursor-week, cal-tex-cursor-week2)
7 (cal-tex-cursor-week-iso, cal-tex-week-hours)
8 (cal-tex-cursor-week-monday, cal-tex-weekly4-box)
9 (cal-tex-cursor-filofax-2week, cal-tex-cursor-filofax-week)
10 (cal-tex-cursor-filofax-daily, cal-tex-daily-page): Doc fix.
11
12007-07-24 Stefan Monnier <monnier@iro.umontreal.ca> 122007-07-24 Stefan Monnier <monnier@iro.umontreal.ca>
2 13
3 * pcvs.el (cvs-temp-buffer): Disable undo in temp buffers. 14 * pcvs.el (cvs-temp-buffer): Disable undo in temp buffers.
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el
index e229f02002f..6c3ce9a5e84 100644
--- a/lisp/calendar/cal-tex.el
+++ b/lisp/calendar/cal-tex.el
@@ -65,18 +65,21 @@ to only print Monday, Wednesday, Friday."
65 :group 'calendar-tex) 65 :group 'calendar-tex)
66 66
67(defcustom cal-tex-holidays t 67(defcustom cal-tex-holidays t
68 "*If t (default), then the holidays are also printed. 68 "Non-nil means holidays are printed in the LaTeX calendars that support it.
69If finding the holidays is too slow, set this to nil." 69If finding the holidays is too slow, set this to nil."
70 :type 'boolean 70 :type 'boolean
71 :group 'calendar-tex) 71 :group 'calendar-tex)
72 72
73(defcustom cal-tex-diary nil 73(defcustom cal-tex-diary nil
74 "*If t, the diary entries are printed in the calendar." 74 "Non-nil means diary entries are printed in LaTeX calendars that support it.
75At present, this only affects the monthly, filofax, and iso-week
76calendars (i.e. not the yearly, plain weekly, or daily calendars)."
75 :type 'boolean 77 :type 'boolean
76 :group 'calendar-tex) 78 :group 'calendar-tex)
77 79
78(defcustom cal-tex-rules nil 80(defcustom cal-tex-rules nil
79 "*If t, pages will be ruled in some styles." 81 "Non-nil means pages will be ruled in some LaTeX calendar styles.
82At present, this only affects the daily filofax calendar."
80 :type 'boolean 83 :type 'boolean
81 :group 'calendar-tex) 84 :group 'calendar-tex)
82 85
@@ -102,12 +105,12 @@ will put the Hebrew date at the bottom of each day."
102 :group 'calendar-tex) 105 :group 'calendar-tex)
103 106
104(defcustom cal-tex-buffer "calendar.tex" 107(defcustom cal-tex-buffer "calendar.tex"
105 "*The name for the tex-ed calendar." 108 "The name for the output LaTeX calendar buffer."
106 :type 'string 109 :type 'string
107 :group 'calendar-tex) 110 :group 'calendar-tex)
108 111
109(defcustom cal-tex-24 nil 112(defcustom cal-tex-24 nil
110 "*If t, use a 24 hour clock in the daily calendar." 113 "Non-nil means use a 24 hour clock in the daily calendar."
111 :type 'boolean 114 :type 'boolean
112 :group 'calendar-tex) 115 :group 'calendar-tex)
113 116
@@ -162,7 +165,7 @@ characters with diacritical marks to their LaTeX equivalents, use
162;;; Definitions for LaTeX code 165;;; Definitions for LaTeX code
163;;; 166;;;
164 167
165(defvar cal-tex-day-prefix "\\caldate{%s}{%s}" 168(defvar cal-tex-day-prefix "\\caldate{%s}{%s}"
166 "The initial LaTeX code for a day. 169 "The initial LaTeX code for a day.
167The holidays, diary entries, bottom string, and the text follow.") 170The holidays, diary entries, bottom string, and the text follow.")
168 171
@@ -316,30 +319,30 @@ four months each."
316 (cal-tex-vspace "-.6cm") 319 (cal-tex-vspace "-.6cm")
317 (cal-tex-vspace "-3.1cm")) 320 (cal-tex-vspace "-3.1cm"))
318 (calendar-for-loop j from 1 to n do 321 (calendar-for-loop j from 1 to n do
319 (insert "\\vfill%\n") 322 (insert "\\vfill%\n")
320 (cal-tex-b-center) 323 (cal-tex-b-center)
321 (cal-tex-Huge (number-to-string year)) 324 (cal-tex-Huge (number-to-string year))
322 (cal-tex-e-center) 325 (cal-tex-e-center)
323 (cal-tex-vspace "1cm") 326 (cal-tex-vspace "1cm")
324 (cal-tex-b-center) 327 (cal-tex-b-center)
325 (cal-tex-b-parbox "l" (if landscape "5.9in" "4.3in")) 328 (cal-tex-b-parbox "l" (if landscape "5.9in" "4.3in"))
326 (insert "\n") 329 (insert "\n")
327 (cal-tex-noindent) 330 (cal-tex-noindent)
328 (cal-tex-nl) 331 (cal-tex-nl)
329 (calendar-for-loop i from 1 to 12 do 332 (calendar-for-loop i from 1 to 12 do
330 (insert (cal-tex-mini-calendar i year "month" "1.1in" "1in")) 333 (insert (cal-tex-mini-calendar i year "month" "1.1in" "1in"))
331 (insert "\\month") 334 (insert "\\month")
332 (cal-tex-hspace "0.5in") 335 (cal-tex-hspace "0.5in")
333 (if (zerop (mod i (if landscape 4 3))) 336 (if (zerop (mod i (if landscape 4 3)))
334 (cal-tex-nl "0.5in"))) 337 (cal-tex-nl "0.5in")))
335 (cal-tex-e-parbox) 338 (cal-tex-e-parbox)
336 (cal-tex-e-center) 339 (cal-tex-e-center)
337 (insert "\\vfill%\n") 340 (insert "\\vfill%\n")
338 (setq year (1+ year)) 341 (setq year (1+ year))
339 (if (/= j n) 342 (if (/= j n)
340 (cal-tex-newpage) 343 (cal-tex-newpage)
341 (cal-tex-end-document)) 344 (cal-tex-end-document))
342 (run-hooks 'cal-tex-year-hook)) 345 (run-hooks 'cal-tex-year-hook))
343 (run-hooks 'cal-tex-hook)) 346 (run-hooks 'cal-tex-hook))
344 347
345(defun cal-tex-cursor-filofax-year (&optional arg) 348(defun cal-tex-cursor-filofax-year (&optional arg)
@@ -360,35 +363,35 @@ Optional parameter specifies number of years."
360 (cal-tex-b-document) 363 (cal-tex-b-document)
361 (cal-tex-cmd "\\vspace*{0.25in}") 364 (cal-tex-cmd "\\vspace*{0.25in}")
362 (calendar-for-loop j from 1 to n do 365 (calendar-for-loop j from 1 to n do
363 (insert (format "\\hfil {\\Large \\bf %s} \\hfil\\\\\n" year)) 366 (insert (format "\\hfil {\\Large \\bf %s} \\hfil\\\\\n" year))
364 (cal-tex-b-center) 367 (cal-tex-b-center)
365 (cal-tex-b-parbox "l" "\\textwidth") 368 (cal-tex-b-parbox "l" "\\textwidth")
366 (insert "\n") 369 (insert "\n")
367 (cal-tex-noindent) 370 (cal-tex-noindent)
368 (cal-tex-nl) 371 (cal-tex-nl)
369 (let ((month-names; don't use default in case user changed it 372 (let ((month-names; don't use default in case user changed it
370 ;; These are only used to define the command names, not 373 ;; These are only used to define the command names, not
371 ;; the names of the months they insert. 374 ;; the names of the months they insert.
372 ["January" "February" "March" "April" "May" "June" 375 ["January" "February" "March" "April" "May" "June"
373 "July" "August" "September" "October" "November" "December"])) 376 "July" "August" "September" "October" "November" "December"]))
374 (calendar-for-loop i from 1 to 12 do 377 (calendar-for-loop i from 1 to 12 do
375 (insert (cal-tex-mini-calendar i year 378 (insert (cal-tex-mini-calendar i year
376 (aref month-names (1- i)) 379 (aref month-names (1- i))
377 "1in" ".9in" "tiny" "0.6mm")))) 380 "1in" ".9in" "tiny" "0.6mm"))))
378 (insert 381 (insert
379"\\noindent\\fbox{\\January}\\fbox{\\February}\\fbox{\\March}\\\\ 382 "\\noindent\\fbox{\\January}\\fbox{\\February}\\fbox{\\March}\\\\
380\\noindent\\fbox{\\April}\\fbox{\\May}\\fbox{\\June}\\\\ 383\\noindent\\fbox{\\April}\\fbox{\\May}\\fbox{\\June}\\\\
381\\noindent\\fbox{\\July}\\fbox{\\August}\\fbox{\\September}\\\\ 384\\noindent\\fbox{\\July}\\fbox{\\August}\\fbox{\\September}\\\\
382\\noindent\\fbox{\\October}\\fbox{\\November}\\fbox{\\December} 385\\noindent\\fbox{\\October}\\fbox{\\November}\\fbox{\\December}
383") 386")
384 (cal-tex-e-parbox) 387 (cal-tex-e-parbox)
385 (cal-tex-e-center) 388 (cal-tex-e-center)
386 (setq year (1+ year)) 389 (setq year (1+ year))
387 (if (= j n) 390 (if (= j n)
388 (cal-tex-end-document) 391 (cal-tex-end-document)
389 (cal-tex-newpage) 392 (cal-tex-newpage)
390 (cal-tex-cmd "\\vspace*{0.25in}")) 393 (cal-tex-cmd "\\vspace*{0.25in}"))
391 (run-hooks 'cal-tex-year-hook)) 394 (run-hooks 'cal-tex-year-hook))
392 (run-hooks 'cal-tex-hook))) 395 (run-hooks 'cal-tex-hook)))
393 396
394;;; 397;;;
@@ -396,9 +399,12 @@ Optional parameter specifies number of years."
396;;; 399;;;
397 400
398(defun cal-tex-cursor-month-landscape (&optional arg) 401(defun cal-tex-cursor-month-landscape (&optional arg)
399 "Make a buffer with LaTeX commands for the month cursor is on. 402 "Make a LaTeX calendar buffer for the month the cursor is on.
400Optional prefix argument specifies number of months to be produced. 403Optional prefix argument specifies number of months to be
401The output is in landscape format, one month to a page." 404produced (default 1). The output is in landscape format, one
405month to a page. It shows holiday and diary entries if
406`cal-tex-holidays' and `cal-tex-diary', respectively, are
407non-nil."
402 (interactive "p") 408 (interactive "p")
403 (let* ((n (if arg arg 1)) 409 (let* ((n (if arg arg 1))
404 (date (calendar-cursor-to-date t)) 410 (date (calendar-cursor-to-date t))
@@ -431,52 +437,54 @@ The output is in landscape format, one month to a page."
431 (cal-tex-insert-preamble (cal-tex-number-weeks month year 1) t "12pt") 437 (cal-tex-insert-preamble (cal-tex-number-weeks month year 1) t "12pt")
432 (cal-tex-cmd cal-tex-cal-one-month) 438 (cal-tex-cmd cal-tex-cal-one-month)
433 (calendar-for-loop i from 1 to n do 439 (calendar-for-loop i from 1 to n do
434 (setq other-month month) 440 (setq other-month month)
435 (setq other-year year) 441 (setq other-year year)
436 (increment-calendar-month other-month other-year -1) 442 (increment-calendar-month other-month other-year -1)
437 (insert (cal-tex-mini-calendar other-month other-year "lastmonth" 443 (insert (cal-tex-mini-calendar other-month other-year "lastmonth"
438 "\\cellwidth" "\\cellheight")) 444 "\\cellwidth" "\\cellheight"))
439 (increment-calendar-month other-month other-year 2) 445 (increment-calendar-month other-month other-year 2)
440 (insert (cal-tex-mini-calendar other-month other-year "nextmonth" 446 (insert (cal-tex-mini-calendar other-month other-year "nextmonth"
441 "\\cellwidth" "\\cellheight")) 447 "\\cellwidth" "\\cellheight"))
442 (cal-tex-insert-month-header 1 month year month year) 448 (cal-tex-insert-month-header 1 month year month year)
443 (cal-tex-insert-day-names) 449 (cal-tex-insert-day-names)
444 (cal-tex-nl ".2cm") 450 (cal-tex-nl ".2cm")
445 (setq small-months-at-start 451 (setq small-months-at-start
446 (< 1 (mod (- (calendar-day-of-week (list month 1 year)) 452 (< 1 (mod (- (calendar-day-of-week (list month 1 year))
447 calendar-week-start-day) 453 calendar-week-start-day)
448 7))) 454 7)))
449 (if small-months-at-start 455 (if small-months-at-start
450 (insert "\\lastmonth\\nextmonth\\hspace*{-2\\cellwidth}")) 456 (insert "\\lastmonth\\nextmonth\\hspace*{-2\\cellwidth}"))
451 (cal-tex-insert-blank-days month year cal-tex-day-prefix) 457 (cal-tex-insert-blank-days month year cal-tex-day-prefix)
452 (cal-tex-insert-days month year diary-list holidays 458 (cal-tex-insert-days month year diary-list holidays
453 cal-tex-day-prefix) 459 cal-tex-day-prefix)
454 (cal-tex-insert-blank-days-at-end month year cal-tex-day-prefix) 460 (cal-tex-insert-blank-days-at-end month year cal-tex-day-prefix)
455 (if (and (not small-months-at-start) 461 (if (and (not small-months-at-start)
456 (< 1 (mod (- (1- calendar-week-start-day) 462 (< 1 (mod (- (1- calendar-week-start-day)
457 (calendar-day-of-week 463 (calendar-day-of-week
458 (list month 464 (list month
459 (calendar-last-day-of-month month year) 465 (calendar-last-day-of-month month year)
460 year))) 466 year)))
461 7))) 467 7)))
462 (insert "\\vspace*{-\\cellwidth}\\hspace*{-2\\cellwidth}" 468 (insert "\\vspace*{-\\cellwidth}\\hspace*{-2\\cellwidth}"
463 "\\lastmonth\\nextmonth% 469 "\\lastmonth\\nextmonth%
464")) 470"))
465 (if (/= i n) 471 (if (/= i n)
466 (progn 472 (progn
467 (run-hooks 'cal-tex-month-hook) 473 (run-hooks 'cal-tex-month-hook)
468 (cal-tex-newpage) 474 (cal-tex-newpage)
469 (increment-calendar-month month year 1) 475 (increment-calendar-month month year 1)
470 (cal-tex-vspace "-2cm") 476 (cal-tex-vspace "-2cm")
471 (cal-tex-insert-preamble 477 (cal-tex-insert-preamble
472 (cal-tex-number-weeks month year 1) t "12pt" t)))) 478 (cal-tex-number-weeks month year 1) t "12pt" t))))
473 (cal-tex-end-document) 479 (cal-tex-end-document)
474 (run-hooks 'cal-tex-hook)))) 480 (run-hooks 'cal-tex-hook))))
475 481
476(defun cal-tex-cursor-month (arg) 482(defun cal-tex-cursor-month (arg)
477 "Make a buffer with LaTeX commands for the month cursor is on. 483 "Make a LaTeX calendar buffer for the month the cursor is on.
478Optional prefix argument specifies number of months to be produced. 484Optional prefix argument specifies number of months to be
479Calendar is condensed onto one page." 485produced (default 1). The calendar is condensed onto one page.
486It shows holiday and diary entries if `cal-tex-holidays' and
487`cal-tex-diary', respectively, are non-nil."
480 (interactive "p") 488 (interactive "p")
481 (let* ((date (calendar-cursor-to-date t)) 489 (let* ((date (calendar-cursor-to-date t))
482 (month (extract-calendar-month date)) 490 (month (extract-calendar-month date))
@@ -513,20 +521,20 @@ Calendar is condensed onto one page."
513 (cal-tex-nl ".2cm") 521 (cal-tex-nl ".2cm")
514 (cal-tex-insert-blank-days month year cal-tex-day-prefix) 522 (cal-tex-insert-blank-days month year cal-tex-day-prefix)
515 (calendar-for-loop i from 1 to n do 523 (calendar-for-loop i from 1 to n do
516 (setq other-month month) 524 (setq other-month month)
517 (setq other-year year) 525 (setq other-year year)
518 (cal-tex-insert-days month year diary-list holidays 526 (cal-tex-insert-days month year diary-list holidays
519 cal-tex-day-prefix) 527 cal-tex-day-prefix)
520 (if (= (mod (calendar-absolute-from-gregorian 528 (if (= (mod (calendar-absolute-from-gregorian
521 (list month 529 (list month
522 (calendar-last-day-of-month month year) 530 (calendar-last-day-of-month month year)
523 year)) 531 year))
524 7) 532 7)
525 6); last day of month was Saturday 533 6); last day of month was Saturday
526 (progn 534 (progn
527 (cal-tex-hfill) 535 (cal-tex-hfill)
528 (cal-tex-nl))) 536 (cal-tex-nl)))
529 (increment-calendar-month month year 1)) 537 (increment-calendar-month month year 1))
530 (cal-tex-insert-blank-days-at-end end-month end-year cal-tex-day-prefix) 538 (cal-tex-insert-blank-days-at-end end-month end-year cal-tex-day-prefix)
531 (cal-tex-end-document))) 539 (cal-tex-end-document)))
532 (run-hooks 'cal-tex-hook)) 540 (run-hooks 'cal-tex-hook))
@@ -534,8 +542,8 @@ Calendar is condensed onto one page."
534(defun cal-tex-insert-days (month year diary-list holidays day-format) 542(defun cal-tex-insert-days (month year diary-list holidays day-format)
535 "Insert LaTeX commands for a range of days in monthly calendars. 543 "Insert LaTeX commands for a range of days in monthly calendars.
536LaTeX commands are inserted for the days of the MONTH in YEAR. 544LaTeX commands are inserted for the days of the MONTH in YEAR.
537Diary entries on DIARY-LIST are included. Holidays on HOLIDAYS are included. 545Diary entries on DIARY-LIST are included. Holidays on HOLIDAYS
538Each day is formatted using format DAY-FORMAT." 546are included. Each day is formatted using format DAY-FORMAT."
539 (let* ((blank-days;; at start of month 547 (let* ((blank-days;; at start of month
540 (mod 548 (mod
541 (- (calendar-day-of-week (list month 1 year)) 549 (- (calendar-day-of-week (list month 1 year))
@@ -562,12 +570,12 @@ Each day is formatted using format DAY-FORMAT."
562(defun cal-tex-insert-day-names () 570(defun cal-tex-insert-day-names ()
563 "Insert the names of the days at top of a monthly calendar." 571 "Insert the names of the days at top of a monthly calendar."
564 (calendar-for-loop i from 0 to 6 do 572 (calendar-for-loop i from 0 to 6 do
565 (if (memq i cal-tex-which-days) 573 (if (memq i cal-tex-which-days)
566 (insert (format cal-tex-day-name-format 574 (insert (format cal-tex-day-name-format
567 (cal-tex-LaTeXify-string 575 (cal-tex-LaTeXify-string
568 (aref calendar-day-name-array 576 (aref calendar-day-name-array
569 (mod (+ calendar-week-start-day i) 7)))))) 577 (mod (+ calendar-week-start-day i) 7))))))
570 (cal-tex-comment))) 578 (cal-tex-comment)))
571 579
572(defun cal-tex-insert-month-header (n month year end-month end-year) 580(defun cal-tex-insert-month-header (n month year end-month end-year)
573 "Create a title for a calendar. 581 "Create a title for a calendar.
@@ -594,8 +602,8 @@ blank, no days are inserted."
594 calendar-week-start-day) 602 calendar-week-start-day)
595 7))) 603 7)))
596 (calendar-for-loop i from 0 to (1- blank-days) do 604 (calendar-for-loop i from 0 to (1- blank-days) do
597 (if (memq i cal-tex-which-days) 605 (if (memq i cal-tex-which-days)
598 (insert (format day-format " " " ") "{}{}{}{}%\n")))))) 606 (insert (format day-format " " " ") "{}{}{}{}%\n"))))))
599 607
600(defun cal-tex-insert-blank-days-at-end (month year day-format) 608(defun cal-tex-insert-blank-days-at-end (month year day-format)
601 "Insert code for final days not in calendar. 609 "Insert code for final days not in calendar.
@@ -668,11 +676,13 @@ this is only an upper bound."
668{\\makebox[2em]{\\rule{0cm}{#2ex}#1}\\rule{3in}{.15mm}}\n" 676{\\makebox[2em]{\\rule{0cm}{#2ex}#1}\\rule{3in}{.15mm}}\n"
669 "One hour and a line on the right.") 677 "One hour and a line on the right.")
670 678
679;; TODO cal-tex-diary-support.
671(defun cal-tex-cursor-week (&optional arg) 680(defun cal-tex-cursor-week (&optional arg)
672 "Make a buffer with LaTeX commands for a two-page one-week calendar. 681 "Make a LaTeX calendar buffer for a two-page one-week calendar.
673It applies to the week that point is in. 682It applies to the week that point is in. The optional prefix
674Optional prefix argument specifies number of weeks. 683argument specifies the number of weeks (default 1). The calendar
675Holidays are included if `cal-tex-holidays' is t." 684shows holidays if `cal-tex-holidays' is t (note that diary
685entries are not shown)."
676 (interactive "p") 686 (interactive "p")
677 (let* ((n (if arg arg 1)) 687 (let* ((n (if arg arg 1))
678 (date (calendar-gregorian-from-absolute 688 (date (calendar-gregorian-from-absolute
@@ -696,34 +706,36 @@ Holidays are included if `cal-tex-holidays' is t."
696 (cal-tex-b-document) 706 (cal-tex-b-document)
697 (cal-tex-cmd "\\pagestyle{empty}") 707 (cal-tex-cmd "\\pagestyle{empty}")
698 (calendar-for-loop i from 1 to n do 708 (calendar-for-loop i from 1 to n do
699 (cal-tex-vspace "-1.5in") 709 (cal-tex-vspace "-1.5in")
700 (cal-tex-b-center) 710 (cal-tex-b-center)
701 (cal-tex-Huge-bf (format "\\uppercase{%s}" 711 (cal-tex-Huge-bf (format "\\uppercase{%s}"
702 (cal-tex-month-name month))) 712 (cal-tex-month-name month)))
703 (cal-tex-hspace "2em") 713 (cal-tex-hspace "2em")
704 (cal-tex-Huge-bf (number-to-string year)) 714 (cal-tex-Huge-bf (number-to-string year))
705 (cal-tex-nl ".5cm") 715 (cal-tex-nl ".5cm")
706 (cal-tex-e-center) 716 (cal-tex-e-center)
707 (cal-tex-hspace "-.2in") 717 (cal-tex-hspace "-.2in")
708 (cal-tex-b-parbox "l" "7in") 718 (cal-tex-b-parbox "l" "7in")
709 (calendar-for-loop j from 1 to 7 do 719 (calendar-for-loop j from 1 to 7 do
710 (cal-tex-week-hours date holidays "3.1") 720 (cal-tex-week-hours date holidays "3.1")
711 (setq date (cal-tex-incr-date date))) 721 (setq date (cal-tex-incr-date date)))
712 (cal-tex-e-parbox) 722 (cal-tex-e-parbox)
713 (setq month (extract-calendar-month date)) 723 (setq month (extract-calendar-month date))
714 (setq year (extract-calendar-year date)) 724 (setq year (extract-calendar-year date))
715 (if (/= i n) 725 (if (/= i n)
716 (progn 726 (progn
717 (run-hooks 'cal-tex-week-hook) 727 (run-hooks 'cal-tex-week-hook)
718 (cal-tex-newpage)))) 728 (cal-tex-newpage))))
719 (cal-tex-end-document) 729 (cal-tex-end-document)
720 (run-hooks 'cal-tex-hook))) 730 (run-hooks 'cal-tex-hook)))
721 731
732;; TODO cal-tex-diary support.
722(defun cal-tex-cursor-week2 (&optional arg) 733(defun cal-tex-cursor-week2 (&optional arg)
723 "Make a buffer with LaTeX commands for a two-page one-week calendar. 734 "Make a LaTeX calendar buffer for a two-page one-week calendar.
724It applies to the week that point is in. 735It applies to the week that point is in. Optional prefix
725Optional prefix argument specifies number of weeks. 736argument specifies number of weeks (default 1). The calendar
726Holidays are included if `cal-tex-holidays' is t." 737shows holidays if `cal-tex-holidays' is non-nil (note that diary
738entries are not shown)."
727 (interactive "p") 739 (interactive "p")
728 (let* ((n (if arg arg 1)) 740 (let* ((n (if arg arg 1))
729 (date (calendar-gregorian-from-absolute 741 (date (calendar-gregorian-from-absolute
@@ -748,62 +760,62 @@ Holidays are included if `cal-tex-holidays' is t."
748 (cal-tex-b-document) 760 (cal-tex-b-document)
749 (cal-tex-cmd "\\pagestyle{empty}") 761 (cal-tex-cmd "\\pagestyle{empty}")
750 (calendar-for-loop i from 1 to n do 762 (calendar-for-loop i from 1 to n do
751 (cal-tex-vspace "-1.5in") 763 (cal-tex-vspace "-1.5in")
752 (cal-tex-b-center) 764 (cal-tex-b-center)
753 (cal-tex-Huge-bf (format "\\uppercase{%s}" 765 (cal-tex-Huge-bf (format "\\uppercase{%s}"
754 (cal-tex-month-name month))) 766 (cal-tex-month-name month)))
755 (cal-tex-hspace "2em") 767 (cal-tex-hspace "2em")
756 (cal-tex-Huge-bf (number-to-string year)) 768 (cal-tex-Huge-bf (number-to-string year))
757 (cal-tex-nl ".5cm") 769 (cal-tex-nl ".5cm")
758 (cal-tex-e-center) 770 (cal-tex-e-center)
759 (cal-tex-hspace "-.2in") 771 (cal-tex-hspace "-.2in")
760 (cal-tex-b-parbox "l" "\\textwidth") 772 (cal-tex-b-parbox "l" "\\textwidth")
761 (calendar-for-loop j from 1 to 3 do 773 (calendar-for-loop j from 1 to 3 do
762 (cal-tex-week-hours date holidays "5") 774 (cal-tex-week-hours date holidays "5")
763 (setq date (cal-tex-incr-date date))) 775 (setq date (cal-tex-incr-date date)))
764 (cal-tex-e-parbox) 776 (cal-tex-e-parbox)
765 (cal-tex-nl) 777 (cal-tex-nl)
766 (insert (cal-tex-mini-calendar 778 (insert (cal-tex-mini-calendar
767 (extract-calendar-month (cal-tex-previous-month date)) 779 (extract-calendar-month (cal-tex-previous-month date))
768 (extract-calendar-year (cal-tex-previous-month date)) 780 (extract-calendar-year (cal-tex-previous-month date))
769 "lastmonth" "1.1in" "1in")) 781 "lastmonth" "1.1in" "1in"))
770 (insert (cal-tex-mini-calendar 782 (insert (cal-tex-mini-calendar
771 (extract-calendar-month date) 783 (extract-calendar-month date)
772 (extract-calendar-year date) 784 (extract-calendar-year date)
773 "thismonth" "1.1in" "1in")) 785 "thismonth" "1.1in" "1in"))
774 (insert (cal-tex-mini-calendar 786 (insert (cal-tex-mini-calendar
775 (extract-calendar-month (cal-tex-next-month date)) 787 (extract-calendar-month (cal-tex-next-month date))
776 (extract-calendar-year (cal-tex-next-month date)) 788 (extract-calendar-year (cal-tex-next-month date))
777 "nextmonth" "1.1in" "1in")) 789 "nextmonth" "1.1in" "1in"))
778 (insert "\\hbox to \\textwidth{") 790 (insert "\\hbox to \\textwidth{")
779 (cal-tex-hfill) 791 (cal-tex-hfill)
780 (insert "\\lastmonth") 792 (insert "\\lastmonth")
781 (cal-tex-hfill) 793 (cal-tex-hfill)
782 (insert "\\thismonth") 794 (insert "\\thismonth")
783 (cal-tex-hfill) 795 (cal-tex-hfill)
784 (insert "\\nextmonth") 796 (insert "\\nextmonth")
785 (cal-tex-hfill) 797 (cal-tex-hfill)
786 (insert "}") 798 (insert "}")
787 (cal-tex-nl) 799 (cal-tex-nl)
788 (cal-tex-b-parbox "l" "\\textwidth") 800 (cal-tex-b-parbox "l" "\\textwidth")
789 (calendar-for-loop j from 4 to 7 do 801 (calendar-for-loop j from 4 to 7 do
790 (cal-tex-week-hours date holidays "5") 802 (cal-tex-week-hours date holidays "5")
791 (setq date (cal-tex-incr-date date))) 803 (setq date (cal-tex-incr-date date)))
792 (cal-tex-e-parbox) 804 (cal-tex-e-parbox)
793 (setq month (extract-calendar-month date)) 805 (setq month (extract-calendar-month date))
794 (setq year (extract-calendar-year date)) 806 (setq year (extract-calendar-year date))
795 (if (/= i n) 807 (if (/= i n)
796 (progn 808 (progn
797 (run-hooks 'cal-tex-week-hook) 809 (run-hooks 'cal-tex-week-hook)
798 (cal-tex-newpage)))) 810 (cal-tex-newpage))))
799 (cal-tex-end-document) 811 (cal-tex-end-document)
800 (run-hooks 'cal-tex-hook))) 812 (run-hooks 'cal-tex-hook)))
801 813
802(defun cal-tex-cursor-week-iso (&optional arg) 814(defun cal-tex-cursor-week-iso (&optional arg)
803 "Make a buffer with LaTeX commands for a one page ISO-style weekly calendar. 815 "Make a LaTeX calendar buffer for a one page ISO-style weekly calendar.
804Optional prefix argument specifies number of weeks. 816Optional prefix argument specifies number of weeks (default 1).
805Diary entries are included if `cal-tex-diary' is t. 817The calendar shows holiday and diary entries if
806Holidays are included if `cal-tex-holidays' is t." 818`cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil."
807 (interactive "p") 819 (interactive "p")
808 (let* ((n (if arg arg 1)) 820 (let* ((n (if arg arg 1))
809 (date (calendar-gregorian-from-absolute 821 (date (calendar-gregorian-from-absolute
@@ -833,64 +845,65 @@ Holidays are included if `cal-tex-holidays' is t."
833 (cal-tex-b-document) 845 (cal-tex-b-document)
834 (cal-tex-cmd "\\pagestyle{empty}") 846 (cal-tex-cmd "\\pagestyle{empty}")
835 (calendar-for-loop i from 1 to n do 847 (calendar-for-loop i from 1 to n do
836 (cal-tex-vspace "-1.5in") 848 (cal-tex-vspace "-1.5in")
837 (cal-tex-b-center) 849 (cal-tex-b-center)
838 (cal-tex-Huge-bf 850 (cal-tex-Huge-bf
839 (let* ((d (calendar-iso-from-absolute 851 (let* ((d (calendar-iso-from-absolute
840 (calendar-absolute-from-gregorian date)))) 852 (calendar-absolute-from-gregorian date))))
841 (format "Week %d of %d" 853 (format "Week %d of %d"
842 (extract-calendar-month d) 854 (extract-calendar-month d)
843 (extract-calendar-year d)))) 855 (extract-calendar-year d))))
844 (cal-tex-nl ".5cm") 856 (cal-tex-nl ".5cm")
845 (cal-tex-e-center) 857 (cal-tex-e-center)
846 (cal-tex-b-parbox "l" "\\textwidth") 858 (cal-tex-b-parbox "l" "\\textwidth")
847 (calendar-for-loop j from 1 to 7 do 859 (calendar-for-loop j from 1 to 7 do
848 (cal-tex-b-parbox "t" "\\textwidth") 860 (cal-tex-b-parbox "t" "\\textwidth")
849 (cal-tex-b-parbox "t" "\\textwidth") 861 (cal-tex-b-parbox "t" "\\textwidth")
850 (cal-tex-rule "0pt" "\\textwidth" ".2mm") 862 (cal-tex-rule "0pt" "\\textwidth" ".2mm")
851 (cal-tex-nl) 863 (cal-tex-nl)
852 (cal-tex-b-parbox "t" "\\textwidth") 864 (cal-tex-b-parbox "t" "\\textwidth")
853 (cal-tex-large-bf (cal-tex-LaTeXify-string (calendar-day-name date))) 865 (cal-tex-large-bf (cal-tex-LaTeXify-string (calendar-day-name date)))
854 (insert ", ") 866 (insert ", ")
855 (cal-tex-large-bf (cal-tex-month-name month)) 867 (cal-tex-large-bf (cal-tex-month-name month))
856 (insert " ") 868 (insert " ")
857 (cal-tex-large-bf (number-to-string day)) 869 (cal-tex-large-bf (number-to-string day))
858 (if (not (string= "" (cal-tex-latexify-list holidays date))) 870 (if (not (string= "" (cal-tex-latexify-list holidays date)))
859 (progn 871 (progn
860 (insert ": ") 872 (insert ": ")
861 (cal-tex-large-bf (cal-tex-latexify-list holidays date "; ")))) 873 (cal-tex-large-bf (cal-tex-latexify-list holidays date "; "))))
862 (cal-tex-hfill) 874 (cal-tex-hfill)
863 (insert " " (eval cal-tex-daily-string)) 875 (insert " " (eval cal-tex-daily-string))
864 (cal-tex-e-parbox) 876 (cal-tex-e-parbox)
865 (cal-tex-nl) 877 (cal-tex-nl)
866 (cal-tex-noindent) 878 (cal-tex-noindent)
867 (cal-tex-b-parbox "t" "\\textwidth") 879 (cal-tex-b-parbox "t" "\\textwidth")
868 (if (not (string= "" (cal-tex-latexify-list diary-list date))) 880 (if (not (string= "" (cal-tex-latexify-list diary-list date)))
869 (progn 881 (progn
870 (insert "\\vbox to 0pt{") 882 (insert "\\vbox to 0pt{")
871 (cal-tex-large-bf 883 (cal-tex-large-bf
872 (cal-tex-latexify-list diary-list date)) 884 (cal-tex-latexify-list diary-list date))
873 (insert "}"))) 885 (insert "}")))
874 (cal-tex-e-parbox) 886 (cal-tex-e-parbox)
875 (cal-tex-nl) 887 (cal-tex-nl)
876 (setq date (cal-tex-incr-date date)) 888 (setq date (cal-tex-incr-date date))
877 (setq month (extract-calendar-month date)) 889 (setq month (extract-calendar-month date))
878 (setq day (extract-calendar-day date)) 890 (setq day (extract-calendar-day date))
879 (cal-tex-e-parbox) 891 (cal-tex-e-parbox)
880 (cal-tex-e-parbox "2cm") 892 (cal-tex-e-parbox "2cm")
881 (cal-tex-nl) 893 (cal-tex-nl)
882 (setq month (extract-calendar-month date)) 894 (setq month (extract-calendar-month date))
883 (setq year (extract-calendar-year date))) 895 (setq year (extract-calendar-year date)))
884 (cal-tex-e-parbox) 896 (cal-tex-e-parbox)
885 (if (/= i n) 897 (if (/= i n)
886 (progn 898 (progn
887 (run-hooks 'cal-tex-week-hook) 899 (run-hooks 'cal-tex-week-hook)
888 (cal-tex-newpage)))) 900 (cal-tex-newpage))))
889 (cal-tex-end-document) 901 (cal-tex-end-document)
890 (run-hooks 'cal-tex-hook))) 902 (run-hooks 'cal-tex-hook)))
891 903
892(defun cal-tex-week-hours (date holidays height) 904(defun cal-tex-week-hours (date holidays height)
893 "Insert hourly entries for DATE with HOLIDAYS, with line height HEIGHT." 905 "Insert hourly entries for DATE with HOLIDAYS, with line height HEIGHT.
906Uses the 24-hour clock if `cal-tex-24' is non-nil."
894 (let ((month (extract-calendar-month date)) 907 (let ((month (extract-calendar-month date))
895 (day (extract-calendar-day date)) 908 (day (extract-calendar-day date))
896 (year (extract-calendar-year date)) 909 (year (extract-calendar-year date))
@@ -925,11 +938,13 @@ Holidays are included if `cal-tex-holidays' is t."
925 (cal-tex-arg height) 938 (cal-tex-arg height)
926 (cal-tex-nl)))) 939 (cal-tex-nl))))
927 940
941;; TODO cal-tex-diary support.
928(defun cal-tex-cursor-week-monday (&optional arg) 942(defun cal-tex-cursor-week-monday (&optional arg)
929 "Make a buffer with LaTeX commands for a two-page one-week calendar. 943 "Make a LaTeX calendar buffer for a two-page one-week calendar.
930It applies to the week that point is in, and starts on Monday. 944It applies to the week that point is in, and starts on Monday.
931Optional prefix argument specifies number of weeks. 945Optional prefix argument specifies number of weeks (default 1).
932Holidays are included if `cal-tex-holidays' is t." 946The calendar shows holidays if `cal-tex-holidays' is
947non-nil (note that diary entries are not shown)."
933 (interactive "p") 948 (interactive "p")
934 (let* ((n (if arg arg 1)) 949 (let* ((n (if arg arg 1))
935 (date (calendar-gregorian-from-absolute 950 (date (calendar-gregorian-from-absolute
@@ -944,26 +959,27 @@ Holidays are included if `cal-tex-holidays' is t."
944 (cal-tex-cmd "\\evensidemargin 0in") 959 (cal-tex-cmd "\\evensidemargin 0in")
945 (cal-tex-b-document) 960 (cal-tex-b-document)
946 (calendar-for-loop i from 1 to n do 961 (calendar-for-loop i from 1 to n do
947 (cal-tex-vspace "-1cm") 962 (cal-tex-vspace "-1cm")
948 (insert "\\noindent ") 963 (insert "\\noindent ")
949 (cal-tex-weekly4-box (cal-tex-incr-date date) nil) 964 (cal-tex-weekly4-box (cal-tex-incr-date date) nil)
950 (cal-tex-weekly4-box (cal-tex-incr-date date 4) nil) 965 (cal-tex-weekly4-box (cal-tex-incr-date date 4) nil)
951 (cal-tex-nl ".2cm") 966 (cal-tex-nl ".2cm")
952 (cal-tex-weekly4-box (cal-tex-incr-date date 2) nil) 967 (cal-tex-weekly4-box (cal-tex-incr-date date 2) nil)
953 (cal-tex-weekly4-box (cal-tex-incr-date date 5) nil) 968 (cal-tex-weekly4-box (cal-tex-incr-date date 5) nil)
954 (cal-tex-nl ".2cm") 969 (cal-tex-nl ".2cm")
955 (cal-tex-weekly4-box (cal-tex-incr-date date 3) nil) 970 (cal-tex-weekly4-box (cal-tex-incr-date date 3) nil)
956 (cal-tex-weekly4-box (cal-tex-incr-date date 6) t) 971 (cal-tex-weekly4-box (cal-tex-incr-date date 6) t)
957 (if (/= i n) 972 (if (/= i n)
958 (progn 973 (progn
959 (run-hooks 'cal-tex-week-hook) 974 (run-hooks 'cal-tex-week-hook)
960 (setq date (cal-tex-incr-date date 7)) 975 (setq date (cal-tex-incr-date date 7))
961 (cal-tex-newpage)))) 976 (cal-tex-newpage))))
962 (cal-tex-end-document) 977 (cal-tex-end-document)
963 (run-hooks 'cal-tex-hook))) 978 (run-hooks 'cal-tex-hook)))
964 979
965(defun cal-tex-weekly4-box (date weekend) 980(defun cal-tex-weekly4-box (date weekend)
966 "Make one box for DATE, different if WEEKEND." 981 "Make one box for DATE, different if WEEKEND.
982Uses the 24-hour clock if `cal-tex-24' is non-nil."
967 (let* ( 983 (let* (
968 (day (extract-calendar-day date)) 984 (day (extract-calendar-day date))
969 (month (extract-calendar-month date)) 985 (month (extract-calendar-month date))
@@ -1002,10 +1018,10 @@ Holidays are included if `cal-tex-holidays' is t."
1002 (cal-tex-hspace "1cm"))) 1018 (cal-tex-hspace "1cm")))
1003 1019
1004(defun cal-tex-cursor-filofax-2week (&optional arg) 1020(defun cal-tex-cursor-filofax-2week (&optional arg)
1005 "Two-weeks-at-a-glance Filofax style calendar for week indicated by cursor. 1021 "Two-weeks-at-a-glance Filofax style calendar for week cursor is in.
1006Optional prefix argument specifies number of weeks. 1022Optional prefix argument specifies number of weeks (default 1).
1007Diary entries are included if `cal-tex-diary' is t. 1023The calendar shows holiday and diary entries if
1008Holidays are included if `cal-tex-holidays' is t." 1024`cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil."
1009 (interactive "p") 1025 (interactive "p")
1010 (let* ((n (if arg arg 1)) 1026 (let* ((n (if arg arg 1))
1011 (date (calendar-gregorian-from-absolute 1027 (date (calendar-gregorian-from-absolute
@@ -1104,10 +1120,9 @@ Holidays are included if `cal-tex-holidays' is t."
1104 1120
1105(defun cal-tex-cursor-filofax-week (&optional arg) 1121(defun cal-tex-cursor-filofax-week (&optional arg)
1106 "One-week-at-a-glance Filofax style calendar for week indicated by cursor. 1122 "One-week-at-a-glance Filofax style calendar for week indicated by cursor.
1107Optional prefix argument specifies number of weeks. 1123Optional prefix argument specifies number of weeks (default 1),
1108Weeks start on Monday. 1124starting on Mondays. The calendar shows holiday and diary entries
1109Diary entries are included if `cal-tex-diary' is t. 1125if `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil."
1110Holidays are included if `cal-tex-holidays' is t."
1111 (interactive "p") 1126 (interactive "p")
1112 (let* ((n (if arg arg 1)) 1127 (let* ((n (if arg arg 1))
1113 (date (calendar-gregorian-from-absolute 1128 (date (calendar-gregorian-from-absolute
@@ -1169,96 +1184,96 @@ Holidays are included if `cal-tex-holidays' is t."
1169 (cal-tex-cmd "\\pagestyle{empty}\\ ") 1184 (cal-tex-cmd "\\pagestyle{empty}\\ ")
1170 (cal-tex-newpage) 1185 (cal-tex-newpage)
1171 (calendar-for-loop i from 1 to n do 1186 (calendar-for-loop i from 1 to n do
1172 (insert "\\lefthead") 1187 (insert "\\lefthead")
1173 (cal-tex-arg 1188 (cal-tex-arg
1174 (let ((d (cal-tex-incr-date date 2))) 1189 (let ((d (cal-tex-incr-date date 2)))
1175 (if (= (extract-calendar-month date) 1190 (if (= (extract-calendar-month date)
1191 (extract-calendar-month d))
1192 (format "%s %s"
1193 (cal-tex-month-name
1194 (extract-calendar-month date))
1195 (extract-calendar-year date))
1196 (if (= (extract-calendar-year date)
1197 (extract-calendar-year d))
1198 (format "%s---%s %s"
1199 (cal-tex-month-name
1200 (extract-calendar-month date))
1201 (cal-tex-month-name
1202 (extract-calendar-month d))
1203 (extract-calendar-year date))
1204 (format "%s %s---%s %s"
1205 (cal-tex-month-name
1206 (extract-calendar-month date))
1207 (extract-calendar-year date)
1208 (cal-tex-month-name (extract-calendar-month d))
1209 (extract-calendar-year d))))))
1210 (insert "%\n")
1211 (calendar-for-loop j from 1 to 3 do
1212 (insert "\\leftday")
1213 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
1214 (cal-tex-arg (int-to-string (extract-calendar-day date)))
1215 (cal-tex-arg (cal-tex-latexify-list diary-list date))
1216 (cal-tex-arg (cal-tex-latexify-list holidays date))
1217 (cal-tex-arg (eval cal-tex-daily-string))
1218 (insert "%\n")
1219 (setq date (cal-tex-incr-date date)))
1220 (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n")
1221 (cal-tex-newpage)
1222 (insert "\\righthead")
1223 (cal-tex-arg
1224 (let ((d (cal-tex-incr-date date 3)))
1225 (if (= (extract-calendar-month date)
1176 (extract-calendar-month d)) 1226 (extract-calendar-month d))
1177 (format "%s %s" 1227 (format "%s %s"
1178 (cal-tex-month-name 1228 (cal-tex-month-name
1179 (extract-calendar-month date)) 1229 (extract-calendar-month date))
1180 (extract-calendar-year date)) 1230 (extract-calendar-year date))
1181 (if (= (extract-calendar-year date) 1231 (if (= (extract-calendar-year date)
1182 (extract-calendar-year d)) 1232 (extract-calendar-year d))
1183 (format "%s---%s %s" 1233 (format "%s---%s %s"
1184 (cal-tex-month-name 1234 (cal-tex-month-name
1185 (extract-calendar-month date)) 1235 (extract-calendar-month date))
1186 (cal-tex-month-name 1236 (cal-tex-month-name
1187 (extract-calendar-month d)) 1237 (extract-calendar-month d))
1188 (extract-calendar-year date)) 1238 (extract-calendar-year date))
1189 (format "%s %s---%s %s" 1239 (format "%s %s---%s %s"
1190 (cal-tex-month-name 1240 (cal-tex-month-name
1191 (extract-calendar-month date)) 1241 (extract-calendar-month date))
1192 (extract-calendar-year date) 1242 (extract-calendar-year date)
1193 (cal-tex-month-name (extract-calendar-month d)) 1243 (cal-tex-month-name (extract-calendar-month d))
1194 (extract-calendar-year d)))))) 1244 (extract-calendar-year d))))))
1195 (insert "%\n") 1245 (insert "%\n")
1196 (calendar-for-loop j from 1 to 3 do 1246 (calendar-for-loop j from 1 to 2 do
1197 (insert "\\leftday") 1247 (insert "\\rightday")
1198 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) 1248 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
1199 (cal-tex-arg (int-to-string (extract-calendar-day date))) 1249 (cal-tex-arg (int-to-string (extract-calendar-day date)))
1200 (cal-tex-arg (cal-tex-latexify-list diary-list date)) 1250 (cal-tex-arg (cal-tex-latexify-list diary-list date))
1201 (cal-tex-arg (cal-tex-latexify-list holidays date)) 1251 (cal-tex-arg (cal-tex-latexify-list holidays date))
1202 (cal-tex-arg (eval cal-tex-daily-string)) 1252 (cal-tex-arg (eval cal-tex-daily-string))
1203 (insert "%\n") 1253 (insert "%\n")
1204 (setq date (cal-tex-incr-date date))) 1254 (setq date (cal-tex-incr-date date)))
1205 (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n") 1255 (calendar-for-loop j from 1 to 2 do
1206 (cal-tex-newpage) 1256 (insert "\\weekend")
1207 (insert "\\righthead") 1257 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
1208 (cal-tex-arg 1258 (cal-tex-arg (int-to-string (extract-calendar-day date)))
1209 (let ((d (cal-tex-incr-date date 3))) 1259 (cal-tex-arg (cal-tex-latexify-list diary-list date))
1210 (if (= (extract-calendar-month date) 1260 (cal-tex-arg (cal-tex-latexify-list holidays date))
1211 (extract-calendar-month d)) 1261 (cal-tex-arg (eval cal-tex-daily-string))
1212 (format "%s %s" 1262 (insert "%\n")
1213 (cal-tex-month-name 1263 (setq date (cal-tex-incr-date date)))
1214 (extract-calendar-month date)) 1264 (if (/= i n)
1215 (extract-calendar-year date)) 1265 (progn
1216 (if (= (extract-calendar-year date) 1266 (run-hooks 'cal-tex-week-hook)
1217 (extract-calendar-year d)) 1267 (cal-tex-newpage))))
1218 (format "%s---%s %s"
1219 (cal-tex-month-name
1220 (extract-calendar-month date))
1221 (cal-tex-month-name
1222 (extract-calendar-month d))
1223 (extract-calendar-year date))
1224 (format "%s %s---%s %s"
1225 (cal-tex-month-name
1226 (extract-calendar-month date))
1227 (extract-calendar-year date)
1228 (cal-tex-month-name (extract-calendar-month d))
1229 (extract-calendar-year d))))))
1230 (insert "%\n")
1231 (calendar-for-loop j from 1 to 2 do
1232 (insert "\\rightday")
1233 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
1234 (cal-tex-arg (int-to-string (extract-calendar-day date)))
1235 (cal-tex-arg (cal-tex-latexify-list diary-list date))
1236 (cal-tex-arg (cal-tex-latexify-list holidays date))
1237 (cal-tex-arg (eval cal-tex-daily-string))
1238 (insert "%\n")
1239 (setq date (cal-tex-incr-date date)))
1240 (calendar-for-loop j from 1 to 2 do
1241 (insert "\\weekend")
1242 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
1243 (cal-tex-arg (int-to-string (extract-calendar-day date)))
1244 (cal-tex-arg (cal-tex-latexify-list diary-list date))
1245 (cal-tex-arg (cal-tex-latexify-list holidays date))
1246 (cal-tex-arg (eval cal-tex-daily-string))
1247 (insert "%\n")
1248 (setq date (cal-tex-incr-date date)))
1249 (if (/= i n)
1250 (progn
1251 (run-hooks 'cal-tex-week-hook)
1252 (cal-tex-newpage))))
1253 (cal-tex-end-document) 1268 (cal-tex-end-document)
1254 (run-hooks 'cal-tex-hook))) 1269 (run-hooks 'cal-tex-hook)))
1255 1270
1256(defun cal-tex-cursor-filofax-daily (&optional arg) 1271(defun cal-tex-cursor-filofax-daily (&optional arg)
1257 "Day-per-page Filofax style calendar for week indicated by cursor. 1272 "Day-per-page Filofax style calendar for week indicated by cursor.
1258Optional prefix argument specifies number of weeks. Weeks start on Monday. 1273Optional prefix argument specifies number of weeks (default 1),
1259Diary entries are included if `cal-tex-diary' is t. 1274starting on Mondays. The calendar shows holiday and diary
1260Holidays are included if `cal-tex-holidays' is t. 1275entries if `cal-tex-holidays' and `cal-tex-diary', respectively,
1261Pages are ruled if `cal-tex-rules' is t." 1276are non-nil. Pages are ruled if `cal-tex-rules' is non-nil."
1262 (interactive "p") 1277 (interactive "p")
1263 (let* ((n (if arg arg 1)) 1278 (let* ((n (if arg arg 1))
1264 (date (calendar-gregorian-from-absolute 1279 (date (calendar-gregorian-from-absolute
@@ -1323,40 +1338,40 @@ Pages are ruled if `cal-tex-rules' is t."
1323 (cal-tex-b-document) 1338 (cal-tex-b-document)
1324 (cal-tex-cmd "\\pagestyle{empty}") 1339 (cal-tex-cmd "\\pagestyle{empty}")
1325 (calendar-for-loop i from 1 to n do 1340 (calendar-for-loop i from 1 to n do
1326 (calendar-for-loop j from 1 to 5 do 1341 (calendar-for-loop j from 1 to 5 do
1327 (let ((odd (/= 0 (% j 2)))) 1342 (let ((odd (/= 0 (% j 2))))
1328 (insert (if odd "\\righthead" "\\lefthead")) 1343 (insert (if odd "\\righthead" "\\lefthead"))
1329 (cal-tex-arg (calendar-date-string date)) 1344 (cal-tex-arg (calendar-date-string date))
1330 (insert "%\n") 1345 (insert "%\n")
1331 (insert (if odd "\\rightday" "\\leftday"))) 1346 (insert (if odd "\\rightday" "\\leftday")))
1332 (cal-tex-arg (cal-tex-latexify-list diary-list date)) 1347 (cal-tex-arg (cal-tex-latexify-list diary-list date))
1333 (cal-tex-arg (cal-tex-latexify-list holidays date "\\\\" t)) 1348 (cal-tex-arg (cal-tex-latexify-list holidays date "\\\\" t))
1334 (cal-tex-arg (eval cal-tex-daily-string)) 1349 (cal-tex-arg (eval cal-tex-daily-string))
1335 (insert "%\n") 1350 (insert "%\n")
1336 (if cal-tex-rules 1351 (if cal-tex-rules
1337 (insert "\\linesfill\n") 1352 (insert "\\linesfill\n")
1338 (insert "\\vfill\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n")) 1353 (insert "\\vfill\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n"))
1339 (cal-tex-newpage) 1354 (cal-tex-newpage)
1340 (setq date (cal-tex-incr-date date))) 1355 (setq date (cal-tex-incr-date date)))
1341 (insert "%\n") 1356 (insert "%\n")
1342 (calendar-for-loop j from 1 to 2 do 1357 (calendar-for-loop j from 1 to 2 do
1343 (insert "\\lefthead") 1358 (insert "\\lefthead")
1344 (cal-tex-arg (calendar-date-string date)) 1359 (cal-tex-arg (calendar-date-string date))
1345 (insert "\\weekend") 1360 (insert "\\weekend")
1346 (cal-tex-arg (cal-tex-latexify-list diary-list date)) 1361 (cal-tex-arg (cal-tex-latexify-list diary-list date))
1347 (cal-tex-arg (cal-tex-latexify-list holidays date "\\\\" t)) 1362 (cal-tex-arg (cal-tex-latexify-list holidays date "\\\\" t))
1348 (cal-tex-arg (eval cal-tex-daily-string)) 1363 (cal-tex-arg (eval cal-tex-daily-string))
1349 (insert "%\n") 1364 (insert "%\n")
1350 (if cal-tex-rules 1365 (if cal-tex-rules
1351 (insert "\\linesfill\n") 1366 (insert "\\linesfill\n")
1352 (insert "\\vfill")) 1367 (insert "\\vfill"))
1353 (setq date (cal-tex-incr-date date))) 1368 (setq date (cal-tex-incr-date date)))
1354 (if (not cal-tex-rules) 1369 (if (not cal-tex-rules)
1355 (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n")) 1370 (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n"))
1356 (if (/= i n) 1371 (if (/= i n)
1357 (progn 1372 (progn
1358 (run-hooks 'cal-tex-week-hook) 1373 (run-hooks 'cal-tex-week-hook)
1359 (cal-tex-newpage)))) 1374 (cal-tex-newpage))))
1360 (cal-tex-end-document) 1375 (cal-tex-end-document)
1361 (run-hooks 'cal-tex-hook))) 1376 (run-hooks 'cal-tex-hook)))
1362 1377
@@ -1377,10 +1392,10 @@ Optional prefix argument specifies number of days."
1377 (cal-tex-b-document) 1392 (cal-tex-b-document)
1378 (cal-tex-cmd "\\pagestyle{empty}") 1393 (cal-tex-cmd "\\pagestyle{empty}")
1379 (calendar-for-loop i from 1 to n do 1394 (calendar-for-loop i from 1 to n do
1380 (cal-tex-vspace "-1.7in") 1395 (cal-tex-vspace "-1.7in")
1381 (cal-tex-daily-page (calendar-gregorian-from-absolute date)) 1396 (cal-tex-daily-page (calendar-gregorian-from-absolute date))
1382 (setq date (1+ date)) 1397 (setq date (1+ date))
1383 (if (/= i n) 1398 (if (/= i n)
1384 (progn 1399 (progn
1385 (cal-tex-newpage) 1400 (cal-tex-newpage)
1386 (run-hooks 'cal-tex-daily-hook)))) 1401 (run-hooks 'cal-tex-daily-hook))))
@@ -1388,7 +1403,10 @@ Optional prefix argument specifies number of days."
1388 (run-hooks 'cal-tex-hook))) 1403 (run-hooks 'cal-tex-hook)))
1389 1404
1390(defun cal-tex-daily-page (date) 1405(defun cal-tex-daily-page (date)
1391 "Make a calendar page for Gregorian DATE on 8.5 by 11 paper." 1406 "Make a calendar page for Gregorian DATE on 8.5 by 11 paper.
1407Uses the 24-hour clock if `cal-tex-24' is non-nil. Produces
1408hourly sections for the period specified by `cal-tex-daily-start'
1409and `cal-tex-daily-end'."
1392 (let* ((hour) 1410 (let* ((hour)
1393 (month-name (cal-tex-month-name (extract-calendar-month date)))) 1411 (month-name (cal-tex-month-name (extract-calendar-month date))))
1394 (cal-tex-banner "cal-tex-daily-page") 1412 (cal-tex-banner "cal-tex-daily-page")
@@ -1494,12 +1512,12 @@ COLSEP gives the column separation; 1mm is the default."
1494 (calendar-for-loop i from 1 to blank-days do 1512 (calendar-for-loop i from 1 to blank-days do
1495 (setq str (concat str " & "))) 1513 (setq str (concat str " & ")))
1496 (calendar-for-loop i from 1 to last do 1514 (calendar-for-loop i from 1 to last do
1497 (setq str (concat str (int-to-string i))) 1515 (setq str (concat str (int-to-string i)))
1498 (setq str (concat str (if (zerop (mod (+ i blank-days) 7)) 1516 (setq str (concat str (if (zerop (mod (+ i blank-days) 7))
1499 (if (/= i last) "\\\\[0.5mm]\n" "") 1517 (if (/= i last) "\\\\[0.5mm]\n" "")
1500 " & ")))) 1518 " & "))))
1501 (setq str (concat str "\n\\end{tabular}\\hfil}\\vfil}}}%\n")) 1519 (setq str (concat str "\n\\end{tabular}\\hfil}\\vfil}}}%\n"))
1502 str)) 1520 str))
1503 1521
1504;;; 1522;;;
1505;;; Various calendar functions 1523;;; Various calendar functions