summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/context/manuals/reference/en/co-textelements.tex
blob: 3fc87cbd333177f0e7bffc222c74c89d80a53b03 (plain)
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
\startcomponent co-en-09

\environment contextref-env
\product contextref

\chapter[text elements]{Text elements}

\section{Introduction}
\index{structure}

The core of \CONTEXT\ is formed by the commands that
structures the text. The most common structuring elements
are chapters and sections. The structure is visualized by
means of titles and summarized in the table of contents.

A text can be subdivided in different ways. As an
introduction we use the methods of H.~van Krimpen,
K.~Treebus and the Collectief Gaade. First we examine the
method of van Krimpen:

\startitemize[n,broad,columns,three]
\item  French title
\item  title
\item  history \& copyright
\item  mission
\item  preface|/|introduction
\item  \unknown
\item  list of illustrations
\item  acknowledgement
\item  errata
\item  the content
\item  notes
\item  literature
\item  register(s)
\item  colofon
\stopitemize

The French title is found at the same spread as the back of
the cover, or first empty sheet. In the colofon we find the
used font, the names of the typesetter and illustrator, the
number of copies, the press, the paper, the binding, etc.

The subdivision of Treebus looks like this:

\startitemize[n,broad,columns,three]
\item  French title
\item  titlepage
\item  colofon
\item  copyright
\item  mission
\item  preface (1)
\item  table of content
\item  list of illustrations
\item  introduction|/|preface (2)
\item  \unknown
\item  epilogue
\item  appendices
\item  summaries
\item  notes
\item  literature
\item  used words
\item  addenda
\item  register
\item  acknowledgement photos
\item  (colofon)
\stopitemize

In this way of dividing a text the colofon is printed on the
back of the titlepage. The first preface is written by
others and not by the author.

The last text structure is that of the Collectief Gaade:

\startitemize[n,broad,columns,three]
\item  French  title
\item  series title
\item  title
\item  copyright
\item  mission
\item  blank
\item  preface
\item  table of content
\item  introduction
\item  \unknown
\item  appendices
\item  notes
\item  list of illustrations
\item  used words
\item  bibliography
\item  colofon
\item  register
\stopitemize

Since there seems to be no standardized way of setting up a
document, \CONTEXT\ will only provide general mechanisms.
These are designed in such a way that they meet the following
specifications:

\startitemize[n]

\item  In a text the depth of sectioning seldom exceeds
       four. However, in a complex manuals more depth can be
       useful. In paper documents a depth of six may be very
       confusing for the reader but in electronic documents
       we need far more structure. This is caused by the
       fact that a reader cannot make a visual
       representation of the electronic book. Elements to
       indicate this structure are necessary to be able to
       deal with the information.

\item  Not every level needs a number but in the background
       every level is numbered to be able to refer to these
       unnumbered structuring elements.

\item  The names given to the structuring elements must be
       a logical ones and must relate to their purpose.

\item  It is possible to generate tables of contents and
       registers at every level of the document and they
       must support complex interactivity.

\item  A document will be divided in functional components
       like introductions and appendices with their
       respective (typographical) characteristics.

\item  The hyphenation of titles must be handled correctly.

\item  Headers and footers are supported based on the
       standard labels used in a document. For example
       \type{chapter} in a book and \type{procedure} in a
       manual.

\item  A \CONTEXT\ user must be able to design titles without
       worrying about vertical and horizontal spacing,
       referencing and synchronisation.

\stopitemize

These prerequisites have resulted in a heavy duty mechanism
that works in the background while running \CONTEXT. The
commands that are described in the following sections are an
example of an implementation. We will also show examples of
self designed titles.

\section[subdivision,structuring]{Subdividing the text}
\index{structure}
\index{structuring elements}
\index{parts}
\index{chapters}
\index{sections}
\index{heads}
\index{numbering+chapters}
\index{titles}
\index{marking}
\index{headers+marking}
\index{footers+marking}
\macro{\tex{part}}
\macro{\tex{chapter}}
\macro{\tex{section}}
\macro{\tex{subsection}}
\macro{\tex{subsubsection}}
\macro{\tex{title}}
\macro{\tex{subject}}
\macro{\tex{subsubject}}
\macro{\tex{subsubsubject}}
\macro{\tex{definehead}}
\macro{\tex{momarking}}
\macro{\tex{nolist}}

