1
2
3
4
5
6
7
8
9
10
11
12
13
14\unprotect
15
16
17
18
19
20
21
22
23
24
25
26
27
28\usemodule[abbreviationswords]
29
30\startmodule[modulesbasics]
31
32\setupdocument
33 [ file=\jobname,
34 type=unknown,
35 version={\currentdate[\v!year,{.},\v!month,{.},\v!day]},
36 system=\CONTEXT,
37 title=Unknown Title,
38 subtitle=,
39 author=Unknown Author,
40 date=\currentdate,
41 copyright=Unknown Copyright,
42 suggestions=]
43
44\let\module\setupdocument
45
46\definepalet [module:unknown] [locallocalone=darkyellow,localtwo=darkred,localthree=white,localfour=darkgray]
47
48\definepalet [module:tex] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray]
49\definepalet [module:mkii] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray]
50\definepalet [module:mkiv] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray]
51\definepalet [module:mkvi] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray]
52\definepalet [module:mkxl] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray]
53\definepalet [module:mklx] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray]
54
55\definepalet [module:lua] [localone=darkred,localtwo=darkgreen,localthree=white,localfour=darkgray]
56\definepalet [module:lmt] [localone=darkred,localtwo=darkgreen,localthree=white,localfour=darkgray]
57\definepalet [module:cld] [localone=darkred,localtwo=darkgreen,localthree=white,localfour=darkgray]
58
59\definepalet [module:mp] [localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray]
60\definepalet [module:mpii] [localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray]
61\definepalet [module:mpiv] [localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray]
62\definepalet [module:mpxl] [localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray]
63\definepalet [module:metapost][localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray]
64
65\setuppalet
66 [module:unknown]
67
68\startuseMPgraphic{page}
69
70 StartPage ;
71
72 color local_one ; local_one := .6 \MPcolor{localone} ;
73 color local_two ; local_two := .6 \MPcolor{localtwo} ;
74 color local_three ; local_three := \MPcolor{localthree} ;
75 color local_four ; local_four := \MPcolor{localfour} ;
76
77 numeric width ; width := bbwidth Page ;
78 numeric height ; height := bbheight Page ;
79
80 u := width400 ;
81
82 def a_module (expr dx, dy) =
83 picture p ; p := image (
84 ddy := 0 ; sx := 60u ;
85 for i=1 upto (4 randomized 2) :
86 sy := 7u randomized 3u ;
87 fill unitsquare xyscaled(sx,sy) shifted (0,ddy)
88 withcolor local_two ;
89 ddy := ddy sy 4u ;
90 endfor ;
91 ) ;
92 p := p shifted (dx,dy) shifted center p ;
93 fill boundingbox p enlarged 8u withcolor local_four ;
94 fill boundingbox p enlarged 4u withcolor local_one ;
95 draw p ;
96 enddef ;
97
98 set_grid(width, height, width15, height15) ;
99
100 forever:
101 if new_on_grid(uniformdeviate width,uniformdeviate height):
102 a_module(dx,dy) ;
103 fi ;
104 exitif grid_full ;
105 endfor ;
106
107 picture p ;
108
109 draw image (
110 draw anchored.urt(textext("\bf\strut\documentvariable{system}") ysized 5.0cm,urcorner Page shifted (-1cm, 1cm)) ;
111 draw anchored.urt(textext("\bf\strut\documentvariable{title}") ysized 1.5cm,urcorner Page shifted (-1cm, 8cm)) ;
112 draw anchored.urt(textext("\bf\strut\documentvariable{subtitle}") ysized 1.5cm,urcorner Page shifted (-1cm,-10cm)) ;
113 draw anchored.urt(textext("\bf\strut\documentvariable{author}") ysized 1.5cm,lrcorner Page shifted (-1cm, 5cm)) ;
114 draw anchored.urt(textext("\bf\strut\currentdate") ysized 1.5cm,lrcorner Page shifted (-1cm, 3cm)) ;
115 ) withcolor local_three ;
116
117 StopPage ;
118
119\stopuseMPgraphic
120
121\startsetups[document:start]
122
123 \setuppalet
124 [module:\documentvariable{type}]
125
126 \setuptyping
127 [definition]
128 [lines=yes,
129 option=\documentvariable{type}]
130
131 \startTEXpage
132 \useMPgraphic{page}
133 \stopTEXpage
134
135 \page[right]
136
137\stopsetups
138
139\startsetups[document:stop]
140
141 \page
142
143 \placeregister
144 [\v!index]
145 [\c!balance=\v!yes,
146 \c!indicator=\v!no,
147 \c!criterium=\v!text]
148
149\stopsetups
150
151
152
153
154\starttexdefinition startmoduledocumentation
155 \starttext
156 \page
157 \begingroup
158 \startdocument
159\stoptexdefinition
160
161\starttexdefinition stopmoduledocumentation
162 \stopdocument
163 \page
164 \endgroup
165 \stoptext
166\stoptexdefinition
167
168\starttexdefinition startdocumentation
169 \par
170 \bgroup
171\stoptexdefinition
172
173\starttexdefinition stopdocumentation
174 \par
175 \egroup
176\stoptexdefinition
177
178\definetyping
179 [definition]
180
181\starttexdefinition startcompressdefinitions
182 \blank
183 \begingroup
184 \setuptyping[definition][bodyfont=small]
185\stoptexdefinition
186
187\starttexdefinition stopcompressdefinitions
188 \blank
189 \endgroup
190\stoptexdefinition
191
192
193
194
195
196
197
198\setuptyping
199 [\v!typing]
200 [\c!margin=\v!standard,
201 \c!lines=\v!yes]
202
203\setuptyping
204 [\v!file]
205 [\c!margin=\v!standard,
206 \c!lines=\v!yes]
207
208\setuptyping
209 [definition]
210 [\c!margin=0pt,
211 \c!numbering=\v!line,
212 \c!continue=\v!yes,
213 \c!lines=\v!yes]
214
215\setuplinenumbering
216 [definition]
217 [\c!style=\ttx,
218 \c!align=\v!flushright]
219
220
221
222\unexpanded\def\domodulemarginstuff#1#2
223 {\marginstuff
224 {\ifx#1\relax
225 \index{#2}
226 \else
227 \index{#1{#2}}
228 \fi
229 \dontleavehmode#1{\doboundtext{#2}{\leftmarginwidth}{..}}}}
230
231\unexpanded\def\modulemarginstuff#1#2
232 {\processcommalist[#2]{\domodulemarginstuff#1}}
233
234\definemargindata
235 [marginstuff]
236 [left]
237 [stack=yes,
238 hoffset=2em,
239 style=\ttxx\setstrut]
240
241\unexpanded\def\macros {\modulemarginstuff\tex }
242\unexpanded\def\extras {\modulemarginstuff\relax}
243\unexpanded\def\elements{\modulemarginstuff\someelement}
244
245\unexpanded\def\someelement#1{\type{<#1>}}
246
247
248
249
250
251
252
253
254
255
256
257
258\starttexdefinition startexample
259 \par
260 \startnarrower
261\stoptexdefinition
262
263\starttexdefinition stopexample
264 \stopnarrower
265\stoptexdefinition
266
267
268
269\usemodule[intload] \loadsetups
270
271\let\showsetup\setup
272
273\setupframedtexts
274 [setuptext]
275 [\c!background=\v!screen,
276 \c!frame=\v!off]
277
278
279
280\usebodyfont
281 [dejavucondensed,9pt]
282
283\setupbodyfont
284 [dejavu,9pt]
285
286\mainlanguage
287 [en]
288
289\setuptyping
290 [\v!typing]
291 [\c!bodyfont=dejavucondensed]
292
293\setupwhitespace
294 [\v!big]
295
296\setuptolerance
297 [\v!verytolerant,\v!stretch]
298
299\setuplayout
300 [\c!backspace=3.5cm,
301 \c!cutspace=2cm,
302 \c!leftmargin=1.75cm,
303 \c!rightmargin=0cm,
304 \c!margindistance=.5cm,
305 \c!leftedgedistance=.25cm,
306 \c!rightedgedistance=.5cm,
307 \c!edge=1.5cm,
308 \c!width=middle,
309 \c!topspace=2cm,
310 \c!header=1.25cm,
311 \c!footer=1.25cm,
312 \c!height=middle,
313 \c!style=\ss]
314
315\setuppagenumbering
316 [\c!location=]
317
318\setuppagenumbering
319 [\c!alternative={\v!doublesided,\v!singlesided}]
320
321\setupfootertexts
322 [\v!edge]
323 [][\pagenumber]
324
325\setupfootertexts
326 [\v!margin]
327 [\filename{\documentvariable{file}}][]
328 [\filename{\documentvariable{file}}][]
329
330\setupfootertexts
331 [\v!text]
332 [\CONTEXT]
333 [\documentvariable{title}]
334
335\setupheadertexts
336 [\v!text]
337 []
338 [\documentvariable{subtitle}]
339
340\setupinmargin
341 [\c!location=\v!left]
342
343\setupheads
344 [\c!alternative=\v!inmargin]
345
346\setuphead
347 [\v!chapter]
348 [\c!style=\bfc,
349 \c!page=\v!right,
350 \c!header=\v!empty]
351
352\setuphead
353 [\v!section]
354 [\c!style=\bfb,
355 \c!page=\v!right]
356
357\setuphead
358 [\v!subsection]
359 [\c!style=\bfa]
360
361\setuplist
362 [\v!chapter]
363 [\c!style=\v!bold,
364 \c!after=\blank]
365
366\setupcombinedlist
367 [\v!content]
368 [\c!width=3em,
369 \c!aligntitle=\v!yes]
370
371\setupregister
372 [\v!index]
373 [\c!balance=\v!yes,
374 \c!indicator=\v!no]
375
376\setupinteraction
377 [\c!state=\v!start,
378 \c!color=,
379 \c!contrastcolor=,
380 \c!style=]
381
382
383
384\doifmode {nocolor} {
385
386 \setupcolors
387 [\c!conversion=\v!always]
388
389}
390
391\doifmode {singlesided} {
392
393 \setuppagenumbering
394 [\c!alternative=\v!singlesided]
395
396 \setupfootertexts
397 [\v!margin]
398 [\filename{\documentvariable{file}}][]
399
400}
401
402\protect
403
404\stopmodule
405 |