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
|
%D \module
%D [ file=s-pre-04,
%D version=1998.09.06,
%D title=\CONTEXT\ Style File,
%D subtitle=Presentation Environment 4,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
\usemodule[pre-general]
%D \macros
%D {setupbodyfont}
%D
%D This is just another environment for typesetting interactive
%D presentations. I wrote this module on behalf of a course I
%D gave for the United Kingdom \TeX\ users group.
\setupbodyfont[ams,pos,14.4pt]
%D \macros
%D {setupcolors,definecolor}
%D
%D I started using dark blue for the navigational elements. In
%D that context, dark red is a logical choice for the contrast
%D color. While playing around with the navigational elements
%D I decided to use the not so dominant color yellow for the
%D status bar.
%D
%D A few days before I wrote this style, the recent acquisition
%D of Mondriaans last painting by the Dutch governement was a
%D hot topic in the dutch news scenary. Therefore I decided to
%D replace the rather dull title page by something more
%D colorful, in mondriaan colors, but far more random than any
%D of his paintings. For consistence we remap the already
%D defined primary colors.
\setupcolors [state=start]
\definecolor [NoneColor] [s=.6]
\definecolor [GotoColor] [b=.6] \definecolor[blue] [GotoColor]
\definecolor [ExitColor] [r=.6] \definecolor[red] [ExitColor]
\definecolor [JumpColor] [s=.6]
\definecolor [UserColor] [g=.6] \definecolor[green] [UserColor]
\definecolor [StepColor] [r=.6,g=.6] \definecolor[yellow][StepColor]
\definecolor [PageColor] [s=.80] \definecolor[gray] [PageColor]
\definecolor [TextColor] [s=.90]
%D \macros
%D {setuppapersize}
%D
%D As usual, we take a screen oriented paper size:
\setuppapersize
[S6][S6]
%D \macros
%D {setuplayout,setupinteractionscreen}
%D
%D The layout definition fits into this $600\times450$ point
%D area, but the dimensions are somewhat diffused by the text
%D background offset.
\setuplayout
[width=530pt,
height=400pt,
header=0pt,
footer=0pt,
backspace=15pt,
topspace=15pt,
bottomdistance=15pt,
bottom=10pt,
margin=0pt,
rightedgedistance=15pt,
rightedge=30pt]
\setupinteractionscreen
[option=max]
%D \macros
%D {setupbackgrounds}
%D
%D Both the page and the text area have a gray background.
%D The \type {[text,text]} area also has an offset. Later we
%D will see that we have to compensate for that in the
%D navigational areas.
\setupbackgrounds
[page]
[background=color,
backgroundcolor=PageColor]
\setupbackgrounds
[text][text]
[background=color,
backgroundcolor=TextColor,
backgroundoffset=5pt]
%D \macros
%D {setupinteraction}
%D
%D For convenient navigation, we turn on interaction.
\setupinteraction
[state=start,
menu=on,
color=UserColor,
contrastcolor=NoneColor]
%D \macros
%D {setupsubpagenumber}
%D
%D When navigating the document, we keep the title page out
%D of sight, therefore we use sub page numbers.
\setupsubpagenumber
[state=start,
way=bytext]
%D \macros
%D {setupinteractionmenu}
%D
%D There is only one interaction menu, located in the right
%D edge of the screen. Both offsets enlarge the edge by the
%D same amount as the text background offset.
\setupinteractionmenu
[right]
[state=start,
frame=off,
strut=no,
offset=0pt,
inbetween=,
bottomoffset=-5pt,
topoffset=-5pt]
%D \macros
%D {startinteractionmenu}
%D
%D The menu itself is not that spectacular. We use the
%D start||stop alternative for setting the content. The macro
%D \type {\interactioncolor} expands into either the
%D interaction color or the contrast color, the latter only
%D when no jump is possible.
\startinteractionmenu[right]
\setupinteraction[color=GotoColor]
\but [previoussubpage] \Triangle {90}\framedwidth\interactioncolor \\
\vskip10pt
\but [nextsubpage] \Triangle{270}\framedwidth\interactioncolor \\
\vfill
\but [PreviousJump] \Triangle{180}\framedwidth{NoneColor} \\
\vskip-5pt
\but [NextJump] \Triangle {0}\framedwidth{NoneColor} \\
\stopinteractionmenu
%D \macros
%D {setupinteractionbar}
%D
%D The interaction bar at the bottom is also larger than the
%D normal width of the bottom area.
\setupinteractionbar
[alternative=f,
width=\textwidth,
height=\bottomheight,
distance=10pt,
color=NoneColor,
contrastcolor=StepColor]
%D \macros
%D {setupbottomtexts}
%D
%D The bar is centered in the middle.
\setupbottomtexts
[\interactionbar]
%D We can exit viewing with a close button, located on the
%D rightmost bottom area.
\def\CloseButton
{\button
[width=\rightedgewidth,height=\bottomheight,offset=overlay,
background=color,backgroundcolor=ExitColor,frame=off]
{}%
[CloseDocument]}
\setupbottomtexts
[edge][][\CloseButton]
%D \macros
%D {definesymbol,setupitemize}
%D
%D Because some prominent things are rectangular or triangular,
%D we prefer some different symbols in itemizations:
\definesymbol[1][$\blacktriangleright$]
\definesymbol[2][$\blacktriangledown$]
\definesymbol[3][$\blacktriangleright$]
\definesymbol[4][$\blacktriangledown$]
\setupitemize[each][color=NoneColor]
%D \macros
%D {TitlePage,defineoverlay,button,setupalign,
%D setupbackgrounds,setupinteraction,setupinteractionbar,
%D startstandardmakeup,switchtobodyfont,setupinterlinespace}
%D
%D Now the main layout and navigational definitions are
%D done, it makes sense to define and tune some structuring
%D commands. First we build the titlepage.
\defineoverlay [TitleGraphic] [\useMPgraphic{title}]
\defineoverlay [NextPage] [\overlaybutton{nextpage}]
\def\StartTitlePage
{\setupbackgrounds[page][background={color,TitleGraphic,NextPage}]
\setupbackgrounds[text][text][background=]
\setupinteraction[menu=off]
\setupinteractionbar[state=stop]
\startstandardmakeup
\switchtobodyfont[24pt]
\bfd\setupinterlinespace
\setupalign[middle]
\vfil
\let\\=\vfil}
\def\StopTitlePage
{\vfil\vfil\vfil
\stopstandardmakeup
\setupinteraction[menu=on]
\setupinteractionbar[state=start]
\setupbackgrounds[page][background=color]
\setupbackgrounds[text][text][background=color]
\setupsubpagenumber[reset]}
\def\TitlePage#1%
{\StartTitlePage#1\StopTitlePage}
%D \macros
%D {Topic, Nopic, Subject,
%D definehead, setuphead}
%D
%D We use \type {\Topic} and \type {\Subject} instead of
%D chapters and sections. The \type {\Nopic} alternative is
%D meant for internal use.
\definehead [Topic] [chapter]
\definehead [Nopic] [title]
\definehead [Subject] [section]
\setuphead
[Topic, Nopic]
[after={\blank[3*medium]},
number=no,
style=\tfb,
page=yes,
alternative=middle]
\setuphead
[Subject]
[after=\blank,
number=no,
page=yes,
continue=no,
style=\tfa]
%D \macros
%D {Topics, Subjects,
%D setuplist, placelist, startcolumns}
%D
%D This style is meant for the more large presentations, and
%D therefore provided for a list of topics as well as local
%D lists of subjects. When many topics are introduces, the
%D list is typeset in columns.
\setuplist
[Topic,Subject]
[alternative=g,
interaction=all,
before=,
after=]
\setuplist
[Topic]
[criterium=all]
\def\Topics#1%
{\determinelistcharacteristics[Topic]
\ifnum\utilitylistlength>0
\Nopic[Topics]{#1}
\ifnum\utilitylistlength>12
\startcolumns
\placelist[Topic]
\stopcolumns
\else
\placelist[Topic]
\fi
\fi}
\def\Subjects%
{\placelist[Subject]}
%D Last we define the overlays. Look at the way colors are
%D linked into the macros.
\startMPinclusions
def triangle (expr wid, rot, col) =
x1 := x3 := y1 := 0 ; x2 := y3 := wid ; y2 := .5y3 ;
fill (z1--z2--z3--cycle) rotated rot withcolor col ;
currentpicture := currentpicture xysized (wid,wid) ;
enddef ;
\stopMPinclusions
\setupMPvariables
[triangle]
[width=1cm,
rotation=0,
color=black]
\startuniqueMPgraphic{triangle}{width,rotation,color}
triangle(\MPvar{width},\MPvar{rotation},\MPvar{color}) ;
\stopuniqueMPgraphic
\def\Triangle#1#2#3%
{\uniqueMPgraphic{triangle}{rotation=#1,width=#2,color=#3}}
\startuseMPgraphic{title} % can be simplified with "randomized"
color c ; path p ;
for i=1 upto 250 :
x0 := uniformdeviate \overlaywidth ;
y0 := uniformdeviate \overlayheight ;
sx := uniformdeviate 20 ;
sy := uniformdeviate 20 ;
cc := round(uniformdeviate 2) ;
if cc=0 : c := \MPcolor{GotoColor} fi ;
if cc=1 : c := \MPcolor{ExitColor} fi ;
if cc=2 : c := \MPcolor{StepColor} fi ;
qq := round(uniformdeviate 1) ;
if qq=0 :
p := unitsquare xscaled sx yscaled sy ;
else :
rr := round(uniformdeviate 3) * 90 ;
x1 := x3 := y1 := 0 ; x2 := y3 := sx; y2 := .5y3 ;
p := (z1--z2--z3--cycle) rotated rr ;
fi ;
fill p shifted z0 withcolor c ;
endfor ;
\stopuseMPgraphic
\doifnotmode{demo}{\endinput}
%D The (rather silly) demo section.
\starttext
\TitlePage{Title Page\\pre-colorfull}
\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
|