A text is divided in chapters, sections, etc. with the
commands:

\showsetup{part}

\showsetup{chapter}

\showsetup{section}

\showsetup{subsection}

\showsetup{subsubsection}

and

\showsetup{title}

\showsetup{subject}

\showsetup{subsubject}

\showsetup{subsubsubject}

The first series of commands (\type{\chapter} \unknown)
generate a numbered head, with the second series the titles
are not numbered. There are a few more levels available than
those shown above.

\placetable{The structuring elements.}
\starttable[|c|l|l|]
\HL
\VL \bf level \VL \bf numbered title       \VL
                  \bf unnumbered title     \VL\SR
\HL
\VL 1          \VL {\type{\part}}          \VL
                                           \VL\FR
\VL 2          \VL {\type{\chapter}}       \VL
                   {\type{\title}}         \VL\MR
\VL 3          \VL {\type{\section}}       \VL
                   {\type{\subject}}       \VL\MR
\VL 4          \VL {\type{\subsection}}    \VL
                   {\type{\subsubject}}    \VL\MR
\VL 5          \VL {\type{\subsubsection}} \VL
                   {\type{\subsubsubject}} \VL\LR
\HL
\stoptable

By default \type {\part} generates {\em no} title because
most of the times these require special attention and a
specific design. In the background however the partnumbering
is active and carries out several initialisations. The other
elements are set up to typeset a title.

A structuring element has two arguments. The first argument,
the reference, makes it possible to refer to the chapter or
section from another location of the document. In
\in{chapter}[references] this mechanism is described in
full. A reference is optional and can be left out.

\startexample
\starttyping
\section{Subdividing a text}
\stoptyping
\stopexample

\CONTEXT\ generates automatically the numbers of chapters
and sections. However there are situations where you want to
enforce your own numbering. This is also supported.

\startbuffer
\setuphead[subsection][ownnumber=yes]
\subsection{399}{The old number}
\subsection[someref]{400}{Another number}
\stopbuffer

\typebuffer

In this example an additional argument appears. In the
background \CONTEXT\ still uses its own numbering mechanism,
so operations that depend upon a consistent numbering still
work okay. The extra argument is just used for typesetting
the number. This user||provided number does not have to be
number, it may be anything, like ABC-123.

\start \getbuffer \stop

You can automatically place titles of chapters, sections or
other structuring elements in the header and footer with the
marking mechanism. Titles that are too long can be shortened
by:

\showsetup{nomarking}

For example:

\startexample
\starttyping
\chapter{Influences \nomarking{in the 20th century:} an introduction}
\stoptyping
\stopexample

The text enclosed by \type {\nomarking} is replaced by dots
in the header or footer. Perhaps an easier strategy is to
use the automatic marking limiting mechanism. The next
command puts the chapter title left and the section title
right in the header. Both titles are limited in length.

\startexample
\starttyping
\setupheadertexts[chapter][section]
\setupheader[leftwidth=.4\hsize,rightwidth=.5\hsize]
\stoptyping
\stopexample

A comparable problem may occur in the table of contents. In
that case we use \type {\nolist}:

\startexample
\starttyping
\chapter{Influences in the 20th century\nolist{: an introduction}}
\stoptyping
\stopexample

When you type the command \type{\\} in a title a new line
will be generated at that location. When you type
\type {\crlf} in a title you will enforce a new line only in
the table of contents. For example:

\startexample
\starttyping
\chapter{Influences in the 20th century:\crlf an introduction}
\stoptyping
\stopexample

This will result in a two line title in the table of context,
while the title is only one line in the text.

It is possible to define your own structuring elements. Your
\quote {own} element is derived from an existing text
element.

\showsetup{definehead}

An example of a definition is:

\startexample
\starttyping
\definehead[category][subsubject]
\stoptyping
\stopexample

