annotate lisp/calendar/cal-tex.el @ 13581:e69e87bdc813

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