1
2
3\startenvironment luatexstyle
4
5
6
7\enabletrackers[fonts.usage]
8
9\usemodule[fontsstatistics]
10
11\setuplayout
12 [height=middle,
13 width=middle,
14 backspace=2cm,
15 topspace=10mm,
16 bottomspace=10mm,
17 header=10mm,
18 footer=10mm,
19 footerdistance=10mm,
20 headerdistance=10mm]
21
22\setuppagenumbering
23 [alternative=doublesided]
24
25\setuptolerance
26 [stretch,tolerant]
27
28\setuptype
29 [lines=hyphenated]
30
31\setuptyping
32 [lines=hyphenated]
33
34\setupitemize
35 [each]
36 [packed]
37
38\definesymbol[1][\Uchar"2023]
39\definesymbol[2][\endash]
40\definesymbol[3][\wait]
41
42\setupitemize
43 [each]
44 [headcolor=maincolor,
45 symbolcolor=maincolor,
46 color=maincolor]
47
48\setupwhitespace
49 [medium]
50
51\setuptabulate
52 [blank={small,samepage},
53 headstyle=bold,
54 rulecolor=maincolor,
55 rulethickness=1pt,
56 foregroundcolor=white,
57 foregroundstyle=\ss\bfx\WORD,
58 backgroundcolor=maincolor]
59
60\setupcaptions
61 [headcolor=darkblue]
62
63\startluacode
64 local skipped = table.tohash { 'id', 'subtype', 'next', 'prev' }
65
66 function document.functions.showfields(s)
67 local t = string.split(s,',')
68 local f = node.fields(t[1],t[2])
69 if f then
70 local d = false
71 for i=1,#f do
72 local fi = f[i]
73 if skipped[fi] then
74
75 elseif d then
76 context(', {\tttf %s}', fi)
77 else
78 context('{\tttf %s}', fi)
79 d = true
80 end
81 end
82 end
83 end
84
85 function document.functions.showid(s)
86 local t = string.split(s,',')
87 context('{tttf %s}',node.id(t[1]))
88 if t[2] then
89 context(', {tttf %s}',node.subtype(t[2]))
90 end
91 end
92
93 function document.functions.showsubtypes(s)
94 local s = node.subtypes(s)
95 local d = false
96 for k, v in table.sortedhash(s) do
97 if d then
98 context(', %s = {\\tttf %s}',k,v)
99 else
100 context('%s = {\\tttf %s}',k,v)
101 d = true
102 end
103 end
104 end
105\stopluacode
106
107\unexpanded\def\showfields #1{\ctxlua{document.functions.showfields("#1")}}
108\unexpanded\def\showid #1{\ctxlua{document.functions.showid("#1")}}
109\unexpanded\def\showsubtypes#1{\ctxlua{document.functions.showsubtypes("#1")}}
110
111\definecolor[blue] [b=.5]
112\definecolor[red] [r=.5]
113\definecolor[green] [g=.5]
114\definecolor[maincolor] [b=.5]
115\definecolor[keptcolor] [b=.5]
116\definecolor[othercolor][r=.5,g=.5]
117
118\writestatus{luatex manual}{}
119\writestatus{luatex manual}{defining lucodaot} \usebodyfont [lucidaot]
120\writestatus{luatex manual}{defining pagella} \usebodyfont [pagella]
121\writestatus{luatex manual}{defining cambria} \usebodyfont [cambria]
122\writestatus{luatex manual}{defining modern} \usebodyfont [modern]
123\writestatus{luatex manual}{defining dejavu} \setupbodyfont[dejavu,10pt]
124\writestatus{luatex manual}{}
125
126\setuphead [chapter] [align={flushleft,broad},style=\bfd]
127\setuphead [section] [align={flushleft,broad},style=\bfb]
128\setuphead [subsection] [align={flushleft,broad},style=\bfa]
129\setuphead [subsubsection][align={flushleft,broad},style=\bf]
130
131\setuphead [chapter] [color=maincolor]
132\setuphead [section] [color=maincolor]
133\setuphead [subsection] [color=maincolor]
134\setuphead [subsubsection][color=maincolor]
135
136\setupfloats
137 [ntop=4]
138
139\definehead
140 [remark]
141 [subsubsubject]
142
143\setupheadertexts
144 []
145
146
147
148
149
150\definemixedcolumns
151 [twocolumns]
152 [n=2,
153 balance=yes,
154 before=\blank,
155 after=\blank]
156
157\definemixedcolumns
158 [threecolumns]
159 [twocolumns]
160 [n=3]
161
162\definemixedcolumns
163 [fourcolumns]
164 [threecolumns]
165 [n=4]
166
167
168
169
170
171
172
173
174
175\definetyping
176 [functioncall]
177
178\startMPdefinitions
179
180 color luaplanetcolor ; luaplanetcolor := \MPcolor{maincolor} ;
181 color luaholecolor ; luaholecolor := white ;
182 numeric luaextraangle ; luaextraangle := 0 ;
183 numeric luaorbitfactor ; luaorbitfactor := .25 ;
184
185 vardef lualogo = image (
186
187
188
189 save d, r, p ; numeric d, r, p ;
190
191 d := sqrt(2)4 ; r := 14 ; p := r8 ;
192
193 fill fullcircle scaled 1
194 withcolor luaplanetcolor ;
195 draw fullcircle rotated 40.5 scaled (1r)
196 dashed evenly scaled p
197 withpen pencircle scaled (p2)
198 withcolor (luaorbitfactor luaholecolor) ;
199 fill fullcircle scaled r shifted (d+18,d+18)
200 rotated luaextraangle
201 withcolor luaplanetcolor ;
202 fill fullcircle scaled r shifted (d-18,d-18)
203 withcolor luaholecolor ;
204 luaorbitfactor := .25 ;
205 ) enddef ;
206
207\stopMPdefinitions
208
209\startuseMPgraphic{luapage}
210 StartPage ;
211
212 fill Page withcolor \MPcolor{othercolor} ;
213
214 luaorbitfactor := 1 ;
215
216 picture p ; p := lualogo ysized (5\measure{paperheight}10) ;
217 draw p
218 shifted center p
219 shifted (
220 \measure{spreadwidth} .5\measure{paperwidth} \measure{spinewidth},
221 .375\measure{paperheight}
222 )
223 ;
224
225 StopPage ;
226\stopuseMPgraphic
227
228
229
230
231
232
233
234
235\startuseMPgraphic{luanumber}
236
237 luaextraangle := if (LastPageNumber < 10) : 10 else : (RealPageNumber LastPageNumber) 360 fi;
238 luaorbitfactor := 0.25 ;
239 picture p ; p := lualogo ;
240 setbounds p to boundingbox fullcircle ;
241 draw p ysized 1cm ;
242\stopuseMPgraphic
243
244\definelayer
245 [page]
246 [width=\paperwidth,
247 height=\paperheight]
248
249\setupbackgrounds
250 [leftpage]
251 [background=page]
252
253\setupbackgrounds
254 [rightpage]
255 [background=page]
256
257\definemeasure[banneroffset][\bottomspace\footerheight\footerdistance2cm]
258
259\startsetups pagenumber:right
260 \setlayerframed
261 [page]
262 [preset=rightbottom,x=1.0cm,y=\measure{banneroffset}]
263 [frame=off,height=1cm,offset=overlay]
264 {\strut\useMPgraphic{luanumber}}
265 \setlayerframed
266 [page]
267 [preset=rightbottom,x=2.5cm,y=\measure{banneroffset}]
268 [frame=off,height=1cm,width=1cm,offset=overlay,
269 foregroundstyle=bold,foregroundcolor=maincolor]
270 {\strut\pagenumber}
271 \setlayerframed
272 [page]
273 [preset=rightbottom,x=3.5cm,y=\measure{banneroffset}]
274 [frame=off,height=1cm,offset=overlay,
275 foregroundstyle=bold,foregroundcolor=maincolor]
276 {\strut\getmarking[chapter]}
277\stopsetups
278
279\startsetups pagenumber:left
280 \setlayerframed
281 [page]
282 [preset=leftbottom,x=3.5cm,y=\measure{banneroffset}]
283 [frame=off,height=1cm,offset=overlay,
284 foregroundstyle=bold,foregroundcolor=maincolor]
285 {\strut\getmarking[chapter]}
286 \setlayerframed
287 [page]
288 [preset=leftbottom,x=2.5cm,y=\measure{banneroffset}]
289 [frame=off,height=1cm,width=1cm,offset=overlay,
290 foregroundstyle=bold,foregroundcolor=maincolor]
291 {\strut\pagenumber}
292 \setlayerframed
293 [page]
294 [preset=leftbottom,x=1.0cm,y=\measure{banneroffset}]
295 [frame=off,height=1cm,offset=overlay]
296 {\strut\useMPgraphic{luanumber}}
297\stopsetups
298
299\unexpanded\def\nonterminal#1>{\mathematics{\langle\hbox{\rm #1}\rangle}}
300
301
302
303\newcatcodetable\syntaxcodetable
304
305\unexpanded\def\makesyntaxcodetable
306 {\begingroup
307 \catcode\<=13 \catcode\|=12
308 \catcode\!= 0 \catcode\\=12
309 \savecatcodetable\syntaxcodetable
310 \endgroup}
311
312\makesyntaxcodetable
313
314\unexpanded\def\startsyntax {\begingroup\catcodetable\syntaxcodetable \dostartsyntax}
315\unexpanded\def\syntax {\begingroup\catcodetable\syntaxcodetable \dosyntax}
316 \let\stopsyntax \relax
317
318\unexpanded\def\syntaxenvbody#1
319 {\par
320 \tt
321 \startnarrower
322
323 #1
324 \stopnarrower
325 \par}
326
327\unexpanded\def\syntaxbody#1
328 {\begingroup
329
330 \tt #1
331 \endgroup}
332
333\bgroup \catcodetable\syntaxcodetable
334
335!gdef!dostartsyntax#1\stopsyntax{!let<!nonterminal!syntaxenvbody{#1}!endgroup}
336!gdef!dosyntax #1{!let<!nonterminal!syntaxbody{#1}!endgroup}
337
338!egroup
339
340\definetyping
341 [texsyntax]
342
343
344
345
346\setupinteraction
347 [state=start,
348 focus=standard,
349 style=,
350 color=,
351 contrastcolor=]
352
353\placebookmarks
354 [chapter,section,subsection]
355
356\setuplist
357 [chapter,section,subsection,subsubsection]
358 [interaction=all,
359 width=3em]
360
361\setuplist
362 [chapter]
363 [style=bold,
364 before={\testpage[4]\blank},
365 color=keptcolor]
366
367\setuplist
368 [section]
369 [before={\testpage[3]}]
370
371\setuplist
372 [subsection,subsubsection]
373 [margin=3em,
374 width=5em]
375
376\definestartstop
377 [notabene]
378 [style=slanted]
379
380\definestartstop
381 [preamble]
382 [style=normal,
383 before=\blank,
384 after=\blank]
385
386
387
388
389
390
391\startbuffer[stylecalculations]
392
393 \normalexpanded{\definemeasure[spinewidth] [0pt]}
394 \normalexpanded{\definemeasure[paperwidth] [\the\paperwidth ]}
395 \normalexpanded{\definemeasure[paperheight][\the\paperheight]}
396 \normalexpanded{\definemeasure[spreadwidth][\measure{paperwidth}]}
397
398\stopbuffer
399
400\getbuffer[stylecalculations]
401
402\dontcomplain
403
404\environment luatexlogos
405
406\defineregister[topicindex]
407\defineregister[primitiveindex]
408\defineregister[callbackindex]
409\defineregister[nodeindex]
410\defineregister[libraryindex]
411
412\unexpanded\def\lpr#1{\doifmode{*bodypart}{\primitiveindex[#1]{\bf\tex {#1}}}\tex {#1}}
413\unexpanded\def\prm#1{\doifmode{*bodypart}{\primitiveindex[#1]{\tex {#1}}}\tex {#1}}
414\unexpanded\def\orm#1{\doifmode{*bodypart}{\primitiveindex[#1]{\tex {#1}}}\tex {#1}}
415\unexpanded\def\cbk#1{\doifmode{*bodypart}{\callbackindex [#1]{\type {#1}}}\type{#1}}
416\unexpanded\def\nod#1{\doifmode{*bodypart}{\nodeindex [#1]{\bf\type{#1}}}\type{#1}}
417\unexpanded\def\whs#1{\doifmode{*bodypart}{\nodeindex [#1]{\type {#1}}}\type{#1}}
418\unexpanded\def\noa#1{\doifmode{*bodypart}{\nodeindex [#1]{\type {#1}}}\type{#1}}
419
420\hyphenation{subnodes}
421
422\def\currentlibraryindex{\namedstructureuservariable{section}{library}}
423
424\setupregister
425 [libraryindex]
426 [indicator=no,before=]
427
428\setupregister
429 [libraryindex]
430 [1]
431 [textstyle=\ttbf]
432
433\setupregister
434 [libraryindex]
435 [2]
436 [textstyle=\tttf]
437
438\unexpanded\def\lib #1{\doifmode{*bodypart}{\expanded{\libraryindex{\currentlibraryindex#1}}\type{\currentlibraryindex.#1}}}
439\unexpanded\def\libindex#1{\doifmode{*bodypart}{\expanded{\libraryindex{\currentlibraryindex#1}}}}
440\unexpanded\def\libidx#1#2{\doifmode{*bodypart}{\expanded{\libraryindex{#1#2}}\type{#1.#2}}}
441\unexpanded\def\lix #1#2{\doifmode{*bodypart}{\expanded{\libraryindex{#1#2}}}}
442
443
444
445\stopenvironment
446 |