summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/calendar/evntlist.dtx
blob: f2412966ce08903894fa923d18c2cd092e5b96cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
%\iffalse
%
% file: evntlist.dtx
% Copyright (C) 1996-1997 by Frank Bennett.  All rights reserved.
%
% IMPORTANT NOTICE:
% 
% You are not allowed to change this file.  You may however copy
% this file to a file with a different name and then change the
% copy if (a) you do not charge for the modified code, (b) you
% acknowledge the author of this file in the new file, if it
% is distributed to others, and (c) you attach these same
% conditions to the new file.
% 
% You are not allowed to distribute this file alone.  You are not
% allowed to take money for the distribution or use of this file
% (or a changed version) except for a nominal charge for copying
% etc.
% 
% You are allowed to distribute this file under the condition that
% it is distributed with all of its contents, intact.
% 
% For error reports, or offers to help make this a more powerful,
% friendlier, and altogether more thrilling package, please contact me on
% fb@soas.ac.uk.  Better yet, make a contribution to
% my pension.  Account details available on request.
%
%\fi
%
% \def\fileversion{2.2}
% \def\filedate{1997/11/07 10:44:05}
%
% \iffalse
%
%<*driver>
\documentclass{ltxdoc}
%\CodelineIndex
%\EnableCrossrefs
\begin{document}
\OnlyDescription    % Comment out for implementation details
\DocInput{evntlist.dtx}
\end{document}
%</driver>
%\fi
%
%\iffalse
% evntlist.dtx,v
% Revision 3.1.1.1  1998/01/17 18:14:57  root
% Release code, checksum verified
%
% Revision 3.1  1998/01/17 17:12:58  root
% Release code
%
% Revision 1.3  1998/01/16 17:46:34  root
% *** empty log message ***
%
% Revision 1.2  1998/01/15 23:39:20  root
% *** empty log message ***
%
% Revision 1.1  1997/11/26 07:20:12  bennett
% Initial revision
%
%\fi
%
% \title{User's Guide to the Event List 
%    package\thanks{This file is version number
%    \fileversion{}.  It was last revised on
%    \filedate{}.}}
%
% \author{Frank G. Bennett, Jr.}
%
% \maketitle
%
% \setcounter{StandardModuleDepth}{1}
% \DeleteShortVerb{\|}
% \MakeShortVerb{\"}
%
% \begin{abstract}
% \noindent This package makes a cronological list
%  of events.
% \end{abstract}
%
% \CheckSum{133}
%
% Please see the file \texttt{calguide.tex} for details on the
% use of this package.
%
% \StopEventually{\PrintIndex}
%
% \section{The Class File}
%
% \subsection{Preliminaries}
% Use \LaTeXe, and tell the user who we are.
%    \begin{macrocode}
%<*style>
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{evntlist}
          [1997/11/07 10:44:05 2.2 Event List (Frank Bennett)]
%    \end{macrocode}
% Define some more variables and switches for use in the body
% of the style.
%
% \subsection{Options}
%
% In common with all other packages in the Calendar
% bundle, we
% include some code for declaring languages.
%
%    \begin{macrocode}
\input calopts.cfg
\InputIfFileExists{dates.cfg}{}{}
\ProcessOptions
%    \end{macrocode}
%
% \subsection{Option Postprocessing}
%
% Now that the options lists are available to us,
% we can start loading packages.  The following packages
% are always loaded.
%    \begin{macrocode}
\RequirePackage{calendar}
%    \end{macrocode}
% The "color" package is only loaded if the user asked
% for it as an option to \sc{documentclass}, or in the
% "weekly.cfg" file.
%    \begin{macrocode}
 \newif\if@el@noheadyet
 \@el@noheadyettrue
 \def\el@output#1{\protected@write\@el@outputfile{}{#1}}
 \def\el@maybeheader{\if@el@noheadyet%
   \begin{itemize}\item\theday\space\themonth\space\theyear\@el@noheadyetfalse\fi}
 \def\el@maybeitem{\if@el@noheadyet\else\item\theday\space\themonth\space\theyear%
 \fi}
%    \end{macrocode}
%
% \subsection{Calendar Setup}
%
% \subsection{Calendar Definition}
%
% The calendar definition itself consists of a single command
% and its associated arguments.
%    \begin{macrocode}
\newcalendar%
%    \end{macrocode}
% We give the environment a name.
%    \begin{macrocode}
{eventlist}
%    \end{macrocode}
% We're producing DVI, so we use the standard
% macro for dropping text into the hopper.
%    \begin{macrocode}
{\cal@insert}
%    \end{macrocode}
% Starting day for the calendar is not fixed here,
% because we don't pad with blank entries.  Season to taste.
% Use integers "0" through "6".  A value over 7 means no padding.
%    \begin{macrocode}
{8}
%    \end{macrocode}
% The length of a group is one day.
%    \begin{macrocode}
{1}
%    \end{macrocode}
% The length of a subgroup is one day.
%    \begin{macrocode}
{1}
%    \end{macrocode}
% Our delimiter is an \cs{item}.
%    \begin{macrocode}
{\relax}
%    \end{macrocode}
% Increment the date counter with every item.
%    \begin{macrocode}
{I}
%    \end{macrocode}
% Define the header.
%    \begin{macrocode}
{\relax}
%    \end{macrocode}
% We define the end of the calendar.  This spits out
% all of the boxes one last time, and closes the page
% formatting environment.
%    \begin{macrocode}
{\end{itemize}}
%    \end{macrocode}
% We define a way to open a new group.  In this case,
% we just relax.
%    \begin{macrocode}
{\relax}
%    \end{macrocode}
% We define the way to end a subgroup.  This spits out
% all of the boxes built for a page of text.
%    \begin{macrocode}
{\relax}
%    \end{macrocode}
% We set up to require a month and day in the environment typed
% into the user's document.
%    \begin{macrocode}
{\dates@requiremonthtrue\dates@requiredaytrue}
%    \end{macrocode}
% The next section runs after the calendar dates have been
% scanned from the environment, but before the table is
% opened.
% \textit{Start date.}
%    \begin{macrocode}
{\global\dates@date\cal@range@start%
 \caldate%
%    \end{macrocode}
% \textit{We tell the user where we're starting.}
%    \begin{macrocode}
  \message{^^JStart: \theshortweekday\space%
    \theday\space\theshortmonth\space\theyear}%
%    \end{macrocode}
% \textit{End date.}
%    \begin{macrocode}
  \global\dates@date\cal@range@end%
  \caldate%
%    \end{macrocode}
% \textit{We let the user know where we plan to stop.}
%    \begin{macrocode}
  \message{^^JEnd: \theshortweekday\space%
    \theday\space\theshortmonth\space\theyear}%
%    \end{macrocode}
% \textit{We jump back to the starting date and reset the
% human-side values.}
%    \begin{macrocode}
  \global\dates@date\cal@range@start%
  \caldate}%
%    \end{macrocode}
% Events are delimited by \cs{item}.
%    \begin{macrocode}
{\item}%
%    \end{macrocode}
% The next argument is dropped on DVI for each item.
% We use it here to fetch the text of appointments and
% events to the standard list macros, using the
% standard text-fetching commands.  Each generates a
% stack delimited by the phrase that was set above.
%    \begin{macrocode}
{\cal@get@appointments\cal@get@events}%
%    \end{macrocode}
% This sets \cs{cal@entry@text}.  It is executed for every
% event or appointment in the database that applies
% to a given item.  We differentiate between whole-day events,
% pinpointed events and ranged events.
%    \begin{macrocode}
{\relax%
   \ifnum\dates@time@start>0\relax%
    \ifnum\dates@time@start=\dates@time@end%
      \protected@edef\cal@entry@text{%
        \thetimestart\space%
        \cal@textcolor{\calcolor}{\thelongtext}}%
    \else%
      \protected@edef\cal@entry@text{%
        \thetimestart--\thetimeend\space%
        \cal@textcolor{\calcolor}{\thelongtext}}%
    \fi%
  \else%
      \protected@edef\cal@entry@text{%
        \cal@textcolor{\calcolor}{\thelongtext}}%
  \fi}%
%    \end{macrocode}
% Finally ...
%    \begin{macrocode}
{\ifcat$\theevents\theappointments$\else%
\el@maybeitem%
\el@maybeheader%
\fi%
\bgroup%
\let\item\par%
\ifcat$\theevents$\else%
  \par%
  \theevents%
\fi%
\egroup%
\ifcat$\theappointments$\else%
\begin{itemize}%
\item%
\theappointments%
\end{itemize}%
\fi}
%</style>
%    \end{macrocode}
% \Finale \PrintChanges