1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17\setuppapersize
18 [ S 6 ] [ S 6 ]
19
20\setuplayout
21 [ width = middle ,
22 height = middle ,
23 header = 0 pt ,
24 footer = 0 pt ,
25 bottomdistance = . 5 cm ,
26 bottom = 1 cm ,
27 topspace = 2 cm ,
28 backspace = 2 cm ]
29
30
31
32
33
34\startmode [ asintended ] \setupbodyfont [ lbr , hw ] \stopmode
35
36
37
38
39\setupcolors
40 [ state = start ]
41
42\definecolor [ PageColor ] [ s = . 6 ]
43\definecolor [ TextColor ] [ s = . 8 ]
44\definecolor [ LineColor ] [ g = . 4 ]
45\definecolor [ SymbolColor ] [ r = . 4 ]
46
47
48
49
50\setupinteractionscreen
51 [ option = max ]
52
53\setupinteractionmenu
54 [ bottom ]
55 [ state = start ,
56 height = 1 cm ,
57 middle = \hskip 1 cm ]
58
59\setupinteraction
60 [ state = start ,
61 menu = on ,
62 display = new ,
63 click = no ,
64 color = SymbolColor ,
65 contrastcolor = SymbolColor ]
66
67\startinteractionmenu [ bottom ]
68 \hfill
69 \got [ previouspage ] \symbol [ prevmark ] \\
70 \got [ nextpage ] \symbol [ nextmark ] \\
71 \got [ CloseDocument ] \symbol [ stopmark ] \\
72 \txt \tfd \SymbolColor \pagenumber \\
73\stopinteractionmenu
74
75
76
77
78
79
80\definesymbol [ itemmark ] [ \useMPgraphic { itemmark } ]
81\definesymbol [ stopmark ] [ \useMPgraphic { stopmark } ]
82\definesymbol [ nextmark ] [ \useMPgraphic { nextmark } ]
83\definesymbol [ prevmark ] [ \useMPgraphic { prevmark } ]
84
85
86
87\defineoverlay [ page ] [ \useMPgraphic { page } ]
88\defineoverlay [ next ] [ \overlaybutton { forward } ]
89\defineoverlay [ prev ] [ \overlaybutton { PreviousJump } ]
90
91\setupbackgrounds
92 [ page ]
93 [ background = { page , prev } ]
94
95\setupbackgrounds
96 [ text ]
97 [ background = next ]
98
99\setuphead
100 [ chapter ]
101 [ alternative = middle ,
102 number = no ,
103 color = SymbolColor ,
104 style = \tfc ]
105
106
107
108\setupwhitespace
109 [ big ]
110
111\setupitemize
112 [ 1 ]
113 [ symbol = itemmark ,
114 width = 3 \bodyfontsize ]
115
116\def \StartTitlePage
117 { \setupinteractionmenu [ bottom ] [ state = stop ]
118 \startstandardmakeup
119 \setupalign [ middle ]
120 \def \\
121 { \stopcolor
122 \vfil
123 \bfb \setupinterlinespace
124 \startcolor [ black ] }
125 \bfd \setupinterlinespace
126 \vfil
127 \startcolor [ SymbolColor ] }
128
129\def \StopTitlePage
130 { \stopcolor
131 \vfil \vfil
132 \stopstandardmakeup
133 \setupinteractionmenu [ bottom ] [ state = start ] }
134
135
136\def \TitlePage # 1
137 { \StartTitlePage # 1 \StopTitlePage }
138
139\definehead [ Topic ] [ chapter ]
140\definehead [ Nopic ] [ title ]
141
142\setuplist
143 [ Topic ]
144 [ criterium = all ,
145 alternative = g ,
146 interaction = all ,
147 after = \blank ]
148
149\def \Topics # 1
150 { \Nopic { # 1 }
151 \bgroup
152 \setupinteraction
153 [ color = ,
154 contrastcolor = ]
155 \determinelistcharacteristics [ Topic ]
156 \ifnum \utilitylistlength > 1 2
157 \startcolumns [ n = 2 ]
158 \placelist [ Topic ]
159 \stopcolumns
160 \else
161 \placelist [ Topic ]
162 \fi
163 \egroup }
164
165
166
167\let \Subject \Topic
168\let \Subjects \relax
169
170
171
172
173
174
175\startuseMPgraphic { page }
176
177 width : = \overlaywidth ;
178 height : = \overlayheight ;
179
180 d : = 15 ; dd : = d ; dd : = 10 ;
181
182 def fuzzy ( expr p , dx , dy ) =
183 ( xpart p dx uniformdeviate dx , ypart p dy uniformdeviate dy )
184 enddef ;
185
186 pair ll , lr , ur , ul ;
187
188 ll : = ( d , d ) ;
189 lr : = ( width d , d ) ;
190 ur : = ( width d , height d ) ;
191 ul : = ( d , height d ) ;
192
193 path p , q , r , s ;
194
195 p : = ll .. for i = .1 step .1 until .9 : fuzzy ( i [ ll , lr ] , 0 , dd ) .. endfor lr ;
196 q : = lr .. for i = .1 step .1 until .9 : fuzzy ( i [ lr , ur ] , dd , 0 ) .. endfor ur ;
197 r : = ur .. for i = .1 step .1 until .9 : fuzzy ( i [ ur , ul ] , 0 , dd ) .. endfor ul ;
198 s : = ul .. for i = .1 step .1 until .9 : fuzzy ( i [ ul , ll ] , dd , 0 ) .. endfor ll ;
199
200 fill unitsquare xscaled width yscaled height withcolor \MPcolor { PageColor } ;
201
202 fill p & q & r & s -- cycle withcolor \MPcolor { TextColor } ;
203
204 color c ; c : = \MPcolor { LineColor } ;
205
206 draw p withpen pencircle xscaled 20 yscaled 5 rotated 30 withcolor c ;
207 draw q withpen pencircle xscaled 5 yscaled 20 rotated 30 withcolor c ;
208 draw r withpen pencircle xscaled 20 yscaled 5 rotated 30 withcolor c ;
209 draw s withpen pencircle xscaled 5 yscaled 20 rotated 30 withcolor c ;
210
211\stopuseMPgraphic
212
213\startuseMPgraphic { itemmark }
214 width : = BodyFontSize ; height : = width 4 ;
215 maxheight : = StrutHeight ; line : = 3 width 2 ;
216
217 def fuzzy = ( height 4 ) uniformdeviate ( height 2 ) enddef ;
218
219 draw
220 ( ( 0 , 0 fuzzy ) -- ( width , height fuzzy 2 ) )
221 shifted ( line 2 , 0 )
222 withpen pencircle
223 xscaled line yscaled ( line 4 )
224 rotated ( 25 uniformdeviate 10 ) withcolor \MPcolor { SymbolColor } ;
225
226 setbounds currentpicture to unitsquare xyscaled ( width , maxheight ) ;
227\stopuseMPgraphic
228
229\startuseMPgraphic { nextmark }
230 LoadPageState ; width : = BottomHeight ; height : = line : = width 2 ;
231
232 def fuzzy = ( height 8 ) uniformdeviate ( height 4 ) enddef ;
233
234 z 1 = ( 0 , 0 fuzzy ) ; z 2 = ( width , height 2 fuzzy 2 ) ; z 3 = ( 0 , height fuzzy ) ;
235
236 draw
237 ( z 1. . { right } z 2 & z 2 { left } . . z 3 )
238 withpen pencircle
239 xscaled line yscaled ( line 4 )
240 rotated 30 withcolor \MPcolor { SymbolColor } ;
241
242 setbounds currentpicture to unitsquare xyscaled ( width , height ) ;
243\stopuseMPgraphic
244
245\startuseMPgraphic { prevmark }
246 LoadPageState ; width : = BottomHeight ; height : = line : = width 2 ;
247
248 def fuzzy = ( height 8 ) uniformdeviate ( height 4 ) enddef ;
249
250 z 1 = ( width , 0 fuzzy ) ; z 2 = ( 0 , height 2 fuzzy 2 ) ; z 3 = ( width , height fuzzy ) ;
251
252 draw
253 ( z 1. . { left } z 2 & z 2 { right } . . z 3 )
254 withpen pencircle
255 xscaled line yscaled ( line 4 )
256 rotated 30 withcolor \MPcolor { SymbolColor } ;
257
258 setbounds currentpicture to unitsquare xyscaled ( width , height ) ;
259\stopuseMPgraphic
260
261\startuseMPgraphic { stopmark }
262 LoadPageState ; width : = BottomHeight ; height : = line : = width 2 ;
263
264 def fuzzy = ( height 8 ) uniformdeviate ( height 4 ) enddef ;
265
266 z 1 = ( 0 , 0 fuzzy ) ;
267 z 2 = ( width , height fuzzy ) ;
268 z 3 = ( width , 0 fuzzy ) ;
269 z 4 = ( 0 , height fuzzy ) ;
270 z 5 = ( width 2 , height 2 ) ;
271
272 drawoptions
273 ( withpen pencircle
274 xscaled line yscaled ( line 4 )
275 rotated 30 withcolor \MPcolor { SymbolColor } ) ;
276
277 draw z 1. . { right } z 5. . z 2 ; draw z 3. . { left } z 5. . z 4 ;
278
279 setbounds currentpicture to unitsquare xyscaled ( width , height ) ;
280\stopuseMPgraphic
281
282\doifnotmode { demo } { \endinput }
283
284
285
286\starttext
287
288\TitlePage { Title Page \\ pre writing }
289
290\Topics { Some Nice Quotes }
291
292\Topic { A Few }
293
294\Subject { Knuth } \input knuth
295\Subject { Tufte } \input tufte
296
297\Topic { Some More }
298
299\Subject { Zapf } \input zapf
300\Subject { Bryson } \input bryson
301
302\stoptext
303 |