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