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