strc-def.mkiv /size: 9299 b    last modification: 2023-12-21 09:44
1%D   [       file=strc-def,
2%D        version=2008.10.20,
3%D          title=\CONTEXT\ Structure Macros,
4%D       subtitle=Definitions,
5%D         author=Hans Hagen,
6%D           date=\currentdate,
7%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
8%C
9%C This module is part of the \CONTEXT\ macro||package and is
10%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
11%C details.
12
13\writestatus{loading}{ConTeXt Structure Macros / Definitions}
14
15%registerctxluafile{strc-def}{}
16
17\unprotect
18
19% \setupsectionblock[appendix][sectionconversionset=appendix]
20% \setuphead[chapter][sectionconversionset=\sectionblockparameter\c!sectionconversionset] % \sectionblockparameter]
21
22% \defineresetset[default][0,1,1,0][1] % this will not reset parts and subsections
23% \setuphead[part][sectionresetset=default]
24% \starttext
25%     \placelist[chapter,section,subsection][criterium=all,width=3cm]
26%     \part{first}  \chapter{alpha} \section{a} \section{b} \subsection{x} \subsection{y} \chapter{beta}
27%     \part{second} \chapter{gamma} \section{a} \section{b} \subsection{x} \subsection{y} \chapter{delta}
28% \stoptext
29
30\defineseparatorset  [\v!none] [] []
31
32\defineseparatorset  [\s!default] [] [.]
33\defineconversionset [\s!default] [] [numbers]
34\defineresetset      [\s!default] [] [1] % each level
35\defineprefixset     [\s!default] [section-1,section-2,section-3] []
36
37\defineconversionset [\v!number]     [] [numbers]
38\defineconversionset [\v!pagenumber] [] [numbers]
39
40\defineprefixset     [\v!all]  [section-1,section-2,section-3,section-4,section-5,section-6,section-7,section-8] []
41\defineprefixset     [\v!none] [] []
42
43\defineprefixset     [\v!part]    [section-1] []
44\defineprefixset     [\v!chapter] [section-2] []
45
46\defineseparatorset  [\v!appendix:\s!default] [] [.]
47\defineconversionset [\v!appendix:\s!default] [Romannumerals,Characters] [numbers]
48\defineresetset      [\v!appendix:\s!default] [] [1] % why was this 0
49
50\setupuserpagenumber
51  [\c!numberconversionset=\v!pagenumber]
52
53\setupcounters
54  [\c!numberconversionset=\v!number]
55
56% \startsetups defaults:frontpart:pagenumbers:roman
57%     \defineconversionset[\c!frontpart:\c!pagenumber][][romannumerals]
58%     \setupuserpagenumber[\c!way=\v!by\v!block]
59% \stopsetups
60
61% \definesectionblock
62
63\definesectionblock [\v!frontpart] [\v!frontmatter] [\c!number=\v!no]
64\definesectionblock [\v!bodypart]  [\v!bodymatter]  [\c!number=\v!yes]
65\definesectionblock [\v!appendix]  [\v!appendices]  [\c!number=\v!yes]
66\definesectionblock [\v!backpart]  [\v!backmatter]  [\c!number=\v!no]
67
68\setsectionblock [\v!bodypart] % default
69
70% \setuphead[sectionsegments=\currentheadlevel]
71% \setuphead[sectionsegments=current]
72%
73% \startchapter[title=One,ownnumber={A}]
74%     \startsection[title=OneOne,ownnumber={A.B}]
75%         \startsubsection[title=OneOneOne,ownnumber={A.B.C}]
76%             test
77%         \stopsubsection
78%     \stopsection
79% \stopchapter
80
81% \appendtoks
82%     \setsectionblock[\v!bodypart]% default
83% \to \everyjob
84%
85% \appendtoks
86%     \clf_setinitialsectionblock{\v!bodypart}%
87% \to \everystarttext
88
89\appendtoks
90    \clf_setinitialsectionblock{\v!bodypart}%
91\to \everyjob
92
93% \definesection (could become \definehead with one parameter)
94
95\definesection[\s!section-1]  % part
96\definesection[\s!section-2]  % chapter
97\definesection[\s!section-3]  % section
98\definesection[\s!section-4]  % subsection
99\definesection[\s!section-5]  % subsubsection
100\definesection[\s!section-6]  % subsubsubsection
101\definesection[\s!section-7]  % subsubsubsubsection
102\definesection[\s!section-8]  % subsubsubsubsubsection
103\definesection[\s!section-9]  % subsubsubsubsubsubsection
104\definesection[\s!section-10] % subsubsubsubsubsubsubsection
105\definesection[\s!section-11] % subsubsubsubsubsubsubsubsection
106\definesection[\s!section-12] % subsubsubsubsubsubsubsubsubsection
107
108% \definehead
109
110\definehead
111  [\v!part]
112  [\c!section=\s!section-1]
113
114\definehead
115  [\v!chapter]
116  [\c!section=\s!section-2]
117
118\definehead
119  [\v!section]
120  [\c!section=\s!section-3]
121
122\definehead
123  [\v!subsection]
124  [\c!section=\s!section-4,
125   \c!default=\v!section]
126
127\definehead
128  [\v!subsubsection]
129  [\c!section=\s!section-5,
130   \c!default=\v!subsection]
131
132\definehead
133  [\v!subsubsubsection]
134  [\c!section=\s!section-6,
135   \c!default=\v!subsubsection]
136
137\definehead
138  [\v!subsubsubsubsection]
139  [\c!section=\s!section-7,
140   \c!default=\v!subsubsubsection]
141
142\definehead
143  [\v!subsubsubsubsubsection]
144  [\c!section=\s!section-8,
145   \c!default=\v!subsubsubsubsection]
146
147\definehead
148  [\v!subsubsubsubsubsubsection]
149  [\c!section=\s!section-9,
150   \c!default=\v!subsubsubsubsubsection]
151
152\definehead
153  [\v!subsubsubsubsubsubsubsection]
154  [\c!section=\s!section-10,
155   \c!default=\v!subsubsubsubsubsubsection]
156
157\definehead
158  [\v!subsubsubsubsubsubsubsubsection]
159  [\c!section=\s!section-11,
160   \c!default=\v!subsubsubsubsubsubsubsection]
161
162\definehead
163  [\v!subsubsubsubsubsubsubsubsubsection]
164  [\c!section=\s!section-12,
165   \c!default=\v!subsubsubsubsubsubsubsubsection]
166
167\definehead
168  [\v!title]
169  [\c!coupling=\v!chapter,
170   \c!default=\v!chapter,
171   \c!incrementnumber=\v!no]
172
173\definehead
174  [\v!subject]
175  [\c!coupling=\v!section,
176   \c!default=\v!section,
177   \c!incrementnumber=\v!no]
178
179\definehead
180  [\v!subsubject]
181  [\c!coupling=\v!subsection,
182   \c!default=\v!subsection,
183   \c!incrementnumber=\v!no]
184
185\definehead
186  [\v!subsubsubject]
187  [\c!coupling=\v!subsubsection,
188   \c!default=\v!subsubsection,
189   \c!incrementnumber=\v!no]
190
191\definehead
192  [\v!subsubsubsubject]
193  [\c!coupling=\v!subsubsubsection,
194   \c!default=\v!subsubsubsection,
195   \c!incrementnumber=\v!no]
196
197\definehead
198  [\v!subsubsubsubsubject]
199  [\c!coupling=\v!subsubsubsubsection,
200   \c!default=\v!subsubsubsubsection,
201   \c!incrementnumber=\v!no]
202
203\definehead
204  [\v!subsubsubsubsubsubject]
205  [\c!coupling=\v!subsubsubsubsubsection,
206   \c!default=\v!subsubsubsubsubsection,
207   \c!incrementnumber=\v!no]
208
209\definehead
210  [\v!subsubsubsubsubsubsubject]
211  [\c!coupling=\v!subsubsubsubsubsubsection,
212   \c!default=\v!subsubsubsubsubsubsection,
213   \c!incrementnumber=\v!no]
214
215\definehead
216  [\v!subsubsubsubsubsubsubsubject]
217  [\c!coupling=\v!subsubsubsubsubsubsubsection,
218   \c!default=\v!subsubsubsubsubsubsubsection,
219   \c!incrementnumber=\v!no]
220
221\definehead
222  [\v!subsubsubsubsubsubsubsubsubject]
223  [\c!coupling=\v!subsubsubsubsubsubsubsubsection,
224   \c!default=\v!subsubsubsubsubsubsubsubsection,
225   \c!incrementnumber=\v!no]
226
227\definehead
228  [\v!subsubsubsubsubsubsubsubsubsubject]
229  [\c!coupling=\v!subsubsubsubsubsubsubsubsubsection,
230   \c!default=\v!subsubsubsubsubsubsubsubsubsection,
231   \c!incrementnumber=\v!no]
232
233% setups
234
235\setuphead
236  [\v!part]
237  [\c!placehead=\v!no]
238
239\setuphead
240  [\v!chapter]
241  [\v!appendix\c!label=\v!appendix,
242   \v!bodypart\c!label=\v!chapter]       %   bijlageconversie=\Character
243
244\setuphead
245  [\v!section]
246  [\v!appendix\c!label=\v!section,
247   \v!bodypart\c!label=\v!section]       %   bijlageconversie=\Character
248
249\setuphead
250  [\v!subsection]
251  [\v!appendix\c!label=\v!subsection,
252   \v!bodypart\c!label=\v!subsection]    %   bijlageconversie=\Character
253
254\setuphead
255  [\v!subsubsection]
256  [\v!appendix\c!label=\v!subsubsection,
257   \v!bodypart\c!label=\v!subsubsection] %   bijlageconversie=\Character
258
259% prefixes
260
261\defineprefixset
262  [\v!all]
263  [section-1,section-2,section-3,section-4,section-5,section-6,section-7,%
264   section-8,section-9,section-10,section-11,section-12]
265  []
266
267% \setuphead
268
269\setuphead
270  [\v!part,\v!chapter]
271  [%\c!align=,
272   %\c!indentnext=\v!no,
273   \c!continue=\v!no,
274   \c!page=\v!right,
275   \c!marking=\v!page,
276   \c!header=,
277   \c!style=\tfc,
278   \c!distance=.75\emwidth,
279   \c!textdistance=\emwidth plus \emwidth minus .25\emwidth,
280   \c!before={\blank[2*\v!big]},
281   \c!after={\blank[2*\v!big]}]
282
283\setuphead
284  [\v!section]
285  [%\c!align=,
286   %\c!indentnext=\v!no,
287   \c!style=\tfa,
288   \c!distance=.75\emwidth,
289   \c!textdistance=\emwidth plus \emwidth minus .25\emwidth,
290   \c!before={\blank[2*\v!big]},
291   \c!after=\blank]
292
293\setuphead % nieuw
294  [\v!subsection]
295  [\c!page=]
296
297% brrr
298
299% \definecounter[\v!page][\c!start=1] % todo: setup
300
301% lists
302
303\definecombinedlist
304  [\v!content]
305  [\v!part,
306   \v!chapter,
307   \v!section,
308   \v!subsection,
309   \v!subsubsection,
310   \v!subsubsubsection,
311   \v!subsubsubsubsection]
312  [\c!level=\v!subsubsubsubsection,
313   \c!criterium=\v!local]
314
315\setuplist
316  [\v!part]
317  [\c!before={\blank[\v!preference,\v!big]}, % sort of mkii compatible, watch columns
318   \c!after=\blank,
319   \c!label=\v!yes,
320   \c!distance=\emwidth]
321
322\setuplist
323  [\v!chapter]
324  [\c!before={\blank[\v!preference,\v!big]}, % sort of mkii compatible, watch columns
325   \c!after=]
326
327\setuplist [\v!part] [\c!width=0\emwidth]
328\setuplist [\v!chapter] [\c!width=2\emwidth]
329\setuplist [\v!section] [\c!width=3\emwidth]
330\setuplist [\v!subsection] [\c!width=4\emwidth]
331\setuplist [\v!subsubsection] [\c!width=5\emwidth]
332\setuplist [\v!subsubsubsection] [\c!width=6\emwidth]
333\setuplist [\v!subsubsubsubsection] [\c!width=7\emwidth]
334\setuplist [\v!subsubsubsubsubsection] [\c!width=8\emwidth]
335\setuplist [\v!subsubsubsubsubsubsection] [\c!width=9\emwidth]
336\setuplist [\v!subsubsubsubsubsubsubsection] [\c!width=10\emwidth]
337\setuplist [\v!subsubsubsubsubsubsubsubsection] [\c!width=11\emwidth]
338\setuplist [\v!subsubsubsubsubsubsubsubsubsection] [\c!width=12\emwidth]
339
340\protect \endinput
341