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