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