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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
|
%D \module
%D [ file=s-pre-01,
%D version=1997.07.22,
%D title=\CONTEXT\ Style File,
%D subtitle=Presentation Environment 1,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
%D This environment can be used to typeset interactive
%D presentations. This module was first used at the 1997 \TUG\
%D meeting.
\usemodule[pre-general]
%D \macros
%D {language}
%D
%D Because this module is defined in english, we default to the
%D english hyphenation patterns and labels too.
\language
[en]
%D \macros
%D {setupbodyfont,setuplayout}
%D
%D For screen reading, a Lucida Bright font looks nice. We use
%D a 14.4 point bodyfont for the main text, but switch back to
%D 12 points for ornaments.
\startmode[asintended] \setupbodyfont[lbr] \stopmode
\setupbodyfont[14.4pt]
\setuplayout
[style=smallbodyfont]
%D \macros
%D {setupcolors,definecolor}
%D
%D Screen presentations without color just look dull, so we
%D enable color support. We define ourselves a yellowish
%D backgroundcolor and a not too dark blue interactioncolor.
\setupcolors
[state=start]
\definecolor [BackgroundColor] [r=1, g=1, b=.7]
\definecolor [InteractionColor] [r=.1, g=.5, b=.8]
\definecolor [ContrastColor] [r=.9, g=.5, b=.2]
%D \macros
%D {setuppapersize,setuplayout,setupinteractionscreen}
%D
%D
%D We use a nice large screen, and dedicate the right edge and
%D bottom part to navigational tools. We automatically set
%D the width and height of the page and start up full screen.
\setuppapersize
[S6][S6]
\setuplayout
[topspace=12pt,
header=0pt,
footer=0pt,
height=402pt, % 450 - 12 - 15 - 12 - 12 + 3
bottomdistance=15pt,
bottom=12pt,
backspace=12pt,
margin=0pt,
width=fit,
edgedistance=12pt,
rightedge=96pt]
\setupinteractionscreen
[option=max]
%D \macros
%D {setupbackgrounds}
%D
%D We set the pagecolor to yellow except the part of the screen
%D that is used to display the running text. By seting the
%D offset to 3pt the text will not touch the yellow parts. We
%D do not set the depth.
\setupbackgrounds
[page]
[background=color,
backgroundcolor=BackgroundColor,
offset=3pt]
\setupbackgrounds
[text][text]
[background=color,
backgroundcolor=white]
%D I considered the next setup too, but finaly decided to
%D comment it out.
%D
%D \starttyping
%D \setupbackgrounds
%D [bottom][text]
%D [frame=on,
%D framecolor=white]
%D \stoptyping
%D \macros
%D {setupinteraction}
%D
%D We did not enable interactive text support yet, so let's do
%D that now. We force page reference to circumvent problems
%D with named destinations in buggy viewers.
\setupinteraction
[page=yes,
color=InteractionColor,
contrastcolor=ContrastColor,
menu=on,
state=start]
%D \macros
%D {setupinteractionmenu,startinteractionmenu}
%D
%D At the bottom of the screen we show two navigational bars.
%D At the left we show the subpage bar, at the right we use a
%D non default backward|/|forward bar.
\setupinteractionmenu
[bottom]
[leftoffset=-3pt,
rightoffset=-3pt]
\startinteractionmenu[bottom]
\txt \InteractionBar \\
\txt \InteractionButtons \\
\stopinteractionmenu
%D \macros
%D {interactionbar}
%D
%D The left bar gets a white border (on the yellow background).
%D Because we don't want to typeset an empty frame when no
%D subpage bar is shown, we check for the number of subpages.
\def\InteractionBar%
{\ifnum\nofsubpages>1
\framed
[framecolor=white,rulethickness=1pt,
height=\bottomheight,strut=no]
{\interactionbar[alternative=f,width=.5\makeupwidth,height=1ex]}
\fi}
%D \macros
%D {setupinteractionbar, interactionbuttons}
%D
%D The right hand buttons enable us to jump backward and forward,
%D as well as to the previous and next jump. We also enable to
%D close the presentation.
\setupinteractionbar
[framecolor=white,rulethickness=1pt,
height=\bottomheight,strut=no]
\def\InteractionButtons%
{\interactionbuttons
[width=15em]
[PreviousJump,NextJump,
firstpage,
firstsubpage,previouspage,nextpage,lastsubpage,
lastpage,
CloseDocument]}
%D \macros
%D {StartTitlePage, TitlePage}
%D
%D The titlepage is rather simple and can be typeset in two
%D ways:
%D
%D \starttyping
%D \StartTitlePage
%D text \\ text \\ text
%D \StopTitlepage
%D \stoptyping
%D
%D or more straightforward:
%D
%D \starttyping
%D \TitlePage{text\\text\\text}
%D \stoptyping
%D
%D The first alternative can be used for more complicated
%D title pages.
\def\StartTitlePage%
{\startstandardmakeup
\bfd\setupinterlinespace
\setupalign[middle]
\vfil
\let\\=\vfil}
\def\StopTitlePage%
{\vfil\vfil\vfil
\stopstandardmakeup}
\def\TitlePage#1%
{\StartTitlePage#1\StopTitlePage}
%D \macros
%D {TitlePage, Topics, Topic, Subject}
%D
%D A presentation after loading this module looks like:
%D
%D \starttyping
%D \TitlePage {About Whatever\\Topics}
%D
%D \Topics {Todays Talk}
%D
%D \Topic {Some topic}
%D
%D \Subject {Alfa}
%D
%D .....
%D
%D \Subject {Beta}
%D
%D .....
%D \stoptyping
%D \macros
%D {definehead}
%D
%D The commands \type{\Topic} and \type{\Subject} are defined
%D as copies of head. We use \type{\Nopic} for internal
%D purposes.
\definehead [Topic] [chapter]
\definehead [Subject] [section]
\definehead [Nopic] [title]
%D \macros
%D {setuphead}
%D
%D Because chapters and sections do not make sense in
%D presentations, we use our own command for typesetting the
%D titles. Sectionnumbers are of course hidden from viewing.
%D Each topic is followed by a list of subjects that belong
%D to the topic.
\setuphead
[Topic, Nopic, Subject]
[command=\HeadLine,
page=yes,
style=\tfb,
after=\blank,
sectionnumber=no]
\setuphead
[Topic]
[after=\PlaceSubjectList]
\setuphead
[Subject]
[continue=no]
%D \macros
%D {framed, midalined}
%D
%D The command used to typeset the head lines is rather simple.
%D We just center the framed title. The frame macro optimizes
%D the alignment and at the same time enables us to typeset a
%D nice colored rule.
\def\HeadLine#1#2%
{\midaligned
{\framed
[framecolor=BackgroundColor,rulethickness=1pt,
width=.8\hsize,align=middle,strut=no]
{#2}}}
%D \macros
%D {setuplist}
%D
%D The subject list is automatically placed. We center each
%D subject line by using one of the default alternatives (g). We
%D could have said:
%D
%D \starttyping
%D \setuplist
%D [Subject]
%D [alternative=none,
%D command=\SubjectListLine,
%D interaction=all]
%D
%D \def\SubjectListLine#1#2#3%
%D {\midaligned{#2}}
%D \stoptyping
%D
%D But why should we complicate things when we can use
%D alternative~\type{g}. The test is only needed if one
%D does not automatically goes a new page with each subject.
\def\PlaceSubjectList%
{\blank
\determinelistcharacteristics[Subject]
% \ifnum\utilitylistlength>0 \placelist[Subject] \fi}
\doifmode{*list}{\placelist[Subject]}}
\setuplist
[Subject, Topic]
[alternative=g,
interaction=all,
before=,
after=]
% %D \macros
% %D {setuptexttexts}
% %D
% %D The topics will be listed in the right edge, using:
%
% \setuptexttexts
% [edge]
% [][\TopicList]
%D \macros
%D {setuplist, placelist,startinteractionmenu}
%D
%D The actual topic list is typeset using a \type{\vbox}. We
%D have to specify \type{criteriumcriterium=all} because otherwise no
%D list will be typeset. (By default lists are typeset
%D locally.)
\startinteractionmenu[right]
\placelist
[Topic]
[alternative=f, % command, % none,
maxwidth=\hsize,
width=\hsize,
offset=0pt,
criterium=all,
align=left,
style=\setsmallbodyfont\bfx]
\stopinteractionmenu
\def\Topics#1% temporary hack
{\Nopic{#1}
\placelist[Topic][criterium=all]}
\def\Subjects%
{}
%D \macros
%D {setuptexttexts, button}
%D
%D During a presentation, we want to use the cursor to point to
%D parts of the text. Furthermore we want to be able to jump to
%D the next page, without the need to move the cursor on buttons.
%D Therefore we make the text part of the screen into an
%D invisible button.
\setuptexttexts
[\GotoNextPage][]
\def\GotoNextPage
{\button[width=\hsize,height=\vsize,frame=off]{}[nextpage]}
%D \macros
%D {setupsubpagenumber}
%D
%D The left bottom navigation bar shows the subpages, which will
%D be counted by text. One can change this in the preentation
%D itself by saying \type {[way=byTopic]}.
\setupsubpagenumber
[way=bytext, % Topic,
state=start]
\doifnotmode{demo}{\endinput}
%D The (rather silly) demo section.
\starttext
\TitlePage{Title Page\\pre-original}
\Topics{Some Nice Quotes}
\Topic{A Few}
\Subject{Knuth} \input knuth
\Subject{Tufte} \input tufte
\Topic{Some More}
\Subject{Zapf} \input zapf
\Subject{Bryson} \input bryson
\stoptext
|