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
|
$if(context-lang)$
\mainlanguage[$context-lang$]
$endif$
$if(context-dir)$
\setupalign[$context-dir$]
\setupdirections[bidi=on,method=two]
$endif$
% Enable hyperlinks
\setupinteraction
[state=start,
$if(title)$
title={$title$},
$endif$
$if(subtitle)$
subtitle={$subtitle$},
$endif$
$if(author)$
author={$for(author)$$author$$sep$; $endfor$},
$endif$
$if(keywords)$
keyword={$for(keywords)$$keywords$$sep$; $endfor$},
$endif$
style=$linkstyle$,
color=$linkcolor$,
contrastcolor=$linkcolor$]
% make chapter, section bookmarks visible when opening document
\placebookmarks[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][chapter, section]
\setupinteractionscreen[option=bookmark]
\setuptagging[state=start]
$if(papersize)$
\setuppapersize[$for(papersize)$$papersize$$sep$,$endfor$]
$endif$
$if(layout)$
\setuplayout[$for(layout)$$layout$$sep$,$endfor$]
$endif$
$if(pagenumbering)$
\setuppagenumbering[$for(pagenumbering)$$pagenumbering$$sep$,$endfor$]
$endif$
% use microtypography
\definefontfeature[default][default][protrusion=quality,expansion=quality,onum=yes,pnum=yes]
\definefontfeature[smallcaps][smallcaps][protrusion=quality,expansion=quality,onum=yes,pnum=yes]
\setupalign[hz,hanging]
\setupbodyfontenvironment[default][em=italic] % use italic as em, not slanted
$if(mainfont)$
\definefontfamily[mainfont][serif][$mainfont$]
$endif$
$if(sansfont)$
\definefontfamily[sansfont][sans][$sansfont$]
$endif$
$if(monofont)$
\definefontfamily[monofont][mono][$monofont$][features=none]
$endif$
$if(mathfont)$
\definefontfamily[mathfont][math][$mathfont$]
$endif$
\setupbodyfont[mainfont$if(fontsize)$,$fontsize$$endif$]
\setupwhitespace[$if(whitespace)$$whitespace$$else$medium$endif$]
$if(indenting)$
\setupindenting[$for(indenting)$$indenting$$sep$,$endfor$]
$endif$
$if(interlinespace)$
\setupinterlinespace[$for(interlinespace)$$interlinespace$$sep$,$endfor$]
$endif$
\setuphead[chapter] [style=\tfd,header=empty]
\setuphead[section] [style=\tfc]
\setuphead[subsection] [style=\tfb]
\setuphead[subsubsection] [style=\bf]
\setuphead[subsubsubsection] [style=\sc]
\setuphead[subsubsubsubsection][style=\it]
$if(headertext)$
\setupheadertexts$for(headertext)$[$headertext$]$endfor$
$endif$
$if(footertext)$
\setupfootertexts$for(footertext)$[$footertext$]$endfor$
$endif$
$if(number-sections)$
$else$
\setuphead[chapter, section, subsection, subsubsection, subsubsubsection, subsubsubsubsection][number=no]
$endif$
\definedescription
[description]
[headstyle=bold, style=normal, location=hanging, width=broad, margin=1cm, alternative=hanging]
\setupitemize[autointro] % prevent orphan list intro
\setupitemize[indentnext=no]
\setupfloat[figure][default={here,nonumber}]
\setupfloat[table][default={here,nonumber}]
\setupthinrules[width=15em] % width of horizontal rules
\setuphead[title][
style={\tfd\raggedcenter},
before={\startalignment[middle]},
after={
$if(subtitle)$
\smallskip
{\tfa $subtitle$}
$endif$
$if(author)$
\smallskip
{\tfa $for(author)$$author$$sep$\crlf $endfor$}
$endif$
$if(date)$
\smallskip
{\tfa $date$}
$endif$
\bigskip\stopalignment}]
$for(header-includes)$
$header-includes$
$endfor$
\starttext
$if(title)$
\title{$title$}
$endif$
$if(abstract)$
\midaligned{\it Abstract}
\startnarrower[2*middle]
$abstract$
\stopnarrower
\blank[big]
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
\completecontent
$endif$
$if(lot)$
\completelistoftables
$endif$
$if(lof)$
\completelistoffigures
$endif$
$body$
$for(include-after)$
$include-after$
$endfor$
\stoptext
|