From this moment on the command \type{\category} behaves
just like \type{\subsubject}, i.e., \type {\category} {\em
inherits} the default properties of \type {\subsubject}. For
example, \type {\category} is not numbered.

A number of characteristics available with \type
{\setuphead} are described in \in {section} [titles]. Your
own defined structuring elements can also be set up. The
category defined above can be set up as follows:

\startexample
\starttyping
\setuphead[category][page=yes]
\stoptyping
\stopexample

This setup causes each new instance of category to be placed
at the top of a new page.

We can also block the sectionnumbering with \type
{\setupheads[sectionnumber=no]}. Sectionnumbering will
stop but \CONTEXT\ will continue the numbering on the
background. This is necessary to be able to perform local
actions like the generating local tables of content.

In defining your own structuring elements there is always
the danger that you use existing \TEX\ or \CONTEXT\
commands. It is of good practice to use capitals for your
own definitions. For example:

\startexample
\starttyping
\definehead[WorkInstruction][section]
\stoptyping
\stopexample

\section[titles]{Variations in titles}
\index{chapters}
\index{titles}
\index{numbering+chapters}
\macro{\tex{setupheads}}
\macro{\tex{setuphead}}
\macro{\tex{setupheadnumber}}
\macro{\tex{headnumber}}
\macro{\tex{coupledocument}}

The numbering and layout of chapters, sections and
subsections can be influenced by several commands. These
commands are also used in the design of your own heads. We
advise you to start the design process in one of the final
stages of your document production process. You will find
that correct header definitions in the setup area of your
source file will lead to a very clean source without any
layout commands in the text.

The following commands are at your disposal:

\showsetup{setuphead}

Later we will cover many of the parameters mentioned here.
This command can be used to set up one or more heads, while
the next can be used to set some common features.

\showsetup{setupheads}

The number of a title can be set up with:

\showsetup{setupheadnumber}

This command accepts absolute and relative numbers, so \type
{[12]}, \type {[+2]} and \type {[+]}. The relative method is
preferred, like:

\starttyping
\setuphead[chapter][+1]
\stoptyping

This command is only used when one writes macros that do
tricky things with heads. A number can be recalled by:

\showsetup{headnumber}

and/or:

\showsetup{currentheadnumber}

For example:

\starttabulate[|l|l|]
\NC \type{\currentheadnumber}   \EQ \currentheadnumber   \NC\NR
\NC \type{\headnumber[chapter]} \EQ \headnumber[chapter] \NC\NR
\NC \type{\headnumber[section]} \EQ \headnumber[section] \NC\NR
\stoptabulate

When you want to use the titlenumber in calculations you
must use the command \type {\currentheadnumber}. This number
is calculated by and available after:

\showsetup{determineheadnumber}

When headers and footers use the chapter and section titles
they are automatically adapted at a new page. The example
below results in going to new right hand side page for each
chapter.

\startexample
\starttyping
\setuphead
  [chapter]
  [page=right,
   after={\blank[2*big]}]
\stoptyping
\stopexample

In extensive documents you can choose to start sections on a
new page. The title of the first section however should be
placed directly below the chapter title. You can also prefer
to start this first section on a new page. In that case you
set \type{continue} at \type{no}. \in {Figure}
[fig:continue] shows the difference between these two
alternatives.

\startexample
\starttyping
\setuphead
  [section]
  [page=yes,continue=no,
   after=\blank]
\stoptyping
\stopexample

\startbuffer
\setupframed[width=8em,height=10em,top=,align=right]
\tfx
\startcombination[4*2]
  {\framed{chapter 1\\section 1.1}} {}
  {\framed{section 1.2}}            {}
  {\framed{section 1.3}}            {}
  {}                                {}
  {\framed{chapter 1}}              {}
  {\framed{section 1.1}}            {}
  {\framed{section 1.2}}            {}
  {\framed{section 1.3}}            {}
\stopcombination
\stopbuffer

\placefigure
  [hier]
  [fig:continue]
  {Two alternatives for the first section.}
  {\getbuffer}

It is also possible that you do not want any headers and
footers on the page where a new chapter begins. In that case
you should set \type {header} at \type {empty}, \type
{high}, \type {nomarking} or an identification of a self
defined header (this is explained in \in {section}
[headandfoot]).

