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