1 \startenvironment luatex-style
3 % todo: use \useMPlibrary[lua]
19 [alternative=doublesided
]
38 local skipped = table.tohash
{ 'id', 'subtype', 'next', 'prev'
}
40 function
document.functions.showfields(s)
41 local t = string.split(s,',')
42 local f = node.fields(t
[1],t
[2])
50 context(',
{\tttf %s}', fi)
52 context('
{\tttf %s}', fi)
59 function
document.functions.showid(s)
60 local t = string.split(s,',')
61 context('
{tttf
%s}',node.id(t[1]))
63 context(',
{tttf
%s}',node.subtype(t[2]))
67 function
document.functions.showsubtypes(s)
68 local s = node.subtypes(s)
70 for k, v in table.sortedhash(s) do
72 context(',
%s = {\\tttf %s}',k,v)
74 context('
%s = {\\tttf %s}',k,v)
81 \unexpanded\def\showfields #1{\ctxlua{document.functions.showfields("
#1")
}}
82 \unexpanded\def\showid #1{\ctxlua{document.functions.showid("
#1")
}}
83 \unexpanded\def\showsubtypes#1{\ctxlua{document.functions.showsubtypes("
#1")
}}
85 \definecolor[blue
] [b=
.5]
86 \definecolor[red
] [r=
.5]
87 \definecolor[green
] [g=
.5]
88 \definecolor[maincolor
] [b=
.5]
89 \definecolor[keptcolor
] [b=
.5]
90 \definecolor[othercolor
][r=
.5,g=
.5]
92 \setupbodyfont[modern
] % we need this in examples so we predefine
94 % \doifmodeelse {atpragma} {
102 % \setuphead [chapter] [style=\bfd]
103 % \setuphead [section] [style=\bfb]
104 % \setuphead [subsection] [style=\bfa]
105 % \setuphead [subsubsection][style=\bf]
109 % \definetypeface[mainfacenormal] [ss][sans] [iwona] [default]
110 % \definetypeface[mainfacenormal] [rm][serif][palatino] [default]
111 % \definetypeface[mainfacenormal] [tt][mono] [modern] [default][rscale=1.1]
112 % \definetypeface[mainfacenormal] [mm][math] [iwona] [default]
114 % \definetypeface[mainfacemedium] [ss][sans] [iwona-medium][default]
115 % \definetypeface[mainfacemedium] [rm][serif][palatino] [default]
116 % \definetypeface[mainfacemedium] [tt][mono] [modern] [default][rscale=1.1]
117 % \definetypeface[mainfacemedium] [mm][math] [iwona-medium][default]
120 % [mainfacenormal,10pt]
122 % \setuphead [chapter] [style=\mainfacemedium\bfd]
123 % \setuphead [section] [style=\mainfacemedium\bfb]
124 % \setuphead [subsection] [style=\mainfacemedium\bfa]
125 % \setuphead [subsubsection][style=\mainfacemedium\bf]
129 \writestatus{luatex manual
}{we assume that dejavu math is available
}
131 \setupbodyfont % assumes dejavu-math
134 \setuphead [chapter
] [align=
{flushleft,broad
},style=
\bfd]
135 \setuphead [section
] [align=
{flushleft,broad
},style=
\bfb]
136 \setuphead [subsection
] [align=
{flushleft,broad
},style=
\bfa]
137 \setuphead [subsubsection
][align=
{flushleft,broad
},style=
\bf]
139 \setuphead [chapter
] [color=maincolor
]
140 \setuphead [section
] [color=maincolor
]
141 \setuphead [subsection
] [color=maincolor
]
142 \setuphead [subsubsection
][color=maincolor
]
168 % if we do this we also need to do it in table cells
181 color luaplanetcolor ; luaplanetcolor :=
\MPcolor{maincolor
} ;
182 color luaholecolor ; luaholecolor := white ;
183 numeric luaextraangle ; luaextraangle :=
0 ;
184 numeric luaorbitfactor ; luaorbitfactor :=
.25 ;
186 vardef lualogo = image (
188 % Graphic design by A. Nakonechnyj. Copyright (c) 1998, All rights reserved.
190 save d, r, p ; numeric d, r, p ;
192 d := sqrt(
2)/
4 ; r :=
1/
4 ; p := r/
8 ;
194 fill fullcircle scaled
1
195 withcolor luaplanetcolor ;
196 draw fullcircle rotated
40.5 scaled (
1+r)
197 dashed evenly scaled p
198 withpen pencircle scaled (p/
2)
199 withcolor (luaorbitfactor * luaholecolor) ;
200 fill fullcircle scaled r shifted (d+
1/
8,d+
1/
8)
201 rotated - luaextraangle
202 withcolor luaplanetcolor ;
203 fill fullcircle scaled r shifted (d-
1/
8,d-
1/
8)
204 withcolor luaholecolor ;
205 luaorbitfactor :=
.25 ;
210 \startuseMPgraphic{luapage
}
213 fill Page withcolor
\MPcolor{othercolor
} ;
215 luaorbitfactor :=
1 ;
216 picture p ; p := lualogo xsized (
3PaperWidth/
5) ;
217 draw p shifted center Page shifted (
0,-
.5ypart center ulcorner p) ;
222 % \starttexdefinition luaextraangle
223 % % we can also just access the last page and so in mp directly
225 % context(\lastpage == 0 and 0 or \realfolio*360/\lastpage)
229 \startuseMPgraphic{luanumber
}
230 % luaextraangle := \luaextraangle;
231 luaextraangle := if (LastPageNumber ==
0) :
0 else : (RealPageNumber / LastPageNumber) *
360 fi;
232 luaorbitfactor :=
0.25 ;
233 picture p ; p := lualogo ;
234 setbounds p to boundingbox fullcircle ;
251 \startsetups pagenumber:right
254 [preset=rightbottom,offset=
1cm
]
255 [frame=off,height=
1cm,offset=overlay
]
256 {\useMPgraphic{luanumber
}}
259 [preset=rightbottom,offset=
1cm,x=
1.5cm
]
260 [frame=off,height=
1cm,width=
1cm,offset=overlay
]
264 [preset=rightbottom,offset=
1cm,x=
2.5cm
]
265 [frame=off,height=
1cm,offset=overlay
]
266 {\getmarking[chapter
]}
269 \startsetups pagenumber:left
272 [preset=leftbottom,offset=
1cm,x=
2.5cm
]
273 [frame=off,height=
1cm,offset=overlay
]
274 {\getmarking[chapter
]}
277 [preset=leftbottom,offset=
1cm,x=
1.5cm
]
278 [frame=off,height=
1cm,width=
1cm,offset=overlay
]
282 [preset=leftbottom,offset=
1cm
]
283 [frame=off,height=
1cm,offset=overlay
]
284 {\useMPgraphic{luanumber
}}
287 \unexpanded\def\nonterminal#1>
{\mathematics{\langle\hbox{\rm #1}\rangle}}
289 % taco's brainwave -) .. todo: create a typing variant so that we can avoid the !crlf
291 \newcatcodetable\syntaxcodetable
293 \unexpanded\def\makesyntaxcodetable
295 \catcode`\<=
13 \catcode`\|=
12
296 \catcode`\!=
0 \catcode`\\=
12
297 \savecatcodetable\syntaxcodetable
302 \unexpanded\def\startsyntax {\begingroup\catcodetable\syntaxcodetable \dostartsyntax}
303 \unexpanded\def\syntax {\begingroup\catcodetable\syntaxcodetable \dosyntax}
304 \let\stopsyntax \relax
306 \unexpanded\def\syntaxenvbody#1%
314 \unexpanded\def\syntaxbody#1%
319 \bgroup \catcodetable\syntaxcodetable
321 !gdef!dostartsyntax
#1\stopsyntax{!let<!nonterminal!syntaxenvbody
{#1}!endgroup
}
322 !gdef!dosyntax
#1{!let<!nonterminal!syntaxbody
{#1}!endgroup
}
340 [chapter,section,subsection
]
343 [chapter,section,subsection,subsubsection
]
353 [subsection,subsubsection
]
357 % Hans doesn't like the bookmarks opening by default so we comment this:
359 % \setupinteractionscreen