By default the titles are typeset in a somewhat larger font.
You can set the text and number style at your own chosen
bodyfont. When the titles make use of the same body font
(serif, sans, etc.) as the running text you should use
neutral identifications for these fonts. So you use \type
{\tfb} instead of \type {\rmb}. Font switching is also an
issue in titles. For example if we use \type {\ssbf} instead
of \type {\ss\bf} there is a chance that capitals and
synonyms are not displayed the way they should. So you
should always use the most robust definitions for
fontswitching. Commands like \type {\kap} adapt their
behaviour to these switchings.

A chapter title consists of a number and a text. It is
possible to define your own command that typesets both
components in a different way.

% In verband met de interactieve versie herstellen we enkele
% standaardinstellingen.  Dit is iets voor insiders.

\startbuffer
\setupheads[alternative=normal]
\subsection{Title alternative equals normal}
\setupheads[alternative=inmargin]
\subsection{Title alternative equals inmargin}
\setupheads[alternative=middle]
\subsubject{Title alternative equals middle}
\stopbuffer

\start

\writestatus{WATCH OUT}{check whether co-en-09.tex has the right head}

\setuplist
  [subsection]
  [state=stop]

\setuphead
  [subsection]
  [command=\normalplacehead,
   commandbefore=,
   style=\tfb,textstyle=,numberstyle=]

\getbuffer

\stop

These titles were generates by:

\typebuffer

In this manual we use a somewhat different title layout. The
design of such a title is time consuming, not so much
because the macros are complicated, but because cooking up
something original takes time. In the examples below we will
show the steps in the design process.

% In verband met de interactieve versie herstellen we enkele
% standaardinstellingen. Dit is iets voor insiders.

\start

\setuplist
  [subsection]
  [state=stop]

\setuphead
  [subsection]
  [commandbefore=]

