diff options
| author | Richard M. Stallman | 2002-04-03 14:35:33 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-04-03 14:35:33 +0000 |
| commit | 1eb0045f75bd541e6ea95c5c901652643bd67213 (patch) | |
| tree | 8677fb5a2c378836ee33e4a4c9a2c9d5add00725 | |
| parent | 651f4408180d7d42aa055d5a0df8f732c11d414e (diff) | |
| download | emacs-1eb0045f75bd541e6ea95c5c901652643bd67213.tar.gz emacs-1eb0045f75bd541e6ea95c5c901652643bd67213.zip | |
(cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
(cal-tex-week-hook, cal-tex-daily-hook): Add doc strings.
(cal-tex-latexify-list): Fix doc string.
(cal-tex-insert-day-names): LaTeXify day names.
(cal-tex-cursor-week-iso, cal-tex-week-hours, cal-tex-weekly4-box)
(cal-tex-cursor-filofax-2week, cal-tex-cursor-filofax-week)
(cal-tex-daily-page, cal-tex-mini-calendar): LaTeXify day names.
Change all instances (interactive "P") to (interactive "p").
(cal-tex-cursor-month): Add hfill and newline at end of month that
ended on Saturday.
(cal-tex-preamble): Change to LaTeX2e.
(cal-tex-cursor-filofax-year): Don't use default month names in
LaTeX macros in case user changes them.
(cal-tex-month-name): New function. Used throughout in case user
has done something funny with month names.
| -rw-r--r-- | lisp/calendar/cal-tex.el | 173 |
1 files changed, 111 insertions, 62 deletions
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el index 3aac65ab20b..cbfcef69cca 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el | |||
| @@ -119,6 +119,35 @@ will put the Hebrew date at the bottom of each day." | |||
| 119 | :type 'integer | 119 | :type 'integer |
| 120 | :group 'calendar-tex) | 120 | :group 'calendar-tex) |
| 121 | 121 | ||
| 122 | (defcustom cal-tex-hook nil | ||
| 123 | "*List of functions called after any LaTeX calendar buffer is generated. | ||
| 124 | You can use this to do postprocessing on the buffer. For example, to change | ||
| 125 | characters with diacritical marks to their LaTeX equivalents, use | ||
| 126 | (add-hook 'cal-tex-hook | ||
| 127 | '(lambda () (iso-iso2tex (point-min) (point-max))))" | ||
| 128 | :type 'hook | ||
| 129 | :group 'calendar-tex) | ||
| 130 | |||
| 131 | (defcustom cal-tex-year-hook nil | ||
| 132 | "*List of functions called after a LaTeX year calendar buffer is generated." | ||
| 133 | :type 'hook | ||
| 134 | :group 'calendar-tex) | ||
| 135 | |||
| 136 | (defcustom cal-tex-month-hook nil | ||
| 137 | "*List of functions called after a LaTeX month calendar buffer is generated." | ||
| 138 | :type 'hook | ||
| 139 | :group 'calendar-tex) | ||
| 140 | |||
| 141 | (defcustom cal-tex-week-hook nil | ||
| 142 | "*List of functions called after a LaTeX week calendar buffer is generated." | ||
| 143 | :type 'hook | ||
| 144 | :group 'calendar-tex) | ||
| 145 | |||
| 146 | (defcustom cal-tex-daily-hook nil | ||
| 147 | "*List of functions called after a LaTeX daily calendar buffer is generated." | ||
| 148 | :type 'hook | ||
| 149 | :group 'calendar-tex) | ||
| 150 | |||
| 122 | ;;; | 151 | ;;; |
| 123 | ;;; Definitions for LaTeX code | 152 | ;;; Definitions for LaTeX code |
| 124 | ;;; | 153 | ;;; |
| @@ -219,7 +248,7 @@ Preamble Includes initial definitions for various LaTeX commands. | |||
| 219 | Optional ARGS are included." | 248 | Optional ARGS are included." |
| 220 | (set-buffer (get-buffer-create cal-tex-buffer)) | 249 | (set-buffer (get-buffer-create cal-tex-buffer)) |
| 221 | (erase-buffer) | 250 | (erase-buffer) |
| 222 | (insert "\\documentstyle") | 251 | (insert "\\documentclass") |
| 223 | (if args | 252 | (if args |
| 224 | (insert "[" args "]")) | 253 | (insert "[" args "]")) |
| 225 | (insert "{article}\n" | 254 | (insert "{article}\n" |
| @@ -253,14 +282,14 @@ Optional ARGS are included." | |||
| 253 | (defun cal-tex-cursor-year (&optional arg) | 282 | (defun cal-tex-cursor-year (&optional arg) |
| 254 | "Make a buffer with LaTeX commands for the year cursor is on. | 283 | "Make a buffer with LaTeX commands for the year cursor is on. |
| 255 | Optional prefix argument specifies number of years." | 284 | Optional prefix argument specifies number of years." |
| 256 | (interactive "P") | 285 | (interactive "p") |
| 257 | (cal-tex-year (extract-calendar-year (calendar-cursor-to-date t)) | 286 | (cal-tex-year (extract-calendar-year (calendar-cursor-to-date t)) |
| 258 | (if arg arg 1))) | 287 | (if arg arg 1))) |
| 259 | 288 | ||
| 260 | (defun cal-tex-cursor-year-landscape (&optional arg) | 289 | (defun cal-tex-cursor-year-landscape (&optional arg) |
| 261 | "Make a buffer with LaTeX commands for the year cursor is on. | 290 | "Make a buffer with LaTeX commands for the year cursor is on. |
| 262 | Optional prefix argument specifies number of years." | 291 | Optional prefix argument specifies number of years." |
| 263 | (interactive "P") | 292 | (interactive "p") |
| 264 | (cal-tex-year (extract-calendar-year (calendar-cursor-to-date t)) | 293 | (cal-tex-year (extract-calendar-year (calendar-cursor-to-date t)) |
| 265 | (if arg arg 1) | 294 | (if arg arg 1) |
| 266 | t)) | 295 | t)) |
| @@ -304,7 +333,7 @@ four months each." | |||
| 304 | (defun cal-tex-cursor-filofax-year (&optional arg) | 333 | (defun cal-tex-cursor-filofax-year (&optional arg) |
| 305 | "Make a Filofax one page yearly calendar of year indicated by cursor. | 334 | "Make a Filofax one page yearly calendar of year indicated by cursor. |
| 306 | Optional parameter specifies number of years." | 335 | Optional parameter specifies number of years." |
| 307 | (interactive "P") | 336 | (interactive "p") |
| 308 | (let* ((n (if arg arg 1)) | 337 | (let* ((n (if arg arg 1)) |
| 309 | (year (extract-calendar-year (calendar-cursor-to-date t)))) | 338 | (year (extract-calendar-year (calendar-cursor-to-date t)))) |
| 310 | (cal-tex-preamble "twoside") | 339 | (cal-tex-preamble "twoside") |
| @@ -325,10 +354,13 @@ Optional parameter specifies number of years." | |||
| 325 | (insert "\n") | 354 | (insert "\n") |
| 326 | (cal-tex-noindent) | 355 | (cal-tex-noindent) |
| 327 | (cal-tex-nl) | 356 | (cal-tex-nl) |
| 328 | (calendar-for-loop i from 1 to 12 do | 357 | (let ((month-names; don't use default in case user changed it |
| 329 | (insert (cal-tex-mini-calendar i year | 358 | ["January" "February" "March" "April" "May" "June" |
| 330 | (calendar-month-name i) | 359 | "July" "August" "September" "October" "November" "December"])) |
| 331 | "1in" ".9in" "tiny" "0.6mm"))) | 360 | (calendar-for-loop i from 1 to 12 do |
| 361 | (insert (cal-tex-mini-calendar i year | ||
| 362 | (aref month-names (1- i)) | ||
| 363 | "1in" ".9in" "tiny" "0.6mm")))) | ||
| 332 | (insert | 364 | (insert |
| 333 | "\\noindent\\fbox{\\January}\\fbox{\\February}\\fbox{\\March}\\\\ | 365 | "\\noindent\\fbox{\\January}\\fbox{\\February}\\fbox{\\March}\\\\ |
| 334 | \\noindent\\fbox{\\April}\\fbox{\\May}\\fbox{\\June}\\\\ | 366 | \\noindent\\fbox{\\April}\\fbox{\\May}\\fbox{\\June}\\\\ |
| @@ -353,7 +385,7 @@ Optional parameter specifies number of years." | |||
| 353 | "Make a buffer with LaTeX commands for the month cursor is on. | 385 | "Make a buffer with LaTeX commands for the month cursor is on. |
| 354 | Optional prefix argument specifies number of months to be produced. | 386 | Optional prefix argument specifies number of months to be produced. |
| 355 | The output is in landscape format, one month to a page." | 387 | The output is in landscape format, one month to a page." |
| 356 | (interactive "P") | 388 | (interactive "p") |
| 357 | (let* ((n (if arg arg 1)) | 389 | (let* ((n (if arg arg 1)) |
| 358 | (date (calendar-cursor-to-date t)) | 390 | (date (calendar-cursor-to-date t)) |
| 359 | (month (extract-calendar-month date)) | 391 | (month (extract-calendar-month date)) |
| @@ -414,7 +446,8 @@ The output is in landscape format, one month to a page." | |||
| 414 | year))) | 446 | year))) |
| 415 | 7))) | 447 | 7))) |
| 416 | (insert "\\vspace*{-\\cellwidth}\\hspace*{-2\\cellwidth}" | 448 | (insert "\\vspace*{-\\cellwidth}\\hspace*{-2\\cellwidth}" |
| 417 | "\\lastmonth\\nextmonth")) | 449 | "\\lastmonth\\nextmonth% |
| 450 | ")) | ||
| 418 | (if (/= i n) | 451 | (if (/= i n) |
| 419 | (progn | 452 | (progn |
| 420 | (run-hooks 'cal-tex-month-hook) | 453 | (run-hooks 'cal-tex-month-hook) |
| @@ -430,7 +463,7 @@ The output is in landscape format, one month to a page." | |||
| 430 | "Make a buffer with LaTeX commands for the month cursor is on. | 463 | "Make a buffer with LaTeX commands for the month cursor is on. |
| 431 | Optional prefix argument specifies number of months to be produced. | 464 | Optional prefix argument specifies number of months to be produced. |
| 432 | Calendar is condensed onto one page." | 465 | Calendar is condensed onto one page." |
| 433 | (interactive "P") | 466 | (interactive "p") |
| 434 | (let* ((date (calendar-cursor-to-date t)) | 467 | (let* ((date (calendar-cursor-to-date t)) |
| 435 | (month (extract-calendar-month date)) | 468 | (month (extract-calendar-month date)) |
| 436 | (year (extract-calendar-year date)) | 469 | (year (extract-calendar-year date)) |
| @@ -470,6 +503,15 @@ Calendar is condensed onto one page." | |||
| 470 | (setq other-year year) | 503 | (setq other-year year) |
| 471 | (cal-tex-insert-days month year diary-list holidays | 504 | (cal-tex-insert-days month year diary-list holidays |
| 472 | cal-tex-day-prefix) | 505 | cal-tex-day-prefix) |
| 506 | (if (= (mod (calendar-absolute-from-gregorian | ||
| 507 | (list month | ||
| 508 | (calendar-last-day-of-month month year) | ||
| 509 | year)) | ||
| 510 | 7) | ||
| 511 | 6); last day of month was Saturday | ||
| 512 | (progn | ||
| 513 | (cal-tex-hfill) | ||
| 514 | (cal-tex-nl))) | ||
| 473 | (increment-calendar-month month year 1)) | 515 | (increment-calendar-month month year 1)) |
| 474 | (cal-tex-insert-blank-days-at-end end-month end-year cal-tex-day-prefix) | 516 | (cal-tex-insert-blank-days-at-end end-month end-year cal-tex-day-prefix) |
| 475 | (cal-tex-end-document))) | 517 | (cal-tex-end-document))) |
| @@ -491,7 +533,7 @@ Each day is formatted using format DAY-FORMAT." | |||
| 491 | (setq date (list month i year)) | 533 | (setq date (list month i year)) |
| 492 | (if (memq (calendar-day-of-week date) cal-tex-which-days) | 534 | (if (memq (calendar-day-of-week date) cal-tex-which-days) |
| 493 | (progn | 535 | (progn |
| 494 | (insert (format day-format (calendar-month-name month) i)) | 536 | (insert (format day-format (cal-tex-month-name month) i)) |
| 495 | (cal-tex-arg (cal-tex-latexify-list diary-list date)) | 537 | (cal-tex-arg (cal-tex-latexify-list diary-list date)) |
| 496 | (cal-tex-arg (cal-tex-latexify-list holidays date)) | 538 | (cal-tex-arg (cal-tex-latexify-list holidays date)) |
| 497 | (cal-tex-arg (eval cal-tex-daily-string)) | 539 | (cal-tex-arg (eval cal-tex-daily-string)) |
| @@ -508,16 +550,17 @@ Each day is formatted using format DAY-FORMAT." | |||
| 508 | (calendar-for-loop i from 0 to 6 do | 550 | (calendar-for-loop i from 0 to 6 do |
| 509 | (if (memq i cal-tex-which-days) | 551 | (if (memq i cal-tex-which-days) |
| 510 | (insert (format cal-tex-day-name-format | 552 | (insert (format cal-tex-day-name-format |
| 511 | (aref calendar-day-name-array | 553 | (cal-tex-LaTeXify-string |
| 512 | (mod (+ calendar-week-start-day i) 7))))) | 554 | (aref calendar-day-name-array |
| 555 | (mod (+ calendar-week-start-day i) 7)))))) | ||
| 513 | (cal-tex-comment))) | 556 | (cal-tex-comment))) |
| 514 | 557 | ||
| 515 | (defun cal-tex-insert-month-header (n month year end-month end-year) | 558 | (defun cal-tex-insert-month-header (n month year end-month end-year) |
| 516 | "Create a title for a calendar. | 559 | "Create a title for a calendar. |
| 517 | A title is inserted for a calendar with N months starting with | 560 | A title is inserted for a calendar with N months starting with |
| 518 | MONTH YEAR and ending with END-MONTH END-YEAR." | 561 | MONTH YEAR and ending with END-MONTH END-YEAR." |
| 519 | (let ( (month-name (calendar-month-name month)) | 562 | (let ((month-name (cal-tex-month-name month)) |
| 520 | (end-month-name (calendar-month-name end-month))) | 563 | (end-month-name (cal-tex-month-name end-month))) |
| 521 | (if (= 1 n) | 564 | (if (= 1 n) |
| 522 | (insert (format "\\calmonth{%s}{%s}\n\\vspace*{-0.5cm}" | 565 | (insert (format "\\calmonth{%s}{%s}\n\\vspace*{-0.5cm}" |
| 523 | month-name year) ) | 566 | month-name year) ) |
| @@ -611,7 +654,7 @@ this is only an upper bound." | |||
| 611 | It applies to the week that point is in. | 654 | It applies to the week that point is in. |
| 612 | Optional prefix argument specifies number of weeks. | 655 | Optional prefix argument specifies number of weeks. |
| 613 | Holidays are included if `cal-tex-holidays' is t." | 656 | Holidays are included if `cal-tex-holidays' is t." |
| 614 | (interactive "P") | 657 | (interactive "p") |
| 615 | (let* ((n (if arg arg 1)) | 658 | (let* ((n (if arg arg 1)) |
| 616 | (date (calendar-gregorian-from-absolute | 659 | (date (calendar-gregorian-from-absolute |
| 617 | (calendar-dayname-on-or-before | 660 | (calendar-dayname-on-or-before |
| @@ -637,7 +680,7 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 637 | (cal-tex-vspace "-1.5in") | 680 | (cal-tex-vspace "-1.5in") |
| 638 | (cal-tex-b-center) | 681 | (cal-tex-b-center) |
| 639 | (cal-tex-Huge-bf (format "\\uppercase{%s}" | 682 | (cal-tex-Huge-bf (format "\\uppercase{%s}" |
| 640 | (calendar-month-name month))) | 683 | (cal-tex-month-name month))) |
| 641 | (cal-tex-hspace "2em") | 684 | (cal-tex-hspace "2em") |
| 642 | (cal-tex-Huge-bf (number-to-string year)) | 685 | (cal-tex-Huge-bf (number-to-string year)) |
| 643 | (cal-tex-nl ".5cm") | 686 | (cal-tex-nl ".5cm") |
| @@ -662,7 +705,7 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 662 | It applies to the week that point is in. | 705 | It applies to the week that point is in. |
| 663 | Optional prefix argument specifies number of weeks. | 706 | Optional prefix argument specifies number of weeks. |
| 664 | Holidays are included if `cal-tex-holidays' is t." | 707 | Holidays are included if `cal-tex-holidays' is t." |
| 665 | (interactive "P") | 708 | (interactive "p") |
| 666 | (let* ((n (if arg arg 1)) | 709 | (let* ((n (if arg arg 1)) |
| 667 | (date (calendar-gregorian-from-absolute | 710 | (date (calendar-gregorian-from-absolute |
| 668 | (calendar-dayname-on-or-before | 711 | (calendar-dayname-on-or-before |
| @@ -689,7 +732,7 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 689 | (cal-tex-vspace "-1.5in") | 732 | (cal-tex-vspace "-1.5in") |
| 690 | (cal-tex-b-center) | 733 | (cal-tex-b-center) |
| 691 | (cal-tex-Huge-bf (format "\\uppercase{%s}" | 734 | (cal-tex-Huge-bf (format "\\uppercase{%s}" |
| 692 | (calendar-month-name month))) | 735 | (cal-tex-month-name month))) |
| 693 | (cal-tex-hspace "2em") | 736 | (cal-tex-hspace "2em") |
| 694 | (cal-tex-Huge-bf (number-to-string year)) | 737 | (cal-tex-Huge-bf (number-to-string year)) |
| 695 | (cal-tex-nl ".5cm") | 738 | (cal-tex-nl ".5cm") |
| @@ -742,7 +785,7 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 742 | Optional prefix argument specifies number of weeks. | 785 | Optional prefix argument specifies number of weeks. |
| 743 | Diary entries are included if `cal-tex-diary' is t. | 786 | Diary entries are included if `cal-tex-diary' is t. |
| 744 | Holidays are included if `cal-tex-holidays' is t." | 787 | Holidays are included if `cal-tex-holidays' is t." |
| 745 | (interactive "P") | 788 | (interactive "p") |
| 746 | (let* ((n (if arg arg 1)) | 789 | (let* ((n (if arg arg 1)) |
| 747 | (date (calendar-gregorian-from-absolute | 790 | (date (calendar-gregorian-from-absolute |
| 748 | (calendar-dayname-on-or-before | 791 | (calendar-dayname-on-or-before |
| @@ -788,9 +831,9 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 788 | (cal-tex-rule "0pt" "\\textwidth" ".2mm") | 831 | (cal-tex-rule "0pt" "\\textwidth" ".2mm") |
| 789 | (cal-tex-nl) | 832 | (cal-tex-nl) |
| 790 | (cal-tex-b-parbox "t" "\\textwidth") | 833 | (cal-tex-b-parbox "t" "\\textwidth") |
| 791 | (cal-tex-large-bf (calendar-day-name date)) | 834 | (cal-tex-large-bf (cal-tex-LaTeXify-string (calendar-day-name date))) |
| 792 | (insert ", ") | 835 | (insert ", ") |
| 793 | (cal-tex-large-bf (calendar-month-name month)) | 836 | (cal-tex-large-bf (cal-tex-month-name month)) |
| 794 | (insert " ") | 837 | (insert " ") |
| 795 | (cal-tex-large-bf (number-to-string day)) | 838 | (cal-tex-large-bf (number-to-string day)) |
| 796 | (if (not (string= "" (cal-tex-latexify-list holidays date))) | 839 | (if (not (string= "" (cal-tex-latexify-list holidays date))) |
| @@ -842,9 +885,9 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 842 | (cal-tex-cmd "\\ \\\\[-.2cm]") | 885 | (cal-tex-cmd "\\ \\\\[-.2cm]") |
| 843 | (cal-tex-cmd "\\noindent") | 886 | (cal-tex-cmd "\\noindent") |
| 844 | (cal-tex-b-parbox "l" "6.8in") | 887 | (cal-tex-b-parbox "l" "6.8in") |
| 845 | (cal-tex-large-bf (calendar-day-name date)) | 888 | (cal-tex-large-bf (cal-tex-LaTeXify-string (calendar-day-name date))) |
| 846 | (insert ", ") | 889 | (insert ", ") |
| 847 | (cal-tex-large-bf (calendar-month-name month)) | 890 | (cal-tex-large-bf (cal-tex-month-name month)) |
| 848 | (insert " ") | 891 | (insert " ") |
| 849 | (cal-tex-large-bf (number-to-string day)) | 892 | (cal-tex-large-bf (number-to-string day)) |
| 850 | (if (not (string= "" (cal-tex-latexify-list holidays date))) | 893 | (if (not (string= "" (cal-tex-latexify-list holidays date))) |
| @@ -873,7 +916,7 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 873 | It applies to the week that point is in, and starts on Monday. | 916 | It applies to the week that point is in, and starts on Monday. |
| 874 | Optional prefix argument specifies number of weeks. | 917 | Optional prefix argument specifies number of weeks. |
| 875 | Holidays are included if `cal-tex-holidays' is t." | 918 | Holidays are included if `cal-tex-holidays' is t." |
| 876 | (interactive "P") | 919 | (interactive "p") |
| 877 | (let* ((n (if arg arg 1)) | 920 | (let* ((n (if arg arg 1)) |
| 878 | (date (calendar-gregorian-from-absolute | 921 | (date (calendar-gregorian-from-absolute |
| 879 | (calendar-dayname-on-or-before | 922 | (calendar-dayname-on-or-before |
| @@ -911,12 +954,12 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 911 | (day (extract-calendar-day date)) | 954 | (day (extract-calendar-day date)) |
| 912 | (month (extract-calendar-month date)) | 955 | (month (extract-calendar-month date)) |
| 913 | (year (extract-calendar-year date)) | 956 | (year (extract-calendar-year date)) |
| 914 | (dayname (calendar-day-name date)) | 957 | (dayname (cal-tex-LaTeXify-string (calendar-day-name date))) |
| 915 | (date1 (cal-tex-incr-date date)) | 958 | (date1 (cal-tex-incr-date date)) |
| 916 | (day1 (extract-calendar-day date1)) | 959 | (day1 (extract-calendar-day date1)) |
| 917 | (month1 (extract-calendar-month date1)) | 960 | (month1 (extract-calendar-month date1)) |
| 918 | (year1 (extract-calendar-year date1)) | 961 | (year1 (extract-calendar-year date1)) |
| 919 | (dayname1 (calendar-day-name date1)) | 962 | (dayname1 (cal-tex-LaTeXify-string (calendar-day-name date1))) |
| 920 | ) | 963 | ) |
| 921 | (cal-tex-b-framebox "8cm" "l") | 964 | (cal-tex-b-framebox "8cm" "l") |
| 922 | (cal-tex-b-parbox "b" "7.5cm") | 965 | (cal-tex-b-parbox "b" "7.5cm") |
| @@ -949,7 +992,7 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 949 | Optional prefix argument specifies number of weeks. | 992 | Optional prefix argument specifies number of weeks. |
| 950 | Diary entries are included if `cal-tex-diary' is t. | 993 | Diary entries are included if `cal-tex-diary' is t. |
| 951 | Holidays are included if `cal-tex-holidays' is t." | 994 | Holidays are included if `cal-tex-holidays' is t." |
| 952 | (interactive "P") | 995 | (interactive "p") |
| 953 | (let* ((n (if arg arg 1)) | 996 | (let* ((n (if arg arg 1)) |
| 954 | (date (calendar-gregorian-from-absolute | 997 | (date (calendar-gregorian-from-absolute |
| 955 | (calendar-dayname-on-or-before | 998 | (calendar-dayname-on-or-before |
| @@ -1009,29 +1052,29 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 1009 | (if (= (extract-calendar-month date) | 1052 | (if (= (extract-calendar-month date) |
| 1010 | (extract-calendar-month d)) | 1053 | (extract-calendar-month d)) |
| 1011 | (format "%s %s" | 1054 | (format "%s %s" |
| 1012 | (calendar-month-name | 1055 | (cal-tex-month-name |
| 1013 | (extract-calendar-month date)) | 1056 | (extract-calendar-month date)) |
| 1014 | (extract-calendar-year date)) | 1057 | (extract-calendar-year date)) |
| 1015 | (if (= (extract-calendar-year date) | 1058 | (if (= (extract-calendar-year date) |
| 1016 | (extract-calendar-year d)) | 1059 | (extract-calendar-year d)) |
| 1017 | (format "%s---%s %s" | 1060 | (format "%s---%s %s" |
| 1018 | (calendar-month-name | 1061 | (cal-tex-month-name |
| 1019 | (extract-calendar-month date)) | 1062 | (extract-calendar-month date)) |
| 1020 | (calendar-month-name | 1063 | (cal-tex-month-name |
| 1021 | (extract-calendar-month d)) | 1064 | (extract-calendar-month d)) |
| 1022 | (extract-calendar-year date)) | 1065 | (extract-calendar-year date)) |
| 1023 | (format "%s %s---%s %s" | 1066 | (format "%s %s---%s %s" |
| 1024 | (calendar-month-name | 1067 | (cal-tex-month-name |
| 1025 | (extract-calendar-month date)) | 1068 | (extract-calendar-month date)) |
| 1026 | (extract-calendar-year date) | 1069 | (extract-calendar-year date) |
| 1027 | (calendar-month-name (extract-calendar-month d)) | 1070 | (cal-tex-month-name (extract-calendar-month d)) |
| 1028 | (extract-calendar-year d)))))) | 1071 | (extract-calendar-year d)))))) |
| 1029 | (insert "%\n") | 1072 | (insert "%\n") |
| 1030 | (calendar-for-loop j from 1 to 7 do | 1073 | (calendar-for-loop j from 1 to 7 do |
| 1031 | (if (= (mod i 2) 1) | 1074 | (if (= (mod i 2) 1) |
| 1032 | (insert "\\rightday") | 1075 | (insert "\\rightday") |
| 1033 | (insert "\\leftday")) | 1076 | (insert "\\leftday")) |
| 1034 | (cal-tex-arg (calendar-day-name date)) | 1077 | (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) |
| 1035 | (cal-tex-arg (int-to-string (extract-calendar-day date))) | 1078 | (cal-tex-arg (int-to-string (extract-calendar-day date))) |
| 1036 | (cal-tex-arg (cal-tex-latexify-list diary-list date)) | 1079 | (cal-tex-arg (cal-tex-latexify-list diary-list date)) |
| 1037 | (cal-tex-arg (cal-tex-latexify-list holidays date)) | 1080 | (cal-tex-arg (cal-tex-latexify-list holidays date)) |
| @@ -1051,7 +1094,7 @@ Optional prefix argument specifies number of weeks. | |||
| 1051 | Weeks start on Monday. | 1094 | Weeks start on Monday. |
| 1052 | Diary entries are included if `cal-tex-diary' is t. | 1095 | Diary entries are included if `cal-tex-diary' is t. |
| 1053 | Holidays are included if `cal-tex-holidays' is t." | 1096 | Holidays are included if `cal-tex-holidays' is t." |
| 1054 | (interactive "P") | 1097 | (interactive "p") |
| 1055 | (let* ((n (if arg arg 1)) | 1098 | (let* ((n (if arg arg 1)) |
| 1056 | (date (calendar-gregorian-from-absolute | 1099 | (date (calendar-gregorian-from-absolute |
| 1057 | (calendar-dayname-on-or-before | 1100 | (calendar-dayname-on-or-before |
| @@ -1118,27 +1161,27 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 1118 | (if (= (extract-calendar-month date) | 1161 | (if (= (extract-calendar-month date) |
| 1119 | (extract-calendar-month d)) | 1162 | (extract-calendar-month d)) |
| 1120 | (format "%s %s" | 1163 | (format "%s %s" |
| 1121 | (calendar-month-name | 1164 | (cal-tex-month-name |
| 1122 | (extract-calendar-month date)) | 1165 | (extract-calendar-month date)) |
| 1123 | (extract-calendar-year date)) | 1166 | (extract-calendar-year date)) |
| 1124 | (if (= (extract-calendar-year date) | 1167 | (if (= (extract-calendar-year date) |
| 1125 | (extract-calendar-year d)) | 1168 | (extract-calendar-year d)) |
| 1126 | (format "%s---%s %s" | 1169 | (format "%s---%s %s" |
| 1127 | (calendar-month-name | 1170 | (cal-tex-month-name |
| 1128 | (extract-calendar-month date)) | 1171 | (extract-calendar-month date)) |
| 1129 | (calendar-month-name | 1172 | (cal-tex-month-name |
| 1130 | (extract-calendar-month d)) | 1173 | (extract-calendar-month d)) |
| 1131 | (extract-calendar-year date)) | 1174 | (extract-calendar-year date)) |
| 1132 | (format "%s %s---%s %s" | 1175 | (format "%s %s---%s %s" |
| 1133 | (calendar-month-name | 1176 | (cal-tex-month-name |
| 1134 | (extract-calendar-month date)) | 1177 | (extract-calendar-month date)) |
| 1135 | (extract-calendar-year date) | 1178 | (extract-calendar-year date) |
| 1136 | (calendar-month-name (extract-calendar-month d)) | 1179 | (cal-tex-month-name (extract-calendar-month d)) |
| 1137 | (extract-calendar-year d)))))) | 1180 | (extract-calendar-year d)))))) |
| 1138 | (insert "%\n") | 1181 | (insert "%\n") |
| 1139 | (calendar-for-loop j from 1 to 3 do | 1182 | (calendar-for-loop j from 1 to 3 do |
| 1140 | (insert "\\leftday") | 1183 | (insert "\\leftday") |
| 1141 | (cal-tex-arg (calendar-day-name date)) | 1184 | (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) |
| 1142 | (cal-tex-arg (int-to-string (extract-calendar-day date))) | 1185 | (cal-tex-arg (int-to-string (extract-calendar-day date))) |
| 1143 | (cal-tex-arg (cal-tex-latexify-list diary-list date)) | 1186 | (cal-tex-arg (cal-tex-latexify-list diary-list date)) |
| 1144 | (cal-tex-arg (cal-tex-latexify-list holidays date)) | 1187 | (cal-tex-arg (cal-tex-latexify-list holidays date)) |
| @@ -1153,27 +1196,27 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 1153 | (if (= (extract-calendar-month date) | 1196 | (if (= (extract-calendar-month date) |
| 1154 | (extract-calendar-month d)) | 1197 | (extract-calendar-month d)) |
| 1155 | (format "%s %s" | 1198 | (format "%s %s" |
| 1156 | (calendar-month-name | 1199 | (cal-tex-month-name |
| 1157 | (extract-calendar-month date)) | 1200 | (extract-calendar-month date)) |
| 1158 | (extract-calendar-year date)) | 1201 | (extract-calendar-year date)) |
| 1159 | (if (= (extract-calendar-year date) | 1202 | (if (= (extract-calendar-year date) |
| 1160 | (extract-calendar-year d)) | 1203 | (extract-calendar-year d)) |
| 1161 | (format "%s---%s %s" | 1204 | (format "%s---%s %s" |
| 1162 | (calendar-month-name | 1205 | (cal-tex-month-name |
| 1163 | (extract-calendar-month date)) | 1206 | (extract-calendar-month date)) |
| 1164 | (calendar-month-name | 1207 | (cal-tex-month-name |
| 1165 | (extract-calendar-month d)) | 1208 | (extract-calendar-month d)) |
| 1166 | (extract-calendar-year date)) | 1209 | (extract-calendar-year date)) |
| 1167 | (format "%s %s---%s %s" | 1210 | (format "%s %s---%s %s" |
| 1168 | (calendar-month-name | 1211 | (cal-tex-month-name |
| 1169 | (extract-calendar-month date)) | 1212 | (extract-calendar-month date)) |
| 1170 | (extract-calendar-year date) | 1213 | (extract-calendar-year date) |
| 1171 | (calendar-month-name (extract-calendar-month d)) | 1214 | (cal-tex-month-name (extract-calendar-month d)) |
| 1172 | (extract-calendar-year d)))))) | 1215 | (extract-calendar-year d)))))) |
| 1173 | (insert "%\n") | 1216 | (insert "%\n") |
| 1174 | (calendar-for-loop j from 1 to 2 do | 1217 | (calendar-for-loop j from 1 to 2 do |
| 1175 | (insert "\\rightday") | 1218 | (insert "\\rightday") |
| 1176 | (cal-tex-arg (calendar-day-name date)) | 1219 | (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) |
| 1177 | (cal-tex-arg (int-to-string (extract-calendar-day date))) | 1220 | (cal-tex-arg (int-to-string (extract-calendar-day date))) |
| 1178 | (cal-tex-arg (cal-tex-latexify-list diary-list date)) | 1221 | (cal-tex-arg (cal-tex-latexify-list diary-list date)) |
| 1179 | (cal-tex-arg (cal-tex-latexify-list holidays date)) | 1222 | (cal-tex-arg (cal-tex-latexify-list holidays date)) |
| @@ -1182,7 +1225,7 @@ Holidays are included if `cal-tex-holidays' is t." | |||
| 1182 | (setq date (cal-tex-incr-date date))) | 1225 | (setq date (cal-tex-incr-date date))) |
| 1183 | (calendar-for-loop j from 1 to 2 do | 1226 | (calendar-for-loop j from 1 to 2 do |
| 1184 | (insert "\\weekend") | 1227 | (insert "\\weekend") |
| 1185 | (cal-tex-arg (calendar-day-name date)) | 1228 | (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) |
| 1186 | (cal-tex-arg (int-to-string (extract-calendar-day date))) | 1229 | (cal-tex-arg (int-to-string (extract-calendar-day date))) |
| 1187 | (cal-tex-arg (cal-tex-latexify-list diary-list date)) | 1230 | (cal-tex-arg (cal-tex-latexify-list diary-list date)) |
| 1188 | (cal-tex-arg (cal-tex-latexify-list holidays date)) | 1231 | (cal-tex-arg (cal-tex-latexify-list holidays date)) |
| @@ -1202,7 +1245,7 @@ Optional prefix argument specifies number of weeks. Weeks start on Monday. | |||
| 1202 | Diary entries are included if `cal-tex-diary' is t. | 1245 | Diary entries are included if `cal-tex-diary' is t. |
| 1203 | Holidays are included if `cal-tex-holidays' is t. | 1246 | Holidays are included if `cal-tex-holidays' is t. |
| 1204 | Pages are ruled if `cal-tex-rules' is t." | 1247 | Pages are ruled if `cal-tex-rules' is t." |
| 1205 | (interactive "P") | 1248 | (interactive "p") |
| 1206 | (let* ((n (if arg arg 1)) | 1249 | (let* ((n (if arg arg 1)) |
| 1207 | (date (calendar-gregorian-from-absolute | 1250 | (date (calendar-gregorian-from-absolute |
| 1208 | (calendar-dayname-on-or-before | 1251 | (calendar-dayname-on-or-before |
| @@ -1311,7 +1354,7 @@ Pages are ruled if `cal-tex-rules' is t." | |||
| 1311 | (defun cal-tex-cursor-day (&optional arg) | 1354 | (defun cal-tex-cursor-day (&optional arg) |
| 1312 | "Make a buffer with LaTeX commands for the day cursor is on. | 1355 | "Make a buffer with LaTeX commands for the day cursor is on. |
| 1313 | Optional prefix argument specifies number of days." | 1356 | Optional prefix argument specifies number of days." |
| 1314 | (interactive "P") | 1357 | (interactive "p") |
| 1315 | (let ((n (if arg arg 1)) | 1358 | (let ((n (if arg arg 1)) |
| 1316 | (date (calendar-absolute-from-gregorian (calendar-cursor-to-date t)))) | 1359 | (date (calendar-absolute-from-gregorian (calendar-cursor-to-date t)))) |
| 1317 | (cal-tex-preamble "12pt") | 1360 | (cal-tex-preamble "12pt") |
| @@ -1333,7 +1376,7 @@ Optional prefix argument specifies number of days." | |||
| 1333 | (defun cal-tex-daily-page (date) | 1376 | (defun cal-tex-daily-page (date) |
| 1334 | "Make a calendar page for Gregorian DATE on 8.5 by 11 paper." | 1377 | "Make a calendar page for Gregorian DATE on 8.5 by 11 paper." |
| 1335 | (let* ((hour) | 1378 | (let* ((hour) |
| 1336 | (month-name (calendar-month-name (extract-calendar-month date)))) | 1379 | (month-name (cal-tex-month-name (extract-calendar-month date)))) |
| 1337 | (cal-tex-banner "cal-tex-daily-page") | 1380 | (cal-tex-banner "cal-tex-daily-page") |
| 1338 | (cal-tex-b-makebox "4cm" "l") | 1381 | (cal-tex-b-makebox "4cm" "l") |
| 1339 | (cal-tex-b-parbox "b" "3.8cm") | 1382 | (cal-tex-b-parbox "b" "3.8cm") |
| @@ -1348,7 +1391,7 @@ Optional prefix argument specifies number of days." | |||
| 1348 | (cal-tex-e-makebox) | 1391 | (cal-tex-e-makebox) |
| 1349 | (cal-tex-hfill) | 1392 | (cal-tex-hfill) |
| 1350 | (cal-tex-b-makebox "4cm" "r") | 1393 | (cal-tex-b-makebox "4cm" "r") |
| 1351 | (cal-tex-bf (calendar-day-name date)) | 1394 | (cal-tex-bf (cal-tex-LaTeXify-string (calendar-day-name date))) |
| 1352 | (cal-tex-e-makebox) | 1395 | (cal-tex-e-makebox) |
| 1353 | (cal-tex-nl) | 1396 | (cal-tex-nl) |
| 1354 | (cal-tex-hspace ".4cm") | 1397 | (cal-tex-hspace ".4cm") |
| @@ -1420,18 +1463,20 @@ COLSEP gives the column separation; 1mm is the default." | |||
| 1420 | "}}r@{\\hspace{" colsep "}}r@{\\hspace{" colsep | 1463 | "}}r@{\\hspace{" colsep "}}r@{\\hspace{" colsep |
| 1421 | "}}r@{\\hspace{" colsep "}}r@{\\hspace{0mm}}}%\n" | 1464 | "}}r@{\\hspace{" colsep "}}r@{\\hspace{0mm}}}%\n" |
| 1422 | "\\multicolumn{7}{c}{" | 1465 | "\\multicolumn{7}{c}{" |
| 1423 | (calendar-month-name month) | 1466 | (cal-tex-month-name month) |
| 1424 | " " | 1467 | " " |
| 1425 | (int-to-string year) | 1468 | (int-to-string year) |
| 1426 | "}\\\\[1mm]\n"))) | 1469 | "}\\\\[1mm]\n"))) |
| 1427 | (calendar-for-loop i from 0 to 6 do | 1470 | (calendar-for-loop i from 0 to 6 do |
| 1428 | (setq str (concat str | 1471 | (setq str |
| 1429 | (substring (aref calendar-day-name-array | 1472 | (concat str |
| 1430 | (mod (+ calendar-week-start-day i) 7)) | 1473 | (cal-tex-LaTeXify-string |
| 1431 | 0 2) | 1474 | (substring (aref calendar-day-name-array |
| 1432 | (if (/= i 6) | 1475 | (mod (+ calendar-week-start-day i) 7)) |
| 1433 | " & " | 1476 | 0 2)) |
| 1434 | "\\\\[0.7mm]\n")))) | 1477 | (if (/= i 6) |
| 1478 | " & " | ||
| 1479 | "\\\\[0.7mm]\n")))) | ||
| 1435 | (calendar-for-loop i from 1 to blank-days do | 1480 | (calendar-for-loop i from 1 to blank-days do |
| 1436 | (setq str (concat str " & "))) | 1481 | (setq str (concat str " & "))) |
| 1437 | (calendar-for-loop i from 1 to last do | 1482 | (calendar-for-loop i from 1 to last do |
| @@ -1453,7 +1498,7 @@ If optional N is given, the date of N days after DATE." | |||
| 1453 | (+ (if n n 1) (calendar-absolute-from-gregorian date)))) | 1498 | (+ (if n n 1) (calendar-absolute-from-gregorian date)))) |
| 1454 | 1499 | ||
| 1455 | (defun cal-tex-latexify-list (date-list date &optional separator final-separator) | 1500 | (defun cal-tex-latexify-list (date-list date &optional separator final-separator) |
| 1456 | "Return string with concatenated, LaTeXified entries in DATE_LIST for DATE. | 1501 | "Return string with concatenated, LaTeXified entries in DATE-LIST for DATE. |
| 1457 | Use double backslash as a separator unless optional SEPARATOR is given. | 1502 | Use double backslash as a separator unless optional SEPARATOR is given. |
| 1458 | If resulting string is not empty, put separator at end if optional | 1503 | If resulting string is not empty, put separator at end if optional |
| 1459 | FINAL-SEPARATOR is t." | 1504 | FINAL-SEPARATOR is t." |
| @@ -1574,6 +1619,10 @@ without erasing current contents." | |||
| 1574 | (setq head (concat head (if pair (cdr pair) ch))))) | 1619 | (setq head (concat head (if pair (cdr pair) ch))))) |
| 1575 | head))) | 1620 | head))) |
| 1576 | 1621 | ||
| 1622 | (defun cal-tex-month-name (month) | ||
| 1623 | "The name of MONTH, LaTeXified." | ||
| 1624 | (cal-tex-LaTeXify-string (calendar-month-name month))) | ||
| 1625 | |||
| 1577 | (defun cal-tex-hfill () "Insert hfill." (insert "\\hfill")) | 1626 | (defun cal-tex-hfill () "Insert hfill." (insert "\\hfill")) |
| 1578 | 1627 | ||
| 1579 | (defun cal-tex-newpage () "Insert newpage." (insert "\\newpage%\n")) | 1628 | (defun cal-tex-newpage () "Insert newpage." (insert "\\newpage%\n")) |