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