annotate lisp/calendar/cal-tex.el @ 78415:73900ddc75ee

(window_min_size_2): New function. (window_min_size_1, size_window, Fdisplay_buffer) (Fsplit_window, adjust_window_trailing_edge): Use it to avoid windows without mode- or header-lines when window-min-height is too small. (size_window): Reset nodelete_p after testing it, following an earlier note by Kim F. Storm. (display_buffer): Do not set split_height_threshold to twice the value of window_min_height to avoid changing the value of a customizable variable. Rather explicitly check whether the height of the window that shall be splitted is at least as large as split_height_threshold. (Fwindow_full_width_p): New defun. (syms_of_window): Defsubr it. (Fdisplay_buffer): Use NILP. (Fset_window_scroll_bars): Likewise.
author Martin Rudalics <rudalics@gmx.at>
date Mon, 06 Aug 2007 06:44:31 +0000
parents 93e11478c954
children 974a828870fe 88083f9a3f28
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36118
diff changeset
1 ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
2
75346
7a3f13e2dd57 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 70311
diff changeset
3 ;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007
67465
a55ee709ec8d Update copyright pending Emacs 22.
Glenn Morris <rgm@gnu.org>
parents: 64085
diff changeset
4 ;; Free Software Foundation, Inc.
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
5
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
6 ;; Author: Steve Fisk <fisk@bowdoin.edu>
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
7 ;; Edward M. Reingold <reingold@cs.uiuc.edu>
67465
a55ee709ec8d Update copyright pending Emacs 22.
Glenn Morris <rgm@gnu.org>
parents: 64085
diff changeset
8 ;; Maintainer: Glenn Morris <rgm@gnu.org>
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
9 ;; Keywords: calendar
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
10 ;; Human-Keywords: Calendar, LaTeX
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
11
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
12 ;; This file is part of GNU Emacs.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
13
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
78216
93e11478c954 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 78205
diff changeset
16 ;; the Free Software Foundation; either version 3, or (at your option)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
17 ;; any later version.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
18
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
22 ;; GNU General Public License for more details.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
23
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13649
diff changeset
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
27 ;; Boston, MA 02110-1301, USA.
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
28
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
29 ;;; Commentary:
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
30
13206
2d1da471963a Minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13195
diff changeset
31 ;; This collection of functions implements the creation of LaTeX calendars
2d1da471963a Minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13195
diff changeset
32 ;; based on the user's holiday choices and diary file.
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
33
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13649
diff changeset
34 ;; TO DO
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13649
diff changeset
35 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13649
diff changeset
36 ;; (*) Add holidays and diary entries to daily calendar.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13649
diff changeset
37 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13649
diff changeset
38 ;; (*) Add diary entries to weekly calendar functions.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13649
diff changeset
39 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13649
diff changeset
40 ;; (*) Make calendar styles for A4 paper.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13649
diff changeset
41 ;;
19973
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
42 ;; (*) Make monthly styles Filofax paper.
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
43
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
44 ;;; Code:
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
45
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
46 (require 'calendar)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
47
70311
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
48 (autoload 'diary-list-entries "diary-lib" nil t)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
49 (autoload 'calendar-holiday-list "holidays" nil t)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
50 (autoload 'calendar-iso-from-absolute "cal-iso" nil t)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
51
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
52 ;;;
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
53 ;;; Customizable variables
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
54 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
55
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
56 (defcustom cal-tex-which-days '(0 1 2 3 4 5 6)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
57 "*The days of the week that are displayed on the portrait monthly calendar.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
58 Sunday is 0, Monday is 1, and so on. The default is to print from Sunday to
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
59 Saturday. For example, use
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
60
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
61 (setq cal-tex-which-days '(1 3 5))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
62
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
63 to only print Monday, Wednesday, Friday."
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
64 :type '(repeat integer)
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
65 :group 'calendar-tex)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
66
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
67 (defcustom cal-tex-holidays t
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
68 "Non-nil means holidays are printed in the LaTeX calendars that support it.
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
69 If finding the holidays is too slow, set this to nil."
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
70 :type 'boolean
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
71 :group 'calendar-tex)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
72
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
73 (defcustom cal-tex-diary nil
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
74 "Non-nil means diary entries are printed in LaTeX calendars that support it.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
75 At present, this only affects the monthly, filofax, and iso-week
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
76 calendars (i.e. not the yearly, plain weekly, or daily calendars)."
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
77 :type 'boolean
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
78 :group 'calendar-tex)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
79
25130
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
80 (defcustom cal-tex-rules nil
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
81 "Non-nil means pages will be ruled in some LaTeX calendar styles.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
82 At present, this only affects the daily filofax calendar."
25130
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
83 :type 'boolean
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
84 :group 'calendar-tex)
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
85
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
86 (defcustom cal-tex-daily-string
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
87 '(let* ((year (extract-calendar-year date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
88 (day (calendar-day-number date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
89 (days-remaining (- (calendar-day-number (list 12 31 year)) day)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
90 (format "%d/%d" day days-remaining))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
91 "*An expression in the variable `date' whose value is placed on date.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
92 The string resulting from evaluating this expression is placed at the bottom
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
93 center of `date' on the monthly calendar, next to the date in the weekly
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
94 calendars, and in the top center of daily calendars.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
95
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
96 Default is ordinal day number of the year and the number of days remaining.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
97 As an example of what you do, setting this to
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
98
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
99 '(progn
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
100 (require 'cal-hebrew)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
101 (calendar-hebrew-date-string date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
102
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
103 will put the Hebrew date at the bottom of each day."
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
104 :type 'sexp
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
105 :group 'calendar-tex)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
106
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
107 (defcustom cal-tex-buffer "calendar.tex"
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
108 "The name for the output LaTeX calendar buffer."
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
109 :type 'string
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
110 :group 'calendar-tex)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
111
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
112 (defcustom cal-tex-24 nil
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
113 "Non-nil means use a 24 hour clock in the daily calendar."
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
114 :type 'boolean
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
115 :group 'calendar-tex)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
116
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
117 (defcustom cal-tex-daily-start 8
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
118 "*The first hour of the daily calendar page."
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
119 :type 'integer
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
120 :group 'calendar-tex)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
121
17626
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
122 (defcustom cal-tex-daily-end 20
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
123 "*The last hour of the daily calendar page."
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
124 :type 'integer
68cce262538d Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17196
diff changeset
125 :group 'calendar-tex)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
126
70311
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
127 (defcustom cal-tex-preamble-extra nil
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
128 "A string giving extra LaTeX commands to insert in the calendar preamble.
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
129 For example, to include extra packages:
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
130 \"\\\\usepackage{foo}\\n\\\\usepackage{bar}\\n\"."
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
131 :type 'string
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
132 :group 'calendar-tex
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
133 :version "22.1")
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
134
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
135 (defcustom cal-tex-hook nil
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
136 "*List of functions called after any LaTeX calendar buffer is generated.
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
137 You can use this to do postprocessing on the buffer. For example, to change
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
138 characters with diacritical marks to their LaTeX equivalents, use
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
139 (add-hook 'cal-tex-hook
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
140 '(lambda () (iso-iso2tex (point-min) (point-max))))"
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
141 :type 'hook
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
142 :group 'calendar-tex)
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
143
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
144 (defcustom cal-tex-year-hook nil
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
145 "*List of functions called after a LaTeX year calendar buffer is generated."
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
146 :type 'hook
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
147 :group 'calendar-tex)
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
148
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
149 (defcustom cal-tex-month-hook nil
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
150 "*List of functions called after a LaTeX month calendar buffer is generated."
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
151 :type 'hook
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
152 :group 'calendar-tex)
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
153
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
154 (defcustom cal-tex-week-hook nil
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
155 "*List of functions called after a LaTeX week calendar buffer is generated."
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
156 :type 'hook
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
157 :group 'calendar-tex)
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
158
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
159 (defcustom cal-tex-daily-hook nil
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
160 "*List of functions called after a LaTeX daily calendar buffer is generated."
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
161 :type 'hook
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
162 :group 'calendar-tex)
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
163
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
164 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
165 ;;; Definitions for LaTeX code
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
166 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
167
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
168 (defvar cal-tex-day-prefix "\\caldate{%s}{%s}"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
169 "The initial LaTeX code for a day.
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
170 The holidays, diary entries, bottom string, and the text follow.")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
171
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
172 (defvar cal-tex-day-name-format "\\myday{%s}%%"
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
173 "The format for LaTeX code for a day name. The names are taken from
52114
48c133ab94d7 (cal-tex-day-name-format): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 49598
diff changeset
174 `calendar-day-name-array'.")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
175
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
176 (defvar cal-tex-cal-one-month
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
177 "\\def\\calmonth#1#2%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
178 {\\begin{center}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
179 \\Huge\\bf\\uppercase{#1} #2 \\\\[1cm]%
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
180 \\end{center}}%
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
181 \\vspace*{-1.5cm}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
182 %
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
183 "
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
184 "LaTeX code for the month header")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
185
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
186 (defvar cal-tex-cal-multi-month
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
187 "\\def\\calmonth#1#2#3#4%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
188 {\\begin{center}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
189 \\Huge\\bf #1 #2---#3 #4\\\\[1cm]%
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
190 \\end{center}}%
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
191 \\vspace*{-1.5cm}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
192 %
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
193 "
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
194 "LaTeX code for the month header")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
196 (defvar cal-tex-myday
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
197 "\\renewcommand{\\myday}[1]%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
198 {\\makebox[\\cellwidth]{\\hfill\\large\\bf#1\\hfill}}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
199 %
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
200 "
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
201 "LaTeX code for a day heading")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
202
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
203 (defvar cal-tex-caldate
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
204 "\\fboxsep=0pt
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
205 \\long\\def\\caldate#1#2#3#4#5#6{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
206 \\fbox{\\hbox to\\cellwidth{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
207 \\vbox to\\cellheight{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
208 \\hbox to\\cellwidth{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
209 {\\hspace*{1mm}\\Large \\bf \\strut #2}\\hspace{.05\\cellwidth}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
210 \\raisebox{\\holidaymult\\cellheight}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
211 {\\parbox[t]{.75\\cellwidth}{\\tiny \\raggedright #4}}}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
212 \\hbox to\\cellwidth{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
213 \\hspace*{1mm}\\parbox{.95\\cellwidth}{\\tiny \\raggedright #3}}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
214 \\hspace*{1mm}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
215 \\hbox to\\cellwidth{#6}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
216 \\vfill%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
217 \\hbox to\\cellwidth{\\hfill \\tiny #5 \\hfill}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
218 \\vskip 1.4pt}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
219 \\hskip -0.4pt}}}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
220 "
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
221 "LaTeX code to insert one box with date info in calendar.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
222 This definition is the heart of the calendar!")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
223
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
224 (defun cal-tex-list-holidays (d1 d2)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
225 "Generate a list of all holidays from absolute date D1 to D2."
22147
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
226 (let* ((start (calendar-gregorian-from-absolute d1))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
227 (displayed-month (extract-calendar-month start))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
228 (displayed-year (extract-calendar-year start))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
229 (end (calendar-gregorian-from-absolute d2))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
230 (end-month (extract-calendar-month end))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
231 (end-year (extract-calendar-year end))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
232 (number-of-intervals
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
233 (1+ (/ (calendar-interval displayed-month displayed-year
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
234 end-month end-year)
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
235 3)))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
236 (holidays nil)
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
237 (in-range))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
238 (increment-calendar-month displayed-month displayed-year 1)
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
239 (calendar-for-loop i from 1 to number-of-intervals do
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
240 (setq holidays (append holidays (calendar-holiday-list)))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
241 (increment-calendar-month displayed-month displayed-year 3))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
242 (while holidays
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
243 (and (car (car holidays))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
244 (let ((a (calendar-absolute-from-gregorian (car (car holidays)))))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
245 (and (<= d1 a) (<= a d2)))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
246 (setq in-range (append (list (car holidays)) in-range)))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
247 (setq holidays (cdr holidays)))
803bcc3c1a49 Rewrote cal-tex-list-holidays to get holidays in the range correctly (and more
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20216
diff changeset
248 in-range))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
249
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
250 (defun cal-tex-list-diary-entries (d1 d2)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
251 "Generate a list of all diary-entries from absolute date D1 to D2."
19312
d67c0dba233d (cal-tex-latexify-list): Put the elements of RESULT in the proper order.
Richard M. Stallman <rms@gnu.org>
parents: 19311
diff changeset
252 (let ((diary-list-include-blanks nil)
22415
c9fa49047eb5 Prevent diary display from being corrupted on printed calendar generation.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22147
diff changeset
253 (diary-display-hook 'ignore))
70311
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
254 (diary-list-entries
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
255 (calendar-gregorian-from-absolute d1)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
256 (1+ (- d2 d1)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
257
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
258 (defun cal-tex-preamble (&optional args)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
259 "Insert the LaTeX preamble.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
260 Preamble Includes initial definitions for various LaTeX commands.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
261 Optional ARGS are included."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
262 (set-buffer (get-buffer-create cal-tex-buffer))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
263 (erase-buffer)
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
264 (insert "\\documentclass")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
265 (if args
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
266 (insert "[" args "]"))
70311
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
267 (insert "{article}\n")
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
268 (if (stringp cal-tex-preamble-extra)
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
269 (insert cal-tex-preamble-extra "\n"))
7551592e369e (cal-tex-preamble-extra): New variable.
Glenn Morris <rgm@gnu.org>
parents: 68721
diff changeset
270 (insert "\\hbadness 20000
14268
28face32932e Add \hfuzz=1000pt to get rid of overfull box messages.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14169
diff changeset
271 \\hfuzz=1000pt
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
272 \\vbadness 20000
17196
1b2490698826 (cal-tex-preamble): Set \lineskip to 0pt.
Karl Heuer <kwzh@gnu.org>
parents: 15433
diff changeset
273 \\lineskip 0pt
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
274 \\marginparwidth 0pt
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
275 \\oddsidemargin -2cm
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
276 \\evensidemargin -2cm
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
277 \\marginparsep 0pt
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
278 \\topmargin 0pt
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
279 \\textwidth 7.5in
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
280 \\textheight 9.5in
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
281 \\newlength{\\cellwidth}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
282 \\newlength{\\cellheight}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
283 \\newlength{\\boxwidth}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
284 \\newlength{\\boxheight}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
285 \\newlength{\\cellsize}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
286 \\newcommand{\\myday}[1]{}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
287 \\newcommand{\\caldate}[6]{}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
288 \\newcommand{\\nocaldate}[6]{}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
289 \\newcommand{\\calsmall}[6]{}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
290 %
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
291 "))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
292
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
293 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
294 ;;; Yearly calendars
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
295 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
296
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
297 (defun cal-tex-cursor-year (&optional arg)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
298 "Make a buffer with LaTeX commands for the year cursor is on.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
299 Optional prefix argument specifies number of years."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
300 (interactive "p")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
301 (cal-tex-year (extract-calendar-year (calendar-cursor-to-date t))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
302 (if arg arg 1)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
303
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
304 (defun cal-tex-cursor-year-landscape (&optional arg)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
305 "Make a buffer with LaTeX commands for the year cursor is on.
13595
2af9ec0bc9cc (cal-tex-version): Deleted.
Richard M. Stallman <rms@gnu.org>
parents: 13206
diff changeset
306 Optional prefix argument specifies number of years."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
307 (interactive "p")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
308 (cal-tex-year (extract-calendar-year (calendar-cursor-to-date t))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
309 (if arg arg 1)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
310 t))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
311
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
312 (defun cal-tex-year (year n &optional landscape)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
313 "Make a one page yearly calendar of YEAR; do this for N years.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
314 There are four rows of three months each, unless optional LANDSCAPE is t,
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
315 in which case the calendar isprinted in landscape mode with three rows of
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
316 four months each."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
317 (cal-tex-insert-preamble 1 landscape "12pt")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
318 (if landscape
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
319 (cal-tex-vspace "-.6cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
320 (cal-tex-vspace "-3.1cm"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
321 (calendar-for-loop j from 1 to n do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
322 (insert "\\vfill%\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
323 (cal-tex-b-center)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
324 (cal-tex-Huge (number-to-string year))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
325 (cal-tex-e-center)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
326 (cal-tex-vspace "1cm")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
327 (cal-tex-b-center)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
328 (cal-tex-b-parbox "l" (if landscape "5.9in" "4.3in"))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
329 (insert "\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
330 (cal-tex-noindent)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
331 (cal-tex-nl)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
332 (calendar-for-loop i from 1 to 12 do
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
333 (insert (cal-tex-mini-calendar i year "month" "1.1in" "1in"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
334 (insert "\\month")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
335 (cal-tex-hspace "0.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
336 (if (zerop (mod i (if landscape 4 3)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
337 (cal-tex-nl "0.5in")))
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
338 (cal-tex-e-parbox)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
339 (cal-tex-e-center)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
340 (insert "\\vfill%\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
341 (setq year (1+ year))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
342 (if (/= j n)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
343 (cal-tex-newpage)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
344 (cal-tex-end-document))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
345 (run-hooks 'cal-tex-year-hook))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
346 (run-hooks 'cal-tex-hook))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
347
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
348 (defun cal-tex-cursor-filofax-year (&optional arg)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
349 "Make a Filofax one page yearly calendar of year indicated by cursor.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
350 Optional parameter specifies number of years."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
351 (interactive "p")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
352 (let* ((n (if arg arg 1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
353 (year (extract-calendar-year (calendar-cursor-to-date t))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
354 (cal-tex-preamble "twoside")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
355 (cal-tex-cmd "\\textwidth 3.25in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
356 (cal-tex-cmd "\\textheight 6.5in")
15433
172725d0d2d5 A bit more fiddling with layout of Filofax year page.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 15432
diff changeset
357 (cal-tex-cmd "\\oddsidemargin 1.675in")
172725d0d2d5 A bit more fiddling with layout of Filofax year page.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 15432
diff changeset
358 (cal-tex-cmd "\\evensidemargin 1.675in")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
359 (cal-tex-cmd "\\topmargin 0pt")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
360 (cal-tex-cmd "\\headheight -0.875in")
15432
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
361 (cal-tex-cmd "\\fboxsep 0.5mm")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
362 (cal-tex-cmd "\\pagestyle{empty}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
363 (cal-tex-b-document)
15432
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
364 (cal-tex-cmd "\\vspace*{0.25in}")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
365 (calendar-for-loop j from 1 to n do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
366 (insert (format "\\hfil {\\Large \\bf %s} \\hfil\\\\\n" year))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
367 (cal-tex-b-center)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
368 (cal-tex-b-parbox "l" "\\textwidth")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
369 (insert "\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
370 (cal-tex-noindent)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
371 (cal-tex-nl)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
372 (let ((month-names; don't use default in case user changed it
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
373 ;; These are only used to define the command names, not
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
374 ;; the names of the months they insert.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
375 ["January" "February" "March" "April" "May" "June"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
376 "July" "August" "September" "October" "November" "December"]))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
377 (calendar-for-loop i from 1 to 12 do
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
378 (insert (cal-tex-mini-calendar i year
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
379 (aref month-names (1- i))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
380 "1in" ".9in" "tiny" "0.6mm"))))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
381 (insert
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
382 "\\noindent\\fbox{\\January}\\fbox{\\February}\\fbox{\\March}\\\\
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
383 \\noindent\\fbox{\\April}\\fbox{\\May}\\fbox{\\June}\\\\
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
384 \\noindent\\fbox{\\July}\\fbox{\\August}\\fbox{\\September}\\\\
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
385 \\noindent\\fbox{\\October}\\fbox{\\November}\\fbox{\\December}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
386 ")
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
387 (cal-tex-e-parbox)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
388 (cal-tex-e-center)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
389 (setq year (1+ year))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
390 (if (= j n)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
391 (cal-tex-end-document)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
392 (cal-tex-newpage)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
393 (cal-tex-cmd "\\vspace*{0.25in}"))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
394 (run-hooks 'cal-tex-year-hook))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
395 (run-hooks 'cal-tex-hook)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
396
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
397 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
398 ;;; Monthly calendars
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
399 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
400
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
401 (defun cal-tex-cursor-month-landscape (&optional arg)
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
402 "Make a LaTeX calendar buffer for the month the cursor is on.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
403 Optional prefix argument specifies number of months to be
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
404 produced (default 1). The output is in landscape format, one
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
405 month to a page. It shows holiday and diary entries if
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
406 `cal-tex-holidays' and `cal-tex-diary', respectively, are
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
407 non-nil."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
408 (interactive "p")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
409 (let* ((n (if arg arg 1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
410 (date (calendar-cursor-to-date t))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
411 (month (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
412 (year (extract-calendar-year date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
413 (end-month month)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
414 (end-year year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
415 (cal-tex-which-days '(0 1 2 3 4 5 6)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
416 (increment-calendar-month end-month end-year (1- n))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
417 (let ((diary-list (if cal-tex-diary
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
418 (cal-tex-list-diary-entries
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
419 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
420 (list month 1 year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
421 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
422 (list end-month
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
423 (calendar-last-day-of-month
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
424 end-month end-year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
425 end-year)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
426 (holidays (if cal-tex-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
427 (cal-tex-list-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
428 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
429 (list month 1 year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
430 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
431 (list end-month
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
432 (calendar-last-day-of-month end-month end-year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
433 end-year)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
434 (other-month)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
435 (other-year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
436 (small-months-at-start))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
437 (cal-tex-insert-preamble (cal-tex-number-weeks month year 1) t "12pt")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
438 (cal-tex-cmd cal-tex-cal-one-month)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
439 (calendar-for-loop i from 1 to n do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
440 (setq other-month month)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
441 (setq other-year year)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
442 (increment-calendar-month other-month other-year -1)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
443 (insert (cal-tex-mini-calendar other-month other-year "lastmonth"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
444 "\\cellwidth" "\\cellheight"))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
445 (increment-calendar-month other-month other-year 2)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
446 (insert (cal-tex-mini-calendar other-month other-year "nextmonth"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
447 "\\cellwidth" "\\cellheight"))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
448 (cal-tex-insert-month-header 1 month year month year)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
449 (cal-tex-insert-day-names)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
450 (cal-tex-nl ".2cm")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
451 (setq small-months-at-start
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
452 (< 1 (mod (- (calendar-day-of-week (list month 1 year))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
453 calendar-week-start-day)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
454 7)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
455 (if small-months-at-start
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
456 (insert "\\lastmonth\\nextmonth\\hspace*{-2\\cellwidth}"))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
457 (cal-tex-insert-blank-days month year cal-tex-day-prefix)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
458 (cal-tex-insert-days month year diary-list holidays
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
459 cal-tex-day-prefix)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
460 (cal-tex-insert-blank-days-at-end month year cal-tex-day-prefix)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
461 (if (and (not small-months-at-start)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
462 (< 1 (mod (- (1- calendar-week-start-day)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
463 (calendar-day-of-week
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
464 (list month
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
465 (calendar-last-day-of-month month year)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
466 year)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
467 7)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
468 (insert "\\vspace*{-\\cellwidth}\\hspace*{-2\\cellwidth}"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
469 "\\lastmonth\\nextmonth%
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
470 "))
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
471 (if (/= i n)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
472 (progn
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
473 (run-hooks 'cal-tex-month-hook)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
474 (cal-tex-newpage)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
475 (increment-calendar-month month year 1)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
476 (cal-tex-vspace "-2cm")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
477 (cal-tex-insert-preamble
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
478 (cal-tex-number-weeks month year 1) t "12pt" t))))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
479 (cal-tex-end-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
480 (run-hooks 'cal-tex-hook))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
481
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
482 (defun cal-tex-cursor-month (arg)
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
483 "Make a LaTeX calendar buffer for the month the cursor is on.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
484 Optional prefix argument specifies number of months to be
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
485 produced (default 1). The calendar is condensed onto one page.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
486 It shows holiday and diary entries if `cal-tex-holidays' and
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
487 `cal-tex-diary', respectively, are non-nil."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
488 (interactive "p")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
489 (let* ((date (calendar-cursor-to-date t))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
490 (month (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
491 (year (extract-calendar-year date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
492 (end-month month)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
493 (end-year year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
494 (n (if arg arg 1)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
495 (increment-calendar-month end-month end-year (1- n))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
496 (let ((diary-list (if cal-tex-diary
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
497 (cal-tex-list-diary-entries
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
498 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
499 (list month 1 year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
500 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
501 (list end-month
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
502 (calendar-last-day-of-month
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
503 end-month end-year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
504 end-year)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
505 (holidays (if cal-tex-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
506 (cal-tex-list-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
507 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
508 (list month 1 year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
509 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
510 (list end-month
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
511 (calendar-last-day-of-month end-month end-year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
512 end-year)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
513 (other-month)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
514 (other-year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
515 (cal-tex-insert-preamble (cal-tex-number-weeks month year n) nil"12pt")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
516 (if (> n 1)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
517 (cal-tex-cmd cal-tex-cal-multi-month)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
518 (cal-tex-cmd cal-tex-cal-one-month))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
519 (cal-tex-insert-month-header n month year end-month end-year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
520 (cal-tex-insert-day-names)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
521 (cal-tex-nl ".2cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
522 (cal-tex-insert-blank-days month year cal-tex-day-prefix)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
523 (calendar-for-loop i from 1 to n do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
524 (setq other-month month)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
525 (setq other-year year)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
526 (cal-tex-insert-days month year diary-list holidays
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
527 cal-tex-day-prefix)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
528 (if (= (mod (calendar-absolute-from-gregorian
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
529 (list month
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
530 (calendar-last-day-of-month month year)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
531 year))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
532 7)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
533 6); last day of month was Saturday
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
534 (progn
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
535 (cal-tex-hfill)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
536 (cal-tex-nl)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
537 (increment-calendar-month month year 1))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
538 (cal-tex-insert-blank-days-at-end end-month end-year cal-tex-day-prefix)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
539 (cal-tex-end-document)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
540 (run-hooks 'cal-tex-hook))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
541
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
542 (defun cal-tex-insert-days (month year diary-list holidays day-format)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
543 "Insert LaTeX commands for a range of days in monthly calendars.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
544 LaTeX commands are inserted for the days of the MONTH in YEAR.
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
545 Diary entries on DIARY-LIST are included. Holidays on HOLIDAYS
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
546 are included. Each day is formatted using format DAY-FORMAT."
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
547 (let* ((blank-days;; at start of month
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
548 (mod
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
549 (- (calendar-day-of-week (list month 1 year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
550 calendar-week-start-day)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
551 7))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
552 (date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
553 (last (calendar-last-day-of-month month year)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
554 (calendar-for-loop i from 1 to last do
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
555 (setq date (list month i year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
556 (if (memq (calendar-day-of-week date) cal-tex-which-days)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
557 (progn
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
558 (insert (format day-format (cal-tex-month-name month) i))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
559 (cal-tex-arg (cal-tex-latexify-list diary-list date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
560 (cal-tex-arg (cal-tex-latexify-list holidays date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
561 (cal-tex-arg (eval cal-tex-daily-string))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
562 (cal-tex-arg)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
563 (cal-tex-comment)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
564 (if (and (zerop (mod (+ i blank-days) 7))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
565 (/= i last))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
566 (progn
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
567 (cal-tex-hfill)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
568 (cal-tex-nl))))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
569
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
570 (defun cal-tex-insert-day-names ()
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
571 "Insert the names of the days at top of a monthly calendar."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
572 (calendar-for-loop i from 0 to 6 do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
573 (if (memq i cal-tex-which-days)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
574 (insert (format cal-tex-day-name-format
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
575 (cal-tex-LaTeXify-string
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
576 (aref calendar-day-name-array
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
577 (mod (+ calendar-week-start-day i) 7))))))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
578 (cal-tex-comment)))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
579
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
580 (defun cal-tex-insert-month-header (n month year end-month end-year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
581 "Create a title for a calendar.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
582 A title is inserted for a calendar with N months starting with
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
583 MONTH YEAR and ending with END-MONTH END-YEAR."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
584 (let ((month-name (cal-tex-month-name month))
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
585 (end-month-name (cal-tex-month-name end-month)))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
586 (if (= 1 n)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
587 (insert (format "\\calmonth{%s}{%s}\n\\vspace*{-0.5cm}"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
588 month-name year) )
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
589 (insert (format "\\calmonth{%s}{%s}{%s}{%s}\n\\vspace*{-0.5cm}"
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
590 month-name year end-month-name end-year))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
591 (cal-tex-comment))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
592
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
593 (defun cal-tex-insert-blank-days (month year day-format)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
594 "Insert code for initial days not in calendar.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
595 Insert LaTeX code for the blank days at the beginning of the MONTH in
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
596 YEAR. The entry is formatted using DAY-FORMAT. If the entire week is
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
597 blank, no days are inserted."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
598 (if (cal-tex-first-blank-p month year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
599 (let* ((blank-days;; at start of month
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
600 (mod
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
601 (- (calendar-day-of-week (list month 1 year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
602 calendar-week-start-day)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
603 7)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
604 (calendar-for-loop i from 0 to (1- blank-days) do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
605 (if (memq i cal-tex-which-days)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
606 (insert (format day-format " " " ") "{}{}{}{}%\n"))))))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
607
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
608 (defun cal-tex-insert-blank-days-at-end (month year day-format)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
609 "Insert code for final days not in calendar.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
610 Insert LaTeX code for the blank days at the end of the MONTH in YEAR.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
611 The entry is formatted using DAY-FORMAT."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
612 (if (cal-tex-last-blank-p month year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
613 (let* ((last-day (calendar-last-day-of-month month year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
614 (blank-days;; at end of month
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
615 (mod
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
616 (- (calendar-day-of-week (list month last-day year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
617 calendar-week-start-day)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
618 7)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
619 (calendar-for-loop i from (1+ blank-days) to 6 do
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
620 (if (memq i cal-tex-which-days)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
621 (insert (format day-format "" "") "{}{}{}{}%\n"))))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
622
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
623 (defun cal-tex-first-blank-p (month year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
624 "Determine if any days of the first week will be printed.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
625 Return t if there will there be any days of the first week printed
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
626 in the calendar starting in MONTH YEAR."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
627 (let ((any-days nil)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
628 (the-saturday)) ;the day of week of 1st Saturday
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
629 (calendar-for-loop i from 1 to 7 do
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
630 (if (= 6 (calendar-day-of-week (list month i year)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
631 (setq the-saturday i)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
632 (calendar-for-loop i from 1 to the-saturday do
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
633 (if (memq (calendar-day-of-week (list month i year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
634 cal-tex-which-days)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
635 (setq any-days t)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
636 any-days))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
637
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
638 (defun cal-tex-last-blank-p (month year)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
639 "Determine if any days of the last week will be printed.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
640 Return t if there will there be any days of the last week printed
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
641 in the calendar starting in MONTH YEAR."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
642 (let ((any-days nil)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
643 (last-day (calendar-last-day-of-month month year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
644 (the-sunday)) ;the day of week of last Sunday
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
645 (calendar-for-loop i from (- last-day 6) to last-day do
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
646 (if (= 0 (calendar-day-of-week (list month i year)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
647 (setq the-sunday i)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
648 (calendar-for-loop i from the-sunday to last-day do
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
649 (if (memq (calendar-day-of-week (list month i year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
650 cal-tex-which-days)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
651 (setq any-days t)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
652 any-days))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
653
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
654 (defun cal-tex-number-weeks (month year n)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
655 "Determine the number of weeks in a range of dates.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
656 Compute the number of weeks in the calendar starting with MONTH and YEAR,
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
657 and lasting N months, including only the days in WHICH-DAYS. As it stands,
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
658 this is only an upper bound."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
659 (let ((d (list month 1 year)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
660 (increment-calendar-month month year (1- n))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
661 (/ (- (calendar-dayname-on-or-before
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
662 calendar-week-start-day
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
663 (+ 7 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
664 (list month (calendar-last-day-of-month month year) year))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
665 (calendar-dayname-on-or-before
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
666 calendar-week-start-day
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
667 (calendar-absolute-from-gregorian d)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
668 7)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
669
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
670 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
671 ;;; Weekly calendars
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
672 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
673
52114
48c133ab94d7 (cal-tex-day-name-format): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 49598
diff changeset
674 (defvar cal-tex-LaTeX-hourbox
48c133ab94d7 (cal-tex-day-name-format): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 49598
diff changeset
675 "\\newcommand{\\hourbox}[2]%
48c133ab94d7 (cal-tex-day-name-format): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 49598
diff changeset
676 {\\makebox[2em]{\\rule{0cm}{#2ex}#1}\\rule{3in}{.15mm}}\n"
48c133ab94d7 (cal-tex-day-name-format): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 49598
diff changeset
677 "One hour and a line on the right.")
48c133ab94d7 (cal-tex-day-name-format): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 49598
diff changeset
678
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
679 ;; TODO cal-tex-diary-support.
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
680 (defun cal-tex-cursor-week (&optional arg)
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
681 "Make a LaTeX calendar buffer for a two-page one-week calendar.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
682 It applies to the week that point is in. The optional prefix
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
683 argument specifies the number of weeks (default 1). The calendar
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
684 shows holidays if `cal-tex-holidays' is t (note that diary
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
685 entries are not shown)."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
686 (interactive "p")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
687 (let* ((n (if arg arg 1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
688 (date (calendar-gregorian-from-absolute
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
689 (calendar-dayname-on-or-before
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
690 calendar-week-start-day
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
691 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
692 (calendar-cursor-to-date t)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
693 (month (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
694 (year (extract-calendar-year date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
695 (holidays (if cal-tex-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
696 (cal-tex-list-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
697 (calendar-absolute-from-gregorian date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
698 (+ (* 7 n)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
699 (calendar-absolute-from-gregorian date))))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
700 (cal-tex-preamble "11pt")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
701 (cal-tex-cmd "\\textwidth 6.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
702 (cal-tex-cmd "\\textheight 10.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
703 (cal-tex-cmd "\\oddsidemargin 0in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
704 (cal-tex-cmd "\\evensidemargin 0in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
705 (insert cal-tex-LaTeX-hourbox)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
706 (cal-tex-b-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
707 (cal-tex-cmd "\\pagestyle{empty}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
708 (calendar-for-loop i from 1 to n do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
709 (cal-tex-vspace "-1.5in")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
710 (cal-tex-b-center)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
711 (cal-tex-Huge-bf (format "\\uppercase{%s}"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
712 (cal-tex-month-name month)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
713 (cal-tex-hspace "2em")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
714 (cal-tex-Huge-bf (number-to-string year))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
715 (cal-tex-nl ".5cm")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
716 (cal-tex-e-center)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
717 (cal-tex-hspace "-.2in")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
718 (cal-tex-b-parbox "l" "7in")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
719 (calendar-for-loop j from 1 to 7 do
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
720 (cal-tex-week-hours date holidays "3.1")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
721 (setq date (cal-tex-incr-date date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
722 (cal-tex-e-parbox)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
723 (setq month (extract-calendar-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
724 (setq year (extract-calendar-year date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
725 (if (/= i n)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
726 (progn
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
727 (run-hooks 'cal-tex-week-hook)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
728 (cal-tex-newpage))))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
729 (cal-tex-end-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
730 (run-hooks 'cal-tex-hook)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
731
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
732 ;; TODO cal-tex-diary support.
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
733 (defun cal-tex-cursor-week2 (&optional arg)
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
734 "Make a LaTeX calendar buffer for a two-page one-week calendar.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
735 It applies to the week that point is in. Optional prefix
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
736 argument specifies number of weeks (default 1). The calendar
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
737 shows holidays if `cal-tex-holidays' is non-nil (note that diary
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
738 entries are not shown)."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
739 (interactive "p")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
740 (let* ((n (if arg arg 1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
741 (date (calendar-gregorian-from-absolute
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
742 (calendar-dayname-on-or-before
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
743 calendar-week-start-day
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
744 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
745 (calendar-cursor-to-date t)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
746 (month (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
747 (year (extract-calendar-year date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
748 (d date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
749 (holidays (if cal-tex-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
750 (cal-tex-list-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
751 (calendar-absolute-from-gregorian date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
752 (+ (* 7 n)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
753 (calendar-absolute-from-gregorian date))))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
754 (cal-tex-preamble "12pt")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
755 (cal-tex-cmd "\\textwidth 6.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
756 (cal-tex-cmd "\\textheight 10.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
757 (cal-tex-cmd "\\oddsidemargin 0in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
758 (cal-tex-cmd "\\evensidemargin 0in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
759 (insert cal-tex-LaTeX-hourbox)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
760 (cal-tex-b-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
761 (cal-tex-cmd "\\pagestyle{empty}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
762 (calendar-for-loop i from 1 to n do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
763 (cal-tex-vspace "-1.5in")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
764 (cal-tex-b-center)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
765 (cal-tex-Huge-bf (format "\\uppercase{%s}"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
766 (cal-tex-month-name month)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
767 (cal-tex-hspace "2em")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
768 (cal-tex-Huge-bf (number-to-string year))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
769 (cal-tex-nl ".5cm")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
770 (cal-tex-e-center)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
771 (cal-tex-hspace "-.2in")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
772 (cal-tex-b-parbox "l" "\\textwidth")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
773 (calendar-for-loop j from 1 to 3 do
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
774 (cal-tex-week-hours date holidays "5")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
775 (setq date (cal-tex-incr-date date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
776 (cal-tex-e-parbox)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
777 (cal-tex-nl)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
778 (insert (cal-tex-mini-calendar
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
779 (extract-calendar-month (cal-tex-previous-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
780 (extract-calendar-year (cal-tex-previous-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
781 "lastmonth" "1.1in" "1in"))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
782 (insert (cal-tex-mini-calendar
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
783 (extract-calendar-month date)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
784 (extract-calendar-year date)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
785 "thismonth" "1.1in" "1in"))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
786 (insert (cal-tex-mini-calendar
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
787 (extract-calendar-month (cal-tex-next-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
788 (extract-calendar-year (cal-tex-next-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
789 "nextmonth" "1.1in" "1in"))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
790 (insert "\\hbox to \\textwidth{")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
791 (cal-tex-hfill)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
792 (insert "\\lastmonth")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
793 (cal-tex-hfill)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
794 (insert "\\thismonth")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
795 (cal-tex-hfill)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
796 (insert "\\nextmonth")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
797 (cal-tex-hfill)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
798 (insert "}")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
799 (cal-tex-nl)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
800 (cal-tex-b-parbox "l" "\\textwidth")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
801 (calendar-for-loop j from 4 to 7 do
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
802 (cal-tex-week-hours date holidays "5")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
803 (setq date (cal-tex-incr-date date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
804 (cal-tex-e-parbox)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
805 (setq month (extract-calendar-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
806 (setq year (extract-calendar-year date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
807 (if (/= i n)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
808 (progn
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
809 (run-hooks 'cal-tex-week-hook)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
810 (cal-tex-newpage))))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
811 (cal-tex-end-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
812 (run-hooks 'cal-tex-hook)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
813
13595
2af9ec0bc9cc (cal-tex-version): Deleted.
Richard M. Stallman <rms@gnu.org>
parents: 13206
diff changeset
814 (defun cal-tex-cursor-week-iso (&optional arg)
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
815 "Make a LaTeX calendar buffer for a one page ISO-style weekly calendar.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
816 Optional prefix argument specifies number of weeks (default 1).
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
817 The calendar shows holiday and diary entries if
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
818 `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
819 (interactive "p")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
820 (let* ((n (if arg arg 1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
821 (date (calendar-gregorian-from-absolute
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
822 (calendar-dayname-on-or-before
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
823 1
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
824 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
825 (calendar-cursor-to-date t)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
826 (month (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
827 (year (extract-calendar-year date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
828 (day (extract-calendar-day date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
829 (holidays (if cal-tex-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
830 (cal-tex-list-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
831 (calendar-absolute-from-gregorian date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
832 (+ (* 7 n)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
833 (calendar-absolute-from-gregorian date)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
834 (diary-list (if cal-tex-diary
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
835 (cal-tex-list-diary-entries
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
836 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
837 (list month 1 year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
838 (+ (* 7 n)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
839 (calendar-absolute-from-gregorian date))))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
840 (cal-tex-preamble "11pt")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
841 (cal-tex-cmd "\\textwidth 6.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
842 (cal-tex-cmd "\\textheight 10.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
843 (cal-tex-cmd "\\oddsidemargin 0in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
844 (cal-tex-cmd "\\evensidemargin 0in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
845 (cal-tex-b-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
846 (cal-tex-cmd "\\pagestyle{empty}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
847 (calendar-for-loop i from 1 to n do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
848 (cal-tex-vspace "-1.5in")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
849 (cal-tex-b-center)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
850 (cal-tex-Huge-bf
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
851 (let* ((d (calendar-iso-from-absolute
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
852 (calendar-absolute-from-gregorian date))))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
853 (format "Week %d of %d"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
854 (extract-calendar-month d)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
855 (extract-calendar-year d))))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
856 (cal-tex-nl ".5cm")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
857 (cal-tex-e-center)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
858 (cal-tex-b-parbox "l" "\\textwidth")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
859 (calendar-for-loop j from 1 to 7 do
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
860 (cal-tex-b-parbox "t" "\\textwidth")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
861 (cal-tex-b-parbox "t" "\\textwidth")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
862 (cal-tex-rule "0pt" "\\textwidth" ".2mm")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
863 (cal-tex-nl)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
864 (cal-tex-b-parbox "t" "\\textwidth")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
865 (cal-tex-large-bf (cal-tex-LaTeXify-string (calendar-day-name date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
866 (insert ", ")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
867 (cal-tex-large-bf (cal-tex-month-name month))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
868 (insert " ")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
869 (cal-tex-large-bf (number-to-string day))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
870 (if (not (string= "" (cal-tex-latexify-list holidays date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
871 (progn
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
872 (insert ": ")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
873 (cal-tex-large-bf (cal-tex-latexify-list holidays date "; "))))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
874 (cal-tex-hfill)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
875 (insert " " (eval cal-tex-daily-string))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
876 (cal-tex-e-parbox)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
877 (cal-tex-nl)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
878 (cal-tex-noindent)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
879 (cal-tex-b-parbox "t" "\\textwidth")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
880 (if (not (string= "" (cal-tex-latexify-list diary-list date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
881 (progn
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
882 (insert "\\vbox to 0pt{")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
883 (cal-tex-large-bf
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
884 (cal-tex-latexify-list diary-list date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
885 (insert "}")))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
886 (cal-tex-e-parbox)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
887 (cal-tex-nl)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
888 (setq date (cal-tex-incr-date date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
889 (setq month (extract-calendar-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
890 (setq day (extract-calendar-day date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
891 (cal-tex-e-parbox)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
892 (cal-tex-e-parbox "2cm")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
893 (cal-tex-nl)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
894 (setq month (extract-calendar-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
895 (setq year (extract-calendar-year date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
896 (cal-tex-e-parbox)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
897 (if (/= i n)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
898 (progn
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
899 (run-hooks 'cal-tex-week-hook)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
900 (cal-tex-newpage))))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
901 (cal-tex-end-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
902 (run-hooks 'cal-tex-hook)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
903
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
904 (defun cal-tex-week-hours (date holidays height)
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
905 "Insert hourly entries for DATE with HOLIDAYS, with line height HEIGHT.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
906 Uses the 24-hour clock if `cal-tex-24' is non-nil."
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
907 (let ((month (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
908 (day (extract-calendar-day date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
909 (year (extract-calendar-year date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
910 (afternoon))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
911 (cal-tex-comment "begin cal-tex-week-hours")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
912 (cal-tex-cmd "\\ \\\\[-.2cm]")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
913 (cal-tex-cmd "\\noindent")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
914 (cal-tex-b-parbox "l" "6.8in")
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
915 (cal-tex-large-bf (cal-tex-LaTeXify-string (calendar-day-name date)))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
916 (insert ", ")
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
917 (cal-tex-large-bf (cal-tex-month-name month))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
918 (insert " ")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
919 (cal-tex-large-bf (number-to-string day))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
920 (if (not (string= "" (cal-tex-latexify-list holidays date)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
921 (progn
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
922 (insert ": ")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
923 (cal-tex-large-bf (cal-tex-latexify-list holidays date "; "))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
924 (cal-tex-hfill)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
925 (insert " " (eval cal-tex-daily-string))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
926 (cal-tex-e-parbox)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
927 (cal-tex-nl "-.3cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
928 (cal-tex-rule "0pt" "6.8in" ".2mm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
929 (cal-tex-nl "-.1cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
930 (calendar-for-loop i from 8 to 12 do
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
931 (if cal-tex-24
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
932 (setq afternoon (+ i 5))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
933 (setq afternoon (- i 7)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
934 (cal-tex-cmd "\\hourbox" (number-to-string i))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
935 (cal-tex-arg height)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
936 (cal-tex-hspace ".4cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
937 (cal-tex-cmd "\\hourbox" (number-to-string afternoon))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
938 (cal-tex-arg height)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
939 (cal-tex-nl))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
940
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
941 ;; TODO cal-tex-diary support.
13595
2af9ec0bc9cc (cal-tex-version): Deleted.
Richard M. Stallman <rms@gnu.org>
parents: 13206
diff changeset
942 (defun cal-tex-cursor-week-monday (&optional arg)
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
943 "Make a LaTeX calendar buffer for a two-page one-week calendar.
13595
2af9ec0bc9cc (cal-tex-version): Deleted.
Richard M. Stallman <rms@gnu.org>
parents: 13206
diff changeset
944 It applies to the week that point is in, and starts on Monday.
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
945 Optional prefix argument specifies number of weeks (default 1).
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
946 The calendar shows holidays if `cal-tex-holidays' is
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
947 non-nil (note that diary entries are not shown)."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
948 (interactive "p")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
949 (let* ((n (if arg arg 1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
950 (date (calendar-gregorian-from-absolute
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
951 (calendar-dayname-on-or-before
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
952 0
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
953 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
954 (calendar-cursor-to-date t))))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
955 (cal-tex-preamble "11pt")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
956 (cal-tex-cmd "\\textwidth 6.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
957 (cal-tex-cmd "\\textheight 10.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
958 (cal-tex-cmd "\\oddsidemargin 0in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
959 (cal-tex-cmd "\\evensidemargin 0in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
960 (cal-tex-b-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
961 (calendar-for-loop i from 1 to n do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
962 (cal-tex-vspace "-1cm")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
963 (insert "\\noindent ")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
964 (cal-tex-weekly4-box (cal-tex-incr-date date) nil)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
965 (cal-tex-weekly4-box (cal-tex-incr-date date 4) nil)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
966 (cal-tex-nl ".2cm")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
967 (cal-tex-weekly4-box (cal-tex-incr-date date 2) nil)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
968 (cal-tex-weekly4-box (cal-tex-incr-date date 5) nil)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
969 (cal-tex-nl ".2cm")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
970 (cal-tex-weekly4-box (cal-tex-incr-date date 3) nil)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
971 (cal-tex-weekly4-box (cal-tex-incr-date date 6) t)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
972 (if (/= i n)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
973 (progn
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
974 (run-hooks 'cal-tex-week-hook)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
975 (setq date (cal-tex-incr-date date 7))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
976 (cal-tex-newpage))))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
977 (cal-tex-end-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
978 (run-hooks 'cal-tex-hook)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
979
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
980 (defun cal-tex-weekly4-box (date weekend)
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
981 "Make one box for DATE, different if WEEKEND.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
982 Uses the 24-hour clock if `cal-tex-24' is non-nil."
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
983 (let* (
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
984 (day (extract-calendar-day date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
985 (month (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
986 (year (extract-calendar-year date))
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
987 (dayname (cal-tex-LaTeXify-string (calendar-day-name date)))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
988 (date1 (cal-tex-incr-date date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
989 (day1 (extract-calendar-day date1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
990 (month1 (extract-calendar-month date1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
991 (year1 (extract-calendar-year date1))
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
992 (dayname1 (cal-tex-LaTeXify-string (calendar-day-name date1)))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
993 )
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
994 (cal-tex-b-framebox "8cm" "l")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
995 (cal-tex-b-parbox "b" "7.5cm")
13206
2d1da471963a Minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13195
diff changeset
996 (insert (format "{\\Large\\bf %s,} %s/%s/%s\\\\\n" dayname month day year))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
997 (cal-tex-rule "0pt" "7.5cm" ".5mm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
998 (cal-tex-nl)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
999 (if (not weekend)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1000 (progn
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1001 (calendar-for-loop i from 8 to 12 do
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1002 (insert (format "{\\large\\sf %d}\\\\\n" i)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1003 (calendar-for-loop i from 1 to 5 do
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1004 (insert (format "{\\large\\sf %d}\\\\\n"
36118
4459c383591a (cal-tex-weekly4-box): Respect setting
Gerd Moellmann <gerd@gnu.org>
parents: 25130
diff changeset
1005 (if cal-tex-24 (+ i 12) i))))))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1006 (cal-tex-nl ".5cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1007 (if weekend
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1008 (progn
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1009 (cal-tex-vspace "1cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1010 (insert "\\ \\vfill")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1011 (insert (format "{\\Large\\bf %s,} %s/%s/%s\\\\\n"
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1012 dayname1 month1 day1 year1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1013 (cal-tex-rule "0pt" "7.5cm" ".5mm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1014 (cal-tex-nl "1.5cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1015 (cal-tex-vspace "1cm")))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1016 (cal-tex-e-parbox)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1017 (cal-tex-e-framebox)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1018 (cal-tex-hspace "1cm")))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1019
13595
2af9ec0bc9cc (cal-tex-version): Deleted.
Richard M. Stallman <rms@gnu.org>
parents: 13206
diff changeset
1020 (defun cal-tex-cursor-filofax-2week (&optional arg)
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1021 "Two-weeks-at-a-glance Filofax style calendar for week cursor is in.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1022 Optional prefix argument specifies number of weeks (default 1).
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1023 The calendar shows holiday and diary entries if
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1024 `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1025 (interactive "p")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1026 (let* ((n (if arg arg 1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1027 (date (calendar-gregorian-from-absolute
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1028 (calendar-dayname-on-or-before
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1029 calendar-week-start-day
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1030 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1031 (calendar-cursor-to-date t)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1032 (month (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1033 (year (extract-calendar-year date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1034 (day (extract-calendar-day date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1035 (holidays (if cal-tex-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1036 (cal-tex-list-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1037 (calendar-absolute-from-gregorian date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1038 (+ (* 7 n)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1039 (calendar-absolute-from-gregorian date)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1040 (diary-list (if cal-tex-diary
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1041 (cal-tex-list-diary-entries
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1042 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1043 (list month 1 year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1044 (+ (* 7 n)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1045 (calendar-absolute-from-gregorian date))))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1046 (cal-tex-preamble "twoside")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1047 (cal-tex-cmd "\\textwidth 3.25in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1048 (cal-tex-cmd "\\textheight 6.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1049 (cal-tex-cmd "\\oddsidemargin 1.75in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1050 (cal-tex-cmd "\\evensidemargin 1.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1051 (cal-tex-cmd "\\topmargin 0pt")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1052 (cal-tex-cmd "\\headheight -0.875in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1053 (cal-tex-cmd "\\headsep 0.125in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1054 (cal-tex-cmd "\\footskip .125in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1055 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1056 \\long\\def\\rightday#1#2#3#4#5{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1057 \\rule{\\textwidth}{0.3pt}\\\\%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1058 \\hbox to \\textwidth{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1059 \\vbox to 0.7in{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1060 \\vspace*{2pt}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1061 \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1062 \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1063 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1064 \\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1065 \\long\\def\\leftday#1#2#3#4#5{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1066 \\rule{\\textwidth}{0.3pt}\\\\%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1067 \\hbox to \\textwidth{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1068 \\vbox to 0.7in{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1069 \\vspace*{2pt}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1070 \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1071 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1072 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1073 ")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1074 (cal-tex-b-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1075 (cal-tex-cmd "\\pagestyle{empty}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1076 (calendar-for-loop i from 1 to n do
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1077 (if (= (mod i 2) 1)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1078 (insert "\\righthead")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1079 (insert "\\lefthead"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1080 (cal-tex-arg
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1081 (let ((d (cal-tex-incr-date date 6)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1082 (if (= (extract-calendar-month date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1083 (extract-calendar-month d))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1084 (format "%s %s"
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1085 (cal-tex-month-name
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1086 (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1087 (extract-calendar-year date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1088 (if (= (extract-calendar-year date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1089 (extract-calendar-year d))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1090 (format "%s---%s %s"
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1091 (cal-tex-month-name
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1092 (extract-calendar-month date))
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1093 (cal-tex-month-name
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1094 (extract-calendar-month d))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1095 (extract-calendar-year date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1096 (format "%s %s---%s %s"
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1097 (cal-tex-month-name
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1098 (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1099 (extract-calendar-year date)
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1100 (cal-tex-month-name (extract-calendar-month d))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1101 (extract-calendar-year d))))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1102 (insert "%\n")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1103 (calendar-for-loop j from 1 to 7 do
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1104 (if (= (mod i 2) 1)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1105 (insert "\\rightday")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1106 (insert "\\leftday"))
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1107 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1108 (cal-tex-arg (int-to-string (extract-calendar-day date)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1109 (cal-tex-arg (cal-tex-latexify-list diary-list date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1110 (cal-tex-arg (cal-tex-latexify-list holidays date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1111 (cal-tex-arg (eval cal-tex-daily-string))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1112 (insert "%\n")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1113 (setq date (cal-tex-incr-date date)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1114 (if (/= i n)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1115 (progn
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1116 (run-hooks 'cal-tex-week-hook)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1117 (cal-tex-newpage))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1118 (cal-tex-end-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1119 (run-hooks 'cal-tex-hook)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1120
13595
2af9ec0bc9cc (cal-tex-version): Deleted.
Richard M. Stallman <rms@gnu.org>
parents: 13206
diff changeset
1121 (defun cal-tex-cursor-filofax-week (&optional arg)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1122 "One-week-at-a-glance Filofax style calendar for week indicated by cursor.
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1123 Optional prefix argument specifies number of weeks (default 1),
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1124 starting on Mondays. The calendar shows holiday and diary entries
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1125 if `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1126 (interactive "p")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1127 (let* ((n (if arg arg 1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1128 (date (calendar-gregorian-from-absolute
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1129 (calendar-dayname-on-or-before
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1130 1
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1131 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1132 (calendar-cursor-to-date t)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1133 (month (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1134 (year (extract-calendar-year date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1135 (day (extract-calendar-day date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1136 (holidays (if cal-tex-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1137 (cal-tex-list-holidays
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1138 (calendar-absolute-from-gregorian date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1139 (+ (* 7 n)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1140 (calendar-absolute-from-gregorian date)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1141 (diary-list (if cal-tex-diary
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1142 (cal-tex-list-diary-entries
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1143 (calendar-absolute-from-gregorian
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1144 (list month 1 year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1145 (+ (* 7 n)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1146 (calendar-absolute-from-gregorian date))))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1147 (cal-tex-preamble "twoside")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1148 (cal-tex-cmd "\\textwidth 3.25in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1149 (cal-tex-cmd "\\textheight 6.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1150 (cal-tex-cmd "\\oddsidemargin 1.75in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1151 (cal-tex-cmd "\\evensidemargin 1.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1152 (cal-tex-cmd "\\topmargin 0pt")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1153 (cal-tex-cmd "\\headheight -0.875in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1154 (cal-tex-cmd "\\headsep 0.125in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1155 (cal-tex-cmd "\\footskip .125in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1156 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1157 \\long\\def\\rightday#1#2#3#4#5{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1158 \\rule{\\textwidth}{0.3pt}\\\\%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1159 \\hbox to \\textwidth{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1160 \\vbox to 1.85in{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1161 \\vspace*{2pt}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1162 \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1163 \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1164 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1165 \\long\\def\\weekend#1#2#3#4#5{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1166 \\rule{\\textwidth}{0.3pt}\\\\%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1167 \\hbox to \\textwidth{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1168 \\vbox to .8in{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1169 \\vspace*{2pt}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1170 \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1171 \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1172 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1173 \\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1174 \\long\\def\\leftday#1#2#3#4#5{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1175 \\rule{\\textwidth}{0.3pt}\\\\%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1176 \\hbox to \\textwidth{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1177 \\vbox to 1.85in{%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1178 \\vspace*{2pt}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1179 \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1180 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}%
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1181 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1182 ")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1183 (cal-tex-b-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1184 (cal-tex-cmd "\\pagestyle{empty}\\ ")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1185 (cal-tex-newpage)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1186 (calendar-for-loop i from 1 to n do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1187 (insert "\\lefthead")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1188 (cal-tex-arg
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1189 (let ((d (cal-tex-incr-date date 2)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1190 (if (= (extract-calendar-month date)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1191 (extract-calendar-month d))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1192 (format "%s %s"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1193 (cal-tex-month-name
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1194 (extract-calendar-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1195 (extract-calendar-year date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1196 (if (= (extract-calendar-year date)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1197 (extract-calendar-year d))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1198 (format "%s---%s %s"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1199 (cal-tex-month-name
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1200 (extract-calendar-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1201 (cal-tex-month-name
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1202 (extract-calendar-month d))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1203 (extract-calendar-year date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1204 (format "%s %s---%s %s"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1205 (cal-tex-month-name
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1206 (extract-calendar-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1207 (extract-calendar-year date)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1208 (cal-tex-month-name (extract-calendar-month d))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1209 (extract-calendar-year d))))))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1210 (insert "%\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1211 (calendar-for-loop j from 1 to 3 do
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1212 (insert "\\leftday")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1213 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1214 (cal-tex-arg (int-to-string (extract-calendar-day date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1215 (cal-tex-arg (cal-tex-latexify-list diary-list date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1216 (cal-tex-arg (cal-tex-latexify-list holidays date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1217 (cal-tex-arg (eval cal-tex-daily-string))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1218 (insert "%\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1219 (setq date (cal-tex-incr-date date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1220 (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1221 (cal-tex-newpage)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1222 (insert "\\righthead")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1223 (cal-tex-arg
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1224 (let ((d (cal-tex-incr-date date 3)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1225 (if (= (extract-calendar-month date)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1226 (extract-calendar-month d))
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1227 (format "%s %s"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1228 (cal-tex-month-name
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1229 (extract-calendar-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1230 (extract-calendar-year date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1231 (if (= (extract-calendar-year date)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1232 (extract-calendar-year d))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1233 (format "%s---%s %s"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1234 (cal-tex-month-name
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1235 (extract-calendar-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1236 (cal-tex-month-name
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1237 (extract-calendar-month d))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1238 (extract-calendar-year date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1239 (format "%s %s---%s %s"
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1240 (cal-tex-month-name
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1241 (extract-calendar-month date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1242 (extract-calendar-year date)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1243 (cal-tex-month-name (extract-calendar-month d))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1244 (extract-calendar-year d))))))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1245 (insert "%\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1246 (calendar-for-loop j from 1 to 2 do
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1247 (insert "\\rightday")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1248 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1249 (cal-tex-arg (int-to-string (extract-calendar-day date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1250 (cal-tex-arg (cal-tex-latexify-list diary-list date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1251 (cal-tex-arg (cal-tex-latexify-list holidays date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1252 (cal-tex-arg (eval cal-tex-daily-string))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1253 (insert "%\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1254 (setq date (cal-tex-incr-date date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1255 (calendar-for-loop j from 1 to 2 do
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1256 (insert "\\weekend")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1257 (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1258 (cal-tex-arg (int-to-string (extract-calendar-day date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1259 (cal-tex-arg (cal-tex-latexify-list diary-list date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1260 (cal-tex-arg (cal-tex-latexify-list holidays date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1261 (cal-tex-arg (eval cal-tex-daily-string))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1262 (insert "%\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1263 (setq date (cal-tex-incr-date date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1264 (if (/= i n)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1265 (progn
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1266 (run-hooks 'cal-tex-week-hook)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1267 (cal-tex-newpage))))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1268 (cal-tex-end-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1269 (run-hooks 'cal-tex-hook)))
19973
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1270
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1271 (defun cal-tex-cursor-filofax-daily (&optional arg)
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1272 "Day-per-page Filofax style calendar for week indicated by cursor.
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1273 Optional prefix argument specifies number of weeks (default 1),
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1274 starting on Mondays. The calendar shows holiday and diary
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1275 entries if `cal-tex-holidays' and `cal-tex-diary', respectively,
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1276 are non-nil. Pages are ruled if `cal-tex-rules' is non-nil."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1277 (interactive "p")
19973
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1278 (let* ((n (if arg arg 1))
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1279 (date (calendar-gregorian-from-absolute
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1280 (calendar-dayname-on-or-before
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1281 1
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1282 (calendar-absolute-from-gregorian
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1283 (calendar-cursor-to-date t)))))
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1284 (month (extract-calendar-month date))
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1285 (year (extract-calendar-year date))
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1286 (day (extract-calendar-day date))
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1287 (holidays (if cal-tex-holidays
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1288 (cal-tex-list-holidays
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1289 (calendar-absolute-from-gregorian date)
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1290 (+ (* 7 n)
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1291 (calendar-absolute-from-gregorian date)))))
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1292 (diary-list (if cal-tex-diary
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1293 (cal-tex-list-diary-entries
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1294 (calendar-absolute-from-gregorian
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1295 (list month 1 year))
25130
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1296 (+ (* 7 n)
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1297 (calendar-absolute-from-gregorian date))))))
19973
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1298 (cal-tex-preamble "twoside")
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1299 (cal-tex-cmd "\\textwidth 3.25in")
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1300 (cal-tex-cmd "\\textheight 6.5in")
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1301 (cal-tex-cmd "\\oddsidemargin 1.75in")
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1302 (cal-tex-cmd "\\evensidemargin 1.5in")
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1303 (cal-tex-cmd "\\topmargin 0pt")
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1304 (cal-tex-cmd "\\headheight -0.875in")
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1305 (cal-tex-cmd "\\headsep 0.125in")
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1306 (cal-tex-cmd "\\footskip .125in")
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1307 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]}
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1308 \\long\\def\\rightday#1#2#3{%
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1309 \\rule{\\textwidth}{0.3pt}\\\\%
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1310 \\hbox to \\textwidth{%
25130
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1311 \\vbox {%
19973
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1312 \\vspace*{2pt}%
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1313 \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1314 \\hbox to \\textwidth{\\vbox {\\raggedleft \\em #2}}%
25130
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1315 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}
19973
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1316 \\long\\def\\weekend#1#2#3{%
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1317 \\rule{\\textwidth}{0.3pt}\\\\%
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1318 \\hbox to \\textwidth{%
25130
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1319 \\vbox {%
19973
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1320 \\vspace*{2pt}%
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1321 \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1322 \\hbox to \\textwidth{\\vbox {\\noindent \\em #2}}%
25130
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1323 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}
19973
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1324 \\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]}
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1325 \\long\\def\\leftday#1#2#3{%
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1326 \\rule{\\textwidth}{0.3pt}\\\\%
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1327 \\hbox to \\textwidth{%
25130
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1328 \\vbox {%
19973
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1329 \\vspace*{2pt}%
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1330 \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1331 \\hbox to \\textwidth{\\vbox {\\noindent \\em #2}}%
25130
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1332 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1333 \\newbox\\LineBox
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1334 \\setbox\\LineBox=\\hbox to\\textwidth{%
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1335 \\vrule height.2in width0pt\\leaders\\hrule\\hfill}
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1336 \\def\\linesfill{\\par\\leaders\\copy\\LineBox\\vfill}
19973
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1337 ")
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1338 (cal-tex-b-document)
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1339 (cal-tex-cmd "\\pagestyle{empty}")
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1340 (calendar-for-loop i from 1 to n do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1341 (calendar-for-loop j from 1 to 5 do
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1342 (let ((odd (/= 0 (% j 2))))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1343 (insert (if odd "\\righthead" "\\lefthead"))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1344 (cal-tex-arg (calendar-date-string date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1345 (insert "%\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1346 (insert (if odd "\\rightday" "\\leftday")))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1347 (cal-tex-arg (cal-tex-latexify-list diary-list date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1348 (cal-tex-arg (cal-tex-latexify-list holidays date "\\\\" t))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1349 (cal-tex-arg (eval cal-tex-daily-string))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1350 (insert "%\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1351 (if cal-tex-rules
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1352 (insert "\\linesfill\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1353 (insert "\\vfill\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n"))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1354 (cal-tex-newpage)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1355 (setq date (cal-tex-incr-date date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1356 (insert "%\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1357 (calendar-for-loop j from 1 to 2 do
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1358 (insert "\\lefthead")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1359 (cal-tex-arg (calendar-date-string date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1360 (insert "\\weekend")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1361 (cal-tex-arg (cal-tex-latexify-list diary-list date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1362 (cal-tex-arg (cal-tex-latexify-list holidays date "\\\\" t))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1363 (cal-tex-arg (eval cal-tex-daily-string))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1364 (insert "%\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1365 (if cal-tex-rules
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1366 (insert "\\linesfill\n")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1367 (insert "\\vfill"))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1368 (setq date (cal-tex-incr-date date)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1369 (if (not cal-tex-rules)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1370 (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n"))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1371 (if (/= i n)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1372 (progn
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1373 (run-hooks 'cal-tex-week-hook)
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1374 (cal-tex-newpage))))
19973
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1375 (cal-tex-end-document)
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1376 (run-hooks 'cal-tex-hook)))
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1377
45f02da6ebbb (cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19312
diff changeset
1378
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1379 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1380 ;;; Daily calendars
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1381 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1382
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1383 (defun cal-tex-cursor-day (&optional arg)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1384 "Make a buffer with LaTeX commands for the day cursor is on.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1385 Optional prefix argument specifies number of days."
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1386 (interactive "p")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1387 (let ((n (if arg arg 1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1388 (date (calendar-absolute-from-gregorian (calendar-cursor-to-date t))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1389 (cal-tex-preamble "12pt")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1390 (cal-tex-cmd "\\textwidth 6.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1391 (cal-tex-cmd "\\textheight 10.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1392 (cal-tex-b-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1393 (cal-tex-cmd "\\pagestyle{empty}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1394 (calendar-for-loop i from 1 to n do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1395 (cal-tex-vspace "-1.7in")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1396 (cal-tex-daily-page (calendar-gregorian-from-absolute date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1397 (setq date (1+ date))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1398 (if (/= i n)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1399 (progn
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1400 (cal-tex-newpage)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1401 (run-hooks 'cal-tex-daily-hook))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1402 (cal-tex-end-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1403 (run-hooks 'cal-tex-hook)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1404
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1405 (defun cal-tex-daily-page (date)
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1406 "Make a calendar page for Gregorian DATE on 8.5 by 11 paper.
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1407 Uses the 24-hour clock if `cal-tex-24' is non-nil. Produces
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1408 hourly sections for the period specified by `cal-tex-daily-start'
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1409 and `cal-tex-daily-end'."
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1410 (let* ((hour)
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1411 (month-name (cal-tex-month-name (extract-calendar-month date))))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1412 (cal-tex-banner "cal-tex-daily-page")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1413 (cal-tex-b-makebox "4cm" "l")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1414 (cal-tex-b-parbox "b" "3.8cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1415 (cal-tex-rule "0mm" "0mm" "2cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1416 (cal-tex-Huge (number-to-string (extract-calendar-day date)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1417 (cal-tex-nl ".5cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1418 (cal-tex-bf month-name )
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1419 (cal-tex-e-parbox)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1420 (cal-tex-hspace "1cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1421 (cal-tex-scriptsize (eval cal-tex-daily-string))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1422 (cal-tex-hspace "3.5cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1423 (cal-tex-e-makebox)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1424 (cal-tex-hfill)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1425 (cal-tex-b-makebox "4cm" "r")
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1426 (cal-tex-bf (cal-tex-LaTeXify-string (calendar-day-name date)))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1427 (cal-tex-e-makebox)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1428 (cal-tex-nl)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1429 (cal-tex-hspace ".4cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1430 (cal-tex-rule "0mm" "16.1cm" "1mm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1431 (cal-tex-nl ".1cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1432 (calendar-for-loop i from cal-tex-daily-start to cal-tex-daily-end do
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1433 (cal-tex-cmd "\\noindent")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1434 (setq hour (if cal-tex-24
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1435 i
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1436 (mod i 12)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1437 (if (= 0 hour) (setq hour 12))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1438 (cal-tex-b-makebox "1cm" "c")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1439 (cal-tex-arg (number-to-string hour))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1440 (cal-tex-e-makebox)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1441 (cal-tex-rule "0mm" "15.5cm" ".2mm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1442 (cal-tex-nl ".2cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1443 (cal-tex-b-makebox "1cm" "c")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1444 (cal-tex-arg "$\\diamond$" )
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1445 (cal-tex-e-makebox)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1446 (cal-tex-rule "0mm" "15.5cm" ".2mm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1447 (cal-tex-nl ".2cm"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1448 (cal-tex-hfill)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1449 (insert (cal-tex-mini-calendar
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1450 (extract-calendar-month (cal-tex-previous-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1451 (extract-calendar-year (cal-tex-previous-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1452 "lastmonth" "1.1in" "1in"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1453 (insert (cal-tex-mini-calendar
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1454 (extract-calendar-month date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1455 (extract-calendar-year date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1456 "thismonth" "1.1in" "1in"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1457 (insert (cal-tex-mini-calendar
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1458 (extract-calendar-month (cal-tex-next-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1459 (extract-calendar-year (cal-tex-next-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1460 "nextmonth" "1.1in" "1in"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1461 (insert "\\hbox to \\textwidth{")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1462 (cal-tex-hfill)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1463 (insert "\\lastmonth")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1464 (cal-tex-hfill)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1465 (insert "\\thismonth")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1466 (cal-tex-hfill)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1467 (insert "\\nextmonth")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1468 (cal-tex-hfill)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1469 (insert "}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1470 (cal-tex-banner "end of cal-tex-daily-page")))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1471
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1472 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1473 ;;; Mini calendars
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1474 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1475
15432
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
1476 (defun cal-tex-mini-calendar (month year name width height &optional ptsize colsep)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1477 "Produce mini-calendar for MONTH, YEAR in macro NAME with WIDTH and HEIGHT.
15432
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
1478 Optional PTSIZE gives the point ptsize; scriptsize is the default. Optional
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
1479 COLSEP gives the column separation; 1mm is the default."
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1480 (let* ((blank-days;; at start of month
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1481 (mod
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1482 (- (calendar-day-of-week (list month 1 year))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1483 calendar-week-start-day)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1484 7))
15432
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
1485 (last (calendar-last-day-of-month month year))
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
1486 (colsep (if colsep colsep "1mm"))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1487 (str (concat "\\def\\" name "{\\hbox to" width "{%\n"
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1488 "\\vbox to" height "{%\n"
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1489 "\\vfil \\hbox to" width "{%\n"
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1490 "\\hfil\\"
15432
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
1491 (if ptsize ptsize "scriptsize")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1492 "\\begin{tabular}"
15432
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
1493 "{@{\\hspace{0mm}}r@{\\hspace{" colsep
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
1494 "}}r@{\\hspace{" colsep "}}r@{\\hspace{" colsep
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
1495 "}}r@{\\hspace{" colsep "}}r@{\\hspace{" colsep
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
1496 "}}r@{\\hspace{" colsep "}}r@{\\hspace{0mm}}}%\n"
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1497 "\\multicolumn{7}{c}{"
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1498 (cal-tex-month-name month)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1499 " "
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1500 (int-to-string year)
15432
c76e8e8fdb0a Fix Filofax year output so that it's the correct size.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 14268
diff changeset
1501 "}\\\\[1mm]\n")))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1502 (calendar-for-loop i from 0 to 6 do
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1503 (setq str
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1504 (concat str
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1505 (cal-tex-LaTeXify-string
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1506 (substring (aref calendar-day-name-array
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1507 (mod (+ calendar-week-start-day i) 7))
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1508 0 2))
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1509 (if (/= i 6)
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1510 " & "
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1511 "\\\\[0.7mm]\n"))))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1512 (calendar-for-loop i from 1 to blank-days do
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1513 (setq str (concat str " & ")))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1514 (calendar-for-loop i from 1 to last do
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1515 (setq str (concat str (int-to-string i)))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1516 (setq str (concat str (if (zerop (mod (+ i blank-days) 7))
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1517 (if (/= i last) "\\\\[0.5mm]\n" "")
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1518 " & "))))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1519 (setq str (concat str "\n\\end{tabular}\\hfil}\\vfil}}}%\n"))
78205
0be3f4770a65 (cal-tex-holidays, cal-tex-diary)
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
1520 str))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1521
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1522 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1523 ;;; Various calendar functions
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1524 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1525
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1526 (defun cal-tex-incr-date (date &optional n)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1527 "The date of the day following DATE.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1528 If optional N is given, the date of N days after DATE."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1529 (calendar-gregorian-from-absolute
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1530 (+ (if n n 1) (calendar-absolute-from-gregorian date))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1531
25130
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1532 (defun cal-tex-latexify-list (date-list date &optional separator final-separator)
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1533 "Return string with concatenated, LaTeXified entries in DATE-LIST for DATE.
25130
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1534 Use double backslash as a separator unless optional SEPARATOR is given.
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1535 If resulting string is not empty, put separator at end if optional
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1536 FINAL-SEPARATOR is t."
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1537 (let* ((sep (if separator separator "\\\\"))
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1538 (result
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1539 (mapconcat '(lambda (x) (cal-tex-LaTeXify-string x))
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1540 (let ((result)
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1541 (p date-list))
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1542 (while p
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1543 (and (car (car p))
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1544 (calendar-date-equal date (car (car p)))
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1545 (setq result (cons (car (cdr (car p))) result)))
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1546 (setq p (cdr p)))
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1547 (reverse result))
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1548 sep)))
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1549 (if (and final-separator (not (string-equal result "")))
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1550 (concat result sep)
3f2b516f9ddc (cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents: 23120
diff changeset
1551 result)))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1552
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1553 (defun cal-tex-previous-month (date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1554 "Return the date of the first day in the month previous to DATE."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1555 (let* ((month (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1556 (year (extract-calendar-year date)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1557 (increment-calendar-month month year -1)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1558 (list month 1 year)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1559
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1560 (defun cal-tex-next-month (date)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1561 "Return the date of the first day in the month following DATE."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1562 (let* ((month (extract-calendar-month date))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1563 (year (extract-calendar-year date)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1564 (increment-calendar-month month year 1)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1565 (list month 1 year)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1566
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1567 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1568 ;;; LaTeX Code
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1569 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1570
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1571 (defun cal-tex-end-document ()
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1572 "Finish the LaTeX document.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1573 Insert the trailer to LaTeX document, pop to LaTeX buffer, add
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1574 informative header, and run HOOK."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1575 (cal-tex-e-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1576 (latex-mode)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1577 (pop-to-buffer cal-tex-buffer)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1578 (goto-char (point-min))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1579 (cal-tex-comment " This buffer was produced by cal-tex.el.")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1580 (cal-tex-comment " To print a calendar, type")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1581 (cal-tex-comment " M-x tex-buffer RET")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1582 (cal-tex-comment " M-x tex-print RET")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1583 (goto-char (point-min)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1584
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1585 (defun cal-tex-insert-preamble (weeks landscape size &optional append)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1586 "Initialize the output buffer.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1587 Select the output buffer, and insert the preamble for a calendar of
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1588 WEEKS weeks. Insert code for landscape mode if LANDSCAPE is true.
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1589 Use pointsize SIZE. Optional argument APPEND, if t, means add to end of
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1590 without erasing current contents."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1591 (let ((width "18cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1592 (height "24cm"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1593 (if landscape
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1594 (progn
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1595 (setq width "24cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1596 (setq height "18cm")))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1597 (if (not append)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1598 (progn
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1599 (cal-tex-preamble size)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1600 (if (not landscape)
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1601 (progn
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1602 (cal-tex-cmd "\\oddsidemargin -1.75cm")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1603 (cal-tex-cmd "\\def\\holidaymult{.06}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1604 (cal-tex-cmd "\\special{landscape}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1605 (cal-tex-cmd "\\textwidth 9.5in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1606 (cal-tex-cmd "\\textheight 7in")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1607 (cal-tex-comment)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1608 (cal-tex-cmd "\\def\\holidaymult{.08}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1609 (cal-tex-cmd cal-tex-caldate)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1610 (cal-tex-cmd cal-tex-myday)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1611 (cal-tex-b-document)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1612 (cal-tex-cmd "\\pagestyle{empty}")))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1613 (cal-tex-cmd "\\setlength{\\cellwidth}" width)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1614 (insert (format "\\setlength{\\cellwidth}{%f\\cellwidth}\n"
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1615 (/ 1.1 (length cal-tex-which-days))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1616 (cal-tex-cmd "\\setlength{\\cellheight}" height)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1617 (insert (format "\\setlength{\\cellheight}{%f\\cellheight}\n"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1618 (/ 1.0 weeks)))
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1619 (cal-tex-cmd "\\ \\par")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1620 (cal-tex-vspace "-3cm")))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1621
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1622 (defvar cal-tex-LaTeX-subst-list
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1623 '(("\"". "``")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1624 ("\"". "''");; Quote changes meaning when list is reversed.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1625 ("@" . "\\verb|@|")
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1626 ("&" . "\\&")
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1627 ("%" . "\\%")
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1628 ("$" . "\\$")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1629 ("#" . "\\#")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1630 ("_" . "\\_")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1631 ("{" . "\\{")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1632 ("}" . "\\}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1633 ("<" . "$<$")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1634 (">" . "$>$")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1635 ("\n" . "\\ \\\\")) ;\\ needed for e.g \begin{center}\n AA\end{center}
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1636 "List of symbols and their replacements.")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1637
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1638 (defun cal-tex-LaTeXify-string (string)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1639 "Protect special characters in STRING from LaTeX."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1640 (if (not string)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1641 ""
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1642 (let ((head "")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1643 (tail string)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1644 (list cal-tex-LaTeX-subst-list))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1645 (while (not (string-equal tail ""))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1646 (let* ((ch (substring tail 0 1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1647 (pair (assoc ch list)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1648 (if (and pair (string-equal ch "\""))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1649 (setq list (reverse list)));; Quote changes meaning each time.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1650 (setq tail (substring tail 1))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1651 (setq head (concat head (if pair (cdr pair) ch)))))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1652 head)))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1653
44368
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1654 (defun cal-tex-month-name (month)
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1655 "The name of MONTH, LaTeXified."
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1656 (cal-tex-LaTeXify-string (calendar-month-name month)))
ceb605d3c4dd (cal-tex-hook, cal-tex-year-hook, cal-tex-month-hook)
Richard M. Stallman <rms@gnu.org>
parents: 38422
diff changeset
1657
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1658 (defun cal-tex-hfill () "Insert hfill." (insert "\\hfill"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1659
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1660 (defun cal-tex-newpage () "Insert newpage." (insert "\\newpage%\n"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1661
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1662 (defun cal-tex-noindent () "Insert noindent." (insert "\\noindent"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1663
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1664 (defun cal-tex-vspace (space)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1665 "Insert vspace command to move SPACE vertically."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1666 (insert "\\vspace*{" space "}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1667 (cal-tex-comment))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1668
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1669 (defun cal-tex-hspace (space)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1670 "Insert hspace command to move SPACE horizontally."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1671 (insert "\\hspace*{" space "}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1672 (cal-tex-comment))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1673
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1674 (defun cal-tex-comment (&optional comment)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1675 "Insert % at end of line, include COMMENT if present, and move
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1676 to next line."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1677 (insert "% ")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1678 (if comment
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1679 (insert comment))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1680 (insert "\n"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1681
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1682 (defun cal-tex-banner (comment)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1683 "Insert the COMMENT separated by blank lines."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1684 (cal-tex-comment)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1685 (cal-tex-comment)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1686 (cal-tex-comment (concat "\t\t\t" comment))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1687 (cal-tex-comment))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1688
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1689
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1690 (defun cal-tex-nl (&optional skip comment)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1691 "End a line with \\. If SKIP, then add that much spacing.
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1692 Add COMMENT if present"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1693 (insert "\\\\")
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1694 (if skip
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1695 (insert "[" skip "]"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1696 (cal-tex-comment comment))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44368
diff changeset
1697
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1698 (defun cal-tex-arg (&optional text)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1699 "Insert optional TEXT surrounded by braces."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1700 (insert "{")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1701 (if text (insert text))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1702 (insert "}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1703
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1704 (defun cal-tex-cmd (cmd &optional arg)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1705 "Insert LaTeX CMD, with optional ARG, and end with %"
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1706 (insert cmd)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1707 (cal-tex-arg arg)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1708 (cal-tex-comment))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1709
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1710 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1711 ;;; Environments
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1712 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1713
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1714 (defun cal-tex-b-document ()
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1715 "Insert beginning of document."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1716 (cal-tex-cmd "\\begin{document}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1717
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1718 (defun cal-tex-e-document ()
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1719 "Insert end of document."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1720 (cal-tex-cmd "\\end{document}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1721
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1722 (defun cal-tex-b-center ()
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1723 "Insert beginning of centered block."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1724 (cal-tex-cmd "\\begin{center}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1725
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1726 (defun cal-tex-e-center ()
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1727 "Insert end of centered block."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1728 (cal-tex-comment)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1729 (cal-tex-cmd "\\end{center}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1730
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1731
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1732 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1733 ;;; Boxes
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1734 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1735
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1736
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1737 (defun cal-tex-b-parbox (position width)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1738 "Insert parbox with parameters POSITION and WIDTH."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1739 (insert "\\parbox[" position "]{" width "}{")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1740 (cal-tex-comment))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1741
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1742 (defun cal-tex-e-parbox (&optional height)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1743 "Insert end of parbox. Force it to be a given HEIGHT."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1744 (cal-tex-comment)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1745 (if height
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1746 (cal-tex-rule "0mm" "0mm" height))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1747 (insert "}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1748 (cal-tex-comment "end parbox"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1749
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1750 (defun cal-tex-b-framebox ( width position )
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1751 "Insert framebox with parameters WIDTH and POSITION (clr)."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1752 (insert "\\framebox[" width "][" position "]{" )
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1753 (cal-tex-comment))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1754
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1755 (defun cal-tex-e-framebox ()
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1756 "Insert end of framebox."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1757 (cal-tex-comment)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1758 (insert "}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1759 (cal-tex-comment "end framebox"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1760
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1761
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1762 (defun cal-tex-b-makebox ( width position )
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1763 "Insert makebox with parameters WIDTH and POSITION (clr)."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1764 (insert "\\makebox[" width "][" position "]{" )
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1765 (cal-tex-comment))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1766
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1767 (defun cal-tex-e-makebox ()
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1768 "Insert end of makebox."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1769 (cal-tex-comment)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1770 (insert "}")
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1771 (cal-tex-comment "end makebox"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1772
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1773
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1774 (defun cal-tex-rule (lower width height)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1775 "Insert a rule with parameters LOWER WIDTH HEIGHT."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1776 (insert "\\rule[" lower "]{" width "}{" height "}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1777
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1778 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1779 ;;; Fonts
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1780 ;;;
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1781
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1782 (defun cal-tex-em (string)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1783 "Insert STRING in bf font."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1784 (insert "{\\em " string "}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1785
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1786 (defun cal-tex-bf (string)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1787 "Insert STRING in bf font."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1788 (insert "{\\bf " string "}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1789
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1790 (defun cal-tex-scriptsize (string)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1791 "Insert STRING in scriptsize font."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1792 (insert "{\\scriptsize " string "}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1793
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1794 (defun cal-tex-huge (string)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1795 "Insert STRING in huge size."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1796 (insert "{\\huge " string "}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1797
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1798 (defun cal-tex-Huge (string)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1799 "Insert STRING in Huge size."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1800 (insert "{\\Huge " string "}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1801
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1802 (defun cal-tex-Huge-bf (string)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1803 "Insert STRING in Huge bf size."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1804 (insert "{\\Huge\\bf " string "}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1805
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1806 (defun cal-tex-large (string)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1807 "Insert STRING in large size."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1808 (insert "{\\large " string "}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1809
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1810 (defun cal-tex-large-bf (string)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1811 "Insert STRING in large bf size."
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1812 (insert "{\\large\\bf " string "}"))
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1813
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1814 (provide 'cal-tex)
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1815
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52114
diff changeset
1816 ;;; arch-tag: ca8168a4-5a00-4508-a565-17e3bccce6d0
13195
b558ab9fbef4 Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
1817 ;;; cal-tex.el ends here