\startbuffer
\def\HeadTitle#1#2%
  {\hbox to \hsize
     {\hfill % the % after {#1} suppresses a space
      \framed[height=1cm,width=2cm,align=left]{#1}%
      \framed[height=1cm,width=4cm,align=right]{#2}}}

\setuphead[subsection][command=\HeadTitle]
\stopbuffer

\startexample
\typebuffer
\stopexample

\getbuffer
\subsection{Title}

A reader will expect the title of a section on the left hand
side of the page, but we see an alternative here. The title
is at the right hand side. One of the advantages of using
\type {\framed} is, that turning \type {frame=on}, some
insight can be gained in what is happening.

\startbuffer
\def\HeadTitle#1#2%
  {\hbox to \hsize \bgroup
   \hfill
   \setupframed[height=1cm,offset=.5em,frame=off]
   \framed[width=2cm,align=left]{#1}%
   \framed[width=4cm,align=right,leftframe=on]{#2}%
   \egroup}

\setuphead
  [subsection]
  [command=\HeadTitle,
   style=\tfb]
\stopbuffer

\getbuffer
\subsection{Another title}

This alternative looks somewhat better. The first definition
is slightly altered. This example also shows the features
of the command \type{\framed}.

\typebuffer

We see that the font is set with the command
\type{\setuphead}. These font commands should not be placed
in the command \type{\HeadTitle}. You may wonder what happens
when \CONTEXT\ encounters a long title. Here is the answer.

\getbuffer\subsection{A somewhat longer title}

Since we have fixed the height at 1cm, the second line of
the title end up below the frame. We will solve that problem
in the next alternative. A \type {\tbox} provides a top
aligned box.

\startbuffer
\def\HeadTitle#1#2%
  {\hbox to \hsize \bgroup
   \hfill
   \setupframed[offset=.5em,frame=off]
   \tbox{\framed[width=3cm,align=left]{#1}}%
   \tbox{\framed[width=4cm,align=right,leftframe=on]{#2}}%
   \egroup}

\setuphead
  [subsection]
  [command=\HeadTitle]
\stopbuffer

\typebuffer

This definition results in a title and a number that align on
their first lines (due to \type {\tbox}).

\getbuffer
\subsection{A considerably longer title}

\stop

When the title design becomes more complex you have to know
more of \TEX. Not every design specification can be foreseen.

\startbuffer
\setuphead[subsubject]   [alternative=text,style=bold]
\setuphead[subsubsubject][alternative=text,style=slantedbold]
\stopbuffer

\typebuffer

\start
\getbuffer \setuphead[subsubject,subsubsubject][command=]

\subsubject
  {Titles in the text}
\subsubsubject
  {Why are titles in the text more  difficult to program in
   \TEX\ than we may expect beforehand.}

The answer lies in the fact that \CONTEXT\ supports the
generation of parallel documents. These are documents that
have a printable paper version and an electronic screen
version. These versions are coupled and thus hyperlinked by
their titles. This means that when you click on a title you
will jump to the same title in the other document. So we
{\em couple} document versions:

\starttyping
\coupledocument
  [screenversion]
  [repman-e]
  [chapter,section,subsection,subsubsection,part,appendix]
  [The Reporting Manual]
\setuphead
  [chapter,section,subsection,subsubsection,part,appendix]
  [file=screenversion]
\stoptyping

The first argument in \type {\coupledocument} identfies the
screen document and the second argument specifies the file
name of that document. The third argument specifies the
coupling and the fourth is a description. After generating
the documents you can jump from one version to another by
just clicking the titles. This command only preloads
references, the actual coupling is achieved by \type
{\setuphead} command. Because titles in a text may take up
several lines some heavy duty manipulation is necessary when
typesetting such titles as we will see later.

\stop

\section[introduction]{Meta||structure}
\index{introductions}
\index{headers}
\index{appendices}
\index{extroductions}
\macro{\tex{startintroductions}}
\macro{\tex{startbodypart}}
\macro{\tex{startappendices}}
\macro{\tex{startextroductions}}

You can divide your document in functional components. The
characteristics of the titles may depend in what component
the title is used. By default we distinguish the next
functional components:

\startitemize[packed,columns,four]
\item frontmatter
\item bodypart
\item appendices
\item backmatter
\stopitemize

Introductions and extroductions are enclosed by \type{\start
... \stop} constructs. In that case the titles will not be
numbered like the chapters, but they are displayed in the
table of contents. Within the component \quote
{bodypart} there are no specific actions or layout
manipulations, but in the \quote {appendices} the titles are
numbered by letters (A, B, C, etc.).

\def\Roman{\rm}

\startexample
\setuptyping[option=commands]
\starttyping
\startfrontmatter
  \completecontent
  \chapter{Introduction}    <</Roman in content, no number>>
\stopfrontmatter

\startbodymatter
  \chapter{First}           <</Roman number 1, in content>>
    \section{Alfa}          <</Roman number 1.1, in content>>
    \section{Beta}          <</Roman number 1.2, in content>>
  \chapter{Second}          <</Roman number 2, in content>>
    \subject{Blabla}        <</Roman no number, not in content>>
\stopbodymatter

\startappendices
  \chapter{Index}           <</Roman letter A, in content>>
  \chapter{Abbreviations}   <</Roman letter B, in content>>
\stopappendices

\startbackmatter
  \chapter{Acknowlegdement} <</Roman no number, in content>>
  \title{Colofon}           <</Roman no number, not in content>>
\stopbackmatter
\stoptyping
\stopexample

When this code is processed, you will see that commands like
\type {\title} and \type {\subject} never appear in the
table of content and never get a number. Their behaviour is
not influenced by the functional component they are used in.
The behaviour of the other commands depend on the setup
within such a component. Therefore it is possible to adapt
the numbering in a functional component with one parameter
setup.

% \section[bijlagen]{Bijlagen}
% \index{bijlagen}
% \macro{\tex{startbijlagen}}
%
% Standaard worden chapterken genummerd in cijfers. Bijlagen
% daarentegen worden in letters genummerd. Bijlagen worden, zo
% zagen we in de vorige section, voorafgegaan en afgesloten
% met:
%
% \startexample
% \starttyping
% \startbijlagen
% \stopbijlagen
% \stoptyping
% \stopexample
%
% In de volgende section zullen we zien dat bijlagen een
% voorbeeld zijn van een functionele eenheid.
%
% Er is een commando \type{\bijlage} beschikbaar waarmee
% \quote {zelfstandig genummerde} bijlagen kunnen worden
% gemaakt.
%
% \showsetup{bijlage}
%
% Eigenlijk is dit commando niet nodig, omdat hetzelfde
% eenvoudig kan worden bereikt met andere commando's. We geven
% hieronder de (wat uitgeklede) definitie van het commando.
%
% \startexample
% \starttyping
% \def\bijlage[#1]#2%
%   {\pagina[rechts]
%    \stelnummeringin[state=stop]
%    \chapter[#1]{#2}
%    \pagina[rechts]
%    \stelnummeringin[state=start]
%    \stelpaginanummerin[nummer=1]}
% \stoptyping
% \stopexample
%
% Allereerst gaan we over naar een nieuwe bladzijde. Doen we
% dit niet, dan lopen we de kans dat de instelling
% \type{[state=stop]} ook voor de vorige bladzijde geldt.
% Vervolgens plaatsen we, op een aparte bladzijde, de titel
% van de bijlage. Ook hier dwingen we weer een overgang naar
% een nieuwe bladzijde af, omdat we de nummering weer op
% \type{start} willen zetten en het paginanummer op~\type{1}.
% Het is leerzaam eens een uurtje te experimenteren met
% dergelijke commando's.
%
% De overgang naar een rechter||bladzijde is nodig in het
% geval we dubbelzijdig zetten.
%
% \startexample
% \starttyping
% \bijlage[bijl:antwoorden]{Antwoorden}
%
% \onderdeel antwoord.tex    % of \input antwoord.tex
% \stoptyping
% \stopexample
%
% Een voorbeeld van een aanroep is:
%
% \startexample
% \starttyping
% \bijlage[bijl:antwoorden]{Antwoorden}
%
% \onderdeel antwoord.tex    % of \input antwoord.tex
% \stoptyping
% \stopexample

\section[alternative heads]{Alternative mechanisms}
\index{titles+alternatives}
\index{numbering+chapters}
\macro[nextsection]{\tex{next<<section>>}}

Not every document can be structured in chapters and
sections. There are documents with other numbering mechanisms
and other ways to indicate levels in the text. The title
mechanism supports these documents.

At the lowest level, the macros of \CONTEXT\ do not work
with chapters and sections but with sectionblocks. The
chapter and section commands are predefined sectionblocks. In
dutch this distinction is more clear, since there we have
\type {\hoofdstuk} and \type {\paragraaf} as instances of
\quote {secties}.

\showsetup{definesectionblock}

\showsetup{setupsectionblock}

\showsetup{definesection}

\showsetup{setupsection}

By default there are four sectionblocks:

\startexample
\starttyping
\definesectionblock [bodypart]      [headnumber=yes]
\definesectionblock [appendices]    [headnumber=yes]
\definesectionblock [introductions] [headnumber=no]
\definesectionblock [extroductions] [headnumber=no]
\stoptyping
\stopexample

We see that numbering is set with these commands. When
numbering is off local tables of contents can not be
generated. When numbers are generated but they do not have
to be displayed you can use
\type{\setupheads[sectionnumber=no]}.

By default every sectionblock starts at a new (right hand
side) page. This prevents markings from being reset too
early. A new page is enforced by \type{page}.

In \CONTEXT\ there are seven levels in use but more levels
can be made available.

\startexample
\starttyping
\definesection [section-1]
\definesection [section-2]
.............. ..........
\definesection [section-7]
\stoptyping
\stopexample

There are a number of titles predefined with the command
\type {\definehead}. We show here some of the definitions:

\startexample
\starttyping
\definehead [part]    [section=section-1]
\definehead [chapter] [section=section-2]
\definehead [section] [section=section-3]
\stoptyping
\stopexample

The definition of a subsection differs somewhat from the
others, since the subs inherit the characteristics of a
section:

\startexample
\starttyping
\definehead
  [subsection]
  [section=section-4,
   default=section]
\stoptyping
\stopexample

The definitions of unnumbered titles and subjects are
different because we don't want any numbering:

\startexample
\starttyping
\definehead
  [title]
  [coupling=chapter,
   default=chapter,
   incrementnumber=no]
\stoptyping
\stopexample

The unnumbered title is coupled to the numbered chapter.
This means that in most situations the title is handled the
same way as a chapter. You can think of the ways new pages
are generated at each new unnumbered title or chapter.
Characteristics like the style and color are also inherited.

There is more to consider. The predefined sectionblocks
are used in appendices, because these have a different
numbering system.

\startexample
\starttyping
\setupsection
  [section-2]
  [appendixconversion=Character, % Watch the capital
   previousnumber=no]
\setuphead
  [part]
  [placehead=no]
\setuphead
  [chapter]
  [appendixlabel=appendix,
   bodypartlabel=chapter]
\stoptyping
\stopexample

This means that within an \type{appendix} conversion
from number to character takes place, but only at the level of
section~2. Furthermore the titles that are related
to \type{section-2} do not get a prefix in front of the
number. The prefix consists of the separate numbers of the
sectionblocks:

\startexample
\setuptyping[option=commands]
\starttyping
<section-1><separator><section-2><separator><section-3> <</rm etc.>>
\stoptyping
\stopexample

By default section~2 (appendix) will be prefixed by the
partnumber and a separator (.) and this is not desirable at
this instance. At that level we block the prefix mechanism
and we prevent that in lower levels (section~3 ...) the
partnumber is included.

In the standard setup of \CONTEXT\ we do not display
the part title. You can undo this by saying:

\starttyping
\setuphead[part][placehead=yes]
\stoptyping

Chapters and appendices can be labeled. This means that the
titles are preceded with a word like {\em Chapter} or {\em
Appendix}. This is done with \type {\setuplabeltext}, for
example:

\startexample
\starttyping
\setuplabeltext[appendix=Appendix~]
\stoptyping
\stopexample

The look of the titles are defined by \type {\setuphead}.
\CONTEXT\ has set up the lower level section headings to
inherit their settings from the higher level. The default
setups for \CONTEXT\ are therefore limited to:

\startexample
\starttyping
\setuphead
  [part,chapter]
  [align=normal,
   continue=no,
   page=right,
   head=nomarking,
   style=\tfc,
   before={\blank[2*big]},
   after={\blank[2*big]}]

\setuphead
  [section]
  [align=normal,
   style=\tfa,
   before={\blank[2*big]},
   after=\blank]
\stoptyping
\stopexample

With \type {nomarking}, we tell \CONTEXT\ to ignore markings
in running heads at the page where a chapter starts. We
prefer \type{\tfc}, because this enables the title to adapt
to the actual bodyfont. The \argchars\ around \type{\blank}
are essential for we do not want any conflicts with
\setchars.

Earlier we saw that new structuring elements could be
defined that inherit characteristics of existing elements.
Most of the time this is sufficient:

\startexample
\starttyping
\definehead[topic]   [section][style=bold,before=\blank]
\definehead[category][subject][style=bold,before=\blank]
\stoptyping
\stopexample

One of the reasons that the mechanism is rather complex is
the fact that we use the names of the sections as setups
in other commands. The marking of \type {category} can be
compared with that of \type{subject}, but that of subject
can not be compared with that \type{section}. During the
last few years it appeared that subject is used for all
sorts of titles in the running text. We don't want to see
these in headers and footers.

While setting the parameter \type {criterium} in lists and
registers and the \type {way} of numbering, we can choose
\type {persection} or \type {persubject}. For indicating the
level we can use the parameter \type {section} as well as \type
{subject}. So we can alter the names of sections in logical
ones that relate to their purpose. For example:

\startexample
\starttyping
\definehead [handbook]       [section=section-1]
\definehead [procedure]      [section=section-2]
\definehead [subprocedure]   [section=section-3]
\definehead [instruction]    [procedure]
\stoptyping
\stopexample

After this we can set up the structuring elements (or
inherit them) and generate lists of procedures and
instructions. We will discuss this feature in detail in one
of the later chapters.

\stopcomponent