1 ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX
3 ;; Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc.
5 ;; Author: Steve Fisk <fisk@bowdoin.edu>
6 ;; Edward M. Reingold <reingold@cs.uiuc.edu>
7 ;; Maintainer: Glenn Morris <rgm@gnu.org>
9 ;; Human-Keywords: Calendar, LaTeX
12 ;; This file is part of GNU Emacs.
14 ;; GNU Emacs is free software: you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation, either version 3 of the License, or
17 ;; (at your option) any later version.
19 ;; GNU Emacs is distributed in the hope that it will be useful,
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;; GNU General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
29 ;; This collection of functions implements the creation of LaTeX calendars
30 ;; based on the user's holiday choices and diary file.
32 ;; The user commands are:
33 ;; cal-tex-cursor-year
34 ;; cal-tex-cursor-year-landscape
35 ;; cal-tex-cursor-filofax-year
36 ;; cal-tex-cursor-month-landscape
37 ;; cal-tex-cursor-month
38 ;; cal-tex-cursor-week
39 ;; cal-tex-cursor-week2
40 ;; cal-tex-cursor-week-iso
41 ;; cal-tex-cursor-week-monday
42 ;; cal-tex-cursor-filofax-2week
43 ;; cal-tex-cursor-filofax-week
44 ;; cal-tex-cursor-filofax-daily
49 ;; (*) Add holidays and diary entries to daily calendar.
51 ;; (*) Add diary entries to weekly calendar functions.
53 ;; (*) Make calendar styles for A4 paper.
55 ;; (*) Make monthly styles Filofax paper.
62 ;;; Customizable variables
65 (defgroup calendar-tex nil
66 "Options for printing calendar with LaTeX."
70 (defcustom cal-tex-which-days
'(0 1 2 3 4 5 6)
71 "The days of the week that are displayed on the portrait monthly calendar.
72 Sunday is 0, Monday is 1, and so on. The default is to print from Sunday to
73 Saturday. For example, use '(1 3 5) to only print Monday, Wednesday, Friday."
74 :type
'(repeat integer
)
77 (defcustom cal-tex-holidays t
78 "Non-nil means holidays are printed in the LaTeX calendars that support it.
79 Setting this to nil may speed up calendar generation."
83 (defcustom cal-tex-diary nil
84 "Non-nil means diary entries are printed in LaTeX calendars that support it.
85 At present, this only affects the monthly, filofax, and iso-week
86 calendars (i.e. not the yearly, plain weekly, or daily calendars).
87 Setting this to nil may speed up calendar generation."
91 (defcustom cal-tex-rules nil
92 "Non-nil means pages will be ruled in some LaTeX calendar styles.
93 At present, this only affects the daily filofax calendar."
97 (defcustom cal-tex-daily-string
98 '(let* ((year (calendar-extract-year date
))
99 (day (calendar-day-number date
))
100 (days-remaining (- (calendar-day-number (list 12 31 year
)) day
)))
101 (format "%d/%d" day days-remaining
))
102 "Lisp expression giving the date format to use in the LaTeX calendars.
103 This should be an expression involving the variable `date'. When
104 this expression is called, `date' is a list of the form '(MONTH DAY YEAR)'.
106 The string resulting from evaluating this expression is placed at
107 the bottom center of each date in monthly calendars, next to the
108 date in the weekly calendars, and in the top center of daily calendars.
110 The default is ordinal day number of the year and the number of
111 days remaining. As an example, setting this to
113 '(calendar-hebrew-date-string date)
115 will put the Hebrew date at the bottom of each day."
117 :group
'calendar-tex
)
119 (defcustom cal-tex-buffer
"calendar.tex"
120 "The name for the output LaTeX calendar buffer."
122 :group
'calendar-tex
)
124 (defcustom cal-tex-24 nil
125 "Non-nil means use a 24 hour clock in the daily calendar."
127 :group
'calendar-tex
)
129 (defcustom cal-tex-daily-start
8
130 "The first hour of the daily LaTeX calendar page.
131 At present, this only affects `cal-tex-cursor-day'."
133 :group
'calendar-tex
)
135 (defcustom cal-tex-daily-end
20
136 "The last hour of the daily LaTeX calendar page.
137 At present, this only affects `cal-tex-cursor-day'."
139 :group
'calendar-tex
)
141 (defcustom cal-tex-preamble-extra nil
142 "A string giving extra LaTeX commands to insert in the calendar preamble.
143 For example, to include extra packages:
144 \"\\\\usepackage{foo}\\n\\\\usepackage{bar}\\n\"."
145 :type
'(choice (const nil
)
146 ;; An example to help people format things in custom.
147 (string :value
"\\usepackage{foo}\n\\usepackage{bar}\n"))
151 (defcustom cal-tex-hook nil
152 "List of functions called after any LaTeX calendar buffer is generated.
153 You can use this to do post-processing on the buffer. For example, to change
154 characters with diacritical marks to their LaTeX equivalents, use
155 (add-hook 'cal-tex-hook
156 (lambda () (iso-iso2tex (point-min) (point-max))))"
158 :group
'calendar-tex
)
160 (defcustom cal-tex-year-hook nil
161 "List of functions called after a LaTeX year calendar buffer is generated."
163 :group
'calendar-tex
)
165 (defcustom cal-tex-month-hook nil
166 "List of functions called after a LaTeX month calendar buffer is generated."
168 :group
'calendar-tex
)
170 (defcustom cal-tex-week-hook nil
171 "List of functions called after a LaTeX week calendar buffer is generated."
173 :group
'calendar-tex
)
175 (defcustom cal-tex-daily-hook nil
176 "List of functions called after a LaTeX daily calendar buffer is generated."
178 :group
'calendar-tex
)
181 ;;; Definitions for LaTeX code
184 (defconst cal-tex-day-prefix
"\\caldate{%s}{%s}"
185 "The initial LaTeX code for a day.
186 The holidays, diary entries, bottom string, and the text follow.")
188 (defconst cal-tex-day-name-format
"\\myday{%s}%%"
189 "The format for LaTeX code for a day name.
190 The names are taken from `calendar-day-name-array'.")
192 (defconst cal-tex-cal-one-month
193 "\\def\\calmonth#1#2%
195 \\Huge\\bf\\uppercase{#1} #2 \\\\[1cm]%
200 "LaTeX code for the month header, for a single month calendar.")
202 (defconst cal-tex-cal-multi-month
203 "\\def\\calmonth#1#2#3#4%
205 \\Huge\\bf #1 #2---#3 #4\\\\[1cm]%
210 "LaTeX code for the month header, for a multi-month calendar.")
212 (defconst cal-tex-myday
213 "\\renewcommand{\\myday}[1]%
214 {\\makebox[\\cellwidth]{\\hfill\\large\\bf#1\\hfill}}
217 "LaTeX code for a day heading.")
219 (defconst cal-tex-caldate
221 \\long\\def\\caldate#1#2#3#4#5#6{%
222 \\fbox{\\hbox to\\cellwidth{%
223 \\vbox to\\cellheight{%
224 \\hbox to\\cellwidth{%
225 {\\hspace*{1mm}\\Large \\bf \\strut #2}\\hspace{.05\\cellwidth}%
226 \\raisebox{\\holidaymult\\cellheight}%
227 {\\parbox[t]{.75\\cellwidth}{\\tiny \\raggedright #4}}}
228 \\hbox to\\cellwidth{%
229 \\hspace*{1mm}\\parbox{.95\\cellwidth}{\\tiny \\raggedright #3}}
231 \\hbox to\\cellwidth{#6}%
233 \\hbox to\\cellwidth{\\hfill \\tiny #5 \\hfill}%
237 "LaTeX code to insert one box with date info in calendar.
238 This definition is the heart of the calendar!")
240 (autoload 'holiday-in-range
"holidays")
242 (define-obsolete-function-alias 'cal-tex-list-holidays
'holiday-in-range
"24.3")
244 (autoload 'diary-list-entries
"diary-lib")
246 (defun cal-tex-list-diary-entries (d1 d2
)
247 "Generate a list of all diary-entries from absolute date D1 to D2."
248 (let (diary-list-include-blanks)
249 (diary-list-entries (calendar-gregorian-from-absolute d1
)
252 (defun cal-tex-preamble (&optional args
)
253 "Insert the LaTeX calendar preamble into `cal-tex-buffer'.
254 Preamble includes initial definitions for various LaTeX commands.
255 Optional string ARGS are included as options for the article document class."
256 (set-buffer (generate-new-buffer cal-tex-buffer
))
257 (insert (format "\\documentclass%s{article}\n"
261 (if (stringp cal-tex-preamble-extra
)
262 (insert cal-tex-preamble-extra
"\n"))
263 (insert "\\hbadness 20000
269 \\evensidemargin -2cm
274 \\newlength{\\cellwidth}
275 \\newlength{\\cellheight}
276 \\newlength{\\boxwidth}
277 \\newlength{\\boxheight}
278 \\newlength{\\cellsize}
279 \\newcommand{\\myday}[1]{}
280 \\newcommand{\\caldate}[6]{}
281 \\newcommand{\\nocaldate}[6]{}
282 \\newcommand{\\calsmall}[6]{}
291 (defun cal-tex-cursor-year (&optional n event
)
292 "Make a buffer with LaTeX commands for the year cursor is on.
293 Optional prefix argument N specifies number of years.
294 Optional EVENT indicates a buffer position to use instead of point."
295 (interactive (list (prefix-numeric-value current-prefix-arg
)
297 (cal-tex-year (calendar-extract-year (calendar-cursor-to-date t event
))
301 (defun cal-tex-cursor-year-landscape (&optional n event
)
302 "Make a buffer with LaTeX commands for the year cursor is on.
303 Optional prefix argument N specifies number of years.
304 Optional EVENT indicates a buffer position to use instead of point."
305 (interactive (list (prefix-numeric-value current-prefix-arg
)
307 (cal-tex-year (calendar-extract-year (calendar-cursor-to-date t event
))
310 (defun cal-tex-year (year n
&optional landscape
)
311 "Make a one page yearly calendar of YEAR; do this for N years.
312 There are four rows of three months each, unless optional
313 LANDSCAPE is non-nil, in which case the calendar is printed in
314 landscape mode with three rows of four months each."
315 (cal-tex-insert-preamble 1 landscape
"12pt")
317 (cal-tex-vspace "-.6cm")
318 (cal-tex-vspace "-3.1cm"))
320 (insert "\\vfill%\n")
322 (cal-tex-Huge (number-to-string year
))
324 (cal-tex-vspace "1cm")
326 (cal-tex-b-parbox "l" (if landscape
"5.9in" "4.3in"))
331 (insert (cal-tex-mini-calendar (1+ i
) year
"month" "1.1in" "1in"))
333 (cal-tex-hspace "0.5in")
334 (if (zerop (mod (1+ i
) (if landscape
4 3)))
335 (cal-tex-nl "0.5in")))
338 (insert "\\vfill%\n")
339 (setq year
(1+ year
))
341 (cal-tex-end-document)
343 (run-hooks 'cal-tex-year-hook
))
344 (run-hooks 'cal-tex-hook
))
347 (defun cal-tex-filofax-paper (&optional year
)
348 "Insert some page size settings for filofax layouts."
349 (insert "\\textwidth 3.25in
351 \\headheight -0.875in
355 ;; Why is this one subtly different? Who knows...
356 (if year
"\\oddsidemargin 1.675in
357 \\evensidemargin 1.675in
359 "\\oddsidemargin 1.75in
360 \\evensidemargin 1.5in
366 (defun cal-tex-cursor-filofax-year (&optional n event
)
367 "Make a Filofax one page yearly calendar of year indicated by cursor.
368 Optional prefix argument N specifies number of years.
369 Optional EVENT indicates a buffer position to use instead of point."
370 (interactive (list (prefix-numeric-value current-prefix-arg
)
373 (let ((year (calendar-extract-year (calendar-cursor-to-date t event
))))
374 (cal-tex-preamble "twoside")
375 (cal-tex-filofax-paper 'year
)
376 (cal-tex-cmd "\\fboxsep 0.5mm")
377 (cal-tex-cmd "\\pagestyle" "empty")
379 (cal-tex-vspace "0.25in")
381 (insert (format "\\hfil \\textbf{\\Large %s} \\hfil\\\\\n" year
))
383 (cal-tex-b-parbox "l" "\\textwidth")
387 (let ((month-names; don't use default in case user changed it
388 ;; These are only used to define the command names, not
389 ;; the names of the months they insert.
390 ["January" "February" "March" "April" "May" "June"
391 "July" "August" "September" "October" "November" "December"]))
393 (insert (cal-tex-mini-calendar (1+ i
) year
(aref month-names i
)
394 "1in" ".9in" "tiny" "0.6mm"))))
396 "\\noindent\\fbox{\\January}\\fbox{\\February}\\fbox{\\March}\\\\
397 \\noindent\\fbox{\\April}\\fbox{\\May}\\fbox{\\June}\\\\
398 \\noindent\\fbox{\\July}\\fbox{\\August}\\fbox{\\September}\\\\
399 \\noindent\\fbox{\\October}\\fbox{\\November}\\fbox{\\December}
403 (setq year
(1+ year
))
405 (cal-tex-end-document)
407 (cal-tex-vspace "0.25in"))
408 (run-hooks 'cal-tex-year-hook
))
409 (run-hooks 'cal-tex-hook
)))
412 ;;; Monthly calendars
416 (defun cal-tex-cursor-month-landscape (&optional n event
)
417 "Make a LaTeX calendar buffer for the month the cursor is on.
418 Optional prefix argument N specifies number of months to be
419 produced (default 1). The output is in landscape format, one
420 month to a page. It shows holiday and diary entries if
421 `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil.
422 Optional EVENT indicates a buffer position to use instead of point."
423 (interactive (list (prefix-numeric-value current-prefix-arg
)
426 (let* ((date (calendar-cursor-to-date t event
))
427 (month (calendar-extract-month date
))
428 (year (calendar-extract-year date
))
431 (cal-tex-which-days '(0 1 2 3 4 5 6))
432 (d1 (calendar-absolute-from-gregorian (list month
1 year
)))
434 (calendar-increment-month end-month end-year
(1- n
))
435 (calendar-absolute-from-gregorian
437 (calendar-last-day-of-month end-month end-year
)
439 (diary-list (if cal-tex-diary
(cal-tex-list-diary-entries d1 d2
)))
440 (holidays (if cal-tex-holidays
(holiday-in-range d1 d2
)))
441 other-month other-year small-months-at-start
)
442 (cal-tex-insert-preamble (cal-tex-number-weeks month year
1) t
"12pt")
443 (cal-tex-cmd cal-tex-cal-one-month
)
445 (setq other-month month
447 (calendar-increment-month other-month other-year -
1)
448 (insert (cal-tex-mini-calendar other-month other-year
"lastmonth"
449 "\\cellwidth" "\\cellheight"))
450 (calendar-increment-month other-month other-year
2)
451 (insert (cal-tex-mini-calendar other-month other-year
"nextmonth"
452 "\\cellwidth" "\\cellheight"))
453 (cal-tex-insert-month-header 1 month year month year
)
454 (cal-tex-insert-day-names)
456 (if (setq small-months-at-start
457 (< 1 (mod (- (calendar-day-of-week (list month
1 year
))
458 calendar-week-start-day
)
460 (insert "\\lastmonth\\nextmonth\\hspace*{-2\\cellwidth}"))
461 (cal-tex-insert-blank-days month year cal-tex-day-prefix
)
462 (cal-tex-insert-days month year diary-list holidays
464 (cal-tex-insert-blank-days-at-end month year cal-tex-day-prefix
)
465 (if (and (not small-months-at-start
)
466 (< 1 (mod (- (1- calendar-week-start-day
)
467 (calendar-day-of-week
469 (calendar-last-day-of-month month year
)
472 (insert "\\vspace*{-\\cellwidth}\\hspace*{-2\\cellwidth}"
473 "\\lastmonth\\nextmonth%
476 (run-hooks 'cal-tex-month-hook
)
478 (calendar-increment-month month year
1)
479 (cal-tex-vspace "-2cm")
480 (cal-tex-insert-preamble
481 (cal-tex-number-weeks month year
1) t
"12pt" t
))))
482 (cal-tex-end-document)
483 (run-hooks 'cal-tex-hook
))
486 (defun cal-tex-cursor-month (&optional n event
)
487 "Make a LaTeX calendar buffer for the month the cursor is on.
488 Optional prefix argument N specifies number of months to be
489 produced (default 1). The calendar is condensed onto one page.
490 It shows holiday and diary entries if `cal-tex-holidays' and
491 `cal-tex-diary', respectively, are non-nil. Optional EVENT
492 indicates a buffer position to use instead of point."
493 (interactive (list (prefix-numeric-value current-prefix-arg
)
496 (let* ((date (calendar-cursor-to-date t event
))
497 (month (calendar-extract-month date
))
498 (year (calendar-extract-year date
))
501 ;; FIXME -landscape sets cal-tex-which-days?
502 (d1 (calendar-absolute-from-gregorian (list month
1 year
)))
504 (calendar-increment-month end-month end-year
(1- n
))
505 (calendar-absolute-from-gregorian
507 (calendar-last-day-of-month end-month end-year
)
509 (diary-list (if cal-tex-diary
(cal-tex-list-diary-entries d1 d2
)))
510 (holidays (if cal-tex-holidays
(holiday-in-range d1 d2
))))
511 (cal-tex-insert-preamble (cal-tex-number-weeks month year n
) nil
"12pt")
513 (cal-tex-cmd cal-tex-cal-multi-month
)
514 (cal-tex-cmd cal-tex-cal-one-month
))
515 (cal-tex-insert-month-header n month year end-month end-year
)
516 (cal-tex-insert-day-names)
518 (cal-tex-insert-blank-days month year cal-tex-day-prefix
)
520 (cal-tex-insert-days month year diary-list holidays cal-tex-day-prefix
)
521 (when (= (calendar-week-end-day)
522 (calendar-day-of-week
524 (calendar-last-day-of-month month year
)
525 year
))) ; last day of month was last day of week
528 (calendar-increment-month month year
1))
529 (cal-tex-insert-blank-days-at-end end-month end-year cal-tex-day-prefix
))
530 (cal-tex-end-document)
531 (run-hooks 'cal-tex-hook
))
533 (defun cal-tex-insert-days (month year diary-list holidays day-format
)
534 "Insert LaTeX commands for a range of days in monthly calendars.
535 LaTeX commands are inserted for the days of the MONTH in YEAR.
536 Diary entries on DIARY-LIST are included. Holidays on HOLIDAYS
537 are included. Each day is formatted using format DAY-FORMAT."
538 (let ((blank-days ; at start of month
540 (- (calendar-day-of-week (list month
1 year
))
541 calendar-week-start-day
)
543 (last (calendar-last-day-of-month month year
))
546 (setq j
(1+ i
) ; 1-last, incl
547 date
(list month j year
))
548 (when (memq (calendar-day-of-week date
) cal-tex-which-days
)
549 (insert (format day-format
(cal-tex-month-name month
) j
))
550 (cal-tex-arg (cal-tex-latexify-list diary-list date
))
551 (cal-tex-arg (cal-tex-latexify-list holidays date
))
552 (cal-tex-arg (eval cal-tex-daily-string
))
555 (when (and (zerop (mod (+ j blank-days
) 7))
560 (defun cal-tex-insert-day-names ()
561 "Insert the names of the days at top of a monthly calendar."
564 (if (memq (setq j
(mod (+ calendar-week-start-day i
) 7))
566 (insert (format cal-tex-day-name-format
567 (cal-tex-LaTeXify-string
568 (aref calendar-day-name-array j
)))))
571 (defun cal-tex-insert-month-header (n month year end-month end-year
)
572 "Create a title for a calendar.
573 A title is inserted for a calendar with N months starting with
574 MONTH YEAR and ending with END-MONTH END-YEAR."
575 (let ((month-name (cal-tex-month-name month
))
576 (end-month-name (cal-tex-month-name end-month
)))
578 (insert (format "\\calmonth{%s}{%s}\n\\vspace*{-0.5cm}"
580 (insert (format "\\calmonth{%s}{%s}{%s}{%s}\n\\vspace*{-0.5cm}"
581 month-name year end-month-name end-year
))))
584 (defun cal-tex-insert-blank-days (month year day-format
)
585 "Insert code for initial days not in calendar.
586 Insert LaTeX code for the blank days at the beginning of the MONTH in
587 YEAR. The entry is formatted using DAY-FORMAT. If the entire week is
588 blank, no days are inserted."
589 (if (cal-tex-first-blank-p month year
)
590 (let ((blank-days ; at start of month
592 (- (calendar-day-of-week (list month
1 year
))
593 calendar-week-start-day
)
595 (dotimes (i blank-days
)
596 (if (memq (mod (+ calendar-week-start-day i
) 7) cal-tex-which-days
)
597 (insert (format day-format
" " " ") "{}{}{}{}%\n"))))))
599 (defun cal-tex-insert-blank-days-at-end (month year day-format
)
600 "Insert code for final days not in calendar.
601 Insert LaTeX code for the blank days at the end of the MONTH in YEAR.
602 The entry is formatted using DAY-FORMAT."
603 (if (cal-tex-last-blank-p month year
)
604 (let* ((last-day (calendar-last-day-of-month month year
))
605 (blank-days ; at end of month
607 (- (calendar-day-of-week (list month last-day year
))
608 calendar-week-start-day
)
611 (while (<= (setq i
(1+ i
)) 6)
612 (if (memq (mod (+ calendar-week-start-day i
) 7) cal-tex-which-days
)
613 (insert (format day-format
"" "") "{}{}{}{}%\n"))))))
615 (defun cal-tex-first-blank-p (month year
)
616 "Determine if any days of the first week will be printed.
617 Return t if there will there be any days of the first week printed
618 in the calendar starting in MONTH YEAR."
619 ;; Check days 1-7 of the month, until we find the last day of the week.
623 (if (memq (setq dow
(calendar-day-of-week (list month
(1+ i
) year
)))
626 (if (= dow
(calendar-week-end-day)) (throw 'found nil
)))))))
628 (defun cal-tex-last-blank-p (month year
)
629 "Determine if any days of the last week will be printed.
630 Return t if there will there be any days of the last week printed
631 in the calendar starting in MONTH YEAR."
632 ;; Check backwards from the last day of the month, until we find the
633 ;; start of the last week in the month.
635 (let ((last-day (calendar-last-day-of-month month year
))
638 (if (memq (setq dow
(calendar-day-of-week
639 (list month
(- last-day i
) year
)))
642 (if (= dow calendar-week-start-day
) (throw 'found nil
)))))))
644 (defun cal-tex-number-weeks (month year n
)
645 "Determine the number of weeks in a range of dates.
646 Compute the number of weeks in the calendar starting with MONTH and YEAR,
647 and lasting N months, including only the days in WHICH-DAYS. As it stands,
648 this is only an upper bound."
649 (let ((d (list month
1 year
)))
650 (calendar-increment-month month year
(1- n
))
651 (/ (- (calendar-dayname-on-or-before
652 calendar-week-start-day
653 (+ 7 (calendar-absolute-from-gregorian
654 (list month
(calendar-last-day-of-month month year
) year
))))
655 (calendar-dayname-on-or-before
656 calendar-week-start-day
657 (calendar-absolute-from-gregorian d
)))
664 (defconst cal-tex-LaTeX-hourbox
665 "\\newcommand{\\hourbox}[2]%
666 {\\makebox[2em]{\\rule{0cm}{#2ex}#1}\\rule{3in}{.15mm}}\n"
667 "One hour and a line on the right.")
669 (defun cal-tex-weekly-paper (&optional nomargins
)
670 "Insert some page size settings for weekly layouts."
671 (insert "\\textwidth 6.5in
674 (or nomargins
(insert "\\oddsidemargin 0in
678 ;; TODO cal-tex-diary-support.
679 ;; TODO respect cal-tex-daily-start,end (see cal-tex-week-hours).
681 (defun cal-tex-cursor-week (&optional n event
)
682 "Make a LaTeX calendar buffer for a two-page one-week calendar.
683 It applies to the week that point is in. The optional prefix
684 argument N specifies number of weeks (default 1). The calendar
685 shows holidays if `cal-tex-holidays' is non-nil (note that diary
686 entries are not shown). The calendar shows the hours 8-12am, 1-5pm."
687 (interactive (list (prefix-numeric-value current-prefix-arg
)
690 (let* ((date (calendar-gregorian-from-absolute
691 (calendar-dayname-on-or-before
692 calendar-week-start-day
693 (calendar-absolute-from-gregorian
694 (calendar-cursor-to-date t event
)))))
695 (month (calendar-extract-month date
))
696 (year (calendar-extract-year date
))
697 (d1 (calendar-absolute-from-gregorian date
))
699 (holidays (if cal-tex-holidays
700 (holiday-in-range d1 d2
))))
701 (cal-tex-preamble "11pt")
702 (cal-tex-weekly-paper)
703 (insert cal-tex-LaTeX-hourbox
)
705 (cal-tex-cmd "\\pagestyle" "empty")
707 (cal-tex-vspace "-1.5in")
709 (cal-tex-Huge-bf (format "\\uppercase{%s}"
710 (cal-tex-month-name month
)))
711 (cal-tex-hspace "2em")
712 (cal-tex-Huge-bf (number-to-string year
))
715 (cal-tex-hspace "-.2in")
716 (cal-tex-b-parbox "l" "7in")
718 (cal-tex-week-hours date holidays
"3.1")
719 (setq date
(cal-tex-incr-date date
)))
721 (setq month
(calendar-extract-month date
)
722 year
(calendar-extract-year date
))
724 (run-hooks 'cal-tex-week-hook
)
726 (cal-tex-end-document)
727 (run-hooks 'cal-tex-hook
)))
729 ;; TODO cal-tex-diary support.
730 ;; TODO respect cal-tex-daily-start,end (see cal-tex-week-hours).
732 (defun cal-tex-cursor-week2 (&optional n event
)
733 "Make a LaTeX calendar buffer for a two-page one-week calendar.
734 It applies to the week that point is in. Optional prefix
735 argument N specifies number of weeks (default 1). The calendar
736 shows holidays if `cal-tex-holidays' is non-nil (note that diary
737 entries are not shown). The calendar shows the hours 8-12am, 1-5pm.
738 Optional EVENT indicates a buffer position to use instead of point."
739 (interactive (list (prefix-numeric-value current-prefix-arg
)
742 (let* ((date (calendar-gregorian-from-absolute
743 (calendar-dayname-on-or-before
744 calendar-week-start-day
745 (calendar-absolute-from-gregorian
746 (calendar-cursor-to-date t event
)))))
747 (month (calendar-extract-month date
))
748 (year (calendar-extract-year date
))
749 (d1 (calendar-absolute-from-gregorian date
))
751 (holidays (if cal-tex-holidays
752 (holiday-in-range d1 d2
))))
753 (cal-tex-preamble "12pt")
754 (cal-tex-weekly-paper)
755 (insert cal-tex-LaTeX-hourbox
)
757 (cal-tex-cmd "\\pagestyle" "empty")
759 (cal-tex-vspace "-1.5in")
761 (cal-tex-Huge-bf (format "\\uppercase{%s}"
762 (cal-tex-month-name month
)))
763 (cal-tex-hspace "2em")
764 (cal-tex-Huge-bf (number-to-string year
))
767 (cal-tex-hspace "-.2in")
768 (cal-tex-b-parbox "l" "\\textwidth")
770 (cal-tex-week-hours date holidays
"5")
771 (setq date
(cal-tex-incr-date date
)))
774 (insert (cal-tex-mini-calendar
775 (calendar-extract-month (cal-tex-previous-month date
))
776 (calendar-extract-year (cal-tex-previous-month date
))
777 "lastmonth" "1.1in" "1in"))
778 (insert (cal-tex-mini-calendar
779 (calendar-extract-month date
)
780 (calendar-extract-year date
)
781 "thismonth" "1.1in" "1in"))
782 (insert (cal-tex-mini-calendar
783 (calendar-extract-month (cal-tex-next-month date
))
784 (calendar-extract-year (cal-tex-next-month date
))
785 "nextmonth" "1.1in" "1in"))
786 (insert "\\hbox to \\textwidth{")
788 (insert "\\lastmonth")
790 (insert "\\thismonth")
792 (insert "\\nextmonth")
796 (cal-tex-b-parbox "l" "\\textwidth")
798 (cal-tex-week-hours date holidays
"5")
799 (setq date
(cal-tex-incr-date date
)))
801 (setq month
(calendar-extract-month date
)
802 year
(calendar-extract-year date
))
804 (run-hooks 'cal-tex-week-hook
)
806 (cal-tex-end-document)
807 (run-hooks 'cal-tex-hook
)))
809 (autoload 'calendar-iso-from-absolute
"cal-iso")
812 (defun cal-tex-cursor-week-iso (&optional n event
)
813 "Make a LaTeX calendar buffer for a one page ISO-style weekly calendar.
814 Optional prefix argument N specifies number of weeks (default 1).
815 The calendar shows holiday and diary entries if
816 `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil.
817 It does not show hours of the day. Optional EVENT indicates a buffer
818 position to use instead of point."
819 (interactive (list (prefix-numeric-value current-prefix-arg
)
822 (let* ((date (calendar-gregorian-from-absolute
823 (calendar-dayname-on-or-before
825 (calendar-absolute-from-gregorian
826 (calendar-cursor-to-date t event
)))))
827 (month (calendar-extract-month date
))
828 (year (calendar-extract-year date
))
829 (day (calendar-extract-day date
))
830 (d1 (calendar-absolute-from-gregorian date
))
832 (holidays (if cal-tex-holidays
833 (holiday-in-range d1 d2
)))
834 (diary-list (if cal-tex-diary
835 (cal-tex-list-diary-entries d1 d2
)))
837 (cal-tex-preamble "11pt")
838 (cal-tex-weekly-paper)
840 (cal-tex-cmd "\\pagestyle" "empty")
842 (cal-tex-vspace "-1.5in")
845 (let ((d (calendar-iso-from-absolute
846 (calendar-absolute-from-gregorian date
))))
847 (format "Week %d of %d"
848 (calendar-extract-month d
)
849 (calendar-extract-year d
))))
852 (cal-tex-b-parbox "l" "\\textwidth")
854 (cal-tex-b-parbox "t" "\\textwidth")
855 (cal-tex-b-parbox "t" "\\textwidth")
856 (cal-tex-rule "0pt" "\\textwidth" ".2mm")
858 (cal-tex-b-parbox "t" "\\textwidth")
859 (cal-tex-large-bf (cal-tex-LaTeXify-string (calendar-day-name date
)))
861 (cal-tex-large-bf (cal-tex-month-name month
))
863 (cal-tex-large-bf (number-to-string day
))
864 (unless (string-equal "" (setq s
(cal-tex-latexify-list
865 holidays date
"; ")))
867 (cal-tex-large-bf s
))
869 (insert " " (eval cal-tex-daily-string
))
873 (cal-tex-b-parbox "t" "\\textwidth")
874 (unless (string-equal "" (setq s
(cal-tex-latexify-list
876 (insert "\\vbox to 0pt{")
881 (setq date
(cal-tex-incr-date date
)
882 month
(calendar-extract-month date
)
883 day
(calendar-extract-day date
))
885 (cal-tex-e-parbox "2cm")
887 (setq month
(calendar-extract-month date
)
888 year
(calendar-extract-year date
)))
891 (run-hooks 'cal-tex-week-hook
)
893 (cal-tex-end-document)
894 (run-hooks 'cal-tex-hook
)))
896 ;; TODO respect cal-tex-daily-start,end?
897 ;; Using different numbers of hours will probably break some layouts.
898 (defun cal-tex-week-hours (date holidays height
)
899 "Insert hourly entries for DATE with HOLIDAYS, with line height HEIGHT.
900 Uses the 24-hour clock if `cal-tex-24' is non-nil. Note that the hours
901 shown are hard-coded to 8-12, 13-17."
902 (let ((month (calendar-extract-month date
))
903 (day (calendar-extract-day date
))
904 (year (calendar-extract-year date
))
906 (cal-tex-comment "begin cal-tex-week-hours")
907 (cal-tex-cmd "\\ \\\\[-.2cm]")
908 (cal-tex-cmd "\\noindent")
909 (cal-tex-b-parbox "l" "6.8in")
910 (cal-tex-large-bf (cal-tex-LaTeXify-string (calendar-day-name date
)))
912 (cal-tex-large-bf (cal-tex-month-name month
))
914 (cal-tex-large-bf (number-to-string day
))
915 (unless (string-equal "" (setq s
(cal-tex-latexify-list
916 holidays date
"; ")))
918 (cal-tex-large-bf s
))
920 (insert " " (eval cal-tex-daily-string
))
923 (cal-tex-rule "0pt" "6.8in" ".2mm")
926 (setq morning
(+ i
8) ; 8-12 incl
927 afternoon
(if cal-tex-24
928 (+ i
13) ; 13-17 incl
930 (cal-tex-cmd "\\hourbox" (number-to-string morning
))
932 (cal-tex-hspace ".4cm")
933 (cal-tex-cmd "\\hourbox" (number-to-string afternoon
))
937 ;; TODO cal-tex-diary support.
938 ;; TODO respect cal-tex-daily-start,end (see cal-tex-weekly4-box).
940 (defun cal-tex-cursor-week-monday (&optional n event
)
941 "Make a LaTeX calendar buffer for a two-page one-week calendar.
942 It applies to the week that point is in, and starts on Monday.
943 Optional prefix argument N specifies number of weeks (default 1).
944 The calendar shows holidays if `cal-tex-holidays' is
945 non-nil (note that diary entries are not shown). The calendar shows
946 the hours 8-12am, 1-5pm. Optional EVENT indicates a buffer position
947 to use instead of point."
948 (interactive (list (prefix-numeric-value current-prefix-arg
)
951 (let ((date (calendar-gregorian-from-absolute
952 (calendar-dayname-on-or-before
954 (calendar-absolute-from-gregorian
955 (calendar-cursor-to-date t event
))))))
956 (cal-tex-preamble "11pt")
957 (cal-tex-weekly-paper)
960 (cal-tex-vspace "-1cm")
961 (insert "\\noindent ")
962 (cal-tex-weekly4-box (cal-tex-incr-date date
) nil
)
963 (cal-tex-weekly4-box (cal-tex-incr-date date
4) nil
)
965 (cal-tex-weekly4-box (cal-tex-incr-date date
2) nil
)
966 (cal-tex-weekly4-box (cal-tex-incr-date date
5) nil
)
968 (cal-tex-weekly4-box (cal-tex-incr-date date
3) nil
)
969 (cal-tex-weekly4-box (cal-tex-incr-date date
6) t
)
971 (run-hooks 'cal-tex-week-hook
)
972 (setq date
(cal-tex-incr-date date
7))
974 (cal-tex-end-document)
975 (run-hooks 'cal-tex-hook
)))
977 ;; TODO respect cal-tex-daily-start,end?
978 ;; Using different numbers of hours will probably break some layouts.
979 (defun cal-tex-weekly4-box (date weekend
)
980 "Make one box for DATE, different if WEEKEND.
981 Uses the 24-hour clock if `cal-tex-24' is non-nil. Note that the hours
982 shown are hard-coded to 8-12, 13-17."
983 (let* ((day (calendar-extract-day date
))
984 (month (calendar-extract-month date
))
985 (year (calendar-extract-year date
))
986 (dayname (cal-tex-LaTeXify-string (calendar-day-name date
)))
987 (date1 (cal-tex-incr-date date
))
988 (day1 (calendar-extract-day date1
))
989 (month1 (calendar-extract-month date1
))
990 (year1 (calendar-extract-year date1
))
991 (dayname1 (cal-tex-LaTeXify-string (calendar-day-name date1
))))
992 (cal-tex-b-framebox "8cm" "l")
993 (cal-tex-b-parbox "b" "7.5cm")
994 (insert (format "\\textbf{\\Large %s,} %s/%s/%s\\\\\n"
995 dayname month day year
))
996 (cal-tex-rule "0pt" "7.5cm" ".5mm")
1000 (insert (format "\\textsf{\\large %d}\\\\\n" (+ i
8))))
1002 (insert (format "\\textsf{\\large %d}\\\\\n"
1004 (+ i
13) ; 13-17 incl
1005 (1+ i
)))))) ; 1-5 incl
1008 (cal-tex-vspace "1cm")
1009 (insert "\\ \\vfill")
1010 (insert (format "\\textbf{\\Large %s,} %s/%s/%s\\\\\n"
1011 dayname1 month1 day1 year1
))
1012 (cal-tex-rule "0pt" "7.5cm" ".5mm")
1013 (cal-tex-nl "1.5cm")
1014 (cal-tex-vspace "1cm"))
1016 (cal-tex-e-framebox)
1017 (cal-tex-hspace "1cm")))
1020 (defun cal-tex-cursor-week-at-a-glance (&optional n event
)
1021 "One-week-at-a-glance full page calendar for week indicated by cursor.
1022 Optional prefix argument N specifies number of weeks (default 1),
1023 starting on Mondays. The calendar shows holiday and diary entries
1024 if `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil.
1025 It does not show hours of the day. Optional EVENT indicates a buffer
1026 position to use instead of point."
1027 (interactive (list (prefix-numeric-value current-prefix-arg
)
1028 last-nonmenu-event
))
1030 (let* ((date (calendar-gregorian-from-absolute
1031 (calendar-dayname-on-or-before
1033 (calendar-absolute-from-gregorian
1034 (calendar-cursor-to-date t event
)))))
1035 (month (calendar-extract-month date
))
1036 (year (calendar-extract-year date
))
1037 (day (calendar-extract-day date
))
1038 (d1 (calendar-absolute-from-gregorian date
))
1040 (holidays (if cal-tex-holidays
1041 (holiday-in-range d1 d2
)))
1042 (diary-list (if cal-tex-diary
1043 (cal-tex-list-diary-entries d1 d2
))))
1044 (cal-tex-preamble "twoside,12pt")
1045 (insert "\\textwidth 7in
1048 \\evensidemargin 0in
1050 \\headheight -0.875in
1054 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]}
1055 \\long\\def\\rightday#1#2#3#4#5{%
1056 \\rule{\\textwidth}{0.3pt}\\\\%
1057 \\hbox to \\textwidth{%
1060 \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%
1061 \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}%
1062 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
1063 \\long\\def\\weekend#1#2#3#4#5{%
1064 \\rule{\\textwidth}{0.3pt}\\\\%
1065 \\hbox to \\textwidth{%
1068 \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%
1069 \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}%
1070 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
1071 \\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]}
1072 \\long\\def\\leftday#1#2#3#4#5{%
1073 \\rule{\\textwidth}{0.3pt}\\\\%
1074 \\hbox to \\textwidth{%
1077 \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}%
1078 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}%
1079 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
1081 (cal-tex-b-document)
1082 (cal-tex-cmd "\\pagestyle" "empty")
1084 (insert "\\lefthead")
1086 (let ((d (cal-tex-incr-date date
2)))
1087 (if (= (calendar-extract-month date
)
1088 (calendar-extract-month d
))
1090 (cal-tex-month-name (calendar-extract-month date
))
1091 (calendar-extract-year date
))
1092 (if (= (calendar-extract-year date
)
1093 (calendar-extract-year d
))
1094 (format "%s---%s %s"
1095 (cal-tex-month-name (calendar-extract-month date
))
1096 (cal-tex-month-name (calendar-extract-month d
))
1097 (calendar-extract-year date
))
1098 (format "%s %s---%s %s"
1099 (cal-tex-month-name (calendar-extract-month date
))
1100 (calendar-extract-year date
)
1101 (cal-tex-month-name (calendar-extract-month d
))
1102 (calendar-extract-year d
))))))
1104 (dotimes (_jdummy 3)
1105 (insert "\\leftday")
1106 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date
)))
1107 (cal-tex-arg (number-to-string (calendar-extract-day date
)))
1108 (cal-tex-arg (cal-tex-latexify-list diary-list date
))
1109 (cal-tex-arg (cal-tex-latexify-list holidays date
))
1110 (cal-tex-arg (eval cal-tex-daily-string
))
1112 (setq date
(cal-tex-incr-date date
)))
1113 (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n")
1115 (insert (cal-tex-mini-calendar
1116 (calendar-extract-month (cal-tex-previous-month date
))
1117 (calendar-extract-year (cal-tex-previous-month date
))
1118 "lastmonth" "1.1in" "1in"))
1119 (insert (cal-tex-mini-calendar
1120 (calendar-extract-month date
)
1121 (calendar-extract-year date
)
1122 "thismonth" "1.1in" "1in"))
1123 (insert (cal-tex-mini-calendar
1124 (calendar-extract-month (cal-tex-next-month date
))
1125 (calendar-extract-year (cal-tex-next-month date
))
1126 "nextmonth" "1.1in" "1in"))
1127 (insert "\\hbox to \\textwidth{")
1129 (insert "\\lastmonth")
1131 (insert "\\thismonth")
1133 (insert "\\nextmonth")
1137 (insert "\\righthead")
1139 (let ((d (cal-tex-incr-date date
3)))
1140 (if (= (calendar-extract-month date
)
1141 (calendar-extract-month d
))
1143 (cal-tex-month-name (calendar-extract-month date
))
1144 (calendar-extract-year date
))
1145 (if (= (calendar-extract-year date
)
1146 (calendar-extract-year d
))
1147 (format "%s---%s %s"
1148 (cal-tex-month-name (calendar-extract-month date
))
1149 (cal-tex-month-name (calendar-extract-month d
))
1150 (calendar-extract-year date
))
1151 (format "%s %s---%s %s"
1152 (cal-tex-month-name (calendar-extract-month date
))
1153 (calendar-extract-year date
)
1154 (cal-tex-month-name (calendar-extract-month d
))
1155 (calendar-extract-year d
))))))
1157 (dotimes (_jdummy 2)
1158 (insert "\\rightday")
1159 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date
)))
1160 (cal-tex-arg (number-to-string (calendar-extract-day date
)))
1161 (cal-tex-arg (cal-tex-latexify-list diary-list date
))
1162 (cal-tex-arg (cal-tex-latexify-list holidays date
))
1163 (cal-tex-arg (eval cal-tex-daily-string
))
1165 (setq date
(cal-tex-incr-date date
)))
1166 (dotimes (_jdummy 2)
1167 (insert "\\weekend")
1168 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date
)))
1169 (cal-tex-arg (number-to-string (calendar-extract-day date
)))
1170 (cal-tex-arg (cal-tex-latexify-list diary-list date
))
1171 (cal-tex-arg (cal-tex-latexify-list holidays date
))
1172 (cal-tex-arg (eval cal-tex-daily-string
))
1174 (setq date
(cal-tex-incr-date date
)))
1175 (unless (= i
(1- n
))
1176 (run-hooks 'cal-tex-week-hook
)
1178 (cal-tex-end-document)
1179 (run-hooks 'cal-tex-hook
)))
1182 (defun cal-tex-cursor-filofax-2week (&optional n event
)
1183 "Two-weeks-at-a-glance Filofax style calendar for week cursor is in.
1184 Optional prefix argument N specifies number of weeks (default 1).
1185 The calendar shows holiday and diary entries if
1186 `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil.
1187 Optional EVENT indicates a buffer position to use instead of point."
1188 (interactive (list (prefix-numeric-value current-prefix-arg
)
1189 last-nonmenu-event
))
1191 (let* ((date (calendar-gregorian-from-absolute
1192 (calendar-dayname-on-or-before
1193 calendar-week-start-day
1194 (calendar-absolute-from-gregorian
1195 (calendar-cursor-to-date t event
)))))
1196 (month (calendar-extract-month date
))
1197 (year (calendar-extract-year date
))
1198 (day (calendar-extract-day date
))
1199 (d1 (calendar-absolute-from-gregorian date
))
1201 (holidays (if cal-tex-holidays
1202 (holiday-in-range d1 d2
)))
1203 (diary-list (if cal-tex-diary
1204 (cal-tex-list-diary-entries d1 d2
))))
1205 (cal-tex-preamble "twoside")
1206 (cal-tex-filofax-paper)
1207 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]}
1208 \\long\\def\\rightday#1#2#3#4#5{%
1209 \\rule{\\textwidth}{0.3pt}\\\\%
1210 \\hbox to \\textwidth{%
1213 \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%
1214 \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}%
1215 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
1216 \\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]}
1217 \\long\\def\\leftday#1#2#3#4#5{%
1218 \\rule{\\textwidth}{0.3pt}\\\\%
1219 \\hbox to \\textwidth{%
1222 \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}%
1223 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}%
1224 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
1226 (cal-tex-b-document)
1227 (cal-tex-cmd "\\pagestyle" "empty")
1229 (if (zerop (mod i
2))
1230 (insert "\\righthead")
1231 (insert "\\lefthead"))
1233 (let ((d (cal-tex-incr-date date
6)))
1234 (if (= (calendar-extract-month date
)
1235 (calendar-extract-month d
))
1237 (cal-tex-month-name (calendar-extract-month date
))
1238 (calendar-extract-year date
))
1239 (if (= (calendar-extract-year date
)
1240 (calendar-extract-year d
))
1241 (format "%s---%s %s"
1242 (cal-tex-month-name (calendar-extract-month date
))
1243 (cal-tex-month-name (calendar-extract-month d
))
1244 (calendar-extract-year date
))
1245 (format "%s %s---%s %s"
1246 (cal-tex-month-name (calendar-extract-month date
))
1247 (calendar-extract-year date
)
1248 (cal-tex-month-name (calendar-extract-month d
))
1249 (calendar-extract-year d
))))))
1251 (dotimes (_jdummy 7)
1252 (if (zerop (mod i
2))
1253 (insert "\\rightday")
1254 (insert "\\leftday"))
1255 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date
)))
1256 (cal-tex-arg (number-to-string (calendar-extract-day date
)))
1257 (cal-tex-arg (cal-tex-latexify-list diary-list date
))
1258 (cal-tex-arg (cal-tex-latexify-list holidays date
))
1259 (cal-tex-arg (eval cal-tex-daily-string
))
1261 (setq date
(cal-tex-incr-date date
)))
1262 (unless (= i
(1- n
))
1263 (run-hooks 'cal-tex-week-hook
)
1265 (cal-tex-end-document)
1266 (run-hooks 'cal-tex-hook
)))
1269 (defun cal-tex-cursor-filofax-week (&optional n event
)
1270 "One-week-at-a-glance Filofax style calendar for week indicated by cursor.
1271 Optional prefix argument N specifies number of weeks (default 1),
1272 starting on Mondays. The calendar shows holiday and diary entries
1273 if `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil.
1274 Optional EVENT indicates a buffer position to use instead of point."
1275 (interactive (list (prefix-numeric-value current-prefix-arg
)
1276 last-nonmenu-event
))
1278 (let* ((date (calendar-gregorian-from-absolute
1279 (calendar-dayname-on-or-before
1281 (calendar-absolute-from-gregorian
1282 (calendar-cursor-to-date t event
)))))
1283 (month (calendar-extract-month date
))
1284 (year (calendar-extract-year date
))
1285 (day (calendar-extract-day date
))
1286 (d1 (calendar-absolute-from-gregorian date
))
1288 (holidays (if cal-tex-holidays
1289 (holiday-in-range d1 d2
)))
1290 (diary-list (if cal-tex-diary
1291 (cal-tex-list-diary-entries d1 d2
))))
1292 (cal-tex-preamble "twoside")
1293 (cal-tex-filofax-paper)
1294 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]}
1295 \\long\\def\\rightday#1#2#3#4#5{%
1296 \\rule{\\textwidth}{0.3pt}\\\\%
1297 \\hbox to \\textwidth{%
1300 \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%
1301 \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}%
1302 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
1303 \\long\\def\\weekend#1#2#3#4#5{%
1304 \\rule{\\textwidth}{0.3pt}\\\\%
1305 \\hbox to \\textwidth{%
1308 \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%
1309 \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}%
1310 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
1311 \\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]}
1312 \\long\\def\\leftday#1#2#3#4#5{%
1313 \\rule{\\textwidth}{0.3pt}\\\\%
1314 \\hbox to \\textwidth{%
1317 \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}%
1318 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}%
1319 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
1321 (cal-tex-b-document)
1322 (cal-tex-cmd "\\pagestyle" "empty")
1324 (insert "\\lefthead")
1326 (let ((d (cal-tex-incr-date date
2)))
1327 (if (= (calendar-extract-month date
)
1328 (calendar-extract-month d
))
1330 (cal-tex-month-name (calendar-extract-month date
))
1331 (calendar-extract-year date
))
1332 (if (= (calendar-extract-year date
)
1333 (calendar-extract-year d
))
1334 (format "%s---%s %s"
1335 (cal-tex-month-name (calendar-extract-month date
))
1336 (cal-tex-month-name (calendar-extract-month d
))
1337 (calendar-extract-year date
))
1338 (format "%s %s---%s %s"
1339 (cal-tex-month-name (calendar-extract-month date
))
1340 (calendar-extract-year date
)
1341 (cal-tex-month-name (calendar-extract-month d
))
1342 (calendar-extract-year d
))))))
1344 (dotimes (_jdummy 3)
1345 (insert "\\leftday")
1346 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date
)))
1347 (cal-tex-arg (number-to-string (calendar-extract-day date
)))
1348 (cal-tex-arg (cal-tex-latexify-list diary-list date
))
1349 (cal-tex-arg (cal-tex-latexify-list holidays date
))
1350 (cal-tex-arg (eval cal-tex-daily-string
))
1352 (setq date
(cal-tex-incr-date date
)))
1353 (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n")
1355 (insert "\\righthead")
1357 (let ((d (cal-tex-incr-date date
3)))
1358 (if (= (calendar-extract-month date
)
1359 (calendar-extract-month d
))
1361 (cal-tex-month-name (calendar-extract-month date
))
1362 (calendar-extract-year date
))
1363 (if (= (calendar-extract-year date
)
1364 (calendar-extract-year d
))
1365 (format "%s---%s %s"
1366 (cal-tex-month-name (calendar-extract-month date
))
1367 (cal-tex-month-name (calendar-extract-month d
))
1368 (calendar-extract-year date
))
1369 (format "%s %s---%s %s"
1370 (cal-tex-month-name (calendar-extract-month date
))
1371 (calendar-extract-year date
)
1372 (cal-tex-month-name (calendar-extract-month d
))
1373 (calendar-extract-year d
))))))
1375 (dotimes (_jdummy 2)
1376 (insert "\\rightday")
1377 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date
)))
1378 (cal-tex-arg (number-to-string (calendar-extract-day date
)))
1379 (cal-tex-arg (cal-tex-latexify-list diary-list date
))
1380 (cal-tex-arg (cal-tex-latexify-list holidays date
))
1381 (cal-tex-arg (eval cal-tex-daily-string
))
1383 (setq date
(cal-tex-incr-date date
)))
1384 (dotimes (_jdummy 2)
1385 (insert "\\weekend")
1386 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date
)))
1387 (cal-tex-arg (number-to-string (calendar-extract-day date
)))
1388 (cal-tex-arg (cal-tex-latexify-list diary-list date
))
1389 (cal-tex-arg (cal-tex-latexify-list holidays date
))
1390 (cal-tex-arg (eval cal-tex-daily-string
))
1392 (setq date
(cal-tex-incr-date date
)))
1393 (unless (= i
(1- n
))
1394 (run-hooks 'cal-tex-week-hook
)
1396 (cal-tex-end-document)
1397 (run-hooks 'cal-tex-hook
)))
1400 (defun cal-tex-cursor-filofax-daily (&optional n event
)
1401 "Day-per-page Filofax style calendar for week indicated by cursor.
1402 Optional prefix argument N specifies number of weeks (default 1),
1403 starting on Mondays. The calendar shows holiday and diary
1404 entries if `cal-tex-holidays' and `cal-tex-diary', respectively,
1405 are non-nil. Pages are ruled if `cal-tex-rules' is non-nil.
1406 Optional EVENT indicates a buffer position to use instead of point."
1407 (interactive (list (prefix-numeric-value current-prefix-arg
)
1408 last-nonmenu-event
))
1410 (let* ((date (calendar-gregorian-from-absolute
1411 (calendar-dayname-on-or-before
1413 (calendar-absolute-from-gregorian
1414 (calendar-cursor-to-date t event
)))))
1415 (month (calendar-extract-month date
))
1416 (year (calendar-extract-year date
))
1417 (day (calendar-extract-day date
))
1418 (d1 (calendar-absolute-from-gregorian date
))
1420 (holidays (if cal-tex-holidays
1421 (holiday-in-range d1 d2
)))
1422 (diary-list (if cal-tex-diary
1423 (cal-tex-list-diary-entries d1 d2
))))
1424 (cal-tex-preamble "twoside")
1425 (cal-tex-filofax-paper)
1426 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]}
1427 \\long\\def\\rightday#1#2#3{%
1428 \\rule{\\textwidth}{0.3pt}\\\\%
1429 \\hbox to \\textwidth{%
1432 \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
1433 \\hbox to \\textwidth{\\vbox {\\raggedleft \\em #2}}%
1434 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}
1435 \\long\\def\\weekend#1#2#3{%
1436 \\rule{\\textwidth}{0.3pt}\\\\%
1437 \\hbox to \\textwidth{%
1440 \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
1441 \\hbox to \\textwidth{\\vbox {\\noindent \\em #2}}%
1442 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}
1443 \\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]}
1444 \\long\\def\\leftday#1#2#3{%
1445 \\rule{\\textwidth}{0.3pt}\\\\%
1446 \\hbox to \\textwidth{%
1449 \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
1450 \\hbox to \\textwidth{\\vbox {\\noindent \\em #2}}%
1451 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}
1453 \\setbox\\LineBox=\\hbox to\\textwidth{%
1454 \\vrule height.2in width0pt\\leaders\\hrule\\hfill}
1455 \\def\\linesfill{\\par\\leaders\\copy\\LineBox\\vfill}
1457 (cal-tex-b-document)
1458 (cal-tex-cmd "\\pagestyle" "empty")
1461 (let ((even (zerop (% j
2))))
1465 (cal-tex-arg (calendar-date-string date
))
1470 (cal-tex-arg (cal-tex-latexify-list diary-list date
))
1471 (cal-tex-arg (cal-tex-latexify-list holidays date
"\\\\" t
))
1472 (cal-tex-arg (eval cal-tex-daily-string
))
1475 (insert "\\linesfill\n")
1476 (insert "\\vfill\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n"))
1478 (setq date
(cal-tex-incr-date date
)))
1480 (dotimes (_jdummy 2)
1481 (insert "\\lefthead")
1482 (cal-tex-arg (calendar-date-string date
))
1483 (insert "\\weekend")
1484 (cal-tex-arg (cal-tex-latexify-list diary-list date
))
1485 (cal-tex-arg (cal-tex-latexify-list holidays date
"\\\\" t
))
1486 (cal-tex-arg (eval cal-tex-daily-string
))
1489 (insert "\\linesfill\n")
1491 (setq date
(cal-tex-incr-date date
)))
1493 (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n"))
1494 (unless (= i
(1- n
))
1495 (run-hooks 'cal-tex-week-hook
)
1497 (cal-tex-end-document)
1498 (run-hooks 'cal-tex-hook
)))
1506 (defun cal-tex-cursor-day (&optional n event
)
1507 "Make a buffer with LaTeX commands for the day cursor is on.
1508 Optional prefix argument N specifies number of days. The calendar shows
1509 the hours between `cal-tex-daily-start' and `cal-tex-daily-end', using
1510 the 24-hour clock if `cal-tex-24' is non-nil. Optional EVENT indicates
1511 a buffer position to use instead of point."
1512 (interactive (list (prefix-numeric-value current-prefix-arg
)
1513 last-nonmenu-event
))
1515 (let ((date (calendar-absolute-from-gregorian
1516 (calendar-cursor-to-date t event
))))
1517 (cal-tex-preamble "12pt")
1518 (cal-tex-weekly-paper 'nomargins
)
1519 (cal-tex-b-document)
1520 (cal-tex-cmd "\\pagestyle" "empty")
1522 (cal-tex-vspace "-1.7in")
1523 (cal-tex-daily-page (calendar-gregorian-from-absolute date
))
1524 (setq date
(1+ date
))
1525 (unless (= i
(1- n
))
1527 (run-hooks 'cal-tex-daily-hook
)))
1528 (cal-tex-end-document)
1529 (run-hooks 'cal-tex-hook
)))
1531 (defun cal-tex-daily-page (date)
1532 "Make a calendar page for Gregorian DATE on 8.5 by 11 paper.
1533 Uses the 24-hour clock if `cal-tex-24' is non-nil. Produces
1534 hourly sections for the period specified by `cal-tex-daily-start'
1535 and `cal-tex-daily-end'."
1536 (let ((month-name (cal-tex-month-name (calendar-extract-month date
)))
1537 (i (1- cal-tex-daily-start
))
1539 (cal-tex-banner "cal-tex-daily-page")
1540 (cal-tex-b-makebox "4cm" "l")
1541 (cal-tex-b-parbox "b" "3.8cm")
1542 (cal-tex-rule "0mm" "0mm" "2cm")
1543 (cal-tex-Huge (number-to-string (calendar-extract-day date
)))
1545 (cal-tex-bf month-name
)
1547 (cal-tex-hspace "1cm")
1548 (cal-tex-scriptsize (eval cal-tex-daily-string
))
1549 (cal-tex-hspace "3.5cm")
1552 (cal-tex-b-makebox "4cm" "r")
1553 (cal-tex-bf (cal-tex-LaTeXify-string (calendar-day-name date
)))
1556 (cal-tex-hspace ".4cm")
1557 (cal-tex-rule "0mm" "16.1cm" "1mm")
1559 (while (<= (setq i
(1+ i
)) cal-tex-daily-end
)
1560 (cal-tex-cmd "\\noindent")
1561 (setq hour
(if cal-tex-24
1564 (if (zerop hour
) (setq hour
12))
1565 (cal-tex-b-makebox "1cm" "c")
1566 (cal-tex-arg (number-to-string hour
))
1568 (cal-tex-rule "0mm" "15.5cm" ".2mm")
1570 (cal-tex-b-makebox "1cm" "c")
1571 (cal-tex-arg "$\\diamond$" )
1573 (cal-tex-rule "0mm" "15.5cm" ".2mm")
1574 (cal-tex-nl ".2cm"))
1576 (insert (cal-tex-mini-calendar
1577 (calendar-extract-month (cal-tex-previous-month date
))
1578 (calendar-extract-year (cal-tex-previous-month date
))
1579 "lastmonth" "1.1in" "1in"))
1580 (insert (cal-tex-mini-calendar
1581 (calendar-extract-month date
)
1582 (calendar-extract-year date
)
1583 "thismonth" "1.1in" "1in"))
1584 (insert (cal-tex-mini-calendar
1585 (calendar-extract-month (cal-tex-next-month date
))
1586 (calendar-extract-year (cal-tex-next-month date
))
1587 "nextmonth" "1.1in" "1in"))
1588 (insert "\\hbox to \\textwidth{")
1590 (insert "\\lastmonth")
1592 (insert "\\thismonth")
1594 (insert "\\nextmonth")
1597 (cal-tex-banner "end of cal-tex-daily-page")))
1603 (defun cal-tex-mini-calendar (month year name width height
&optional ptsize colsep
)
1604 "Produce mini-calendar for MONTH, YEAR in macro NAME with WIDTH and HEIGHT.
1605 Optional string PTSIZE gives the point size (default \"scriptsize\").
1606 Optional string COLSEP gives the column separation (default \"1mm\")."
1607 (or colsep
(setq colsep
"1mm"))
1608 (or ptsize
(setq ptsize
"scriptsize"))
1609 (let ((blank-days ; at start of month
1611 (- (calendar-day-of-week (list month
1 year
))
1612 calendar-week-start-day
)
1614 (last( calendar-last-day-of-month month year
))
1615 (str (concat "\\def\\" name
"{\\hbox to" width
"{%\n"
1616 "\\vbox to" height
"{%\n"
1617 "\\vfil \\hbox to" width
"{%\n"
1620 "{@{\\hspace{0mm}}r@{\\hspace{" colsep
1621 "}}r@{\\hspace{" colsep
"}}r@{\\hspace{" colsep
1622 "}}r@{\\hspace{" colsep
"}}r@{\\hspace{" colsep
1623 "}}r@{\\hspace{" colsep
"}}r@{\\hspace{0mm}}}%\n"
1624 "\\multicolumn{7}{c}{"
1625 (cal-tex-month-name month
)
1627 (number-to-string year
)
1632 (cal-tex-LaTeXify-string
1633 (substring (aref calendar-day-name-array
1634 (mod (+ calendar-week-start-day i
) 7))
1640 (dotimes (_idummy blank-days
)
1641 (setq str
(concat str
" & ")))
1643 (setq str
(concat str
(number-to-string (1+ i
)))
1644 str
(concat str
(if (zerop (mod (+ i
1 blank-days
) 7))
1649 (setq str
(concat str
"\n\\end{tabular}\\hfil}\\vfil}}}%\n"))
1653 ;;; Various calendar functions
1656 (defun cal-tex-incr-date (date &optional n
)
1657 "The date of the day following DATE.
1658 If optional N is given, the date of N days after DATE."
1659 (calendar-gregorian-from-absolute
1660 (+ (or n
1) (calendar-absolute-from-gregorian date
))))
1662 (defun cal-tex-latexify-list (date-list date
&optional separator final-separator
)
1663 "Return string with concatenated, LaTeX-ified entries in DATE-LIST for DATE.
1664 Use double backslash as a separator unless optional SEPARATOR is given.
1665 If resulting string is not empty, put separator at end if optional
1666 FINAL-SEPARATOR is non-nil."
1667 (or separator
(setq separator
"\\\\"))
1670 (mapconcat (lambda (x) (cal-tex-LaTeXify-string x
))
1671 (dolist (d date-list
(reverse result
))
1673 (calendar-date-equal date
(car d
))
1674 (setq result
(cons (cadr d
) result
))))
1676 (if (and final-separator
1677 (not (string-equal result
"")))
1678 (concat result separator
)
1681 (defun cal-tex-previous-month (date)
1682 "Return the date of the first day in the month previous to DATE."
1683 (let ((month (calendar-extract-month date
))
1684 (year (calendar-extract-year date
)))
1685 (calendar-increment-month month year -
1)
1686 (list month
1 year
)))
1688 (defun cal-tex-next-month (date)
1689 "Return the date of the first day in the month following DATE."
1690 (let ((month (calendar-extract-month date
))
1691 (year (calendar-extract-year date
)))
1692 (calendar-increment-month month year
1)
1693 (list month
1 year
)))
1699 (defun cal-tex-end-document ()
1700 "Finish the LaTeX document.
1701 Insert the trailer to LaTeX document, pop to LaTeX buffer, add
1702 informative header, and run HOOK."
1703 (cal-tex-e-document)
1704 (or (and cal-tex-preamble-extra
1705 (string-match "inputenc" cal-tex-preamble-extra
))
1706 (when (re-search-backward "[^[:ascii:]]" nil
'move
)
1707 (goto-char (point-min))
1708 (when (search-forward "documentclass" nil t
)
1710 ;; Eg for some Bahai holidays.
1711 ;; FIXME latin1 might not always be right.
1712 (insert "\\usepackage[latin1]{inputenc}\n"))))
1714 (pop-to-buffer (current-buffer))
1715 (goto-char (point-min))
1716 ;; FIXME auctex equivalents?
1718 (format "\tThis buffer was produced by cal-tex.el.
1719 \tTo print a calendar, type
1720 \t\tM-x tex-buffer RET
1721 \t\tM-x tex-print RET")))
1723 (defun cal-tex-insert-preamble (weeks landscape size
&optional append
)
1724 "Initialize the output LaTeX calendar buffer, `cal-tex-buffer'.
1725 Select the output buffer, and insert the preamble for a calendar
1726 of WEEKS weeks. Insert code for landscape mode if LANDSCAPE is
1727 non-nil. Use point-size SIZE. Optional argument APPEND, if
1728 non-nil, means add to end of buffer without erasing current contents."
1729 (let ((width "18cm")
1735 (cal-tex-preamble size
)
1738 (cal-tex-cmd "\\oddsidemargin -1.75cm")
1739 (cal-tex-cmd "\\def\\holidaymult" ".06"))
1740 (cal-tex-cmd "\\special" "landscape")
1741 (cal-tex-cmd "\\textwidth 9.5in")
1742 (cal-tex-cmd "\\textheight 7in")
1744 (cal-tex-cmd "\\def\\holidaymult" ".08"))
1745 (cal-tex-cmd cal-tex-caldate
)
1746 (cal-tex-cmd cal-tex-myday
)
1747 (cal-tex-b-document)
1748 (cal-tex-cmd "\\pagestyle" "empty"))
1749 (cal-tex-cmd "\\setlength{\\cellwidth}" width
)
1750 (insert (format "\\setlength{\\cellwidth}{%f\\cellwidth}\n"
1751 (/ 1.1 (length cal-tex-which-days
))))
1752 (cal-tex-cmd "\\setlength{\\cellheight}" height
)
1753 (insert (format "\\setlength{\\cellheight}{%f\\cellheight}\n"
1755 (cal-tex-cmd "\\ \\par")
1756 (cal-tex-vspace "-3cm")))
1758 (defconst cal-tex-LaTeX-subst-list
1760 ("\"".
"''") ; quote changes meaning when list is reversed
1761 ;; Don't think this is necessary, and in any case, does not work:
1762 ;; "LaTeX Error: \verb illegal in command argument".
1763 ;;; ("@" . "\\verb|@|")
1773 ("\n" .
"\\ \\\\")) ; \\ needed for e.g \begin{center}\n AA\end{center}
1774 "Alist of symbols and their LaTeX replacements.")
1776 (defun cal-tex-LaTeXify-string (string)
1777 "Protect special characters in STRING from LaTeX."
1782 (list cal-tex-LaTeX-subst-list
)
1784 (while (not (string-equal tail
""))
1785 (setq ch
(substring-no-properties tail
0 1)
1786 pair
(assoc ch list
))
1787 (if (and pair
(string-equal ch
"\""))
1788 (setq list
(reverse list
))) ; quote changes meaning each time
1789 (setq tail
(substring-no-properties tail
1)
1790 head
(concat head
(if pair
(cdr pair
) ch
))))
1793 (defun cal-tex-month-name (month)
1794 "The name of MONTH, LaTeX-ified."
1795 (cal-tex-LaTeXify-string (calendar-month-name month
)))
1797 (defun cal-tex-hfill ()
1801 (defun cal-tex-newpage ()
1803 (insert "\\newpage%\n"))
1805 (defun cal-tex-noindent ()
1807 (insert "\\noindent"))
1809 (defun cal-tex-vspace (space)
1810 "Insert vspace command to move SPACE vertically."
1811 (cal-tex-cmd "\\vspace*" space
))
1813 (defun cal-tex-hspace (space)
1814 "Insert hspace command to move SPACE horizontally."
1815 (cal-tex-cmd "\\hspace*" space
))
1817 (defun cal-tex-comment (&optional comment
)
1818 "Insert `% ', followed by optional string COMMENT, followed by newline.
1819 COMMENT may contain newlines, which are prefixed by `% ' in the output."
1820 (insert (format "%% %s\n"
1822 (replace-regexp-in-string "\n" "\n% " comment
)
1825 (defun cal-tex-banner (comment)
1826 "Insert string COMMENT, separated by blank lines."
1827 (cal-tex-comment (format "\n\n\n\t\t\t%s\n" comment
)))
1829 (defun cal-tex-nl (&optional skip comment
)
1830 "End a line with \\. If SKIP, then add that much spacing.
1831 Add trailing COMMENT if present."
1832 (insert (format "\\\\%s"
1834 (format "[%s]" skip
)
1836 (cal-tex-comment comment
))
1838 (defun cal-tex-arg (&optional text
)
1839 "Insert a brace {} pair containing the optional string TEXT."
1840 (insert (format "{%s}" (or text
""))))
1842 (defun cal-tex-cmd (cmd &optional arg
)
1843 "Insert LaTeX CMD, with optional argument ARG, and end with %."
1852 (defun cal-tex-b-document ()
1853 "Insert beginning of document."
1854 (cal-tex-cmd "\\begin" "document"))
1856 (defun cal-tex-e-document ()
1857 "Insert end of document."
1858 (cal-tex-cmd "\\end" "document"))
1860 (defun cal-tex-b-center ()
1861 "Insert beginning of centered block."
1862 (cal-tex-cmd "\\begin" "center"))
1864 (defun cal-tex-e-center ()
1865 "Insert end of centered block."
1867 (cal-tex-cmd "\\end" "center"))
1875 (defun cal-tex-b-parbox (position width
)
1876 "Insert parbox with parameters POSITION and WIDTH."
1877 (insert "\\parbox[" position
"]{" width
"}{")
1880 (defun cal-tex-e-parbox (&optional height
)
1881 "Insert end of parbox. Optionally, force it to be a given HEIGHT."
1884 (cal-tex-rule "0mm" "0mm" height
))
1886 (cal-tex-comment "end parbox"))
1888 (defun cal-tex-b-framebox (width position
)
1889 "Insert framebox with parameters WIDTH and POSITION (clr)."
1890 (insert "\\framebox[" width
"][" position
"]{" )
1893 (defun cal-tex-e-framebox ()
1894 "Insert end of framebox."
1897 (cal-tex-comment "end framebox"))
1900 (defun cal-tex-b-makebox (width position
)
1901 "Insert makebox with parameters WIDTH and POSITION (clr)."
1902 (insert "\\makebox[" width
"][" position
"]{" )
1905 (defun cal-tex-e-makebox ()
1906 "Insert end of makebox."
1909 (cal-tex-comment "end makebox"))
1912 (defun cal-tex-rule (lower width height
)
1913 "Insert a rule with parameters LOWER WIDTH HEIGHT."
1914 (insert "\\rule[" lower
"]{" width
"}{" height
"}"))
1920 (defun cal-tex-em (string)
1921 "Insert STRING in italic font."
1922 (cal-tex-cmd "\\textit" string
))
1924 (defun cal-tex-bf (string)
1925 "Insert STRING in bf font."
1926 (cal-tex-cmd "\\textbf" string
))
1928 (defun cal-tex-scriptsize (string)
1929 "Insert STRING in scriptsize font."
1930 (cal-tex-arg (concat "\\scriptsize " string
)))
1932 (defun cal-tex-huge (string)
1933 "Insert STRING in huge font."
1934 (cal-tex-arg (concat "\\huge " string
)))
1936 (defun cal-tex-Huge (string)
1937 "Insert STRING in Huge font."
1938 (cal-tex-arg (concat "\\Huge " string
)))
1940 (defun cal-tex-Huge-bf (string)
1941 "Insert STRING in Huge bf font."
1942 (cal-tex-cmd "\\textbf" (concat "\\Huge " string
)))
1944 (defun cal-tex-large (string)
1945 "Insert STRING in large font."
1946 (cal-tex-arg (concat "\\large " string
)))
1948 (defun cal-tex-large-bf (string)
1949 "Insert STRING in large bf font."
1950 (cal-tex-cmd "\\textbf" (concat "\\large " string
)))
1955 ;;; cal-tex.el ends here