Mercurial > emacs
annotate lisp/calendar/cal-tex.el @ 88701:c68f88e42678
(describe-character-set): Account for
more than two dimensions of possibly different size.
author | Dave Love <fx@gnu.org> |
---|---|
date | Fri, 31 May 2002 21:53:21 +0000 |
parents | 7a94f1c588c4 |
children | ceb605d3c4dd |
rev | line source |
---|---|
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36118
diff
changeset
|
1 ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX |
13195 | 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 | |
36118
4459c383591a
(cal-tex-weekly4-box): Respect setting
Gerd Moellmann <gerd@gnu.org>
parents:
25130
diff
changeset
|
931 (insert (format "{\\large\\sf %d}\\\\\n" |
4459c383591a
(cal-tex-weekly4-box): Respect setting
Gerd Moellmann <gerd@gnu.org>
parents:
25130
diff
changeset
|
932 (if cal-tex-24 (+ i 12) i)))))) |
13195 | 933 (cal-tex-nl ".5cm") |
934 (if weekend | |
935 (progn | |
936 (cal-tex-vspace "1cm") | |
937 (insert "\\ \\vfill") | |
938 (insert (format "{\\Large\\bf %s,} %s/%s/%s\\\\\n" | |
939 dayname1 month1 day1 year1)) | |
940 (cal-tex-rule "0pt" "7.5cm" ".5mm") | |
941 (cal-tex-nl "1.5cm") | |
942 (cal-tex-vspace "1cm"))) | |
943 (cal-tex-e-parbox) | |
944 (cal-tex-e-framebox) | |
945 (cal-tex-hspace "1cm"))) | |
946 | |
13595
2af9ec0bc9cc
(cal-tex-version): Deleted.
Richard M. Stallman <rms@gnu.org>
parents:
13206
diff
changeset
|
947 (defun cal-tex-cursor-filofax-2week (&optional arg) |
13195 | 948 "Two-weeks-at-a-glance Filofax style calendar for week indicated by cursor. |
949 Optional prefix argument specifies number of weeks. | |
13595
2af9ec0bc9cc
(cal-tex-version): Deleted.
Richard M. Stallman <rms@gnu.org>
parents:
13206
diff
changeset
|
950 Diary entries are included if `cal-tex-diary' is t. |
13195 | 951 Holidays are included if `cal-tex-holidays' is t." |
952 (interactive "P") | |
953 (let* ((n (if arg arg 1)) | |
954 (date (calendar-gregorian-from-absolute | |
955 (calendar-dayname-on-or-before | |
956 calendar-week-start-day | |
957 (calendar-absolute-from-gregorian | |
958 (calendar-cursor-to-date t))))) | |
959 (month (extract-calendar-month date)) | |
960 (year (extract-calendar-year date)) | |
961 (day (extract-calendar-day date)) | |
962 (holidays (if cal-tex-holidays | |
963 (cal-tex-list-holidays | |
964 (calendar-absolute-from-gregorian date) | |
965 (+ (* 7 n) | |
966 (calendar-absolute-from-gregorian date))))) | |
967 (diary-list (if cal-tex-diary | |
968 (cal-tex-list-diary-entries | |
969 (calendar-absolute-from-gregorian | |
970 (list month 1 year)) | |
971 (+ (* 7 n) | |
972 (calendar-absolute-from-gregorian date)))))) | |
973 (cal-tex-preamble "twoside") | |
974 (cal-tex-cmd "\\textwidth 3.25in") | |
975 (cal-tex-cmd "\\textheight 6.5in") | |
976 (cal-tex-cmd "\\oddsidemargin 1.75in") | |
977 (cal-tex-cmd "\\evensidemargin 1.5in") | |
978 (cal-tex-cmd "\\topmargin 0pt") | |
979 (cal-tex-cmd "\\headheight -0.875in") | |
980 (cal-tex-cmd "\\headsep 0.125in") | |
981 (cal-tex-cmd "\\footskip .125in") | |
982 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]} | |
983 \\long\\def\\rightday#1#2#3#4#5{% | |
984 \\rule{\\textwidth}{0.3pt}\\\\% | |
985 \\hbox to \\textwidth{% | |
986 \\vbox to 0.7in{% | |
987 \\vspace*{2pt}% | |
988 \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% | |
989 \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% | |
990 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | |
991 \\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]} | |
992 \\long\\def\\leftday#1#2#3#4#5{% | |
993 \\rule{\\textwidth}{0.3pt}\\\\% | |
994 \\hbox to \\textwidth{% | |
995 \\vbox to 0.7in{% | |
996 \\vspace*{2pt}% | |
997 \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}% | |
998 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}% | |
999 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | |
1000 ") | |
1001 (cal-tex-b-document) | |
1002 (cal-tex-cmd "\\pagestyle{empty}") | |
1003 (calendar-for-loop i from 1 to n do | |
1004 (if (= (mod i 2) 1) | |
1005 (insert "\\righthead") | |
1006 (insert "\\lefthead")) | |
1007 (cal-tex-arg | |
1008 (let ((d (cal-tex-incr-date date 6))) | |
1009 (if (= (extract-calendar-month date) | |
1010 (extract-calendar-month d)) | |
1011 (format "%s %s" | |
1012 (calendar-month-name | |
1013 (extract-calendar-month date)) | |
1014 (extract-calendar-year date)) | |
1015 (if (= (extract-calendar-year date) | |
1016 (extract-calendar-year d)) | |
1017 (format "%s---%s %s" | |
1018 (calendar-month-name | |
1019 (extract-calendar-month date)) | |
1020 (calendar-month-name | |
1021 (extract-calendar-month d)) | |
1022 (extract-calendar-year date)) | |
1023 (format "%s %s---%s %s" | |
1024 (calendar-month-name | |
1025 (extract-calendar-month date)) | |
1026 (extract-calendar-year date) | |
1027 (calendar-month-name (extract-calendar-month d)) | |
1028 (extract-calendar-year d)))))) | |
1029 (insert "%\n") | |
1030 (calendar-for-loop j from 1 to 7 do | |
1031 (if (= (mod i 2) 1) | |
1032 (insert "\\rightday") | |
1033 (insert "\\leftday")) | |
1034 (cal-tex-arg (calendar-day-name date)) | |
1035 (cal-tex-arg (int-to-string (extract-calendar-day date))) | |
1036 (cal-tex-arg (cal-tex-latexify-list diary-list date)) | |
1037 (cal-tex-arg (cal-tex-latexify-list holidays date)) | |
1038 (cal-tex-arg (eval cal-tex-daily-string)) | |
1039 (insert "%\n") | |
1040 (setq date (cal-tex-incr-date date))) | |
1041 (if (/= i n) | |
1042 (progn | |
1043 (run-hooks 'cal-tex-week-hook) | |
1044 (cal-tex-newpage)))) | |
1045 (cal-tex-end-document) | |
1046 (run-hooks 'cal-tex-hook))) | |
1047 | |
13595
2af9ec0bc9cc
(cal-tex-version): Deleted.
Richard M. Stallman <rms@gnu.org>
parents:
13206
diff
changeset
|
1048 (defun cal-tex-cursor-filofax-week (&optional arg) |
13195 | 1049 "One-week-at-a-glance Filofax style calendar for week indicated by cursor. |
1050 Optional prefix argument specifies number of weeks. | |
1051 Weeks start on Monday. | |
13595
2af9ec0bc9cc
(cal-tex-version): Deleted.
Richard M. Stallman <rms@gnu.org>
parents:
13206
diff
changeset
|
1052 Diary entries are included if `cal-tex-diary' is t. |
13195 | 1053 Holidays are included if `cal-tex-holidays' is t." |
1054 (interactive "P") | |
1055 (let* ((n (if arg arg 1)) | |
1056 (date (calendar-gregorian-from-absolute | |
1057 (calendar-dayname-on-or-before | |
1058 1 | |
1059 (calendar-absolute-from-gregorian | |
1060 (calendar-cursor-to-date t))))) | |
1061 (month (extract-calendar-month date)) | |
1062 (year (extract-calendar-year date)) | |
1063 (day (extract-calendar-day date)) | |
1064 (holidays (if cal-tex-holidays | |
1065 (cal-tex-list-holidays | |
1066 (calendar-absolute-from-gregorian date) | |
1067 (+ (* 7 n) | |
1068 (calendar-absolute-from-gregorian date))))) | |
1069 (diary-list (if cal-tex-diary | |
1070 (cal-tex-list-diary-entries | |
1071 (calendar-absolute-from-gregorian | |
1072 (list month 1 year)) | |
1073 (+ (* 7 n) | |
1074 (calendar-absolute-from-gregorian date)))))) | |
1075 (cal-tex-preamble "twoside") | |
1076 (cal-tex-cmd "\\textwidth 3.25in") | |
1077 (cal-tex-cmd "\\textheight 6.5in") | |
1078 (cal-tex-cmd "\\oddsidemargin 1.75in") | |
1079 (cal-tex-cmd "\\evensidemargin 1.5in") | |
1080 (cal-tex-cmd "\\topmargin 0pt") | |
1081 (cal-tex-cmd "\\headheight -0.875in") | |
1082 (cal-tex-cmd "\\headsep 0.125in") | |
1083 (cal-tex-cmd "\\footskip .125in") | |
1084 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]} | |
1085 \\long\\def\\rightday#1#2#3#4#5{% | |
1086 \\rule{\\textwidth}{0.3pt}\\\\% | |
1087 \\hbox to \\textwidth{% | |
1088 \\vbox to 1.85in{% | |
1089 \\vspace*{2pt}% | |
1090 \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% | |
1091 \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% | |
1092 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | |
1093 \\long\\def\\weekend#1#2#3#4#5{% | |
1094 \\rule{\\textwidth}{0.3pt}\\\\% | |
1095 \\hbox to \\textwidth{% | |
1096 \\vbox to .8in{% | |
1097 \\vspace*{2pt}% | |
1098 \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% | |
1099 \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% | |
1100 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | |
1101 \\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]} | |
1102 \\long\\def\\leftday#1#2#3#4#5{% | |
1103 \\rule{\\textwidth}{0.3pt}\\\\% | |
1104 \\hbox to \\textwidth{% | |
1105 \\vbox to 1.85in{% | |
1106 \\vspace*{2pt}% | |
1107 \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}% | |
1108 \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}% | |
1109 \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | |
1110 ") | |
1111 (cal-tex-b-document) | |
1112 (cal-tex-cmd "\\pagestyle{empty}\\ ") | |
1113 (cal-tex-newpage) | |
1114 (calendar-for-loop i from 1 to n do | |
1115 (insert "\\lefthead") | |
1116 (cal-tex-arg | |
1117 (let ((d (cal-tex-incr-date date 2))) | |
1118 (if (= (extract-calendar-month date) | |
1119 (extract-calendar-month d)) | |
1120 (format "%s %s" | |
1121 (calendar-month-name | |
1122 (extract-calendar-month date)) | |
1123 (extract-calendar-year date)) | |
1124 (if (= (extract-calendar-year date) | |
1125 (extract-calendar-year d)) | |
1126 (format "%s---%s %s" | |
1127 (calendar-month-name | |
1128 (extract-calendar-month date)) | |
1129 (calendar-month-name | |
1130 (extract-calendar-month d)) | |
1131 (extract-calendar-year date)) | |
1132 (format "%s %s---%s %s" | |
1133 (calendar-month-name | |
1134 (extract-calendar-month date)) | |
1135 (extract-calendar-year date) | |
1136 (calendar-month-name (extract-calendar-month d)) | |
1137 (extract-calendar-year d)))))) | |
1138 (insert "%\n") | |
1139 (calendar-for-loop j from 1 to 3 do | |
1140 (insert "\\leftday") | |
1141 (cal-tex-arg (calendar-day-name date)) | |
1142 (cal-tex-arg (int-to-string (extract-calendar-day date))) | |
1143 (cal-tex-arg (cal-tex-latexify-list diary-list date)) | |
1144 (cal-tex-arg (cal-tex-latexify-list holidays date)) | |
1145 (cal-tex-arg (eval cal-tex-daily-string)) | |
1146 (insert "%\n") | |
1147 (setq date (cal-tex-incr-date date))) | |
1148 (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n") | |
1149 (cal-tex-newpage) | |
1150 (insert "\\righthead") | |
1151 (cal-tex-arg | |
1152 (let ((d (cal-tex-incr-date date 3))) | |
1153 (if (= (extract-calendar-month date) | |
1154 (extract-calendar-month d)) | |
1155 (format "%s %s" | |
1156 (calendar-month-name | |
1157 (extract-calendar-month date)) | |
1158 (extract-calendar-year date)) | |
1159 (if (= (extract-calendar-year date) | |
1160 (extract-calendar-year d)) | |
1161 (format "%s---%s %s" | |
1162 (calendar-month-name | |
1163 (extract-calendar-month date)) | |
1164 (calendar-month-name | |
1165 (extract-calendar-month d)) | |
1166 (extract-calendar-year date)) | |
1167 (format "%s %s---%s %s" | |
1168 (calendar-month-name | |
1169 (extract-calendar-month date)) | |
1170 (extract-calendar-year date) | |
1171 (calendar-month-name (extract-calendar-month d)) | |
1172 (extract-calendar-year d)))))) | |
1173 (insert "%\n") | |
1174 (calendar-for-loop j from 1 to 2 do | |
1175 (insert "\\rightday") | |
1176 (cal-tex-arg (calendar-day-name date)) | |
1177 (cal-tex-arg (int-to-string (extract-calendar-day date))) | |
1178 (cal-tex-arg (cal-tex-latexify-list diary-list date)) | |
1179 (cal-tex-arg (cal-tex-latexify-list holidays date)) | |
1180 (cal-tex-arg (eval cal-tex-daily-string)) | |
1181 (insert "%\n") | |
1182 (setq date (cal-tex-incr-date date))) | |
1183 (calendar-for-loop j from 1 to 2 do | |
1184 (insert "\\weekend") | |
1185 (cal-tex-arg (calendar-day-name date)) | |
1186 (cal-tex-arg (int-to-string (extract-calendar-day date))) | |
1187 (cal-tex-arg (cal-tex-latexify-list diary-list date)) | |
1188 (cal-tex-arg (cal-tex-latexify-list holidays date)) | |
1189 (cal-tex-arg (eval cal-tex-daily-string)) | |
1190 (insert "%\n") | |
1191 (setq date (cal-tex-incr-date date))) | |
1192 (if (/= i n) | |
1193 (progn | |
1194 (run-hooks 'cal-tex-week-hook) | |
1195 (cal-tex-newpage)))) | |
1196 (cal-tex-end-document) | |
1197 (run-hooks 'cal-tex-hook))) | |
19973
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1198 |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1199 (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
|
1200 "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
|
1201 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
|
1202 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
|
1203 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
|
1204 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
|
1205 (interactive "P") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1206 (let* ((n (if arg arg 1)) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1207 (date (calendar-gregorian-from-absolute |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1208 (calendar-dayname-on-or-before |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1209 1 |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1210 (calendar-absolute-from-gregorian |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1211 (calendar-cursor-to-date t))))) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1212 (month (extract-calendar-month date)) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1213 (year (extract-calendar-year date)) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1214 (day (extract-calendar-day date)) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1215 (holidays (if cal-tex-holidays |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1216 (cal-tex-list-holidays |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1217 (calendar-absolute-from-gregorian date) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1218 (+ (* 7 n) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1219 (calendar-absolute-from-gregorian date))))) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1220 (diary-list (if cal-tex-diary |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1221 (cal-tex-list-diary-entries |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1222 (calendar-absolute-from-gregorian |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1223 (list month 1 year)) |
25130
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1224 (+ (* 7 n) |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1225 (calendar-absolute-from-gregorian date)))))) |
19973
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1226 (cal-tex-preamble "twoside") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1227 (cal-tex-cmd "\\textwidth 3.25in") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1228 (cal-tex-cmd "\\textheight 6.5in") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1229 (cal-tex-cmd "\\oddsidemargin 1.75in") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1230 (cal-tex-cmd "\\evensidemargin 1.5in") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1231 (cal-tex-cmd "\\topmargin 0pt") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1232 (cal-tex-cmd "\\headheight -0.875in") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1233 (cal-tex-cmd "\\headsep 0.125in") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1234 (cal-tex-cmd "\\footskip .125in") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1235 (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
|
1236 \\long\\def\\rightday#1#2#3{% |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1237 \\rule{\\textwidth}{0.3pt}\\\\% |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1238 \\hbox to \\textwidth{% |
25130
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1239 \\vbox {% |
19973
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1240 \\vspace*{2pt}% |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1241 \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}% |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1242 \\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
|
1243 \\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
|
1244 \\long\\def\\weekend#1#2#3{% |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1245 \\rule{\\textwidth}{0.3pt}\\\\% |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1246 \\hbox to \\textwidth{% |
25130
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1247 \\vbox {% |
19973
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1248 \\vspace*{2pt}% |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1249 \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}% |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1250 \\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
|
1251 \\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
|
1252 \\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
|
1253 \\long\\def\\leftday#1#2#3{% |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1254 \\rule{\\textwidth}{0.3pt}\\\\% |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1255 \\hbox to \\textwidth{% |
25130
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1256 \\vbox {% |
19973
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1257 \\vspace*{2pt}% |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1258 \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}% |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1259 \\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
|
1260 \\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
|
1261 \\newbox\\LineBox |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1262 \\setbox\\LineBox=\\hbox to\\textwidth{% |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1263 \\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
|
1264 \\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
|
1265 ") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1266 (cal-tex-b-document) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1267 (cal-tex-cmd "\\pagestyle{empty}") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1268 (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
|
1269 (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
|
1270 (let ((odd (/= 0 (% j 2)))) |
da72a65a2bd6
(cal-tex-cursor-filofax-daily): Don't use oddp.
Karl Heuer <kwzh@gnu.org>
parents:
22820
diff
changeset
|
1271 (insert (if odd "\\righthead" "\\lefthead")) |
da72a65a2bd6
(cal-tex-cursor-filofax-daily): Don't use oddp.
Karl Heuer <kwzh@gnu.org>
parents:
22820
diff
changeset
|
1272 (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
|
1273 (insert "%\n") |
da72a65a2bd6
(cal-tex-cursor-filofax-daily): Don't use oddp.
Karl Heuer <kwzh@gnu.org>
parents:
22820
diff
changeset
|
1274 (insert (if odd "\\rightday" "\\leftday"))) |
25130
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 diary-list date)) |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1276 (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
|
1277 (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
|
1278 (insert "%\n") |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1279 (if cal-tex-rules |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1280 (insert "\\linesfill\n") |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1281 (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
|
1282 (cal-tex-newpage) |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1283 (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
|
1284 (insert "%\n") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1285 (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
|
1286 (insert "\\lefthead") |
19973
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1287 (cal-tex-arg (calendar-date-string date)) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1288 (insert "\\weekend") |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1289 (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
|
1290 (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
|
1291 (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
|
1292 (insert "%\n") |
25130
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1293 (if cal-tex-rules |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1294 (insert "\\linesfill\n") |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1295 (insert "\\vfill")) |
19973
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1296 (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
|
1297 (if (not cal-tex-rules) |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1298 (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
|
1299 (if (/= i n) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1300 (progn |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1301 (run-hooks 'cal-tex-week-hook) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1302 (cal-tex-newpage)))) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1303 (cal-tex-end-document) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1304 (run-hooks 'cal-tex-hook))) |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1305 |
45f02da6ebbb
(cal-tex-cursor-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19312
diff
changeset
|
1306 |
13195 | 1307 ;;; |
1308 ;;; Daily calendars | |
1309 ;;; | |
1310 | |
1311 (defun cal-tex-cursor-day (&optional arg) | |
1312 "Make a buffer with LaTeX commands for the day cursor is on. | |
1313 Optional prefix argument specifies number of days." | |
1314 (interactive "P") | |
1315 (let ((n (if arg arg 1)) | |
1316 (date (calendar-absolute-from-gregorian (calendar-cursor-to-date t)))) | |
1317 (cal-tex-preamble "12pt") | |
1318 (cal-tex-cmd "\\textwidth 6.5in") | |
1319 (cal-tex-cmd "\\textheight 10.5in") | |
1320 (cal-tex-b-document) | |
1321 (cal-tex-cmd "\\pagestyle{empty}") | |
1322 (calendar-for-loop i from 1 to n do | |
1323 (cal-tex-vspace "-1.7in") | |
1324 (cal-tex-daily-page (calendar-gregorian-from-absolute date)) | |
1325 (setq date (1+ date)) | |
1326 (if (/= i n) | |
1327 (progn | |
1328 (cal-tex-newpage) | |
1329 (run-hooks 'cal-tex-daily-hook)))) | |
1330 (cal-tex-end-document) | |
1331 (run-hooks 'cal-tex-hook))) | |
1332 | |
1333 (defun cal-tex-daily-page (date) | |
1334 "Make a calendar page for Gregorian DATE on 8.5 by 11 paper." | |
1335 (let* ((hour) | |
1336 (month-name (calendar-month-name (extract-calendar-month date)))) | |
1337 (cal-tex-banner "cal-tex-daily-page") | |
1338 (cal-tex-b-makebox "4cm" "l") | |
1339 (cal-tex-b-parbox "b" "3.8cm") | |
1340 (cal-tex-rule "0mm" "0mm" "2cm") | |
1341 (cal-tex-Huge (number-to-string (extract-calendar-day date))) | |
1342 (cal-tex-nl ".5cm") | |
1343 (cal-tex-bf month-name ) | |
1344 (cal-tex-e-parbox) | |
1345 (cal-tex-hspace "1cm") | |
1346 (cal-tex-scriptsize (eval cal-tex-daily-string)) | |
1347 (cal-tex-hspace "3.5cm") | |
1348 (cal-tex-e-makebox) | |
1349 (cal-tex-hfill) | |
1350 (cal-tex-b-makebox "4cm" "r") | |
1351 (cal-tex-bf (calendar-day-name date)) | |
1352 (cal-tex-e-makebox) | |
1353 (cal-tex-nl) | |
1354 (cal-tex-hspace ".4cm") | |
1355 (cal-tex-rule "0mm" "16.1cm" "1mm") | |
1356 (cal-tex-nl ".1cm") | |
1357 (calendar-for-loop i from cal-tex-daily-start to cal-tex-daily-end do | |
1358 (cal-tex-cmd "\\noindent") | |
1359 (setq hour (if cal-tex-24 | |
1360 i | |
1361 (mod i 12))) | |
1362 (if (= 0 hour) (setq hour 12)) | |
1363 (cal-tex-b-makebox "1cm" "c") | |
1364 (cal-tex-arg (number-to-string hour)) | |
1365 (cal-tex-e-makebox) | |
1366 (cal-tex-rule "0mm" "15.5cm" ".2mm") | |
1367 (cal-tex-nl ".2cm") | |
1368 (cal-tex-b-makebox "1cm" "c") | |
1369 (cal-tex-arg "$\\diamond$" ) | |
1370 (cal-tex-e-makebox) | |
1371 (cal-tex-rule "0mm" "15.5cm" ".2mm") | |
1372 (cal-tex-nl ".2cm")) | |
1373 (cal-tex-hfill) | |
1374 (insert (cal-tex-mini-calendar | |
1375 (extract-calendar-month (cal-tex-previous-month date)) | |
1376 (extract-calendar-year (cal-tex-previous-month date)) | |
1377 "lastmonth" "1.1in" "1in")) | |
1378 (insert (cal-tex-mini-calendar | |
1379 (extract-calendar-month date) | |
1380 (extract-calendar-year date) | |
1381 "thismonth" "1.1in" "1in")) | |
1382 (insert (cal-tex-mini-calendar | |
1383 (extract-calendar-month (cal-tex-next-month date)) | |
1384 (extract-calendar-year (cal-tex-next-month date)) | |
1385 "nextmonth" "1.1in" "1in")) | |
1386 (insert "\\hbox to \\textwidth{") | |
1387 (cal-tex-hfill) | |
1388 (insert "\\lastmonth") | |
1389 (cal-tex-hfill) | |
1390 (insert "\\thismonth") | |
1391 (cal-tex-hfill) | |
1392 (insert "\\nextmonth") | |
1393 (cal-tex-hfill) | |
1394 (insert "}") | |
1395 (cal-tex-banner "end of cal-tex-daily-page"))) | |
1396 | |
1397 ;;; | |
1398 ;;; Mini calendars | |
1399 ;;; | |
1400 | |
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
|
1401 (defun cal-tex-mini-calendar (month year name width height &optional ptsize colsep) |
13195 | 1402 "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
|
1403 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
|
1404 COLSEP gives the column separation; 1mm is the default." |
13195 | 1405 (let* ((blank-days;; at start of month |
1406 (mod | |
1407 (- (calendar-day-of-week (list month 1 year)) | |
1408 calendar-week-start-day) | |
1409 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
|
1410 (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
|
1411 (colsep (if colsep colsep "1mm")) |
13195 | 1412 (str (concat "\\def\\" name "{\\hbox to" width "{%\n" |
1413 "\\vbox to" height "{%\n" | |
1414 "\\vfil \\hbox to" width "{%\n" | |
1415 "\\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
|
1416 (if ptsize ptsize "scriptsize") |
13195 | 1417 "\\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
|
1418 "{@{\\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
|
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{" 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
|
1421 "}}r@{\\hspace{" colsep "}}r@{\\hspace{0mm}}}%\n" |
13195 | 1422 "\\multicolumn{7}{c}{" |
1423 (calendar-month-name month) | |
1424 " " | |
1425 (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
|
1426 "}\\\\[1mm]\n"))) |
13195 | 1427 (calendar-for-loop i from 0 to 6 do |
1428 (setq str (concat str | |
1429 (substring (aref calendar-day-name-array | |
1430 (mod (+ calendar-week-start-day i) 7)) | |
1431 0 2) | |
1432 (if (/= i 6) | |
1433 " & " | |
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
|
1434 "\\\\[0.7mm]\n")))) |
13195 | 1435 (calendar-for-loop i from 1 to blank-days do |
1436 (setq str (concat str " & "))) | |
1437 (calendar-for-loop i from 1 to last do | |
1438 (setq str (concat str (int-to-string i))) | |
1439 (setq str (concat str (if (zerop (mod (+ i blank-days) 7)) | |
1440 (if (/= i last) "\\\\[0.5mm]\n" "") | |
1441 " & ")))) | |
1442 (setq str (concat str "\n\\end{tabular}\\hfil}\\vfil}}}%\n")) | |
1443 str)) | |
1444 | |
1445 ;;; | |
1446 ;;; Various calendar functions | |
1447 ;;; | |
1448 | |
1449 (defun cal-tex-incr-date (date &optional n) | |
1450 "The date of the day following DATE. | |
1451 If optional N is given, the date of N days after DATE." | |
1452 (calendar-gregorian-from-absolute | |
1453 (+ (if n n 1) (calendar-absolute-from-gregorian date)))) | |
1454 | |
25130
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1455 (defun cal-tex-latexify-list (date-list date &optional separator final-separator) |
13195 | 1456 "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
|
1457 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
|
1458 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
|
1459 FINAL-SEPARATOR is t." |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1460 (let* ((sep (if separator separator "\\\\")) |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1461 (result |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1462 (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
|
1463 (let ((result) |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1464 (p date-list)) |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1465 (while p |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1466 (and (car (car p)) |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1467 (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
|
1468 (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
|
1469 (setq p (cdr p))) |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1470 (reverse result)) |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1471 sep))) |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1472 (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
|
1473 (concat result sep) |
3f2b516f9ddc
(cal-tex-cursor-filofax-daily): Add possibility of
Karl Heuer <kwzh@gnu.org>
parents:
23120
diff
changeset
|
1474 result))) |
13195 | 1475 |
1476 (defun cal-tex-previous-month (date) | |
1477 "Return the date of the first day in the month previous to DATE." | |
1478 (let* ((month (extract-calendar-month date)) | |
1479 (year (extract-calendar-year date))) | |
1480 (increment-calendar-month month year -1) | |
1481 (list month 1 year))) | |
1482 | |
1483 (defun cal-tex-next-month (date) | |
1484 "Return the date of the first day in the month following DATE." | |
1485 (let* ((month (extract-calendar-month date)) | |
1486 (year (extract-calendar-year date))) | |
1487 (increment-calendar-month month year 1) | |
1488 (list month 1 year))) | |
1489 | |
1490 ;;; | |
1491 ;;; LaTeX Code | |
1492 ;;; | |
1493 | |
1494 (defun cal-tex-end-document () | |
1495 "Finish the LaTeX document. | |
1496 Insert the trailer to LaTeX document, pop to LaTeX buffer, add | |
1497 informative header, and run HOOK." | |
1498 (cal-tex-e-document) | |
1499 (latex-mode) | |
1500 (pop-to-buffer cal-tex-buffer) | |
1501 (goto-char (point-min)) | |
1502 (cal-tex-comment " This buffer was produced by cal-tex.el.") | |
1503 (cal-tex-comment " To print a calendar, type") | |
1504 (cal-tex-comment " M-x tex-buffer RET") | |
1505 (cal-tex-comment " M-x tex-print RET") | |
1506 (goto-char (point-min))) | |
1507 | |
1508 (defun cal-tex-insert-preamble (weeks landscape size &optional append) | |
1509 "Initialize the output buffer. | |
1510 Select the output buffer, and insert the preamble for a calendar of | |
1511 WEEKS weeks. Insert code for landscape mode if LANDSCAPE is true. | |
1512 Use pointsize SIZE. Optional argument APPEND, if t, means add to end of | |
1513 without erasing current contents." | |
1514 (let ((width "18cm") | |
1515 (height "24cm")) | |
1516 (if landscape | |
1517 (progn | |
1518 (setq width "24cm") | |
1519 (setq height "18cm"))) | |
1520 (if (not append) | |
1521 (progn | |
1522 (cal-tex-preamble size) | |
1523 (if (not landscape) | |
1524 (progn | |
1525 (cal-tex-cmd "\\oddsidemargin -1.75cm") | |
1526 (cal-tex-cmd "\\def\\holidaymult{.06}")) | |
1527 (cal-tex-cmd "\\special{landscape}") | |
1528 (cal-tex-cmd "\\textwidth 9.5in") | |
1529 (cal-tex-cmd "\\textheight 7in") | |
1530 (cal-tex-comment) | |
1531 (cal-tex-cmd "\\def\\holidaymult{.08}")) | |
1532 (cal-tex-cmd cal-tex-caldate) | |
1533 (cal-tex-cmd cal-tex-myday) | |
1534 (cal-tex-b-document) | |
1535 (cal-tex-cmd "\\pagestyle{empty}"))) | |
1536 (cal-tex-cmd "\\setlength{\\cellwidth}" width) | |
1537 (insert (format "\\setlength{\\cellwidth}{%f\\cellwidth}\n" | |
1538 (/ 1.1 (length cal-tex-which-days)))) | |
1539 (cal-tex-cmd "\\setlength{\\cellheight}" height) | |
1540 (insert (format "\\setlength{\\cellheight}{%f\\cellheight}\n" | |
1541 (/ 1.0 weeks))) | |
1542 (cal-tex-cmd "\\ \\par") | |
1543 (cal-tex-vspace "-3cm"))) | |
1544 | |
1545 (defvar cal-tex-LaTeX-subst-list | |
1546 '(("\"". "``") | |
1547 ("\"". "''");; Quote changes meaning when list is reversed. | |
1548 ("@" . "\\verb|@|") | |
1549 ("&" . "\\&") | |
1550 ("%" . "\\%") | |
1551 ("$" . "\\$") | |
1552 ("#" . "\\#") | |
1553 ("_" . "\\_") | |
1554 ("{" . "\\{") | |
1555 ("}" . "\\}") | |
1556 ("<" . "$<$") | |
1557 (">" . "$>$") | |
1558 ("\n" . "\\ \\\\")) ;\\ needed for e.g \begin{center}\n AA\end{center} | |
1559 "List of symbols and their replacements.") | |
1560 | |
1561 (defun cal-tex-LaTeXify-string (string) | |
1562 "Protect special characters in STRING from LaTeX." | |
1563 (if (not string) | |
1564 "" | |
1565 (let ((head "") | |
1566 (tail string) | |
1567 (list cal-tex-LaTeX-subst-list)) | |
1568 (while (not (string-equal tail "")) | |
1569 (let* ((ch (substring tail 0 1)) | |
1570 (pair (assoc ch list))) | |
1571 (if (and pair (string-equal ch "\"")) | |
1572 (setq list (reverse list)));; Quote changes meaning each time. | |
1573 (setq tail (substring tail 1)) | |
1574 (setq head (concat head (if pair (cdr pair) ch))))) | |
1575 head))) | |
1576 | |
1577 (defun cal-tex-hfill () "Insert hfill." (insert "\\hfill")) | |
1578 | |
1579 (defun cal-tex-newpage () "Insert newpage." (insert "\\newpage%\n")) | |
1580 | |
1581 (defun cal-tex-noindent () "Insert noindent." (insert "\\noindent")) | |
1582 | |
1583 (defun cal-tex-vspace (space) | |
1584 "Insert vspace command to move SPACE vertically." | |
1585 (insert "\\vspace*{" space "}") | |
1586 (cal-tex-comment)) | |
1587 | |
1588 (defun cal-tex-hspace (space) | |
1589 "Insert hspace command to move SPACE horizontally." | |
1590 (insert "\\hspace*{" space "}") | |
1591 (cal-tex-comment)) | |
1592 | |
1593 (defun cal-tex-comment (&optional comment) | |
1594 "Insert % at end of line, include COMMENT if present, and move | |
1595 to next line." | |
1596 (insert "% ") | |
1597 (if comment | |
1598 (insert comment)) | |
1599 (insert "\n")) | |
1600 | |
1601 (defun cal-tex-banner (comment) | |
1602 "Insert the COMMENT separated by blank lines." | |
1603 (cal-tex-comment) | |
1604 (cal-tex-comment) | |
1605 (cal-tex-comment (concat "\t\t\t" comment)) | |
1606 (cal-tex-comment)) | |
1607 | |
1608 | |
1609 (defun cal-tex-nl (&optional skip comment) | |
1610 "End a line with \\. If SKIP, then add that much spacing. | |
1611 Add COMMENT if present" | |
1612 (insert "\\\\") | |
1613 (if skip | |
1614 (insert "[" skip "]")) | |
1615 (cal-tex-comment comment)) | |
1616 | |
1617 (defun cal-tex-arg (&optional text) | |
1618 "Insert optional TEXT surrounded by braces." | |
1619 (insert "{") | |
1620 (if text (insert text)) | |
1621 (insert "}")) | |
1622 | |
1623 (defun cal-tex-cmd (cmd &optional arg) | |
1624 "Insert LaTeX CMD, with optional ARG, and end with %" | |
1625 (insert cmd) | |
1626 (cal-tex-arg arg) | |
1627 (cal-tex-comment)) | |
1628 | |
1629 ;;; | |
1630 ;;; Environments | |
1631 ;;; | |
1632 | |
1633 (defun cal-tex-b-document () | |
1634 "Insert beginning of document." | |
1635 (cal-tex-cmd "\\begin{document}")) | |
1636 | |
1637 (defun cal-tex-e-document () | |
1638 "Insert end of document." | |
1639 (cal-tex-cmd "\\end{document}")) | |
1640 | |
1641 (defun cal-tex-b-center () | |
1642 "Insert beginning of centered block." | |
1643 (cal-tex-cmd "\\begin{center}")) | |
1644 | |
1645 (defun cal-tex-e-center () | |
1646 "Insert end of centered block." | |
1647 (cal-tex-comment) | |
1648 (cal-tex-cmd "\\end{center}")) | |
1649 | |
1650 | |
1651 ;;; | |
1652 ;;; Boxes | |
1653 ;;; | |
1654 | |
1655 | |
1656 (defun cal-tex-b-parbox (position width) | |
1657 "Insert parbox with parameters POSITION and WIDTH." | |
1658 (insert "\\parbox[" position "]{" width "}{") | |
1659 (cal-tex-comment)) | |
1660 | |
1661 (defun cal-tex-e-parbox (&optional height) | |
1662 "Insert end of parbox. Force it to be a given HEIGHT." | |
1663 (cal-tex-comment) | |
1664 (if height | |
1665 (cal-tex-rule "0mm" "0mm" height)) | |
1666 (insert "}") | |
1667 (cal-tex-comment "end parbox")) | |
1668 | |
1669 (defun cal-tex-b-framebox ( width position ) | |
1670 "Insert framebox with parameters WIDTH and POSITION (clr)." | |
1671 (insert "\\framebox[" width "][" position "]{" ) | |
1672 (cal-tex-comment)) | |
1673 | |
1674 (defun cal-tex-e-framebox () | |
1675 "Insert end of framebox." | |
1676 (cal-tex-comment) | |
1677 (insert "}") | |
1678 (cal-tex-comment "end framebox")) | |
1679 | |
1680 | |
1681 (defun cal-tex-b-makebox ( width position ) | |
1682 "Insert makebox with parameters WIDTH and POSITION (clr)." | |
1683 (insert "\\makebox[" width "][" position "]{" ) | |
1684 (cal-tex-comment)) | |
1685 | |
1686 (defun cal-tex-e-makebox () | |
1687 "Insert end of makebox." | |
1688 (cal-tex-comment) | |
1689 (insert "}") | |
1690 (cal-tex-comment "end makebox")) | |
1691 | |
1692 | |
1693 (defun cal-tex-rule (lower width height) | |
1694 "Insert a rule with parameters LOWER WIDTH HEIGHT." | |
1695 (insert "\\rule[" lower "]{" width "}{" height "}")) | |
1696 | |
1697 ;;; | |
1698 ;;; Fonts | |
1699 ;;; | |
1700 | |
1701 (defun cal-tex-em (string) | |
1702 "Insert STRING in bf font." | |
1703 (insert "{\\em " string "}")) | |
1704 | |
1705 (defun cal-tex-bf (string) | |
1706 "Insert STRING in bf font." | |
1707 (insert "{\\bf " string "}")) | |
1708 | |
1709 (defun cal-tex-scriptsize (string) | |
1710 "Insert STRING in scriptsize font." | |
1711 (insert "{\\scriptsize " string "}")) | |
1712 | |
1713 (defun cal-tex-huge (string) | |
1714 "Insert STRING in huge size." | |
1715 (insert "{\\huge " string "}")) | |
1716 | |
1717 (defun cal-tex-Huge (string) | |
1718 "Insert STRING in Huge size." | |
1719 (insert "{\\Huge " string "}")) | |
1720 | |
1721 (defun cal-tex-Huge-bf (string) | |
1722 "Insert STRING in Huge bf size." | |
1723 (insert "{\\Huge\\bf " string "}")) | |
1724 | |
1725 (defun cal-tex-large (string) | |
1726 "Insert STRING in large size." | |
1727 (insert "{\\large " string "}")) | |
1728 | |
1729 (defun cal-tex-large-bf (string) | |
1730 "Insert STRING in large bf size." | |
1731 (insert "{\\large\\bf " string "}")) | |
1732 | |
1733 (provide 'cal-tex) | |
1734 | |
1735 ;;; cal-tex.el ends here |