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