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