X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/35fb32880c99aa7cd41b835dc17b8639b544dc69..b96e5814f9fdb124f283b8051cc11d667d948d01:/lisp/calendar/cal-tex.el diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el index 0e320ff8f9..c8c80370df 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el @@ -1,13 +1,13 @@ ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX -;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc. ;; Author: Steve Fisk ;; Edward M. Reingold ;; Maintainer: Glenn Morris ;; Keywords: calendar ;; Human-Keywords: Calendar, LaTeX +;; Package: calendar ;; This file is part of GNU Emacs. @@ -134,7 +134,7 @@ At present, this only affects `cal-tex-cursor-day'." (defcustom cal-tex-daily-end 20 "The last hour of the daily LaTeX calendar page. -At present, this only affects `cal-tex-cursor-day'" +At present, this only affects `cal-tex-cursor-day'." :type 'integer :group 'calendar-tex) @@ -237,31 +237,9 @@ The names are taken from `calendar-day-name-array'.") "LaTeX code to insert one box with date info in calendar. This definition is the heart of the calendar!") -(autoload 'calendar-holiday-list "holidays") - -(defun cal-tex-list-holidays (d1 d2) - "Generate a list of all holidays from absolute date D1 to D2." - (let* ((start (calendar-gregorian-from-absolute d1)) - (displayed-month (calendar-extract-month start)) - (displayed-year (calendar-extract-year start)) - (end (calendar-gregorian-from-absolute d2)) - (end-month (calendar-extract-month end)) - (end-year (calendar-extract-year end)) - (number-of-intervals - (1+ (/ (calendar-interval displayed-month displayed-year - end-month end-year) - 3))) - holidays in-range a) - (calendar-increment-month displayed-month displayed-year 1) - (dotimes (idummy number-of-intervals) - (setq holidays (append holidays (calendar-holiday-list))) - (calendar-increment-month displayed-month displayed-year 3)) - (dolist (hol holidays) - (and (car hol) - (setq a (calendar-absolute-from-gregorian (car hol))) - (and (<= d1 a) (<= a d2)) - (setq in-range (append (list hol) in-range)))) - in-range)) +(autoload 'holiday-in-range "holidays") + +(define-obsolete-function-alias 'cal-tex-list-holidays 'holiday-in-range "24.3") (autoload 'diary-list-entries "diary-lib") @@ -446,7 +424,7 @@ Optional EVENT indicates a buffer position to use instead of point." (calendar-last-day-of-month end-month end-year) end-year)))) (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2))) - (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2))) + (holidays (if cal-tex-holidays (holiday-in-range d1 d2))) other-month other-year small-months-at-start) (cal-tex-insert-preamble (cal-tex-number-weeks month year 1) t "12pt") (cal-tex-cmd cal-tex-cal-one-month) @@ -507,6 +485,7 @@ indicates a buffer position to use instead of point." (year (calendar-extract-year date)) (end-month month) (end-year year) + ;; FIXME -landscape sets cal-tex-which-days? (d1 (calendar-absolute-from-gregorian (list month 1 year))) (d2 (progn (calendar-increment-month end-month end-year (1- n)) @@ -515,8 +494,7 @@ indicates a buffer position to use instead of point." (calendar-last-day-of-month end-month end-year) end-year)))) (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2))) - (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2))) - other-month other-year) + (holidays (if cal-tex-holidays (holiday-in-range d1 d2)))) (cal-tex-insert-preamble (cal-tex-number-weeks month year n) nil "12pt") (if (> n 1) (cal-tex-cmd cal-tex-cal-multi-month) @@ -525,15 +503,13 @@ indicates a buffer position to use instead of point." (cal-tex-insert-day-names) (cal-tex-nl ".2cm") (cal-tex-insert-blank-days month year cal-tex-day-prefix) - (dotimes (idummy n) - (setq other-month month - other-year year) + (dotimes (_idummy n) (cal-tex-insert-days month year diary-list holidays cal-tex-day-prefix) - (when (= 6 (mod (calendar-absolute-from-gregorian - (list month - (calendar-last-day-of-month month year) - year)) - 7)) ; last day of month was Saturday + (when (= (calendar-week-end-day) + (calendar-day-of-week + (list month + (calendar-last-day-of-month month year) + year))) ; last day of month was last day of week (cal-tex-hfill) (cal-tex-nl)) (calendar-increment-month month year 1)) @@ -570,13 +546,14 @@ are included. Each day is formatted using format DAY-FORMAT." (defun cal-tex-insert-day-names () "Insert the names of the days at top of a monthly calendar." - (dotimes (i 7) - (if (memq i cal-tex-which-days) - (insert (format cal-tex-day-name-format - (cal-tex-LaTeXify-string - (aref calendar-day-name-array - (mod (+ calendar-week-start-day i) 7)))))) - (cal-tex-comment))) + (let (j) + (dotimes (i 7) + (if (memq (setq j (mod (+ calendar-week-start-day i) 7)) + cal-tex-which-days) + (insert (format cal-tex-day-name-format + (cal-tex-LaTeXify-string + (aref calendar-day-name-array j))))) + (cal-tex-comment)))) (defun cal-tex-insert-month-header (n month year end-month end-year) "Create a title for a calendar. @@ -603,7 +580,7 @@ blank, no days are inserted." calendar-week-start-day) 7))) (dotimes (i blank-days) - (if (memq i cal-tex-which-days) + (if (memq (mod (+ calendar-week-start-day i) 7) cal-tex-which-days) (insert (format day-format " " " ") "{}{}{}{}%\n")))))) (defun cal-tex-insert-blank-days-at-end (month year day-format) @@ -619,42 +596,41 @@ The entry is formatted using DAY-FORMAT." 7)) (i blank-days)) (while (<= (setq i (1+ i)) 6) - (if (memq i cal-tex-which-days) + (if (memq (mod (+ calendar-week-start-day i) 7) cal-tex-which-days) (insert (format day-format "" "") "{}{}{}{}%\n")))))) (defun cal-tex-first-blank-p (month year) "Determine if any days of the first week will be printed. Return t if there will there be any days of the first week printed in the calendar starting in MONTH YEAR." - (let (any-days the-saturday) ; the day of week of 1st Saturday - (dotimes (i 7) - (if (= 6 (calendar-day-of-week (list month (1+ i) year))) - (setq the-saturday (1+ i)))) - (dotimes (i the-saturday) - (if (memq (calendar-day-of-week (list month (1+ i) year)) - cal-tex-which-days) - (setq any-days t))) - any-days)) + ;; Check days 1-7 of the month, until we find the last day of the week. + (catch 'found + (let (dow) + (dotimes (i 7) + (if (memq (setq dow (calendar-day-of-week (list month (1+ i) year))) + cal-tex-which-days) + (throw 'found t) + (if (= dow (calendar-week-end-day)) (throw 'found nil))))))) (defun cal-tex-last-blank-p (month year) "Determine if any days of the last week will be printed. Return t if there will there be any days of the last week printed in the calendar starting in MONTH YEAR." - (let* ((last-day (calendar-last-day-of-month month year)) - (i (- last-day 7)) - any-days the-sunday) ; the day of week of last Sunday - (while (<= (setq i (1+ i)) last-day) - (if (zerop (calendar-day-of-week (list month i year))) - (setq the-sunday i))) - (setq i (1- the-sunday)) - (while (<= (setq i (1+ i)) last-day) - (if (memq (calendar-day-of-week (list month i year)) cal-tex-which-days) - (setq any-days t))) - any-days)) + ;; Check backwards from the last day of the month, until we find the + ;; start of the last week in the month. + (catch 'found + (let ((last-day (calendar-last-day-of-month month year)) + dow) + (dotimes (i 7) + (if (memq (setq dow (calendar-day-of-week + (list month (- last-day i) year))) + cal-tex-which-days) + (throw 'found t) + (if (= dow calendar-week-start-day) (throw 'found nil))))))) (defun cal-tex-number-weeks (month year n) "Determine the number of weeks in a range of dates. -Compute the number of weeks in the calendar starting with MONTH and YEAR, +Compute the number of weeks in the calendar starting with MONTH and YEAR, and lasting N months, including only the days in WHICH-DAYS. As it stands, this is only an upper bound." (let ((d (list month 1 year))) @@ -683,7 +659,7 @@ this is only an upper bound." (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 the number of weeks (default 1). The calendar +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." (interactive (list (prefix-numeric-value current-prefix-arg) @@ -699,7 +675,7 @@ entries are not shown). The calendar shows the hours 8-12am, 1-5pm." (d1 (calendar-absolute-from-gregorian date)) (d2 (+ (* 7 n) d1)) (holidays (if cal-tex-holidays - (cal-tex-list-holidays d1 d2)))) + (holiday-in-range d1 d2)))) (cal-tex-preamble "11pt") (cal-tex-cmd "\\textwidth 6.5in") (cal-tex-cmd "\\textheight 10.5in") @@ -719,7 +695,7 @@ entries are not shown). The calendar shows the hours 8-12am, 1-5pm." (cal-tex-e-center) (cal-tex-hspace "-.2in") (cal-tex-b-parbox "l" "7in") - (dotimes (jdummy 7) + (dotimes (_jdummy 7) (cal-tex-week-hours date holidays "3.1") (setq date (cal-tex-incr-date date))) (cal-tex-e-parbox) @@ -751,11 +727,10 @@ Optional EVENT indicates a buffer position to use instead of point." (calendar-cursor-to-date t event))))) (month (calendar-extract-month date)) (year (calendar-extract-year date)) - (d date) (d1 (calendar-absolute-from-gregorian date)) (d2 (+ (* 7 n) d1)) (holidays (if cal-tex-holidays - (cal-tex-list-holidays d1 d2)))) + (holiday-in-range d1 d2)))) (cal-tex-preamble "12pt") (cal-tex-cmd "\\textwidth 6.5in") (cal-tex-cmd "\\textheight 10.5in") @@ -775,7 +750,7 @@ Optional EVENT indicates a buffer position to use instead of point." (cal-tex-e-center) (cal-tex-hspace "-.2in") (cal-tex-b-parbox "l" "\\textwidth") - (dotimes (jdummy 3) + (dotimes (_jdummy 3) (cal-tex-week-hours date holidays "5") (setq date (cal-tex-incr-date date))) (cal-tex-e-parbox) @@ -803,7 +778,7 @@ Optional EVENT indicates a buffer position to use instead of point." (insert "}") (cal-tex-nl) (cal-tex-b-parbox "l" "\\textwidth") - (dotimes (jdummy 4) + (dotimes (_jdummy 4) (cal-tex-week-hours date holidays "5") (setq date (cal-tex-incr-date date))) (cal-tex-e-parbox) @@ -839,7 +814,7 @@ position to use instead of point." (d1 (calendar-absolute-from-gregorian date)) (d2 (+ (* 7 n) d1)) (holidays (if cal-tex-holidays - (cal-tex-list-holidays d1 d2))) + (holiday-in-range d1 d2))) (diary-list (if cal-tex-diary (cal-tex-list-diary-entries ;; FIXME d1? @@ -865,7 +840,7 @@ position to use instead of point." (cal-tex-nl ".5cm") (cal-tex-e-center) (cal-tex-b-parbox "l" "\\textwidth") - (dotimes (j 7) + (dotimes (_j 7) (cal-tex-b-parbox "t" "\\textwidth") (cal-tex-b-parbox "t" "\\textwidth") (cal-tex-rule "0pt" "\\textwidth" ".2mm") @@ -1034,6 +1009,168 @@ shown are hard-coded to 8-12, 13-17." (cal-tex-e-framebox) (cal-tex-hspace "1cm"))) +(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." + (interactive (list (prefix-numeric-value current-prefix-arg) + last-nonmenu-event)) + (or n (setq n 1)) + (let* ((date (calendar-gregorian-from-absolute + (calendar-dayname-on-or-before + 1 + (calendar-absolute-from-gregorian + (calendar-cursor-to-date t event))))) + (month (calendar-extract-month date)) + (year (calendar-extract-year date)) + (day (calendar-extract-day date)) + (d1 (calendar-absolute-from-gregorian date)) + (d2 (+ (* 7 n) d1)) + (holidays (if cal-tex-holidays + (holiday-in-range d1 d2))) + (diary-list (if cal-tex-diary + (cal-tex-list-diary-entries d1 d2)))) + (cal-tex-preamble "twoside,12pt") + (cal-tex-cmd "\\usepackage{color}") + (cal-tex-cmd "\\textwidth 7in") + (cal-tex-cmd "\\textheight 10.5in") + (cal-tex-cmd "\\oddsidemargin 0in") + (cal-tex-cmd "\\evensidemargin 0in") + (cal-tex-cmd "\\topmargin 0pt") + (cal-tex-cmd "\\headheight -0.875in") + (cal-tex-cmd "\\headsep 0.125in") + (cal-tex-cmd "\\footskip .125in") + (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]} +\\long\\def\\rightday#1#2#3#4#5{% + \\rule{\\textwidth}{0.3pt}\\\\% + \\hbox to \\textwidth{% + \\vbox to 2.75in{% + \\vspace*{2pt}% + \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% + \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em \\textcolor{red}{#4}}}% + \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize \\textcolor{blue}{#3}}}}}\\\\} +\\long\\def\\weekend#1#2#3#4#5{% + \\rule{\\textwidth}{0.3pt}\\\\% + \\hbox to \\textwidth{% + \\vbox to 1.8in{% + \\vspace*{2pt}% + \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% + \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em \\textcolor{red}{#4}}}% + \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize \\textcolor{blue}{#3}}}}}\\\\} +\\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]} +\\long\\def\\leftday#1#2#3#4#5{% + \\rule{\\textwidth}{0.3pt}\\\\% + \\hbox to \\textwidth{% + \\vbox to 2.75in{% + \\vspace*{2pt}% + \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}% + \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em \\textcolor{red}{#4}}}% + \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize \\textcolor{blue}{#3}}}}}\\\\} +") + (cal-tex-b-document) + (cal-tex-cmd "\\pagestyle{empty}\\ ") + (cal-tex-newpage) + (dotimes (i n) + (insert "\\lefthead") + (cal-tex-arg + (let ((d (cal-tex-incr-date date 2))) + (if (= (calendar-extract-month date) + (calendar-extract-month d)) + (format "%s %s" + (cal-tex-month-name (calendar-extract-month date)) + (calendar-extract-year date)) + (if (= (calendar-extract-year date) + (calendar-extract-year d)) + (format "%s---%s %s" + (cal-tex-month-name (calendar-extract-month date)) + (cal-tex-month-name (calendar-extract-month d)) + (calendar-extract-year date)) + (format "%s %s---%s %s" + (cal-tex-month-name (calendar-extract-month date)) + (calendar-extract-year date) + (cal-tex-month-name (calendar-extract-month d)) + (calendar-extract-year d)))))) + (insert "%\n") + (dotimes (_jdummy 3) + (insert "\\leftday") + (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) + (cal-tex-arg (number-to-string (calendar-extract-day date))) + (cal-tex-arg (cal-tex-latexify-list diary-list date)) + (cal-tex-arg (cal-tex-latexify-list holidays date)) + (cal-tex-arg (eval cal-tex-daily-string)) + (insert "%\n") + (setq date (cal-tex-incr-date date))) + (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n") + (cal-tex-nl) + (insert (cal-tex-mini-calendar + (calendar-extract-month (cal-tex-previous-month date)) + (calendar-extract-year (cal-tex-previous-month date)) + "lastmonth" "1.1in" "1in")) + (insert (cal-tex-mini-calendar + (calendar-extract-month date) + (calendar-extract-year date) + "thismonth" "1.1in" "1in")) + (insert (cal-tex-mini-calendar + (calendar-extract-month (cal-tex-next-month date)) + (calendar-extract-year (cal-tex-next-month date)) + "nextmonth" "1.1in" "1in")) + (insert "\\hbox to \\textwidth{") + (cal-tex-hfill) + (insert "\\lastmonth") + (cal-tex-hfill) + (insert "\\thismonth") + (cal-tex-hfill) + (insert "\\nextmonth") + (cal-tex-hfill) + (insert "}") + (cal-tex-newpage) + (insert "\\righthead") + (cal-tex-arg + (let ((d (cal-tex-incr-date date 3))) + (if (= (calendar-extract-month date) + (calendar-extract-month d)) + (format "%s %s" + (cal-tex-month-name (calendar-extract-month date)) + (calendar-extract-year date)) + (if (= (calendar-extract-year date) + (calendar-extract-year d)) + (format "%s---%s %s" + (cal-tex-month-name (calendar-extract-month date)) + (cal-tex-month-name (calendar-extract-month d)) + (calendar-extract-year date)) + (format "%s %s---%s %s" + (cal-tex-month-name (calendar-extract-month date)) + (calendar-extract-year date) + (cal-tex-month-name (calendar-extract-month d)) + (calendar-extract-year d)))))) + (insert "%\n") + (dotimes (_jdummy 2) + (insert "\\rightday") + (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) + (cal-tex-arg (number-to-string (calendar-extract-day date))) + (cal-tex-arg (cal-tex-latexify-list diary-list date)) + (cal-tex-arg (cal-tex-latexify-list holidays date)) + (cal-tex-arg (eval cal-tex-daily-string)) + (insert "%\n") + (setq date (cal-tex-incr-date date))) + (dotimes (_jdummy 2) + (insert "\\weekend") + (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) + (cal-tex-arg (number-to-string (calendar-extract-day date))) + (cal-tex-arg (cal-tex-latexify-list diary-list date)) + (cal-tex-arg (cal-tex-latexify-list holidays date)) + (cal-tex-arg (eval cal-tex-daily-string)) + (insert "%\n") + (setq date (cal-tex-incr-date date))) + (unless (= i (1- n)) + (run-hooks 'cal-tex-week-hook) + (cal-tex-newpage))) + (cal-tex-end-document) + (run-hooks 'cal-tex-hook))) + ;;;###cal-autoload (defun cal-tex-cursor-filofax-2week (&optional n event) "Two-weeks-at-a-glance Filofax style calendar for week cursor is in. @@ -1055,7 +1192,7 @@ Optional EVENT indicates a buffer position to use instead of point." (d1 (calendar-absolute-from-gregorian date)) (d2 (+ (* 7 n) d1)) (holidays (if cal-tex-holidays - (cal-tex-list-holidays d1 d2))) + (holiday-in-range d1 d2))) (diary-list (if cal-tex-diary (cal-tex-list-diary-entries ;; FIXME d1? @@ -1114,7 +1251,7 @@ Optional EVENT indicates a buffer position to use instead of point." (cal-tex-month-name (calendar-extract-month d)) (calendar-extract-year d)))))) (insert "%\n") - (dotimes (jdummy 7) + (dotimes (_jdummy 7) (if (zerop (mod i 2)) (insert "\\rightday") (insert "\\leftday")) @@ -1152,7 +1289,7 @@ Optional EVENT indicates a buffer position to use instead of point." (d1 (calendar-absolute-from-gregorian date)) (d2 (+ (* 7 n) d1)) (holidays (if cal-tex-holidays - (cal-tex-list-holidays d1 d2))) + (holiday-in-range d1 d2))) (diary-list (if cal-tex-diary (cal-tex-list-diary-entries ;; FIXME d1? @@ -1218,7 +1355,7 @@ Optional EVENT indicates a buffer position to use instead of point." (cal-tex-month-name (calendar-extract-month d)) (calendar-extract-year d)))))) (insert "%\n") - (dotimes (jdummy 3) + (dotimes (_jdummy 3) (insert "\\leftday") (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) (cal-tex-arg (number-to-string (calendar-extract-day date))) @@ -1249,7 +1386,7 @@ Optional EVENT indicates a buffer position to use instead of point." (cal-tex-month-name (calendar-extract-month d)) (calendar-extract-year d)))))) (insert "%\n") - (dotimes (jdummy 2) + (dotimes (_jdummy 2) (insert "\\rightday") (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) (cal-tex-arg (number-to-string (calendar-extract-day date))) @@ -1258,7 +1395,7 @@ Optional EVENT indicates a buffer position to use instead of point." (cal-tex-arg (eval cal-tex-daily-string)) (insert "%\n") (setq date (cal-tex-incr-date date))) - (dotimes (jdummy 2) + (dotimes (_jdummy 2) (insert "\\weekend") (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) (cal-tex-arg (number-to-string (calendar-extract-day date))) @@ -1295,7 +1432,7 @@ Optional EVENT indicates a buffer position to use instead of point." (d1 (calendar-absolute-from-gregorian date)) (d2 (+ (* 7 n) d1)) (holidays (if cal-tex-holidays - (cal-tex-list-holidays d1 d2))) + (holiday-in-range d1 d2))) (diary-list (if cal-tex-diary (cal-tex-list-diary-entries ;; FIXME d1? @@ -1364,7 +1501,7 @@ Optional EVENT indicates a buffer position to use instead of point." (cal-tex-newpage) (setq date (cal-tex-incr-date date))) (insert "%\n") - (dotimes (jdummy 2) + (dotimes (_jdummy 2) (insert "\\lefthead") (cal-tex-arg (calendar-date-string date)) (insert "\\weekend") @@ -1499,7 +1636,7 @@ Optional string COLSEP gives the column separation (default \"1mm\")." (- (calendar-day-of-week (list month 1 year)) calendar-week-start-day) 7)) - (last (calendar-last-day-of-month month year)) + (last( calendar-last-day-of-month month year)) (str (concat "\\def\\" name "{\\hbox to" width "{%\n" "\\vbox to" height "{%\n" "\\vfil \\hbox to" width "{%\n" @@ -1525,7 +1662,7 @@ Optional string COLSEP gives the column separation (default \"1mm\")." (if (= i 6) "\\\\[0.7mm]\n" " & ")))) - (dotimes (idummy blank-days) + (dotimes (_idummy blank-days) (setq str (concat str " & "))) (dotimes (i last) (setq str (concat str (number-to-string (1+ i))) @@ -1589,6 +1726,15 @@ FINAL-SEPARATOR is non-nil." Insert the trailer to LaTeX document, pop to LaTeX buffer, add informative header, and run HOOK." (cal-tex-e-document) + (or (and cal-tex-preamble-extra + (string-match "inputenc" cal-tex-preamble-extra)) + (when (re-search-backward "[^[:ascii:]]" nil 'move) + (goto-char (point-min)) + (when (search-forward "documentclass" nil t) + (forward-line 1) + ;; Eg for some Bahai holidays. + ;; FIXME latin1 might not always be right. + (insert "\\usepackage[latin1]{inputenc}\n")))) (latex-mode) (pop-to-buffer cal-tex-buffer) (goto-char (point-min)) @@ -1778,7 +1924,7 @@ Add trailing COMMENT if present." (cal-tex-comment "end framebox")) -(defun cal-tex-b-makebox ( width position ) +(defun cal-tex-b-makebox (width position) "Insert makebox with parameters WIDTH and POSITION (clr)." (insert "\\makebox[" width "][" position "]{" ) (cal-tex-comment)) @@ -1833,5 +1979,4 @@ Add trailing COMMENT if present." (provide 'cal-tex) -;; arch-tag: ca8168a4-5a00-4508-a565-17e3bccce6d0 ;;; cal-tex.el ends here