summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/context/documents/general/fonts/fonts-mkiv.pdfbin0 -> 1256587 bytes
-rw-r--r--doc/context/documents/general/manuals/columnsets.pdfbin0 -> 4526014 bytes
-rw-r--r--doc/context/documents/general/manuals/epub-mkiv-demo.epubbin0 -> 10267 bytes
-rw-r--r--doc/context/documents/general/manuals/epub-mkiv-demo.pdfbin0 -> 19222 bytes
-rw-r--r--doc/context/documents/general/manuals/epub-mkiv.pdfbin0 -> 99316 bytes
-rw-r--r--doc/context/documents/general/manuals/languages-mkiv.pdfbin0 -> 678284 bytes
-rw-r--r--doc/context/documents/general/manuals/lua-mkiv.pdfbin0 -> 57290 bytes
-rw-r--r--doc/context/documents/general/manuals/luatex.pdfbin0 -> 1037938 bytes
-rw-r--r--doc/context/documents/general/manuals/ma-cb-en.pdfbin0 -> 2843652 bytes
-rw-r--r--doc/context/documents/general/manuals/math-mkiv.pdfbin0 -> 2906190 bytes
-rw-r--r--doc/context/documents/general/manuals/mreadme.pdfbin0 -> 41455 bytes
-rw-r--r--doc/context/documents/general/manuals/spacing-mkiv.pdfbin0 -> 39828 bytes
-rw-r--r--doc/context/documents/general/manuals/sql-mkiv.pdfbin0 -> 90609 bytes
-rw-r--r--doc/context/documents/general/manuals/steps-mkiv.pdfbin0 -> 297225 bytes
-rw-r--r--doc/context/documents/general/manuals/swiglib-mkiv.pdfbin0 -> 167938 bytes
-rw-r--r--doc/context/documents/general/manuals/templates-mkiv.pdfbin0 -> 92572 bytes
-rw-r--r--doc/context/documents/general/manuals/tiptrick.pdfbin0 -> 47419 bytes
-rw-r--r--doc/context/documents/general/manuals/tools-mkiv.pdfbin0 -> 358708 bytes
-rw-r--r--doc/context/documents/general/manuals/units-mkiv.pdfbin0 -> 164604 bytes
-rw-r--r--doc/context/documents/general/manuals/workflows-mkiv.pdfbin0 -> 94468 bytes
-rw-r--r--doc/context/documents/general/manuals/xml-mkiv.pdfbin0 -> 1306364 bytes
-rw-r--r--doc/context/documents/general/manuals/xtables-mkiv.pdfbin0 -> 138152 bytes
-rw-r--r--doc/context/documents/general/mathml/mmlexamp.pdfbin0 -> 136092 bytes
-rw-r--r--doc/context/documents/general/mathml/mmlprime.pdfbin0 -> 772848 bytes
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-appendix.tex484
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-environment.tex30
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-extensions.tex2312
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-features.tex2585
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-formats.tex873
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-hooks.tex585
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-introduction.tex95
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-lookups.tex347
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-math.tex998
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-methods.tex376
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-mkiv.tex71
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-modes.tex817
-rw-r--r--doc/context/sources/general/fonts/fonts/fonts-scripts.tex18
-rw-r--r--doc/context/sources/general/fonts/manuals-explaining-contents.tex11
-rw-r--r--doc/context/sources/general/fonts/manuals-explaining-cover.tex199
-rw-r--r--doc/context/sources/general/fonts/manuals-explaining-environment.tex325
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-000.tex63
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-001.tex17
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-002.tex17
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-003.tex35
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-004.tex32
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-005.tex29
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-006.tex35
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-007.tex43
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-101.tex30
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-102.tex36
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-103.tex37
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-201.tex31
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-202.tex32
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-203.tex29
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-204.tex41
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-205.tex42
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-206.tex29
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-301.tex29
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-401.tex26
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-402.tex24
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-403.tex23
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-404.tex34
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-405.tex29
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-601.tex29
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-701.tex23
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-702.tex27
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-703.tex34
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-704.tex69
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-801.tex19
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-802.tex22
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-803.tex26
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-804.tex26
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-805.tex26
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-806.tex26
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-901.tex38
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-902.tex38
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-903.tex41
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets.tex873
-rw-r--r--doc/context/sources/general/manuals/epub/epub-mkiv-demo.tex43
-rw-r--r--doc/context/sources/general/manuals/epub/epub-mkiv.tex466
-rw-r--r--doc/context/sources/general/manuals/languages/languages-appendix.tex48
-rw-r--r--doc/context/sources/general/manuals/languages/languages-basics.tex348
-rw-r--r--doc/context/sources/general/manuals/languages/languages-environment.tex15
-rw-r--r--doc/context/sources/general/manuals/languages/languages-goodies.tex138
-rw-r--r--doc/context/sources/general/manuals/languages/languages-hyphenation.tex876
-rw-r--r--doc/context/sources/general/manuals/languages/languages-introduction.tex69
-rw-r--r--doc/context/sources/general/manuals/languages/languages-labels.tex141
-rw-r--r--doc/context/sources/general/manuals/languages/languages-mkiv.tex61
-rw-r--r--doc/context/sources/general/manuals/languages/languages-numbering.tex307
-rw-r--r--doc/context/sources/general/manuals/languages/languages-sorting.tex235
-rw-r--r--doc/context/sources/general/manuals/lua/lua-mkiv.tex139
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-contents.tex20
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-enhancements.tex892
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-fonts.tex719
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-introduction.tex121
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-languages.tex770
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-logos.tex19
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-lua.tex572
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-math.tex1049
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-modifications.tex1220
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-nodes.tex1915
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-style.tex362
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-titlepage.tex70
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex.tex40
-rw-r--r--doc/context/sources/general/manuals/manuals-explaining-contents.tex11
-rw-r--r--doc/context/sources/general/manuals/manuals-explaining-cover.tex199
-rw-r--r--doc/context/sources/general/manuals/manuals-explaining-environment.tex325
-rw-r--r--doc/context/sources/general/manuals/manuals-xml-environment.tex385
-rw-r--r--doc/context/sources/general/manuals/math/math-framing-001.tex113
-rw-r--r--doc/context/sources/general/manuals/math/math-mkiv.tex58
-rw-r--r--doc/context/sources/general/manuals/math/math-spacing-001.tex73
-rw-r--r--doc/context/sources/general/manuals/mcommon.tex210
-rw-r--r--doc/context/sources/general/manuals/readme/mreadme.tex390
-rw-r--r--doc/context/sources/general/manuals/spacing/spacing-contents.tex9
-rw-r--r--doc/context/sources/general/manuals/spacing/spacing-introduction.tex19
-rw-r--r--doc/context/sources/general/manuals/spacing/spacing-linecorrection.tex108
-rw-r--r--doc/context/sources/general/manuals/spacing/spacing-mkiv.tex16
-rw-r--r--doc/context/sources/general/manuals/spacing/spacing-style.tex55
-rw-r--r--doc/context/sources/general/manuals/spacing/spacing-titlepage.tex37
-rw-r--r--doc/context/sources/general/manuals/sql/sql-mkiv.tex492
-rw-r--r--doc/context/sources/general/manuals/start/cont-en-extra.xml749
-rw-r--r--doc/context/sources/general/manuals/start/en/hasseltbook.bib7
-rw-r--r--doc/context/sources/general/manuals/start/en/hasseltbook.pdfbin0 -> 17205 bytes
-rw-r--r--doc/context/sources/general/manuals/start/en/hasseltbook.tex30
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-alignments.tex73
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-backpage.tex40
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-bibliography.tex63
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-chemical.tex77
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-citations.tex64
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-color.tex71
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-columns.tex154
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-commandlist.tex16
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-commands.tex94
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-composedcharacters.tex55
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-descriptions.tex94
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-document.tex117
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-enumerations.tex106
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-errors.tex79
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-figures.tex258
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-fonts.tex299
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-footnotes.tex99
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-framedtexts.tex58
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-frames.tex144
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-gettingstarted.tex46
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-headers.tex53
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-heads.tex135
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-interactivity.tex310
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-introduction.tex33
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-itemizations.tex297
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-layout.tex241
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-margintexts.tex100
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-math.tex524
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-mathcharacters.tex330
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-metapost.tex75
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-modules.tex45
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-pagebackgrounds.tex93
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-pages.tex208
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-paragraphs.tex280
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-presentations.tex38
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-processingfiles.tex44
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-references.tex148
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-registers.tex83
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-runtimefiles.tex41
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-setupcommands.tex54
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-sortedlists.tex71
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-specialcharacters.tex60
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-structure.tex133
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-support.tex17
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-synonyms.tex89
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-tables.tex385
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-tablesofcontent.tex174
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-tabulations.tex163
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-textbackgrounds.tex55
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-texteditor.tex32
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-units.tex101
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-usersetups.tex68
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en-whatever.tex1079
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en.pdfbin0 -> 2843652 bytes
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-en.tex86
-rw-r--r--doc/context/sources/general/manuals/start/en/ma-cb-language.tex21
-rw-r--r--doc/context/sources/general/manuals/start/en/sounds-001.tex34
-rw-r--r--doc/context/sources/general/manuals/start/graphics/cow.pdfbin0 -> 5526 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/fig-page-areas-en.md830
-rw-r--r--doc/context/sources/general/manuals/start/graphics/fig-page-areas-en.pdf527
-rw-r--r--doc/context/sources/general/manuals/start/graphics/fig-page-parameters-en.md1371
-rw-r--r--doc/context/sources/general/manuals/start/graphics/fig-page-parameters-en.pdf1216
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-00.eps2799
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-00.mp1282
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-00.pdfbin0 -> 13318 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-01.pngbin0 -> 174703 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-03.pngbin0 -> 170986 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-04.pngbin0 -> 174074 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-07.pngbin0 -> 175370 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-08.pngbin0 -> 183539 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-12.pngbin0 -> 163156 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-13.pngbin0 -> 227362 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-15.pngbin0 -> 257643 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-16.pngbin0 -> 193612 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-18.pngbin0 -> 140723 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-19.pngbin0 -> 193286 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-20.pngbin0 -> 158057 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-21.pngbin0 -> 169516 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-22.pngbin0 -> 239855 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-23.pngbin0 -> 154869 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-24.pngbin0 -> 164197 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-25.pngbin0 -> 175417 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/ma-cb-26.pngbin0 -> 206368 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/minibook-en.pdfbin0 -> 11889 bytes
-rw-r--r--doc/context/sources/general/manuals/start/graphics/minibook-en.tex20
-rw-r--r--doc/context/sources/general/manuals/start/ma-cb-abbreviations.tex7
-rw-r--r--doc/context/sources/general/manuals/start/ma-cb-colofon.tex95
-rw-r--r--doc/context/sources/general/manuals/start/ma-cb-copyright.tex41
-rw-r--r--doc/context/sources/general/manuals/start/ma-cb-graphics.tex266
-rw-r--r--doc/context/sources/general/manuals/start/ma-cb-links.tex268
-rw-r--r--doc/context/sources/general/manuals/start/ma-cb-screen.tex201
-rw-r--r--doc/context/sources/general/manuals/start/ma-cb-style.tex678
-rw-r--r--doc/context/sources/general/manuals/start/ma-cb.tex17
-rw-r--r--doc/context/sources/general/manuals/steps/steps-mkiv.tex655
-rw-r--r--doc/context/sources/general/manuals/swiglib/swiglib-mkiv-gm-1.jpgbin0 -> 15689 bytes
-rw-r--r--doc/context/sources/general/manuals/swiglib/swiglib-mkiv-gm-1.pdfbin0 -> 20433 bytes
-rw-r--r--doc/context/sources/general/manuals/swiglib/swiglib-mkiv-gm-1.pngbin0 -> 46978 bytes
-rw-r--r--doc/context/sources/general/manuals/swiglib/swiglib-mkiv.tex352
-rw-r--r--doc/context/sources/general/manuals/templates/templates-mkiv.tex283
-rw-r--r--doc/context/sources/general/manuals/tiptrick/tiptrick.tex117
-rw-r--r--doc/context/sources/general/manuals/tiptrick/tiptrick.xml53
-rw-r--r--doc/context/sources/general/manuals/tools/tools-mkiv.tex511
-rw-r--r--doc/context/sources/general/manuals/units/units-mkiv.tex538
-rw-r--r--doc/context/sources/general/manuals/workflows/workflows-contents.tex13
-rw-r--r--doc/context/sources/general/manuals/workflows/workflows-graphics.tex157
-rw-r--r--doc/context/sources/general/manuals/workflows/workflows-injectors.tex102
-rw-r--r--doc/context/sources/general/manuals/workflows/workflows-introduction.tex25
-rw-r--r--doc/context/sources/general/manuals/workflows/workflows-mkiv.tex32
-rw-r--r--doc/context/sources/general/manuals/workflows/workflows-resources.tex156
-rw-r--r--doc/context/sources/general/manuals/workflows/workflows-setups.tex72
-rw-r--r--doc/context/sources/general/manuals/workflows/workflows-style.tex49
-rw-r--r--doc/context/sources/general/manuals/workflows/workflows-suspects.tex54
-rw-r--r--doc/context/sources/general/manuals/workflows/workflows-titlepage.tex37
-rw-r--r--doc/context/sources/general/manuals/workflows/workflows-xml.tex96
-rw-r--r--doc/context/sources/general/manuals/xml/xml-mkiv-01.xml15
-rw-r--r--doc/context/sources/general/manuals/xml/xml-mkiv-02.xml15
-rw-r--r--doc/context/sources/general/manuals/xml/xml-mkiv.tex3812
-rw-r--r--doc/context/sources/general/manuals/xtables/xtables-mkiv.tex1235
-rw-r--r--doc/context/sources/general/mathml/mathml/envexamp.tex291
-rw-r--r--doc/context/sources/general/mathml/mathml/mmlexamp.tex107
-rw-r--r--doc/context/sources/general/mathml/mathml/mmlprime.tex6036
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-001.xml9
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-002.xml9
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-003.xml18
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-004.xml26
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-005.xml27
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-006.xml38
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-007.xml58
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-008.xml25
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-009.xml25
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-010.xml26
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-011.xml32
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-043.xml47
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-d-051.xml17
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-i-022.xml52
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-i-380.xml73
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-s-001.xml28
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-s-002.xml36
-rw-r--r--doc/context/sources/general/mathml/mathml/pc-s-003.xml40
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-001.xml28
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-002.xml28
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-003.xml28
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-004.xml28
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-005.xml31
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-006.xml31
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-007.xml33
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-008.xml33
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-009.xml33
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-010.xml35
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-011.xml27
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-012.xml27
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-013.xml27
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-014.xml29
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-015.xml32
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-g-016.xml90
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-l-001.xml35
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-l-002.xml35
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-l-003.xml32
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-l-004.xml28
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-s-001.xml49
-rw-r--r--doc/context/sources/general/mathml/mathml/wh-s-002.xml63
-rw-r--r--tex/context/base/context-version.pdfbin4262 -> 4257 bytes
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin9127 -> 9126 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin368501 -> 368501 bytes
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin774404 -> 774401 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60792 -> 60792 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
293 files changed, 59636 insertions, 3 deletions
diff --git a/doc/context/documents/general/fonts/fonts-mkiv.pdf b/doc/context/documents/general/fonts/fonts-mkiv.pdf
new file mode 100644
index 000000000..4cc8b07e6
--- /dev/null
+++ b/doc/context/documents/general/fonts/fonts-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/columnsets.pdf b/doc/context/documents/general/manuals/columnsets.pdf
new file mode 100644
index 000000000..0d4e862f1
--- /dev/null
+++ b/doc/context/documents/general/manuals/columnsets.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/epub-mkiv-demo.epub b/doc/context/documents/general/manuals/epub-mkiv-demo.epub
new file mode 100644
index 000000000..a40c054d3
--- /dev/null
+++ b/doc/context/documents/general/manuals/epub-mkiv-demo.epub
Binary files differ
diff --git a/doc/context/documents/general/manuals/epub-mkiv-demo.pdf b/doc/context/documents/general/manuals/epub-mkiv-demo.pdf
new file mode 100644
index 000000000..78b8f1b99
--- /dev/null
+++ b/doc/context/documents/general/manuals/epub-mkiv-demo.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/epub-mkiv.pdf b/doc/context/documents/general/manuals/epub-mkiv.pdf
new file mode 100644
index 000000000..7ac31386b
--- /dev/null
+++ b/doc/context/documents/general/manuals/epub-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/languages-mkiv.pdf b/doc/context/documents/general/manuals/languages-mkiv.pdf
new file mode 100644
index 000000000..026acfca5
--- /dev/null
+++ b/doc/context/documents/general/manuals/languages-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/lua-mkiv.pdf b/doc/context/documents/general/manuals/lua-mkiv.pdf
new file mode 100644
index 000000000..9e92ebad9
--- /dev/null
+++ b/doc/context/documents/general/manuals/lua-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/luatex.pdf b/doc/context/documents/general/manuals/luatex.pdf
new file mode 100644
index 000000000..8c20ea3ca
--- /dev/null
+++ b/doc/context/documents/general/manuals/luatex.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/ma-cb-en.pdf b/doc/context/documents/general/manuals/ma-cb-en.pdf
new file mode 100644
index 000000000..6ad164eb0
--- /dev/null
+++ b/doc/context/documents/general/manuals/ma-cb-en.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/math-mkiv.pdf b/doc/context/documents/general/manuals/math-mkiv.pdf
new file mode 100644
index 000000000..49b992f65
--- /dev/null
+++ b/doc/context/documents/general/manuals/math-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/mreadme.pdf b/doc/context/documents/general/manuals/mreadme.pdf
new file mode 100644
index 000000000..031be0fda
--- /dev/null
+++ b/doc/context/documents/general/manuals/mreadme.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/spacing-mkiv.pdf b/doc/context/documents/general/manuals/spacing-mkiv.pdf
new file mode 100644
index 000000000..1f0057f1d
--- /dev/null
+++ b/doc/context/documents/general/manuals/spacing-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/sql-mkiv.pdf b/doc/context/documents/general/manuals/sql-mkiv.pdf
new file mode 100644
index 000000000..fa9a5ad61
--- /dev/null
+++ b/doc/context/documents/general/manuals/sql-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/steps-mkiv.pdf b/doc/context/documents/general/manuals/steps-mkiv.pdf
new file mode 100644
index 000000000..fabdff6b2
--- /dev/null
+++ b/doc/context/documents/general/manuals/steps-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/swiglib-mkiv.pdf b/doc/context/documents/general/manuals/swiglib-mkiv.pdf
new file mode 100644
index 000000000..57b717f9b
--- /dev/null
+++ b/doc/context/documents/general/manuals/swiglib-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/templates-mkiv.pdf b/doc/context/documents/general/manuals/templates-mkiv.pdf
new file mode 100644
index 000000000..47a0d70a6
--- /dev/null
+++ b/doc/context/documents/general/manuals/templates-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/tiptrick.pdf b/doc/context/documents/general/manuals/tiptrick.pdf
new file mode 100644
index 000000000..6455b07f8
--- /dev/null
+++ b/doc/context/documents/general/manuals/tiptrick.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/tools-mkiv.pdf b/doc/context/documents/general/manuals/tools-mkiv.pdf
new file mode 100644
index 000000000..1da11dcb0
--- /dev/null
+++ b/doc/context/documents/general/manuals/tools-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/units-mkiv.pdf b/doc/context/documents/general/manuals/units-mkiv.pdf
new file mode 100644
index 000000000..5631be78e
--- /dev/null
+++ b/doc/context/documents/general/manuals/units-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/workflows-mkiv.pdf b/doc/context/documents/general/manuals/workflows-mkiv.pdf
new file mode 100644
index 000000000..9b8e1f142
--- /dev/null
+++ b/doc/context/documents/general/manuals/workflows-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/xml-mkiv.pdf b/doc/context/documents/general/manuals/xml-mkiv.pdf
new file mode 100644
index 000000000..932b4cbaf
--- /dev/null
+++ b/doc/context/documents/general/manuals/xml-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/xtables-mkiv.pdf b/doc/context/documents/general/manuals/xtables-mkiv.pdf
new file mode 100644
index 000000000..fb04a53d9
--- /dev/null
+++ b/doc/context/documents/general/manuals/xtables-mkiv.pdf
Binary files differ
diff --git a/doc/context/documents/general/mathml/mmlexamp.pdf b/doc/context/documents/general/mathml/mmlexamp.pdf
new file mode 100644
index 000000000..d86238a5a
--- /dev/null
+++ b/doc/context/documents/general/mathml/mmlexamp.pdf
Binary files differ
diff --git a/doc/context/documents/general/mathml/mmlprime.pdf b/doc/context/documents/general/mathml/mmlprime.pdf
new file mode 100644
index 000000000..0d48394c0
--- /dev/null
+++ b/doc/context/documents/general/mathml/mmlprime.pdf
Binary files differ
diff --git a/doc/context/sources/general/fonts/fonts/fonts-appendix.tex b/doc/context/sources/general/fonts/fonts/fonts-appendix.tex
new file mode 100644
index 000000000..ae42b10fa
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-appendix.tex
@@ -0,0 +1,484 @@
+% language=uk
+
+\startcomponent fonts-appendix
+
+\environment fonts-environment
+
+\startchapter[title=Appendix][color=darkgray]
+
+\startsection[title=The \type {tfm} file,reference=fontdata:tfm]
+
+The (binary) \type {tfm} file is not human readable but can be turned into a
+verbose property list which is not that hard to understand.
+
+\starttyping
+tftopl texnansi-lmr10.tfm
+\stoptyping
+
+Here is an excerpt from the data file. It starts with some general properties of
+the font. The \type {O} means that the value is in octal while the \type {R} is a
+real. Keep in mind that \TEX\ has no datatype \quote {real} so internally it is
+just integers representing scaled points.
+
+\startnarrowtyping
+(FAMILY LMROMAN10)
+(FACE O 352)
+(CODINGSCHEME LY1 ENCODING /TEX'N'ANSI, Y&Y/)
+(DESIGNSIZE R 10.0)
+(COMMENT DESIGNSIZE IS IN POINTS)
+(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
+(CHECKSUM O 4720464277)
+\stopnarrowtyping
+
+A text font has the following font dimensions:
+
+\startnarrowtyping
+(FONTDIMEN
+ (SLANT R 0.0)
+ (SPACE R 0.333333)
+ (STRETCH R 0.166667)
+ (SHRINK R 0.111112)
+ (XHEIGHT R 0.43055)
+ (QUAD R 1.0)
+ (EXTRASPACE R 0.111112)
+ ...
+)
+\stopnarrowtyping
+
+Kerns and ligatures are packed into a table that is basically a sequence of
+labelled entries. Here we see the entry for the character \type {f} which has
+three ligatures: \type {ff}, \type {fi} and \type {fl}. Because ligatures can be
+chained, octal slot 13 will have ligature entries for \type {ffl} and \type
+{ffi}.
+
+\startnarrowtyping
+(LIGTABLE
+ ...
+ (LABEL C f)
+ (LIG C f O 13)
+ (LIG C i O 14)
+ (LIG C l O 10)
+ (KRN O 135 R 0.027779)
+ (KRN O 41 R 0.027779)
+ (KRN O 51 R 0.027779)
+ (KRN O 77 R 0.027779)
+ (KRN O 223 R 0.027779)
+ (KRN O 224 R 0.027779)
+ (KRN O 140 R 0.027779)
+ (KRN O 47 R 0.027779)
+ (STOP)
+ ...
+)
+\stopnarrowtyping
+
+Each character gets its own entry. In this case there is no depth involved so it
+is not shown. The comment is just a repetition of the entry in the ligtable.
+
+\startnarrowtyping
+(CHARACTER C f
+ (CHARWD R 0.30555)
+ (CHARHT R 0.688875)
+ (CHARIC R 0.079222)
+ (COMMENT
+ (LIG C f O 13)
+ (LIG C i O 14)
+ (LIG C l O 10)
+ (KRN O 135 R 0.027779)
+ (KRN O 41 R 0.027779)
+ (KRN O 51 R 0.027779)
+ (KRN O 77 R 0.027779)
+ (KRN O 223 R 0.027779)
+ (KRN O 224 R 0.027779)
+ (KRN O 140 R 0.027779)
+ (KRN O 47 R 0.027779)
+ )
+)
+\stopnarrowtyping
+
+\stopsection
+
+\startsection[title=The \type {vf} file,reference=fontdata:vf]
+
+A virtual font specification file can be converted to a more readable format with
+\type {vftovp}, for instance:
+
+\starttyping
+vftovp eurm10.vf
+\stoptyping
+
+The information in a \type {vf} file will be combined with the data in the
+accompanying \type {tfm} file so the output looks similar:
+
+\startnarrowtyping
+(VTITLE )
+(FAMILY UNSPECIFIED)
+(FACE F MRR)
+(CODINGSCHEME TEX MATH ITALIC)
+(DESIGNSIZE R 10.0)
+(COMMENT DESIGNSIZE IS IN POINTS)
+(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
+(CHECKSUM O 24401046203)
+(SEVENBITSAFEFLAG TRUE)
+\stopnarrowtyping
+
+Because this font is a math font there is no space defined.
+
+\startnarrowtyping
+(FONTDIMEN
+ (SLANT R 0.0)
+ (SPACE R 0.0)
+ (STRETCH R 0.0)
+ (SHRINK R 0.0)
+ (XHEIGHT R 0.459)
+ (QUAD R 1.0)
+ (EXTRASPACE R 0.0)
+)
+\stopnarrowtyping
+
+A virtual font will take glyphs from another font and therefore there are entries
+that refer to these fonts. In the following definition index \type {0} is created
+(the \type {D} specifies a decimal entry).
+
+\startnarrowtyping
+(MAPFONT D 0
+ (FONTNAME eurm10)
+ (FONTCHECKSUM O 4276740471)
+ (FONTAT R 1.0)
+ (FONTDSIZE R 10.0)
+)
+(MAPFONT D 1
+ (FONTNAME cmmi10)
+ (FONTCHECKSUM O 1350061076)
+ (FONTAT R 1.0)
+ (FONTDSIZE R 10.0)
+)
+\stopnarrowtyping
+
+The zero indexed font is the default, so in the following entry this font is
+taken:
+
+\startnarrowtyping
+(CHARACTER C W
+ (CHARWD R 0.986)
+ (CHARHT R 0.691)
+ (CHARIC R 0.056)
+ (COMMENT
+ (KRN O 177 R 0.056)
+ (KRN O 75 R -0.056)
+ (KRN O 73 R -0.083)
+ (KRN O 72 R -0.083)
+ )
+ (MAP
+ (SETCHAR C W)
+ )
+)
+\stopnarrowtyping
+
+The next specification is a combination of two other glyphs becoming a new
+glyph. We see here that the \type {MAP} table is actually a sort of program:
+
+\startnarrowtyping
+(CHARACTER O 200
+ (CHARWD R 0.622)
+ (CHARHT R 0.691)
+ (MAP
+ (PUSH)
+ (MOVEDOWN R -0.18)
+ (MOVERIGHT R 0.015)
+ (SELECTFONT D 2)
+ (SETCHAR O 40)
+ (POP)
+ (SELECTFONT D 0)
+ (SETCHAR C h)
+ )
+)
+\stopnarrowtyping
+
+The character information is also in the \type {tfm} companion and that is what
+\TEX\ uses. The virtual information kicks in when the backend is creating the
+page stream and embedding the fonts.
+
+\stopsection
+
+\startsection[title=The \type {map} file,reference=fontdata:map]
+
+In a map file each line maps a font name onto a file that contains the font
+shapes in bitmap or outline format. For instance in the file \type
+{lm-texnansi.map} we find the line:
+
+\startnarrowtyping
+texnansi-lmr10 LMRoman10-Regular "enclmtexnansi ReEncodeFont" <lm-texnansi.enc <lmr10.pfb
+\stopnarrowtyping
+
+The backend will fetch the glyph data from \type {lmf10.pfb} and use the given
+encoding file to resolve indices to glyph names. A \type {pfb} file can contain
+more than 256 entries so names are used to access the data. The string between
+quotes is used for the encoding vector in the resulting file.
+
+The second entry in the line is the font name that will be used. This name is
+also used to control subset behaviour. Multiple references to this name will be
+collapsed into one inclusion when possible, thereby making the file as small as
+possible. You better make sure that the names are unique for a specific font.
+
+In addition to this, there can be directives for extending the font (horizontal
+stretch) and transforming it into a slanted variant. Both are to be used with
+care.
+
+In \MKIV\ map files are only used for virtual math fonts and just as in \MKII\ we
+load such files selectively. Users don't have to worry about this.
+
+\stopsection
+
+\startsection[title=The \type {enc} file,reference=fontdata:enc]
+
+For historic reasons, an encoding file is a blob of \POSTSCRIPT, probably because
+it can be copied into the final output directly. Given that \TEX\ got extended
+anyway, you can wonder why this information never ended up in an extended \type
+{tfm} or \type {vf} file. It had definitely made the traditional process much
+more robust.
+
+\startnarrowtyping
+/enclmtexnansi[
+/.notdef
+/Euro
+...
+/dotaccent
+/hungarumlaut
+/ogonek
+...
+/ffi
+/ffl
+/dotlessi
+/dotlessj
+/grave
+...
+/thorn
+/ydieresis
+] def
+\stopnarrowtyping
+
+There are excactly 256 entries in such a vector and the names should match those
+in a \type {pfb} file.
+
+\stopsection
+
+\startsection[title=The \type {afm} file,reference=fontdata:afm]
+
+Here we show an excerpt from an \type {afm} file that comes with Latin Modern
+Roman. Just as with a \type {tfm} file we start with some general information.
+However we don't need to convert the file as is it already in human readable
+format.
+
+\startnarrowtyping
+StartFontMetrics 2.0
+Comment Generated by MetaType1 (a MetaPost-based engine)
+Comment Creation Date: 7th October 2009
+Notice Copyright 2003--2009 by B. Jackowski and J.M. Nowacki (on behalf of TeX USERS GROUPS).
+Comment Supported by CSTUG, DANTE eV, GUST, GUTenberg, NTG, and TUG.
+Comment METATYPE1/Type 1 version by B. Jackowski & J. M. Nowacki
+Comment from GUST (http://www.gust.org.pl).
+Comment This work is released under the GUST Font License.
+Comment For the most recent version of this license see
+Comment This work has the LPPL maintenance status `maintained'.
+Comment The Current Maintainer of this work is Bogus\l{}aw Jackowski and Janusz M. Nowacki.
+Comment This work consists of the files listed in the MANIFEST-Latin-Modern.txt file.
+FontName LMRoman10-Regular
+FullName LMRoman10-Regular
+FamilyName LMRoman10
+Weight Normal
+ItalicAngle 0
+IsFixedPitch false
+UnderlinePosition -146
+UnderlineThickness 40
+Version 2.004
+EncodingScheme FontSpecific
+FontBBox -430 -290 1417 1127
+CapHeight 683.33333
+XHeight 430.55556
+Descender -194.44444
+Ascender 694.44444
+Comment PFM parameters: LMRoman10 0 0 0xEE
+Comment TFM designsize: 10 (in points)
+Comment TFM fontdimen 1: 0 (slant)
+Comment TFM fontdimen 2: 3.33333 (space)
+Comment TFM fontdimen 3: 1.66667 (space stretch)
+Comment TFM fontdimen 4: 1.11111 (space shrink)
+Comment TFM fontdimen 5: 4.3055 (xheight)
+Comment TFM fontdimen 6: 10 (quad)
+Comment TFM fontdimen 7: 1.11111 (extra space)
+Comment TFM fontdimen 8: 6.833 (non-standard: uc height)
+Comment TFM fontdimen 9: 6.9445 (non-standard: ascender)
+Comment TFM fontdimen 10: 11.27 (non-standard: accented cap height)
+Comment TFM fontdimen 11: 1.94443 (non-standard: descender depth)
+Comment TFM fontdimen 12: 11.27 (non-standard: max height)
+Comment TFM fontdimen 13: 2.9 (non-standard: max depth)
+Comment TFM fontdimen 14: 5 (non-standard: digit width)
+Comment TFM fontdimen 15: 0.88889 (non-standard: uc stem)
+Comment TFM fontdimen 16: 12 (non-standard: baselineskip)
+Comment TFM fontdimen 17: 0.69444 (non-standard: lc stem)
+Comment TFM fontdimen 18: 0.55556 (non-standard: u, i.e., font unit)
+Comment TFM fontdimen 19: 0.22223 (non-standard: overshoot)
+Comment TFM fontdimen 20: 0.25 (non-standard: thin stem, hair)
+Comment TFM fontdimen 21: 0.30556 (non-standard: cap thin stem, i.e., cap_hair)
+Comment TFM headerbyte 9: FontSpecific
+Comment TFM headerbyte 49: LMRoman10
+Comment TFM headerbyte 72: 234
+\stopnarrowtyping
+
+Watch the comments! Because \TEX\ needs a couple of so called fontdimens to be
+set, the comments list the appropriate values. When a \type {tfm} file is
+generated from an \type {afm} file, these values have to be used.
+
+Each character (or glyph) gets an entry. When we run out of indices i.e.\ pass
+the 255 boundary (we start at 0) the index becomes \type {-1}. Only the width is
+specified. The height and depth have to be derived from the bounding box for
+which the specification starts with key \type {B}.
+
+\startnarrowtyping
+StartCharMetrics 821
+...
+C 32 ; WX 333.33333 ; N space ; B 0 0 0 0 ;
+...
+C 102 ; WX 305.55556 ; N f ; B 33 0 357 705 ; L f ff ; L i fi ; L k f_k ; L l fl ;
+C 105 ; WX 277.77777 ; N i ; B 33 0 247 657 ;
+C 108 ; WX 277.77777 ; N l ; B 33 0 255 694 ;
+...
+C -1 ; WX 500 ; N Acute ; B 181 493 388 656 ;
+C -1 ; WX 500 ; N acute ; B 188 510 374 698 ;
+C -1 ; WX 500 ; N acute.ts1 ; B 208 513 392 699 ;
+...
+EndCharMetrics
+\stopnarrowtyping
+
+Watch how this font defines a space character and keep in mind that these fonts
+date from the time that there was only one kind of space. The \type {L} entry
+specifies a ligature.
+
+The names of glyphs are standardized, and even the \type {f_k} is conforming to
+standards. This standardization makes it possible to go back from glyphs to characters
+when copying text from a typeset document.
+
+The kern table is pretty large here and for a reason. First of all the file
+defines 821 glyphs so the average amount of kerns per glyph is not that large.
+But take a look at the \type {A}. Because the \type {Aacute} has the same shape
+it kerns in a similar way. This means that ideally all combined characters end up
+with the same value as their base glyph. However, in our case a bit more
+selective approach is taken. The \type {Adieresis} has a different set of kerns,
+probably to save space. It is for this reason that \OPENTYPE\ fonts have a model
+of kern classes so that similar shapes can be treated as one when setting kerns.
+You see a similar issue with ligatures, where often the right part of the shape
+kerns the same as the (stand alone) first part of the shape does.
+
+\startnarrowtyping
+StartKernData
+StartKernPairs 9230
+...
+KPX seven.prop hyphen.prop -37
+KPX seven.prop four.prop -74
+KPX seven.prop six.prop -18.5
+KPX hyphen.prop one.prop -37
+KPX hyphen.prop two.prop -18.5
+KPX hyphen.prop seven.prop -55.5
+KPX seven.oldstyle four.oldstyle -74
+KPX A T -83.333
+KPX Aacute T -83.333
+KPX Abreve T -83.333
+KPX Acircumflex T -83.333
+...
+KPX Adieresis C -27.778
+...
+KPX f bracketright 27.778
+KPX f exclam 27.778
+KPX f parenright 27.778
+KPX f question 27.778
+KPX f quotedblleft 27.778
+KPX f quotedblleft.cm 27.778
+KPX f quotedblright 27.778
+KPX f quotedblright.cm 27.778
+KPX f quoteleft 27.778
+KPX f quoteright 27.778
+...
+KPX ff bracketright 27.778
+KPX ff exclam 27.778
+KPX ff parenright 27.778
+KPX ff question 27.778
+KPX ff quotedblleft 27.778
+KPX ff quotedblleft.cm 27.778
+KPX ff quotedblright 27.778
+KPX ff quotedblright.cm 27.778
+KPX ff quoteleft 27.778
+KPX ff quoteright 27.778
+...
+EndKernPairs
+EndKernData
+\stopnarrowtyping
+
+If you look closely at the names, you will notice that some glyphs have a
+variant. In \OPENTYPE\ fonts these variants are grouped in features like \type
+{oldstyle}. The first part of such a name is still part of the standardization,
+but the second part is up to the font designer.
+
+The file ends with:
+
+\startnarrowtyping
+EndFontMetrics
+\stopnarrowtyping
+
+\stopsection
+
+\startsection[title=The \type {otf} file,reference=fontdata:otf]
+
+In the \LUATEX\ manual you can find an overview of the raw \OTF\ format as
+exposed in a \LUA\ table. The first decade of \LUATEX\ we used the built|-|in
+loader but even then in \CONTEXT\ we didn't use that format directly but used it
+to create a more compact and efficient table instead. The current release of
+\CONTEXT\ uses its own loader written in \LUA, but the fundamentals have not
+changed much. The tables are cached and can be read in at high speed. The
+structure of the tables is unlikely to change much although more data might get
+added. Although you can access the data it seldom makes sense to do so. Where
+needed interfaces are provided.
+
+\stopsection
+
+\startsection[title=The \type {lfg} file,reference=fontdata:lua]
+
+We use the goodies file control what gets added, replaced, patched or manipulated
+in a font. A goodie file permits us to go beyond what font provide by default.
+The content of a goodie file differs per font. As we also use this for
+experiments, not all entries that you find in such files are meant for users.
+
+\stopsection
+
+\startsection[title=Used fonts]
+
+The examples in the document depend on the fonts used. Here is a list of fonts used
+to render this version. Because fonts might have changed in the meantime, some examples
+might come out other than intended.
+
+\startluacode
+local list = table.load("fonts-mkiv-usedfonts.lua")
+
+local NC, NR = context.NC, context.NR
+
+for i=1,#list do
+ local l = list[i]
+ context.starttabulate { "|lB|l|" }
+ local basename = string.lower(file.basename(l.filename))
+ local version = string.lower(l.version)
+ local filesize = (l.size or 0) / 1000 .. " Kb"
+ local instances = l.instances or 1
+ NC() context("filename") NC() context.type(basename) NC() NR()
+ NC() context("instances") NC() context.type(instances) NC() NR()
+ NC() context("filesize") NC() context.type(filesize) NC() NR()
+ NC() context("version") NC() context.type(version) NC() NR()
+ context.stoptabulate()
+end
+
+\stopluacode
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
+
diff --git a/doc/context/sources/general/fonts/fonts/fonts-environment.tex b/doc/context/sources/general/fonts/fonts/fonts-environment.tex
new file mode 100644
index 000000000..971da452d
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-environment.tex
@@ -0,0 +1,30 @@
+\startenvironment fonts-environment
+
+ \environment manuals-explaining-environment
+ \environment manuals-explaining-cover
+
+ \usemodule [s] [fonts-tables]
+ \usemodule [s] [fonts-missing]
+ \usemodule [s] [fonts-vectors]
+ \usemodule [s] [fonts-features]
+ \usemodule [s] [math-extensibles]
+
+ \definefontfeature[demo-onum][kern=yes,onum=yes]
+ %definefontfeature[demo-lnum][kern=yes,lnum=yes]
+ \definefontfeature[demo-tnum][kern=yes,tnum=yes]
+ \definefontfeature[demo-pnum][kern=yes,pnum=yes]
+ \definefontfeature[demo-zero][zero=yes]
+ \definefontfeature[demo-none][]
+
+ \definefont[DemoOnumLM][file:lmroman10-regular*demo-onum at 42pt]
+ %definefont[DemoLnumLM][file:lmroman10-regular*demo-lnum at 42pt]
+ \definefont[DemoTnumLM][file:lmroman10-regular*demo-tnum at 42pt]
+ \definefont[DemoPnumLM][file:lmroman10-regular*demo-pnum at 42pt]
+
+ \definefont[DemoZeroLM][file:lmroman10-regular*demo-zero at 42pt]
+ \definefont[DemoNoneLM][file:lmroman10-regular*demo-none at 42pt]
+
+ \definefont[DemoZeroLT][file:lmtypewriter10-regular*demo-zero at 42pt]
+ \definefont[DemoNoneLT][file:lmtypewriter10-regular*demo-none at 42pt]
+
+\stopenvironment
diff --git a/doc/context/sources/general/fonts/fonts/fonts-extensions.tex b/doc/context/sources/general/fonts/fonts/fonts-extensions.tex
new file mode 100644
index 000000000..2742b1ce0
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-extensions.tex
@@ -0,0 +1,2312 @@
+% language=uk
+
+\startcomponent fonts-extensions
+
+\environment fonts-environment
+
+\startchapter[title=Extensions][color=darkorange]
+
+\startsection[title=Introduction]
+
+One of the benefits of using \TEX\ is that you can add your own features and try
+to optimize the look and feel. Of course this can also go wrong and output can
+look pretty awful when you don't know what you're doing, but on the average it
+works out well. In many aspects the move to an \UNICODE\ data path and \OPENTYPE\
+fonts is a good one and solves a lot of problems with traditional \TEX\ engines
+and helps us to avoid complex and ugly hacks. But, if you look into the source
+code of \CONTEXT\ you will notice that there's still quite some complex coding
+needed. This is because we want to control mechanisms, even if it's only for
+dealing with some border cases. It's also the reason why \LUATEX\ is what it is:
+an extensible engine, building on tradition.
+
+As always with \TEX, fonts are an area where many tuning happens and this is also
+true in \CONTEXT. In this chapter some of the extensions will be discussed. Some
+extensions run on top of the (rather generic) feature mechanism and some are
+using dedicated code.
+
+\stopsection
+
+\startsection[title=Italics]
+
+Although \OPENTYPE\ fonts are more rich in features than traditional \TEX\ and
+\TYPEONE\ fonts, one important feature is missing: italic correction. This might
+sound strange but you need to keep in mind that in practice it's a feature that
+needs to be applied manually.
+
+\starttyping
+test {\it test\/} test
+\stoptyping
+
+It is possible to automate this mechanism and this is what the \type {\em} command
+does in \MKII:
+
+\starttyping
+test {\em test} test
+\stoptyping
+
+This command knows that it switches to italic (or slanted) and when used nested it
+knows to switch back. It also knows if a bold italic or slanted font is used. Therefore
+it can add italic correction between an italic and upright shape.
+
+An italic correction is bound to a glyph and bound to a font. In \in {figure}
+[latinmodern-italic] we see how an italic shape extends out of the bounding box.
+This is not the case in Dejavu: watch \in {figure} [dejavu-italic].
+
+\startplacefigure[reference=latinmodern-italic,title={Italic overshoot in Latin Modern.}]
+ \startcombination
+ \startcontent
+ \backgroundline[gray]{\color[maincolor]{\definedfont[lmroman10-regular*default sa 8]test}}
+ \stopcontent
+ \startcaption
+ Latin Modern Roman Regular
+ \stopcaption
+ \startcontent
+ \backgroundline[gray]{\color[maincolor]{\definedfont[lmroman10-italic*default sa 8]test}}
+ \stopcontent
+ \startcaption
+ Latin Modern Roman Italic
+ \stopcaption
+ \stopcombination
+\stopplacefigure
+
+\startplacefigure[reference=dejavu-italic,title={Italic overshoot in Dejavu Serif.}]
+ \startcombination
+ \startcontent
+ \backgroundline[gray]{\color[maincolor]{\definedfont[dejavuserif*default sa 8]test}}
+ \stopcontent
+ \startcaption
+ Dejavu Regular
+ \stopcaption
+ \startcontent
+ \backgroundline[gray]{\color[maincolor]{\definedfont[dejavuserifitalic*default sa 8]test}}
+ \stopcontent
+ \startcaption
+ Dejavu Italic
+ \stopcaption
+ \stopcombination
+\stopplacefigure
+
+This means that the application of italic correction should never been applied without
+knowing the font. In \in {figure} [italic-upright] we see an upright word following
+an italic. The space is determined by the upright one.
+
+\startplacefigure[reference=italic-upright,title={Italic followed by upright.}]
+ \startcombination
+ \startcontent
+ \backgroundline
+ [gray]
+ {\color[maincolor]{\definedfont[lmroman10-italic*default sa 4]test}
+ \color[maincolor]{\definedfont[lmroman10-regular*default sa 4]\space test}}
+ \stopcontent
+ \startcaption
+ Latin Modern
+ \stopcaption
+ \startcontent
+ \backgroundline
+ [gray]
+ {\color[maincolor]{\definedfont[dejavuserifitalic*default sa 4]test}%
+ \color[maincolor]{\definedfont[dejavuserif*default sa 4]\space test}}
+ \stopcontent
+ \startcaption
+ Dejavu
+ \stopcaption
+ \stopcombination
+\stopplacefigure
+
+Because it is to be used with care you need to enable this feature per font, You
+also need to explicitly enable the application of this correction. in \in {figure}
+[italic-one] we see italic correction in action.
+
+\startbuffer
+\definefontfeature
+ [italic]
+ [default]
+ [itlc=yes]
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+\startplacefigure[reference=italic-one,title={Italic correction.}]
+ \startcombination
+ \startcontent
+ \backgroundline
+ [maincolor]
+ {\color[white]{\definedfont[lmroman10-italic*default sa 4]test}
+ \color[white]{\definedfont[lmroman10-regular*default sa 4]\space test}}
+ \stopcontent
+ \startcaption
+ \backgroundline
+ [maincolor]
+ {\setupitaliccorrection[text]%
+ \color[white]{\definedfont[lmroman10-italic*italic sa 4]test}
+ \color[white]{\definedfont[lmroman10-regular*default sa 4]\space test}}
+ \stopcaption
+ \startcontent
+ \backgroundline
+ [maincolor]
+ {\color[white]{\definedfont[dejavuserifitalic*default sa 4]test}
+ \color[white]{\definedfont[dejavuserif*default sa 4]\space test}}
+ \stopcontent
+ \startcaption
+ \backgroundline
+ [maincolor]
+ {\setupitaliccorrection[text]%
+ \color[white]{\definedfont[dejavuserifitalic*italic sa 4]test}
+ \color[white]{\definedfont[dejavuserif*default sa 4]\space test}}
+ \stopcaption
+ \stopcombination
+\stopplacefigure
+
+This only signals the font constructor that additional italic information has
+to be added to the font metrics. As we already mentioned, the application of
+correction is driven by the \type {\/} primitive and that one consults the
+font metrics. Because the correction is not part of the original font
+metrics it is calculated automatically by adding a small value to the
+width. This value is calculated as follows:
+
+\starttyping
+factor * (parameters.uwidth or 40) / 2
+\stoptyping
+
+The \type {uwidth} parameter is sometimes part of the specification but if not, we
+take a reasonable default. The factor is under user control:
+
+\startbuffer
+\definefontfeature
+ [moreitalic]
+ [default]
+ [itlc=5]
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+This is demonstrated in \in {figure} [italic-two]. You will notice that for Latin
+Modern (any) correction makes sense, but for Dejavu it probably makes things look
+worse. This is why italic correction is disabled by default. When enabled there
+are several variants:
+
+\starttabulate[|Bl|l|]
+\NC global \NC always apply correction \NC \NR
+\NC text \NC only apply correction to text \NC \NR
+\NC always \NC apply correction between text and boxes \NC \NR
+\NC none \NC forget about correction \NC \NR
+\stoptabulate
+
+We keep track of the state using attributes but that comes at a (small) price in terms
+of extra memory and runtime. The \type {global} option simply assumes that we always
+need to check for correction (of course only for fonts that have this feature enables).
+In the given example we used:
+
+\starttyping
+\setupitaliccorrection
+ [text]
+\stoptyping
+
+You can combine keys:
+
+\starttyping
+\setupitaliccorrection
+ [global,always]
+\stoptyping
+
+\startplacefigure[reference=italic-two,title={Italic correction (factor 5).}]
+ \startcombination
+ \startcontent
+ \backgroundline
+ [maincolor]
+ {\color[white]{\definedfont[lmroman10-italic*default sa 4]test}
+ \color[white]{\definedfont[lmroman10-regular*default sa 4]\space test}}
+ \stopcontent
+ \startcaption
+ \backgroundline
+ [maincolor]
+ {\setupitaliccorrection[text]%
+ \color[white]{\definedfont[lmroman10-italic*italic sa 4]test}
+ \color[white]{\definedfont[lmroman10-regular*default sa 4]\space test}}
+ \stopcaption
+ \startcontent
+ \backgroundline
+ [maincolor]
+ {\color[white]{\definedfont[dejavuserifitalic*default sa 4]test}
+ \color[white]{\definedfont[dejavuserif*default sa 4]\space test}}
+ \stopcontent
+ \startcaption
+ \backgroundline
+ [maincolor]
+ {\setupitaliccorrection[text]%
+ \color[white]{\definedfont[dejavuserifitalic*italic sa 4]test}
+ \color[white]{\definedfont[dejavuserif*default sa 4]\space test}}
+ \stopcaption
+ \stopcombination
+\stopplacefigure
+
+The \type {itlc} feature controls if a font gets italic correction applied. In
+principle this is all that the user needs to do, given that the mechanism is
+enabled. These is an extra feature that controls the implementation:
+
+\starttabulate[|T|T|p|]
+\NC itlc \NC no \NC don't apply italic correction (default) \NC \NR
+\NC \NC yes \NC apply italic correction \NC \NR
+\NC textitalics \NC no \NC precalculate italic corrections (permit engine usage) \NC \NR
+\NC \NC yes \NC precalculate italic corrections (inhibit engine) \NC \NR
+\NC \NC delay \NC delay calculation of corrections \NC \NR
+\stoptabulate
+
+When \type {textitalics} is set to \type {yes} or \type {delay} the mechanism
+built into the engine is completely disabled. When set to \type {no} the engine
+can kick in but normally the alternative method takes precedence so that the
+engine sees no reason for further action. You can trace italic corrections with:
+
+\starttyping
+\enabletrackers[typesetters.italics]
+\stoptyping
+
+\stopsection
+
+\startsection[title=Bounding boxes]
+
+\startbuffer
+\definefontfeature
+ [withbbox]
+ [boundingbox=yes]
+
+\definefont
+ [FontWithBB]
+ [Normal*withbbox]
+\stopbuffer
+
+\start \getbuffer \FontWithBB
+
+There are some features that are rather useless and only make sense when figuring out
+issues. An example of such a feature is the following:
+
+\typebuffer
+
+This feature adds a background to each character in a font. In some fonts a glyph
+has a tight bounding box, while on other fonts some extra space is put on the left
+and right. Keep in mind that this feature blocks colored text.
+
+\par \stop
+
+\stopsection
+
+\startsection[title=Slanting]
+
+This features (as well as the one described in the next section) are seldom used
+but provided because they were introduced in \PDFTEX.
+
+\startbuffer[define]
+\definefontfeature
+ [abitslanted]
+ [default]
+ [slant=.1]
+
+\definefontfeature
+ [abitmoreslanted]
+ [default]
+ [slant=.2]
+\stopbuffer
+
+\startbuffer[sample]
+\definedfont[Normal*abitslanted]This is a bit slanted.
+\definedfont[Normal*abitmoreslanted]And this is a bit more slanted.
+\stopbuffer
+
+\typebuffer[define,sample]
+
+The result is:
+
+\getbuffer[define]
+
+\startlines
+\getbuffer[sample]
+\stoplines
+
+\stopsection
+
+\startsection[title=Extending]
+
+The second manipulation is extending the shapes horizontally:
+
+\startbuffer[define]
+\definefontfeature
+ [abitbolder]
+ [default]
+ [extend=1.3]
+
+\definefontfeature
+ [abitnarrower]
+ [default]
+ [extend=0.7]
+\stopbuffer
+
+\startbuffer[sample]
+\definedfont[Normal*abitbolder]This looks a bit bolder.
+\definedfont[Normal*abitnarrower]And this is a bit narrower.
+\stopbuffer
+
+\typebuffer[define,sample]
+
+The result is:
+
+\getbuffer[define]
+
+\startlines
+\getbuffer[sample]
+\stoplines
+
+We can also combine slanting and extending:
+
+\startbuffer[define]
+\definefontfeature
+ [abitofboth]
+ [default]
+ [extend=1.3,
+ slant=.1]
+\stopbuffer
+
+\startbuffer[sample]
+\definedfont[Normal*abitofboth]This is a bit bolder but also slanted.
+\stopbuffer
+
+\typebuffer[define,sample]
+
+If you remember those first needle matrix printers you might recognize the
+next rendering:
+
+\getbuffer[define]
+
+\startlines
+\getbuffer[sample]
+\stoplines
+
+\stopsection
+
+\startsection[title=Fixing] % dimensions
+
+This is a rather special one. First we show a couple of definitions:
+
+\startbuffer
+\definefontfeature
+ [dimensions-a]
+ [default]
+ [dimensions={1,1,1}]
+
+\definefontfeature
+ [dimensions-b]
+ [default]
+ [dimensions={1,2,3}]
+
+\definefontfeature
+ [dimensions-c]
+ [default]
+ [dimensions={1,3,2}]
+
+\definefontfeature
+ [dimensions-d]
+ [default]
+ [dimensions={3,3,3}]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+As usual you apply such a feature as follows:
+
+\starttyping
+\definefont[MyFont][Serif*dimensions-a sa 2]
+\stoptyping
+
+Alternatively you can use such a feature on its own:
+
+\starttyping
+\definefontfeature
+ [dimensions-333]
+ [dimensions={3,3,3}]
+\definefont[MyFont][Serif*default,dimensions-333 sa 2]
+\stoptyping
+
+In \in {figure} [dimensions-side-by-side] you see these four definitions in
+action. The leftmost rendering is the default rendering. The three numbers in the
+definitions represent the width (in em), height and depth (in ex).
+
+\startplacefigure[reference={dimensions-side-by-side},title={Freezing dimensions of glyphs.}]
+ \startcombination[5*1]
+ \startcontent \hbox to 7em {\hss\ruledhbox{\definedfont[Serif*default sa 2]g}\hss}\stopcontent \startcaption default \stopcaption
+ \startcontent \hbox to 7em {\hss\ruledhbox{\definedfont[Serif*dimensions-a sa 2]g}\hss}\stopcontent \startcaption \hbox{1em 1ex 1ex} \stopcaption
+ \startcontent \hbox to 7em {\hss\ruledhbox{\definedfont[Serif*dimensions-b sa 2]g}\hss}\stopcontent \startcaption \hbox{1em 2ex 3ex} \stopcaption
+ \startcontent \hbox to 7em {\hss\ruledhbox{\definedfont[Serif*dimensions-c sa 2]g}\hss}\stopcontent \startcaption \hbox{1em 3ex 2ex} \stopcaption
+ \startcontent \hbox to 7em {\hss\ruledhbox{\definedfont[Serif*dimensions-d sa 2]g}\hss}\stopcontent \startcaption \hbox{3em 3ex 3ex} \stopcaption
+ \stopcombination
+\stopplacefigure
+
+This feature only makes sense for fonts that need a fixed width, like the
+\CJK\ fonts that are used for asian scripts. Normally those fonts already
+have fixed dimensions, but this feature can be used to fix problematic
+fonts or add some more space. However, for such large fonts this also brings a
+larger memory footprint.
+
+A special case is the following:
+
+\startbuffer
+\definefontfeature
+ [dimensions-e]
+ [dimensions=strut]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+This will make the height and depth the same as the current strut height and depth:
+
+\startbuffer
+\ruledhbox{\definedfont[Serif*default,dimensions-e at 8pt]clipped}
+\ruledhbox{\definedfont[Serif*default,dimensions-e at 12pt]clipped}
+\ruledhbox{\definedfont[Serif*default,dimensions-e at 24pt]clipped}
+\stopbuffer
+
+\typebuffer
+
+The dimensions are (in this case) limited:
+
+\startlinecorrection[blank] \dontleavehmode \hpack{\maincolor\inlinebuffer} \stoplinecorrection
+
+\stopsection
+
+\startsection[title=Unicoding]
+
+Nowadays we will mostly use fonts that ship with a \UNICODE\ aware encoding. And
+in \CONTEXT, even if we use a \TYPEONE\ font, it gets mapped onto \UNICODE.
+However, there are some exceptions, for instance the Zapf Dingbats in \TYPEONE\
+format. These have a rather obscure private encoding and the glyph names run from
+\type {a1} upto \type {a206} and have no relation to what the glyph represents.
+
+In the case of Dingbats we're somewhat lucky that they ended up in \UNICODE, so
+we can relocate the glyphs to match their rightful place. This is done by means
+of a goodies file. We already discussed this in \in {section} [goodies] so we
+only repeat the usage.
+
+\startbuffer
+\definefontfeature
+ [dingbats]
+ [mode=base,
+ goodies=dingbats,
+ unicoding=yes]
+
+\definefontsynonym
+ [ZapfDingbats]
+ [file:uzdr.afm]
+ [features=dingbats]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+I tend to qualify the Dingbat font in \TEX\ distributions as rather unstable
+because of name changes and them either or not being included. Therefore it's best to
+use the hard coded name because that triggers the most visible error message when
+the font is not found.
+
+A font like this can for instance be used with the glyph placement macros as is
+demonstrated below. In the last line we see that a direct \UTF\ input also works
+out well.
+
+\starttabulate[|||T|]
+\HL
+\NC \type{\getglyphdirect {ZapfDingbats*dingbats}{\number"2701}} \NC \getglyphdirect {ZapfDingbats*dingbats}{\number"2701} \NC \NC \NR
+\NC \type{\getglyphdirect {ZapfDingbats*dingbats}{\char"2701}} \NC \getglyphdirect {ZapfDingbats*dingbats}{\char"2701} \NC \NC \NR
+\NC \type{\getnamedglyphdirect{ZapfDingbats*dingbats}{a1}} \NC \getnamedglyphdirect{ZapfDingbats*dingbats}{a1} \NC \NC \NR
+\NC \type{\getnamedglyphdirect{ZapfDingbats*dingbats}{a11}} \NC \getnamedglyphdirect{ZapfDingbats*dingbats}{a11} \NC \NC \NR
+\HL
+\NC \type{\getglyphdirect {ZapfDingbats}{\number"2701}} \NC \getglyphdirect {ZapfDingbats}{\number"2701} \NC unknown \NC \NR
+\NC \type{\getglyphdirect {ZapfDingbats}{\char"2701}} \NC \getglyphdirect {ZapfDingbats}{\char"2701} \NC unknown \NC \NR
+\NC \type{\getnamedglyphdirect{ZapfDingbats}{a1}} \NC \getnamedglyphdirect{ZapfDingbats}{a1} \NC \NC \NR
+\NC \type{\getnamedglyphdirect{ZapfDingbats}{a11}} \NC \getnamedglyphdirect{ZapfDingbats}{a11} \NC \NC \NR
+\HL
+\NC \type{\definedfont[ZapfDingbats*dingbats]✁} \NC \definedfont[ZapfDingbats*dingbats]✁ \NC \NC \NR
+\HL
+\stoptabulate
+
+Keep in mind that fonts like Dejavu (that we use here as document font) already
+has these characters which is why it shows up in the verbose part of the table.
+
+\stopsection
+
+\startsection[title=Protrusion]
+
+Protrusion is a feature that \LUATEX\ inherits from \PDFTEX. It is sometimes
+referred to as hanging punctuation but in our case any character qualifies. Also,
+hanging is not frozen but can be tuned in detail. Currently the engine defines
+protrusion in terms of the emwidth which is unfortunate and likely to change.
+\footnote {In general the low level implementation can be optimized as there are
+better mechanisms in \LUATEX.}
+
+It is sometimes believed that protrusion improves for instance narrower columns,
+but I'm pretty sure that this is not the case. It is true that it is taken into
+account when breaking a paragraph into lines, and that we then have a little bit
+more width available, but at the same time it is an extra constraint: if we
+protrude we have to do it for each line (and the whole main body of text) so it's
+just a different solution space. The main reason for applying this feature is
+{\em not} that the lines look better or that we get better looking narrow lines
+but that the right and left margins look nicer. Personally I don't like half
+protrusion of punctuation and hyphens. Best is to have small values for regular
+characters to improve the visual appearance and use full protrusion for hyphens
+(and maybe punctuation).
+
+\startsubsubject[title=protrusion classes]
+
+In \CONTEXT\ we've always defined protrusion as a percentage of the width of a
+glyph. From \MKII\ we inherit the level of control as well as the ability to
+define vectors. The shared properties are collected in so called classes and the
+character specific properties in vectors. The following classes are predefined:
+
+\showprotrusionclass
+
+The names are used in the definitions:
+
+\starttyping
+\definefontfeature[default][protrusion=quality]
+\stoptyping
+
+Currently adding a class only has a \LUA\ interface.
+
+\startbuffer
+\startluacode
+fonts.protrusions.classes.myown = {
+ vector = 'myown',
+ factor = 1,
+}
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\stopsubsubject
+
+\startsubsubject[title=protrusion vectors]
+
+Vectors are larger but not as large as you might expect. Only a subset of
+characters needs to be defined. This is because in practice only latin scripts
+are candidates and these scripts have glyphs that look a lot like each other. As
+we only operate on the horizontal direction characters like \quote
+{aàáâãäå} look the same from the left and right so we only have to define
+the protrusion for \quote {a}.
+
+As with classes, you can define your own vectors:
+
+\startbuffer
+\startluacode
+fonts.protrusions.vectors.myown = table.merged (
+ fonts.protrusions.vectors.quality,
+ {
+ [0x002C] = { 0, 2 }, -- comma
+ }
+)
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\stopsubsubject
+
+\startsubsubject[title=protrusion vector pure]
+ \showprotrusionvector[name=pure]
+\stopsubsubject
+
+\startsubsubject[title=protrusion vector punctuation]
+ \showprotrusionvector[name=punctuation]
+\stopsubsubject
+
+\startsubsubject[title=protrusion vector alpha]
+ \showprotrusionvector[name=alpha]
+\stopsubsubject
+
+\startsubsubject[title=protrusion vector quality]
+ \showprotrusionvector[name=quality]
+\stopsubsubject
+
+\startsubsubject[title=examples of protrusion]
+
+Next we show the quality protrusion. For this we use \type {tufte.tex} as
+this one for sure will result in punctuation and other candidates for
+protrusion.
+
+\startbuffer[define]
+\definefontfeature
+ [whatever]
+ [default]
+ [protrusion=quality]
+
+\definefont[MyTestA][Serif*default at 10pt]
+\definefont[MyTestB][Serif*whatever at 10pt]
+\stopbuffer
+
+\startbuffer[example]
+\startoverlay
+ {\ruledvbox \bgroup
+ \hsize\textwidth
+ \MyTestA
+ \setupalign[normal]
+ \input{tufte}
+ \egroup}
+ {\ruledvbox \bgroup
+ \hsize\textwidth
+ \MyTestB
+ \setupalign[hanging,normal]
+ \maincolor
+ \input{tufte}
+ \egroup}
+\stopoverlay
+\stopbuffer
+
+\typebuffer[define]
+\getbuffer [define]
+
+We use the following example. The results are shown in \in {figure}
+[protrusion:quality]. The colored text is the protruding one.
+
+\typebuffer[example]
+
+\startplacefigure[reference=protrusion:quality,title=The difference between no protrusion and quality protrusion.]
+ \getbuffer [example]
+\stopplacefigure
+
+The previously defined own class and vector is somewhat more extreme:
+
+\startbuffer[define]
+\definefontfeature
+ [whatever]
+ [default]
+ [protrusion=myown]
+
+\definefont[MyTestA][Serif*default at 10pt]
+\definefont[MyTestB][Serif*whatever at 10pt]
+\stopbuffer
+
+\typebuffer[define]
+\getbuffer [define]
+
+In \in {figure} [protrusion:myown] we see that the somewhat extreem definition of
+the comma also pulls the preceding character into the margin.
+
+\startplacefigure[reference=protrusion:myown,title=The influence of extreme protrusion on preceding characters.]
+ \getbuffer [example]
+\stopplacefigure
+
+\stopsection
+
+\startsection[title=Expansion]
+
+Expansion is also an inheritance of \PDFTEX. \footnote {As with protrusion the
+implementation in the engine is somewhat suboptimal and inefficient and will be
+upgraded to a more \LUATEX-ish way.} This mechanism selectively expands
+characters, normally upto 5\%. One reason for applying it is that we have less
+visually incompatible spacing, especially when we have underfull or cramped
+lines. For each (broken) line the badness is reconsidered with either shrink or
+stretch applied to all characters in that line. So, in the worst case a shrunken
+line is followed by a stretched one and that can be visible when the scaling
+factors are chosen wrong.
+
+As with protrusion, the solution space is larger but so are the constraints. But
+contrary to protrusion here the look and feel of the whole line can be made
+better but at the cost of much more runtime and larger (\PDF) files.
+
+\startsubsubject[title=protrusion classes]
+
+The amount of expansion depends in the shape of the character. Vertical strokes
+are more sensitive for expansion then horizontal ones. So an \quote {o} can
+get a different scaling than an \quote {m}. As with protrusion we have collected
+the properties in classes:
+
+\showexpansionclass
+
+The smaller the step, the more instances of a font we get, the better it
+looks, and the larger the files become. it's best not to use too many stretch
+and shrink steps. A stretch of 2 and shrink of 2 and step of .25 results in
+upto 8~instances plus the regular sized one.
+
+\stopsubsubject
+
+\startsubsubject[title=expansion vectors]
+
+We only have one vector: \type {quality}:
+
+\showexpansionvector[name=quality]
+
+\stopsubsubject
+
+\startsubsubject[title=an example of expansion]
+
+We use \type {zapf.tex} as example text, if only because Hermann Zapf introduced
+this optimization. Keep in mind that you can combine expansion and protrusion.
+
+\startbuffer[define]
+\definefontfeature
+ [whatever]
+ [default]
+ [expansion=quality]
+
+\definefont[MyTestA][Serif*default at 10pt]
+\definefont[MyTestB][Serif*whatever at 10pt]
+\stopbuffer
+
+\startbuffer[example]
+\startoverlay
+ {\ruledvbox \bgroup
+ \hsize\textwidth
+ \MyTestA
+ \setupalign[normal]
+ \input{tufte}
+ \egroup}
+ {\ruledvbox \bgroup
+ \hsize\textwidth
+ \MyTestB
+ \setupalign[hz,normal]
+ \maincolor
+ \input{tufte}
+ \egroup}
+\stopoverlay
+\stopbuffer
+
+\typebuffer[define]
+\getbuffer [define]
+
+We use the following example. The results are shown in \in {figure}
+[expansion:quality]. The colored text is the protruding one.
+
+\typebuffer[example]
+
+\startplacefigure[reference=expansion:quality,title=The difference between no expansion and quality expansion.]
+ \getbuffer [example]
+\stopplacefigure
+
+\startsubsubject[title=Expansion and kerning]
+
+When we expand glyphs we also need to look at the font kerns between them. In the
+original implementation taken from \PDFTEX\ expansion was implemented using pseudo
+fonts (with expanded glyph widths) and expansion of inter|-|character kerns was
+based on font information. In \LUATEX\ we have expansion factors in glyph nodes
+instead which is more efficient and gives a cleaner separation between front- and
+backend as the backend has no need to consult the font.
+
+For the font kerns we set the kern compensation directly and for that we use the
+average expansion factors of the neighbouring fonts so technically we support
+kerns between different fonts). This also has the advantage that kerns injected
+in node mode are treated well, given that they are tagged as font kern.
+
+So what is the effect (and need) of scaling font kerns? Let's look at an example.
+Kerns can be positive but also negative:
+
+\startlinecorrection
+\startcombination
+ {\vbox {
+ \forgetall
+ \hpack to 3cm{\hss\ruledhbox{\maincolor V\kern-1ptA}\hss}
+ \hpack to 3cm{\hss\ruledhbox{\maincolor V\kern 0ptA}\hss}
+ }} {negative}
+ {\vbox {
+ \forgetall
+ \hpack to 3cm{\hss\ruledhbox{\maincolor I\kern.25ptI}\hss}
+ \hpack to 3cm{\hss\ruledhbox{\maincolor I\kern 0ptI}\hss}
+ }} {positive}
+\stopcombination
+\stoplinecorrection
+
+If we use a rediculous amount of stretch we get the following. In the top line we
+scale the kern, in the bottom line we don't.
+
+\startlinecorrection
+\startcombination
+ {\vbox {
+ \definedfont[file:texgyrepagella-regular.otf at 12pt]%
+ \forgetall
+ \hpack to 3cm{\maincolor \hss\strut \scale[xscale=5000]{V}\kern-5pt\scale[xscale=5000]{A}\hss}
+ \hpack to 3cm{\maincolor \hss\strut \scale[xscale=5000]{V}\kern-1pt\scale[xscale=5000]{A}\hss}
+ }} {negative}
+ {\vbox {
+ \definedfont[file:texgyrepagella-regular.otf at 12pt]%
+ \forgetall
+ \hpack to 3cm{\maincolor \hss\strut \scale[xscale=5000]{I}\kern1.25pt\scale[xscale=5000]{I}\hss}
+ \hpack to 3cm{\maincolor \hss\strut \scale[xscale=5000]{I}\kern0.25pt\scale[xscale=5000]{I}\hss}
+ }} {positive}
+\stopcombination
+\stoplinecorrection
+
+The reason that we mention this is that when we apply \OPENTYPE\ features,
+positioning not necessarily result in font kerns. For instance ligatures can be
+the result of careful applied kerns and in some scripts kerns are used to connect
+glyphs. This means that we best cannot expand kerns by default. How bad is
+that? By looking at the examples above one would say \quotation {real bad}.
+
+But say that we have about 1pt of font kerns, then a 5\% expansion (which is
+already a lot) amounts to 0.05pt so to \blackrule [width=1pt, height=max,
+depth=max] we add \blackrule [width=.05pt, height=max, depth=max] which is so
+little that it probably goes unnoticed. Even if we use extreme kerns, as between
+VA, in practice the small amount of stretch or shrink added to a font kern goes
+unnoticed.
+
+In \in {figure} [hz:natural] we have overlayed the different strategies. The
+sample and width is chosen such that we see something. On a display you can
+scale up these examples and inspect if there is really something to see,
+but on paper zooming in helps, as in \in {figure} [hz:zoomed]. Even then the
+effect of expanded kerns is invisible. The used definitions are:
+
+\definecolor[hz:test:tr][r=1,a=1,t=.5]
+\definecolor[hz:test:tg][g=1,a=1,t=.5]
+\definecolor[hz:test:tb][b=1,a=1,t=.5]
+
+\startbuffer
+\setupfontexpansion
+ [extremehz]
+ [stretch=5,shrink=5,step=.5,vector=default,factor=1]
+\setupfontexpansion
+ [regularhz]
+ [stretch=2,shrink=2,step=.5,vector=default,factor=1]
+\setupfontexpansion
+ [minimalhz]
+ [stretch=2,shrink=2,step=.5,vector=default,factor=.5]
+
+\definefontfeature
+ [extremehz] [default]
+ [mode=node,expansion=extremehz]
+\definefontfeature
+ [regularhz] [default]
+ [mode=node,expansion=regularhz]
+\definefontfeature [minimalhz] [default]
+ [mode=node,expansion=minimalhz]
+
+\definefont
+ [ExtremeHzFont]
+ [file:texgyrepagella-regular.otf*extremehz at 10pt]
+\definefont
+ [RegularHzFont]
+ [file:texgyrepagella-regular.otf*regularhz at 10pt]
+\definefont
+ [MinimalHzFont]
+ [file:texgyrepagella-regular.otf*minimalhz at 10pt]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\edef\HzSampleText{\cldloadfile{ward}}
+
+\def\NoHzSample {\vbox{\hsize 10cm \color[hz:test:tr]{\setupalign [nohz]\HzSampleText\par}}}
+\def\HzSample {\vbox{\hsize 10cm \color[hz:test:tg]{\setupalign [hz]\HzSampleText\par}}}
+\def\FullHzSample{\vbox{\hsize 10cm \color[hz:test:tb]{\setupalign[fullhz]\HzSampleText\par}}}
+
+\startplacefigure[reference=hz:natural,title={The two expansion methods compared.}]
+ \showfontkerns
+ \dontcomplain
+ \enabledirectives[fonts.injections.fontkern]
+ \startcombination[1*3]
+ {\ExtremeHzFont\ruledhpack{\startoverlay {\NoHzSample} {\HzSample } \stopoverlay}} {no hz \& hz}
+ {\ExtremeHzFont\ruledhpack{\startoverlay {\NoHzSample} {\FullHzSample} \stopoverlay}} {no hz \& full hz}
+ {\ExtremeHzFont\ruledhpack{\startoverlay {\HzSample } {\FullHzSample} \stopoverlay}} {hz \& full hz}
+ \stopcombination
+ \disabledirectives[fonts.injections.fontkern]
+\stopplacefigure
+
+\startplacefigure[reference=hz:zoomed,title={The two expansion methods compared (zoomed in).}]
+ \showfontkerns
+ \dontcomplain
+ \enabledirectives[fonts.injections.fontkern]
+ \startcombination[3*3]
+
+ {\ExtremeHzFont
+ \clip[nx=6,ny=5,x=2,y=2,sx=2]{\startoverlay {\NoHzSample} {\HzSample } \stopoverlay}} {extreme: no hz \& hz}
+ {\ExtremeHzFont
+ \clip[nx=6,ny=5,x=2,y=2,sx=2]{\startoverlay {\NoHzSample} {\FullHzSample} \stopoverlay}} {extreme: no hz \& full hz}
+ {\ExtremeHzFont
+ \clip[nx=6,ny=5,x=2,y=2,sx=2]{\startoverlay {\HzSample } {\FullHzSample} \stopoverlay}} {extreme: hz \& full hz}
+
+ {\RegularHzFont
+ \clip[nx=6,ny=5,x=2,y=2,sx=2]{\startoverlay {\NoHzSample} {\HzSample } \stopoverlay}} {regular: no hz \& hz}
+ {\RegularHzFont
+ \clip[nx=6,ny=5,x=2,y=2,sx=2]{\startoverlay {\NoHzSample} {\FullHzSample} \stopoverlay}} {regular: no hz \& full hz}
+ {\RegularHzFont
+ \clip[nx=6,ny=5,x=2,y=2,sx=2]{\startoverlay {\HzSample } {\FullHzSample} \stopoverlay}} {regular: hz \& full hz}
+
+ {\MinimalHzFont
+ \clip[nx=6,ny=5,x=2,y=2,sx=2]{\startoverlay {\NoHzSample} {\HzSample } \stopoverlay}} {minimal: no hz \& hz}
+ {\MinimalHzFont
+ \clip[nx=6,ny=5,x=2,y=2,sx=2]{\startoverlay {\NoHzSample} {\FullHzSample} \stopoverlay}} {minimal: no hz \& full hz}
+ {\MinimalHzFont
+ \clip[nx=6,ny=5,x=2,y=2,sx=2]{\startoverlay {\HzSample } {\FullHzSample} \stopoverlay}} {minimal: hz \& full hz}
+
+ \stopcombination
+ \disabledirectives[fonts.injections.fontkern]
+\stopplacefigure
+
+In \CONTEXT\ the \type {hz} alignment option only enables expansion of glyphs, while \type
+{fullhz} also applies it to kerns. However, in the examples here we had to explicitly enable
+font kerns in node mode:
+
+\starttyping
+\enabledirectives[fonts.injections.fontkern]
+\stoptyping
+
+It will be clear that you can just stick to using the \type {hz} directive (if
+you want expansion at all) because this directive is normally disabled and
+because most fonts are processed in node mode.
+
+\stopsubsubject
+
+\stopsection
+
+\startsection[title=Composing]
+
+This feature is seldom needed but can come in handy for old fonts or when
+some special language is to be supported. When writing this section I tested
+this feature with Dejavu and only two additional characters were added:
+
+\definefontfeature
+ [default-plus-compose]
+ [compose=yes]
+
+\definefont
+ [MyComposedSerif]
+ [Serif*default-plus-compose]
+
+% we need to cheat a bit as we don't have the main character in mono
+
+\startlines \MyComposedSerif
+\type{fonts > combining > }\hbox to .5em{\hss Ѷ\hss}\type{ (U+00476) = }\hbox to .5em{\hss Ѵ\hss}\type{ (U+00474) + ̏ (U+0030F)}
+\type{fonts > combining > }\hbox to .5em{\hss ѷ\hss}\type{ (U+00477) = }\hbox to .5em{\hss ѵ\hss}\type{ (U+00475) + ̏ (U+0030F)}
+\stoplines
+
+This trace showed up after giving:
+
+\starttyping
+\enabletrackers
+ [fonts.composing.define]
+
+\definefontfeature
+ [default-plus-compose]
+ [compose=yes]
+
+\definefont
+ [MyFont]
+ [Serif*default-plus-compose]
+\stoptyping
+
+Fonts like Latin Modern have lots of glyphs but still lack some. Although the
+composer can add some of the missing, some of those new virtual glyphs probably
+will never look real good. For instance, putting additional accents on top of
+already accented uppercase characters will fail when that character has a rather
+tight (or even clipped) boundingbox in order not to spoil the lineheight. You can
+get some more insight in the process by turning on tracing:
+
+\starttyping
+\enabletrackers[fonts.composing.visualize]
+\stoptyping
+
+One reason why composing can be suboptimal is that it uses the boundingbox of the
+characters that are combined. If you really depend on a specific font and need
+some of the missing characters it makes sense to spend some time on optimizing
+the rendering. This can be done via the goodies mechanism. As an example we've
+added \type {lm-compose-test.lfg} to the distribution. First we show how it
+looks at the \TEX\ end:
+
+\startbuffer
+\enabletrackers[fonts.composing.visualize]
+
+\definefontfeature
+ [default-plus-compose]
+ [compose=yes]
+
+\loadfontgoodies
+ [lm-compose-test] % playground
+
+\definefont
+ [MyComposedSerif]
+ [file:lmroman10regular*default-plus-compose at 48pt]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\blank
+\backgroundline
+ [halfcolor]
+ {\MyComposedSerif B\quad\char"1E02\quad\char"1E04}
+\blank
+
+The positions of the dot accents on top and below the capital B is defined
+in a goodie file:
+
+\starttyping
+return {
+ name = "lm-compose-test",
+ version = "1.00",
+ comment = "Goodies that demonstrate composition.",
+ author = "Hans and Mojca",
+ copyright = "ConTeXt development team",
+ compositions = {
+ ["lmroman12-regular"] = compose,
+ }
+}
+\stoptyping
+
+As this is an experimental feature there are several ways to deal with
+this. For instance:
+
+\starttyping
+local defaultfraction = 10.0
+
+local compose = {
+ dy = defaultfraction,
+ [0x1E02] = { -- B dot above
+ dy = 150
+ },
+ [0x1E04] = { -- B dot below
+ dy = 150
+ },
+}
+\stoptyping
+
+Here the fraction is relative to the difference between the height of the
+accentee and the accent. A better solution is the following:
+
+\starttyping
+local compose = {
+ [0x1E02] = { -- B dot above
+ anchored = "top",
+ },
+ [0x1E04] = { -- B dot below
+ anchored = "bottom",
+ },
+ [0x0042] = { -- B
+ anchors = {
+ top = {
+ x = 300, y = 700,
+ },
+ bottom = {
+ x = 300, y = -30,
+ },
+ },
+ },
+ [0x0307] = {
+ anchors = {
+ top = {
+ x = -250, y = 550,
+ },
+ },
+ },
+ [0x0323] = {
+ anchors = {
+ bottom = {
+ x = -250, y = -80,
+ },
+ },
+ },
+}
+\stoptyping
+
+This approach is more or less the same as \OPENTYPE\ anchoring. It takes a bit
+more effort to define these tables but the result is better.
+
+\stopsection
+
+\startsection[title=Kerning]
+
+Inter|-|character kerning is not supported at the font level and with good
+reason. The fact that something is conceptually possible doesn't mean that we
+should use or support it. Normally proper kerning (or the lack of it) is part
+of a font design and for some scripts different kerning is not even an option.
+
+On the average \TEX\ does a proper job on justification but not all programs
+are that capable. As a consequence designers (at least we ran into it) tend to
+stick to flush left rendering because they don't trust their system to do a
+proper job otherwise. On the other hand they seem to have no problem with
+messing up the inter|-|character spacing and even combine that with excessive
+inter|-|word spacing {\em if} they want to achieve justification (without
+hyphenation). And it can become even worse when extreme glyph expansion (like
+hz) is applied.
+
+Anyhow, it will be clear that consider messing with properties like kerning that
+are part of the font design is to be done careful.
+
+\definecharacterkerning [extremekerning] [factor=.125]
+
+\start \setcharacterkerning[extremekerning]
+
+For running text additional kerning makes no sense. It not only looks
+bad, it also spoils the grayness of a text. When it is applied we need
+to deal with special cases. For instance ligatures make no sense so they
+should be disabled. Additional kerning should relate to already present
+kerning and interword spacing should be adapted accordingly. Embedded
+non|-|characters also need to be treated well.
+
+\par \stop
+
+This paragraph was typeset as follows:
+
+\starttyping
+\definecharacterkerning [extremekerning] [factor=.125]
+
+\setcharacterkerning[extremekerning] ... text ...
+\stoptyping
+
+Where additional kerning can make sense, is in titles. The previous
+command can do that job. In addition we have a mechanism that
+fills a given space. This mechanism uses the following definition:
+
+\starttyping
+\setupcharacterkerning
+ [stretched]
+ [factor=max,
+ width=\availablehsize]
+\stoptyping
+
+\startbuffer
+\stretched{\bfd to the limit}
+\stopbuffer
+
+\typebuffer
+
+\blank \start \color[maincolor]{\getbuffer} \stop \blank
+
+The following does not work:
+
+\startbuffer
+\ruledhbox to 5cm{\stretched{\bfd to the limit}}
+\stopbuffer
+
+\typebuffer
+
+\blank \start \color[maincolor]{\getbuffer} \stop \blank
+
+But this works ok:
+
+\startbuffer
+\setupcharacterkerning
+ [stretched]
+ [width=]
+
+\stretched{\bfd to the limit}
+\stopbuffer
+
+\typebuffer
+
+\blank \start \color[maincolor]{\getbuffer} \stop \blank
+
+You can also say this:
+
+\startbuffer
+\stretched[width=]{\bfd to the limit}
+\stopbuffer
+
+\typebuffer
+
+\blank \start \color[maincolor]{\getbuffer} \stop \blank
+
+or:
+
+\startbuffer
+\ruledhbox{\stretched[width=10cm]{\bfd to the limit}}
+\stopbuffer
+
+\typebuffer
+
+\blank \start \color[maincolor]{\getbuffer} \stop \blank
+
+You can get some insight in what kerning does to your font by the following
+command:
+
+\startbuffer
+\usemodule[typesetting-kerning]
+
+\starttext
+ \showcharacterkerningsteps
+ [style=Bold,
+ sample=how to violate a proper font design,
+ text=rubish,
+ first=0,
+ last=45,
+ step=5]
+\stoptext
+\stopbuffer
+
+\typebuffer
+
+\blank \getbuffer \blank
+
+\stopsection
+
+\startsection[title=Ligatures]
+
+For some Latin fonts ligature building is quite advanced, take Unifraktur. I have no
+problem admitting that I find fraktur hard to read, but this one actually is sort of
+an exception. It's also a good candidate for a screen presentation where you mainly
+made notes for yourself: no one has to read it, but it looks great, especially if
+you consider it to be drawn by a pen.
+
+Anyway, we will use the following code as example (based on some remarks on the
+fonts website).
+
+\startbuffer[sample]
+sitzen / ſitzen / effe fietsen / ch ck ſt tz ſi fi
+\stopbuffer
+
+\typebuffer[sample]
+
+Some ligatures are implemented in the usual way, using the \type {liga} and \type {dlig}
+features, others kick in thanks to \type {ccmp}. This fact alone is an illustration that
+the low level \OPENTYPE\ ligature feature is not related to ligatures at all but a more
+generic mechanism: you can basically combine multiple shapes into one in all features
+exposed to the user.
+
+We define a bunch of specific feature sets:
+
+\startbuffer
+\definefontfeature
+ [unifraktur-a]
+ [default]
+\definefontfeature
+ [unifraktur-b]
+ [default]
+ [goodies=unifraktur,keepligatures=yes]
+\definefontfeature
+ [unifraktur-c]
+ [default]
+ [ccmp=yes]
+\definefontfeature
+ [unifraktur-d]
+ [default]
+ [ccmp=yes,goodies=unifraktur,keepligatures=yes]
+\definefontfeature
+ [unifraktur-e]
+ [default]
+ [liga=no,rlig=no,clig=no,dlig=no,ccmp=yes,keepligatures=auto]
+\stopbuffer
+
+\getbuffer \typebuffer
+
+and also some fonts:
+
+\startbuffer
+\definefont[TestA][UnifrakturCook*unifraktur-a sa 0.9]
+\definefont[TestB][UnifrakturCook*unifraktur-b sa 0.9]
+\definefont[TestC][UnifrakturCook*unifraktur-c sa 0.9]
+\definefont[TestD][UnifrakturCook*unifraktur-d sa 0.9]
+\definefont[TestE][UnifrakturCook*unifraktur-e sa 0.9]
+\stopbuffer
+
+\getbuffer \typebuffer
+
+We show these five alternatives here:
+
+\starttabulate[|T||]
+\NC liga \NC \TestA\getbuffer[sample] \NC \NR
+\NC liga + keepligatures \NC \TestB\getbuffer[sample] \NC \NR
+\NC liga + ccmp \NC \TestC\getbuffer[sample] \NC \NR
+\NC liga + ccmp + keepligatures \NC \TestD\getbuffer[sample] \NC \NR
+\NC ccmp + keepligatures \NC \TestE\getbuffer[sample] \NC \NR
+\stoptabulate
+
+The real fun starts when we want to add extra spacing between characters. Some
+ligatures need to get broken and some kept.
+
+\startbuffer
+\setupcharacterkerning[kerncharacters][factor=0.5]
+\setupcharacterkerning[letterspacing] [factor=0.5]
+\stopbuffer
+
+\getbuffer \typebuffer
+
+\enabletrackers[typesetters.kerns.ligatures]
+
+Next we will see how ligatures behave depending on how the mechanisms are set
+up. The colors indicate what trickery is used:
+
+\starttabulate[|T||]
+\NC \color[darkred] {red} \NC kept by dynamic feature \NC \NR
+\NC \color[darkgreen]{green} \NC kept by static feature \NC \NR
+\NC \color[darkblue] {blue} \NC keep by goodie \NC \NR
+\stoptabulate
+
+First we use \type {\kerncharacters}:
+
+\starttabulate[|T||]
+\NC liga \NC \kerncharacters {\TestA\getbuffer[sample]} \NC \NR
+\NC liga + keepligatures \NC \kerncharacters {\TestB\getbuffer[sample]} \NC \NR
+\NC liga + ccmp \NC \kerncharacters {\TestC\getbuffer[sample]} \NC \NR
+\NC liga + ccmp + keepligatures \NC \kerncharacters {\TestD\getbuffer[sample]} \NC \NR
+\NC ccmp + keepligatures \NC \kerncharacters {\TestE\getbuffer[sample]} \NC \NR
+\stoptabulate
+
+In the next example we use \type {\letterspacing}:
+
+\starttabulate[|T||]
+\NC liga \NC \letterspacing {\TestA\getbuffer[sample]} \NC \NR
+\NC liga + keepligatures \NC \letterspacing {\TestB\getbuffer[sample]} \NC \NR
+\NC liga + ccmp \NC \letterspacing {\TestC\getbuffer[sample]} \NC \NR
+\NC liga + ccmp + keepligatures \NC \letterspacing {\TestD\getbuffer[sample]} \NC \NR
+\NC ccmp + keepligatures \NC \letterspacing {\TestE\getbuffer[sample]} \NC \NR
+\stoptabulate
+
+\disabletrackers[typesetters.kerns.ligatures]
+
+The difference is that the letterspacing variant dynamically adds the predefined
+featureset \type {letterspacing} which is defined in a similar way as \type
+{unifraktur-e}. In the case of this font, this variant is the better one to use.
+In fact, this variant probably works okay with most fonts. However, by not hard
+coding this behaviour we keep control, as one never knows what the demands are.
+When no features are used, information from the (given) goodie file \type
+{unifraktur.lfg} is consulted:
+
+\starttyping
+letterspacing = {
+ -- watch it: zwnj's are used (in the tounicodes too)
+ keptligatures = {
+ ["c_afii301_k.ccmp"] = true, -- ck
+ ["c_afii301_h.ccmp"] = true, -- ch
+ ["t_afii301_z.ccmp"] = true, -- tz
+ ["uniFB05"] = true, -- ſt
+ },
+}
+\stoptyping
+
+These kick in when we don't disable ligatures by setting features (case~e).
+
+There are two pseudo features that can help us out when a font doesn't provide
+the wanted ligatures but has the right glyphs for building them. The \UNICODE\
+database has some information about how characters can be (de)composed and we can
+use that information to create virtual glyphs:
+
+\starttyping
+\definefontfeature
+ [default] [default]
+ [char-ligatures=yes,mode=node]
+\stoptyping
+
+and:
+
+\starttyping
+\definefontfeature
+ [default] [default]
+ [compat-ligatures=yes,mode=node]
+\stoptyping
+
+This feature was added after some discussion on the \CONTEXT\ mailing list about
+the following use case.
+
+\startbuffer
+\definefontfeature
+ [default-l] [default]
+ [char-ligatures=yes,
+ compat-ligatures=yes,
+ mode=node]
+
+\definefont[LigCd][cambria*default]
+\definefont[LigPd][texgyrepagellaregular*default]
+\definefont[LigCl][cambria*default-l]
+\definefont[LigPl][texgyrepagellaregular*default-l]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+These definitions result in:
+
+\starttabulate[|l|l|l|l|l|]
+\NC \NC \type {\LigCd} \NC \type {\LigPd} \NC \type {\LigCl} \NC \type {\LigPl} \NC \NR
+\NC \type{PEL·LÍCULES} \NC \LigCd PEL·LÍCULES \NC \LigPd PEL·LÍCULES \NC \LigCl PEL·LÍCULES \NC \LigPl PEL·LÍCULES \NC \NR
+\NC \type{pel·lícules} \NC \LigCd pel·lícules \NC \LigPd pel·lícules \NC \LigCl pel·lícules \NC \LigPl pel·lícules \NC \NR
+\NC \type{PEĿLÍCULES} \NC \LigCd PEĿLÍCULES \NC \LigPd PEĿLÍCULES \NC \LigCl PEĿLÍCULES \NC \LigPl PEĿLÍCULES \NC \NR
+\NC \type{peŀlícules} \NC \LigCd peŀlícules \NC \LigPd peŀlícules \NC \LigCl peŀlícules \NC \LigPl peŀlícules \NC \NR
+\stoptabulate
+
+Of course one can wonder is this is the right approach and if it's not better to
+use a font that provides the needed characters in the first place.
+
+\stopsection
+
+\startsection[title=New features]
+
+\startsubsection[title=Substitution]
+
+It is possible to add new features via \LUA. Here is an example of a single
+substitution:
+
+\startbuffer
+\startluacode
+ fonts.handlers.otf.addfeature {
+ name = "stest",
+ type = "substitution",
+ data = {
+ a = "X",
+ b = "P",
+ }
+ }
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We show an overview at the end of this section, but here is a simple example
+already. You need to define the feature before defining a font because otherwise
+the font will not know about it.
+
+\startbuffer
+\definefontfeature[stest][stest=yes]
+\definedfont[file:dejavu-serifbold.ttf*default]
+abracadabra: \addff{stest}abracadabra
+\stopbuffer
+
+\typebuffer \start \blank \maincolor \getbuffer \blank \stop
+
+Instead of (more readable) glyph names you can also give \UNICODE\ numbers:
+
+\starttyping
+\startluacode
+ fonts.handlers.otf.addfeature {
+ name = "stest",
+ type = "substitution",
+ data = {
+ [0x61] = 0x58
+ [0x62] = 0x50
+ }
+ }
+\stopluacode
+\stoptyping
+
+The definition is quite simple: we just map glyph names (or unicodes) onto
+other ones. An alternate is also possible:
+
+\startbuffer
+\startluacode
+ fonts.handlers.otf.addfeature {
+ name = "atest",
+ type = "alternate",
+ data = {
+ a = { "X", "Y" },
+ b = { "P", "Q" },
+ }
+ }
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Less useful is a multiple substitution. Normally this one is part of a chain of
+replacements.
+
+\startbuffer
+\startluacode
+ fonts.handlers.otf.addfeature {
+ name = "mtest",
+ type = "multiple",
+ data = {
+ a = { "X", "Y" },
+ b = { "P", "Q" },
+ }
+ }
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+A ligature (or multiple to one) is also possible but normally only makes sense when
+there is indeed a ligature. We use a similar definition for mapping the \TEX\ input
+sequence \type {---} onto an \emdash.
+
+\startbuffer
+\startluacode
+ fonts.handlers.otf.addfeature {
+ name = "ltest",
+ type = "ligature",
+ data = {
+ ['1'] = { "a", "b" },
+ ['2'] = { "d", "a" },
+ }
+ }
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\stopsubsection
+
+\startsubsection[title=Positioning]
+
+You can define a kern feature too but when doing so you need to use measures in
+font units.
+
+\startbuffer
+\startluacode
+ fonts.handlers.otf.addfeature {
+ name = "ktest",
+ type = "kern",
+ data = {
+ a = { b = -500 },
+ }
+ }
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Pairwise positioning is more complex and involves two (optional) arrays
+that specify \type {{dx dy wd ht}} for each of the two glyphs. In the next
+example we only displace the second glyph.
+
+\startbuffer
+\startluacode
+ fonts.handlers.otf.addfeature {
+ name = "ptest",
+ type = "pair",
+ data = {
+ ["a"] = { ["b"] = { false, { -1000, 1200, 0, 0 } } },
+ }
+ }
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Of course you need to know a bit about the metrics of the glyphs involved so in
+practice this boils down to trial and error.
+
+\stopsubsection
+
+\startsubsection[title=Examples]
+
+We didn't show usage yet. This is because we need to define a feature before we
+define a font. New features will be added to a font when it gets defined.
+
+\startbuffer
+\definefontfeature[stest][stest=yes]
+\definefontfeature[atest][atest=2]
+\definefontfeature[mtest][mtest=yes]
+\definefontfeature[ltest][ltest=yes]
+\definefontfeature[ktest][ktest=yes]
+\definefontfeature[ptest][ptest=yes]
+\definefontfeature[ctest][ctest=yes]
+
+\definedfont[file:dejavu-serif.ttf*default]
+
+\starttabulate[|l|l|l|]
+\NC operation \NC feature \NC abracadabra \NC \NR
+\HL
+\NC substitution \NC \type {stest} \NC \addff{stest}abracadabra \NC \NR
+\NC alternate \NC \type {atest} \NC \addff{atest}abracadabra \NC \NR
+\NC multiple \NC \type {mtest} \NC \addff{mtest}abracadabra \NC \NR
+\NC ligature \NC \type {ltest} \NC \addff{ltest}abracadabra \NC \NR
+\NC kern \NC \type {ktest} \NC \addff{ktest}abracadabra \NC \NR
+\NC pair \NC \type {ptest} \NC \addff{ptest}abracadabra \NC \NR
+\NC chain sub \NC \type {ctest} \NC \addff{ctest}abracadabra \NC \NR
+\stoptabulate
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\stopsubsection
+
+\startsubsection[title=Contexts]
+
+A more complex substitution is the following:
+
+\startbuffer
+\startluacode
+ fonts.handlers.otf.addfeature {
+ name = "ytest",
+ type = "chainsubstitution",
+ lookups = {
+ {
+ type = "substitution",
+ data = {
+ ["b"] = "B",
+ ["c"] = "C",
+ },
+ },
+ },
+ data = {
+ rules = {
+ {
+ before = { { "a" } },
+ current = { { "b", "c" } },
+ lookups = { 1 },
+ },
+ },
+ },
+ }
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Here the dataset is a sequence of rules. There can be a \type {before}, \type
+{current} and \type {after} match. The replacements are specified with the \type
+{lookups} entry and the numbers are indices in the provided \type {lookups}
+table.
+
+\stopsubsection
+
+\startsubsection[title={Language dependencies}]
+
+When \OPENTYPE\ was not around we only had to deal with ligatures, smallcaps and
+oldstyle and of course kerns. Their number was so small that the term \quote
+{features} was not even used. In practice one just loaded a font that had
+oldstyle or smallcaps or none of that and was done. There were different fonts and
+sold separately.
+
+In \OPENTYPE\ we have more variation and although these fonts can be much more
+advanced the lack of standardization (for instance what gets initialized, or what
+shapes are in the default slots) can lead to messy setups. Some fonts bind
+features to scripts, some don't, which means that:
+
+\starttyping
+\definefontfeature[smallcaps][smcp=yes,script=dflt]
+\definefontfeature[smallcaps][smcp=yes,script=latn]
+\definefontfeature[smallcaps][smcp=yes,script=cyrl]
+\stoptyping
+
+are in fact different and you don't know in advance if you need to specify \type
+{dflt} or \type {latn}. In practice for a feature like smallcaps there is no
+difference between languages, but for ligatures there can be.
+
+When we extend an existing feature we can think of:
+
+\starttyping
+\definefontfeature[smallcaps][default][smcp=yes,script=auto]
+\definefontfeature[smallcaps][default][smcp=yes,script=*]
+\stoptyping
+
+but that can have side effects too (for instance disabling language specific
+features). The easiest way to explore this language dependency is to make
+a feature of our own.
+
+\startbuffer
+\startluacode
+fonts.handlers.otf.addfeature {
+ name = "simplify",
+ type = "multiple",
+ prepend = true,
+ features = {
+ ["*"] = {
+ ["deu"] = true
+ }
+ },
+ data = {
+ [utf.byte("ä")] = { "a", "e" },
+ [utf.byte("Ä")] = { "A", "E" },
+ [utf.byte("ü")] = { "u", "e" },
+ [utf.byte("Ü")] = { "U", "E" },
+ [utf.byte("ö")] = { "o", "e" },
+ [utf.byte("Ö")] = { "O", "E" },
+ [utf.byte("ß")] = { "s", "z" },
+ [utf.byte("ẞ")] = { "S", "Z" },
+ },
+}
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Here we implement a language specific feature that we use at the \TEX\ end:
+
+\startbuffer
+\definefontfeature
+ [simplify-de]
+ [simplify=yes,
+ language=deu]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+that we can use as:
+
+\startbuffer
+\definedfont[Serif*default,simplify-de]%
+äüöß
+{\de äüöß}
+{\nl äüöß}
+\stopbuffer
+
+\typebuffer
+
+and get: \start \maincolor \inlinebuffer \stop, but as you see, both German and
+Dutch get the same treatment, which might not be what you want, because in Dutch
+the diearesis has a different meaning.
+
+\startbuffer
+\definedfont[Serif*default]%
+ äüöß
+{\de\addff{simplify-de}äüöß}
+{\nl äüöß}
+\stopbuffer
+
+\typebuffer
+
+The above is restricts the usage so now we get: \start \maincolor \inlinebuffer
+\stop, which is more language bound. You don't need much imagination for
+extending this:
+
+\startbuffer
+\definefontfeature
+ [simplify]
+ [simplify=yes,
+ language=deu]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\definedfont[Serif*default]%
+ äüöß
+{\de\addff{simplify}äüöß}
+{\nl\addff{simplify}äüöß}
+\stopbuffer
+
+So what do we expect with the next?
+
+\typebuffer
+
+We get: \start \maincolor \inlinebuffer \stop, and we see that the language
+setting is not taken into account! This is because the font already has been set
+up with a script and language combination. The solution is to temporary set the
+font related language explicitly:
+
+\definefontfeature
+ [simplify]
+ [simplify=yes]
+
+\startbuffer
+\definedfont[Serif*default]%
+ äüöß
+{\de\addfflanguage\addff{simplify}äüöß}
+{\nl\addfflanguage\addff{simplify}äüöß}
+\stopbuffer
+
+\typebuffer
+
+So we can automatically switch to language specific features if we want to:
+\start \maincolor \inlinebuffer \stop.
+
+Let's now move to another level of complexity: support for more than one language
+as in fact this example was made for Dutch in the first place, but the German
+outcome is a bit more visible.
+
+\startbuffer
+\startluacode
+fonts.handlers.otf.addfeature {
+ name = "simplify",
+ type = "multiple",
+ prepend = true,
+ -- prepend = "smcp",
+ dataset =
+ {
+ {
+ features = {
+ ["*"] = {
+ ["nld"] = true
+ }
+ },
+ data = {
+ -- [utf.byte("ä")] = { "a" },
+ -- [utf.byte("Ä")] = { "A" },
+ -- [utf.byte("ü")] = { "u" },
+ -- [utf.byte("Ü")] = { "U" },
+ -- [utf.byte("ö")] = { "o" },
+ -- [utf.byte("Ö")] = { "O" },
+ [utf.byte("ij")] = { "i", "j" },
+ [utf.byte("IJ")] = { "I", "J" },
+ [utf.byte("æ")] = { "a", "e" },
+ [utf.byte("Æ")] = { "A", "E" },
+ },
+ },
+ {
+ -- type = "multiple", -- local values possible
+ features = {
+ ["*"] = {
+ ["deu"] = true
+ }
+ },
+ data = {
+ [utf.byte("ä")] = { "a", "e" },
+ [utf.byte("Ä")] = { "A", "E" },
+ [utf.byte("ü")] = { "u", "e" },
+ [utf.byte("Ü")] = { "U", "E" },
+ [utf.byte("ö")] = { "o", "e" },
+ [utf.byte("Ö")] = { "O", "E" },
+ [utf.byte("ß")] = { "s", "z" },
+ [utf.byte("ẞ")] = { "S", "Z" },
+ },
+ }
+ }
+}
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+For this we use the following example:
+
+\startbuffer
+\definedfont[Serif*default,simplify]%
+ äüöß ijæ
+{\de\addfflanguage äüöß ijæ}
+{\nl\addfflanguage äüöß ijæ}
+\stopbuffer
+
+\typebuffer
+
+Because the Dutch is hard to check we use an \type {æ} replacement too and
+commented the similarities with German: \start \maincolor \inlinebuffer \stop.
+But still we're not done, say that we want smallcaps too:
+
+\startbuffer
+\definefontfeature[alwayssmcp][smcp=always]%
+\definedfont[Serif*default,simplify,alwayssmcp]%
+ äüöß ijæ
+{\de\addfflanguage äüöß ijæ}
+{\nl\addfflanguage äüöß ijæ}
+\stopbuffer
+
+\typebuffer
+
+This comes out as: \start \maincolor \inlinebuffer \stop.
+
+The reason for specifying \type{smcp} as \type {always} is that otherwise we
+get language specific smallcaps while often they are not bound to a language
+but to the defaults. The good news is that we can do this automatically:
+
+\startbuffer
+\setupfonts[language=auto]%
+\definefontfeature[alwayssmcp][smcp=always]%
+\definedfont[Serif*default,simplify,alwayssmcp]%
+ äüöß ijæ
+{\de äüöß ijæ}
+{\nl äüöß ijæ}
+\stopbuffer
+
+\typebuffer
+
+But be aware that this applies to all situations. Here we get: \start \maincolor
+\inlinebuffer \stop.
+
+\stopsubsection
+
+\startsubsection[title=Syntax summary]
+
+In the examples we have seen several ways to define features. One of the
+differences is that you either set a \type {data} field directly, or that you
+specify a dataset. The fields in a dataset entry overload the ones given at the
+top level or when not set the top level value will be taken. There is a bit
+of (downward compatibility) tolerance built in, but best not depend on that.
+
+\starttyping
+fonts.handlers.otf.addfeature {
+ name = "demo",
+ features = {
+ [<script>] = {
+ [<language>] = true
+ }
+ },
+ prepend = true | featurename | position,
+ dataset = {
+ {
+ type = "substitution",
+ data = {
+ [<char|code>] = <char|code>,
+ }
+ },
+ {
+ type = "alternate",
+ data = {
+ [<char|code>] = { <char|code>, <char|code>, ... },
+ }
+ },
+ {
+ type = "multiple",
+ data = {
+ [<char|code>] = { <char|code>, <char|code>, ... },
+ }
+ },
+ {
+ type = "ligature",
+ data = {
+ [<char|code>] = { <char|code>, <char|code>, ... },
+ }
+ },
+ {
+ type = "kern",
+ data = {
+ [<char|code>] = { [<char|code>] = <value> },
+ }
+ },
+ {
+ type = "pair",
+ data = {
+ [<char|code>] = { [<char|code>] = {
+ false | { <value>, <value>, <value>, <value> },
+ false | { <value>, <value>, <value>, <value> }
+ }
+ }
+ },
+ {
+ type = "chainsubstitution",
+ lookups = {
+ {
+ type = <typename>,
+ data = <mapping>,
+ },
+ },
+ data = {
+ rules = {
+ {
+ before = { { [<char|code>], ... } },
+ current = { { [<char|code>], ... } },
+ after = { { [<char|code>], ... } },
+ lookups = { <index>, ... },
+ },
+ },
+ },
+ },
+ },
+}
+\stoptyping
+
+\stopsubsection
+
+\startsubsection[title=Extra characters]
+
+\startbuffer[hyphenchars]
+\startluacode
+
+ local privateslots = fonts.constructors.privateslots
+
+ local function addspecialhyphen(tfmdata)
+
+ local exheight = tfmdata.parameters.xheight
+ local emwidth = tfmdata.parameters.quad
+ local width = emwidth / 4
+ local height = exheight / 10
+ local depth = exheight / 2
+ local offset = emwidth / 6
+
+ tfmdata.characters[privateslots.righthyphenchar] = {
+ -- no dimensions
+ commands = {
+
+ { "right", offset },
+
+ { "push" },
+ { "right", -width },
+ { "down", depth },
+ { "rule", height, width },
+ { "pop" },
+
+ { "right", -width/5 },
+ { "down", depth + height },
+ { "rule", 3*height, width/5 },
+
+
+ }
+ }
+
+ tfmdata.characters[privateslots.lefthyphenchar] = {
+ -- no dimensions
+ commands = {
+
+ { "right", -offset },
+
+ { "push" },
+ { "down", depth + height },
+ { "rule", 3*height, width/5 },
+ { "pop" },
+
+ { "down", depth },
+ { "rule", height, width },
+
+ }
+ }
+
+ end
+
+ fonts.constructors.features.otf.register {
+ name = "specialhyphen",
+ description = "special hyphen",
+ manipulators = {
+ base = addspecialhyphen,
+ node = addspecialhyphen,
+ }
+ }
+
+\stopluacode
+\stopbuffer
+
+You can add virtual characters to fonts. Here we give an example that is derived
+from an example posted on the mailing list. By default, when we hyphenated a word,
+we get this:
+
+\definefont[DemoFont] [Serif*default]
+
+\blank \start \DemoFont \maincolor \hsize 1mm averylongword \par \stop \blank
+
+The default character that is appended at the end and beginning of a line
+can be specified as follows:
+
+\startbuffer
+\setuplanguage
+ [en]
+ [righthyphenchar=45,
+ lefthyphenchar=45]
+\stopbuffer
+
+\typebuffer
+
+So now we get:
+
+\blank \start \getbuffer \DemoFont \maincolor \hsize 1mm averylongword \par \stop \blank
+
+Say that we want a different signal, for instance some rule. Here is how that can
+be done:
+
+\typebuffer[hyphenchars]
+
+\getbuffer[hyphenchars]
+
+Watch the way we use private slots. You can best use a unique glyph name as these
+numbers are shared between fonts. With:
+
+\startbuffer
+\definefontfeature
+ [default]
+ [default]
+ [specialhyphen=yes]
+\definefont
+ [DemoFont]
+ [Serif*default at 24pt]
+\setuplanguage
+ [en]
+ [righthyphenchar=\getprivateglyphslot{righthyphenchar},
+ lefthyphenchar=\getprivateglyphslot{lefthyphenchar}]
+\stopbuffer
+
+\typebuffer
+
+We get:
+
+\startlinecorrection[blank]
+\getbuffer
+\framed
+ [foregroundstyle=\DemoFont \setupinterlinespace,
+ offset=none,
+ frame=no,
+ width=1mm,
+ align={flushleft}]
+ {\hsize 1mm \maincolor averylongword\par}
+\stoplinecorrection
+
+You need to keep in mind that some of these settings are global but in practice that is
+not a real problem. Here is how you reset:
+
+\startbuffer
+\definefontfeature
+ [default]
+ [default]
+ [specialhyphen=no]
+\setuplanguage
+ [en]
+ [righthyphenchar=45,
+ lefthyphenchar=0]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\stopsubsection
+
+\startsubsection[title=Goodies]
+
+The examples above extend a font in the \TEX\ document (normally a style) but you
+can use a goodies file too, for instance \type {cambria.lfg}.
+
+\starttyping
+return {
+ name = "cambria",
+ version = "1.00",
+ comment = "Goodies that complement cambria.",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ extensions = {
+ {
+ name = "kern", -- adds to kerns
+ type = "pair",
+ data = {
+ [0x0153] = { -- combining acute
+ [0x0301] = { -- aeligature
+ false,
+ { -500, 0, 0, 0 }
+ }
+ },
+ }
+ }
+ }
+}
+\stoptyping
+
+Here we use the feature name \type {kern} and therefore we don't have to define a
+specific (new) feature for it. Such a goodie is then used as follows:
+
+\starttyping
+\definefontsynonym
+ [Serif]
+ [cambria]
+ [features=default,
+ goodies=cambria]
+\stoptyping
+
+You can find such definitions in the \type {type-imp-*.mkiv} files.
+
+\stopsubsection
+
+\stopsection
+
+\startsection[title=Spacing]
+
+% By default the font loader deduces the spacing from the space character or
+% other font properties. You can influence this by the \type {space} feature.
+%
+% \starttyping
+% \definefontfeature
+% [korean]
+% [default]
+% [script=hang,
+% language=kor,
+% space=local] % or locl
+% \stoptyping
+%
+% Instead of the usual \type {yes} (which means: use character 32), \type {local}
+% or \type {locl} (which means: use a replacement provided by the \type{locl}
+% feature), you can also pass a character, so
+%
+% \starttyping
+% \definefontfeature
+% [spacy]
+% [default]
+% [space=A]
+% \stoptyping
+%
+% is valid.
+
+As you probably know, \TEX\ has no space character. When the input is read,
+characters tagged as space are intercepted and become glue. Compare this:
+
+\startlinecorrection[blank]
+ \startcombination
+ {\framed
+ [width=3cm,height=15mm,align={middle,lohi},foregroundcolor=maincolor]
+ {\dorecurse{5}{test }}}
+ {\type{text test...}}
+ {\framed
+ [width=3cm,height=15mm,align={middle,lohi},foregroundcolor=maincolor]
+ {\dorecurse{5}{test\char32\relax}}}
+ {\type{text\char32test...}}
+ \stopcombination
+\stoplinecorrection
+
+Most fonts have a space character and you can actually use it and indeed a space
+character will be injected but as it is not glue, the line break algorithm will
+not see it as space.
+
+Al the magic done with space characters other than the native space character
+(decimal 32) are at some point translated into glue.
+
+\starttabulate[||T|p|]
+\NC \bf command \NC \UNICODE \NC width \NC \NR
+
+\NC \type{\nobreakspace}
+ \type{\nbsp} \NC U+00A0 \NC space \NC \NR
+\NC \type{\ideographicspace} \NC U+2000 \NC quad/2 \NC \NR
+\NC \type{\ideographichalffillspace} \NC U+2001 \NC quad \NC \NR
+\NC \type{\twoperemspace}
+ \type{\enspace} \NC U+2002 \NC quad/2 \NC \NR
+\NC \type{\emspace}
+ \type{\quad} \NC U+2003 \NC quad \NC \NR
+\NC \type{\threeperemspace} \NC U+2004 \NC quad/3 \NC \NR
+\NC \type{\fourperemspace} \NC U+2005 \NC quad/4 \NC \NR
+\NC \type{\fiveperemspace} \NC \NC quad/5 \NC \NR
+\NC \type{\sixperemspace} \NC U+2006 \NC quad/6 \NC \NR
+\NC \type{\figurespace} \NC U+2007 \NC width of zero \NC \NR
+\NC \type{\punctuationspace} \NC U+2008 \NC width of period \NC \NR
+\NC \type{\breakablethinspace} \NC U+2009 \NC quad/8 \NC \NR
+\NC \type{\hairspace} \NC U+200A \NC quad/8 \NC \NR
+\NC \type{\zerowidthspace} \NC U+200B \NC 0 \NC \NR
+\NC \type{\zerowidthnonjoiner}
+ \type{\zwnj} \NC U+200C \NC 0 \NC \NR
+\NC \type{\zerowidthjoiner}
+ \type{\zwj} \NC U+200D \NC 0 \NC \NR
+\NC \type{\narrownobreakspace} \NC U+202F \NC quad/8 \NC \NR
+\NC \type{\zerowidthnobreakspace} \NC U+FEFF \NC \NC \NR
+\NC \type{\optionalspace} \NC \NC space when not followed by punctuation \NC \NR
+\stoptabulate
+
+% "205F % space/8 (math)
+
+The last one is not un \UNICODE\ and the fifths of an emspace is not in \UNICODE\
+either. This emspace (or quad in \TEX\ speak) is a font property. The width of
+the space used by \CONTEXT\ is dreived form this value. In case of a monospace
+fonts, the following logic is applied:
+
+\startitemize
+ \startitem
+ When there is a space character, the width of that character is used.
+ \stopitem
+ \startitem
+ Otherwise, when there is an emdash present, the width if that character
+ is used.
+ \stopitem
+ \startitem
+ Otherwise, when there is an \type {charwidth} property available (the
+ average width), that valua is used.
+ \stopitem
+\stopitemize
+
+When a proportional font is used, we do as follows:
+
+\startitemize
+ \startitem
+ When there is a space character, the width of that character is used.
+ \stopitem
+ \startitem
+ Otherwise, when there is an emdash present, the width of that character
+ divided by two is used.
+ \stopitem
+ \startitem
+ Otherwise, when there is an \type {charwidth} property available (the
+ average width), that value is used.
+ \stopitem
+\stopitemize
+
+In both cases, when no value is set we use the units of the font (often 1000 or
+2048). In \TEX\ a space glue also has stretch and shrink. Here we follow the
+traditional \TEX\ logic:
+
+\startitemize
+ \startitem
+ The stretch is set to half the width of a space but to zero with a mono
+ spaced font.
+ \stopitem
+ \startitem
+ The shrink is set to one third of the width of a space but to zero with a
+ mono spaced font.
+ \stopitem
+\stopitemize
+
+The xheight is set to the values specified by the font and when this is unset the
+height of the character \type {x} will be used but when this character is not in
+the font, we use two fifths of the font's units (normally the same as the
+emwidth). The italic angle is also taken from the font (and is of course zero for
+a not italic font). Most fonts have these properties set so we seldom have to
+fall back to a guess.
+
+\stopsection
+
+\startsection[title=Collections]
+
+ {\em Todo.}
+
+\stopsection
+
+\stopchapter
diff --git a/doc/context/sources/general/fonts/fonts/fonts-features.tex b/doc/context/sources/general/fonts/fonts/fonts-features.tex
new file mode 100644
index 000000000..79085c236
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-features.tex
@@ -0,0 +1,2585 @@
+% language=uk
+
+\startcomponent fonts-features
+
+\environment fonts-environment
+
+\startMPextensions
+ vardef MyRectangle(expr n, w, h, x, y, c) =
+ image (
+ fill unitsquare xyscaled (w,h) shifted (x,y) withcolor c ;
+ draw textext("\tttf " & decimal n) xsized (1/2) shifted (w/2,h/2) shifted (x,y) withcolor white ;
+ )
+ enddef ;
+ vardef MyDot(expr x, y) =
+ image (
+ draw (x,y) withpen pencircle scaled (2/3) withcolor white ;
+ draw (x,y) withpen pencircle scaled (1/2) withcolor black ;
+ )
+ enddef ;
+\stopMPextensions
+
+\startchapter[title=Features][color=darkmagenta]
+
+\startsection[title=Introduction]
+
+If you look into fonts, it is hard not to bump into kerns (spacing between
+characters) and ligatures (combining multiple shapes into one) and apart from
+monospaced fonts most \TYPEONE\ fonts have them. In the \OPENTYPE\ universe we
+call these properties features and in such a font there can be many such
+features.
+
+For those who grew up with \TEX\ or still remember the times of eight bit fonts,
+it is no secret that \TEX\ macro packages did some magic to get most out of a
+font: replacing missing glyphs, fixing metrics, using commands to access shapes
+that had a weird code point, to mention a few. As there is absolutely no
+guarantee that an \OPENTYPE\ font does better, there is a good reason to continue
+messing around with fonts. After all, it's what \TEX\ users seem to like:
+control.
+
+So, when we started writing support for \OPENTYPE\ quite soon a mechanism has
+been created that permits adding our own features to the repertoire that comes
+with a font. Because \OPENTYPE\ features demand a configuration and control
+mechanism, it made sense to generalize that and provide a single interface.
+
+This means that when we talk about font features, we don't limit ourselves to
+those provided by the font, but also those provided by \CONTEXT. As with font
+features, they are enabled per font.
+
+Some of the extra features are sort of generic, others are very font specific and
+their properties are somewhat bound to a font. Such features are defined in a
+font goodie files. Consider these goodies a font extension mechanism.
+
+Some features need information that only the engine can provide. This is why we
+have analyzers. Some are generic, others are bound to scripts. They come in
+action before features are applied. Rather special is applying features in
+combination with paragraph building. This is something very specific to \CONTEXT\
+but it depends on properties of the font. It falls into the category \quote
+{optimizing}.
+
+It is clear that when we talk of features many aspects of a font play a role. In
+this chapter we will discuss all the mentioned aspects. There is quite a bit of
+\LUA\ code shown in this chapter, but don't worry, users will seldom need to
+tweak fonts this way. On the other hand it's good to see what is possible.
+
+\stopsection
+
+\startsection[title=Regulars]
+
+\startsubsection[title=Introduction]
+
+The \OPENTYPE\ specification, which can be found on the \MICROSOFT\ website
+is no easy reading. Some of the concepts are easy to understand, like relative
+positioning (that we call kerning in \TEX) or ligature substitution (as we
+have ligatures in \TEX\ too). It makes no sense to discuss the bitwise composition
+of an \OPENTYPE\ or \TRUETYPE\ file here. First of all, all we get to see is
+a \LUA\ table, and in \CONTEXT\ even that one gets sanitized and optimized
+into a more useable table. However, as the data that comes with a font is
+a good indication of what a font is capable of, we will discuss some of it in
+an appendix. In this section we will discuss the basic principles and categories
+of features.
+
+\stopsubsection
+
+\startsubsection[title=Feature sets]
+
+Because in the next examples we will demonstrate features, we need to know how
+we can tell \CONTEXT\ what features to use. Although you can add explicit
+feature definitions to a font specification, I strongly advice you not to do this
+but use the more abstract mechanism of feature sets. These are defined as follows:
+
+\starttyping
+\definefontfeature
+ [MyFeatureSet]
+ [alpha=yes,
+ beta=no,
+ gamma=123]
+\stoptyping
+
+Such a set is bound to a font with the \type {*} specifier, as in:
+
+\starttyping
+\definefont
+ [MyFontInstance]
+ [MyNiceFont*MyFeatureSet at 12pt]
+\stoptyping
+
+In most cases the already defined \type {default} feature set will suffice. It often
+makes sense to use that one as base for new definitions:
+
+\starttyping
+\definefontfeature
+ [MyFeatureSet]
+ [default]
+ [alpha=yes,
+ beta=no,
+ gamma=123]
+\stoptyping
+
+The second argument can be a list, as in:
+
+\starttyping
+\definefontfeature
+ [MyFeatureSet]
+ [MyFirstSet,MySecondSet]
+ [alpha=yes,
+ beta=no,
+ gamma=123]
+\stoptyping
+
+Of course you need to know what features a font support, and one way to find
+out is:
+
+\starttyping
+mtxrun --script font --list --info --pattern=pagella
+\stoptyping
+
+Don't be too surprised if different fonts show different features and even similar
+features can be implemented differently. Sometimes you really need to know the font,
+but fortunately many fonts come with examples.
+
+There are many features and there values are kept with the font when it gets
+defined. This means that when you change a featureset, it will not affect already
+defined fonts. Because fonts are often defined on demand, you need to be aware of
+the fact that a redefinition of a featureset can have consequences for already
+defined fonts. For instance, a bodyfont switch only sets up the fonts and delays
+defining them.
+
+Although features are a sort of abstractions it can be interesting to see what features
+and values are actually used:
+
+\starttyping
+\usemodule[fonts-features] \showusedfeatures
+\stoptyping
+
+You will notice that we have more features than \OPENTYPE\ fonts can offer. This
+is because in \CONTEXT\ features is a more general concept.
+
+\showusedfeatures
+
+\stopsubsection
+
+\startsubsection[title=Main categories]
+
+There are two (but potentially more) main groups of features: those that deal
+with substitution, and those that lead to positioning. It is not really needed
+to know the gory details, but it helps to know at least a bit about them as
+it can help to track down issues with fonts.
+
+There are several substitutions possible:
+
+\startitemize[packed]
+\startitem a single substitution replaces one glyph by another \stopitem
+\startitem a multiple substitution replaces one glyph by one or more \stopitem
+\startitem a ligature substitution replaces multiple glyphs by one glyph \stopitem
+\startitem an alternate substitution replaces one glyph by one out of a set \stopitem
+\stopitemize
+
+Like it or not, but these categories are not always used as intended: they just
+are a way of replacing one or more glyphs by one or more other glyphs. This means
+that when for instance \type {ij} gets replaced by one glyph (given that the font
+supports it) a ligature substitution is used, even when in fact we have to do
+with a diftong that can be represented by one character.
+
+No matter what features you will use, keep in mind that they are nothing more
+than a combination of substitutions and positioning directives. So, the de facto
+standard ligature building feature \type {liga} indeed uses a ligature
+substitution, but other features with names that resemble no ligatures might use
+this substitution as well.
+
+An example of a single substitution is an oldstyle (\type {onum}) although it can
+as well be implemented as a choice out of alternate glyphs. Another example is
+smallcaps (\type {smcp}). Nowdays these are more or less standard features for a
+grown up font, while in the past they came as separate fonts. So, instead of loading
+an extra font, one sticks to one and selects the feature that does the
+substitution.
+
+A second category concerns relative positioning. Again we have several variants:
+
+\startitemize[packed]
+\startitem a single positioning moves a glyph over one of two axis and can change the width and|/|or height \stopitem
+\startitem a pair positioning also moved glyphs but concerns two adjacent glyphs \stopitem
+\startitem a cursive positioning operates on a range of glyphs and is used to visually connect them \stopitem
+\stopitemize
+
+In addition there are three ways to anchor marks onto glyphs:
+
+\startitemize[packed]
+\startitem a mark can be anchored on a base glyph \stopitem
+\startitem a mark can be anchored on a specific (visual) component of a ligature \stopitem
+\startitem a mark can be anchored on another mark \stopitem
+\stopitemize
+
+In base mode the single, alternate and ligature substitutions can rather easily
+be mapped onto the traditional \TEX\ font handling mechanism and this is what
+happens in base mode. A single substitution is just another instance of a glyph
+so there we just replace the original index into the glyph table by another one.
+In the case of an alternate we change the default index into one of several
+possible replacements in the alternate set. Ligatures can be mapped onto \TEX s
+ligature mechanism. The single positioning maps nicely on \TEX s kerning
+mechanism and pairwise positioning is not applicable in base mode. In node mode
+we don't do any remapping at loading time but delegate that to \LUA\ when
+processing the node lists.
+
+Marks are special in the sense that they normally only occur in scripts that also
+use substitution and positioning which in turn means that some more housekeeping
+is involved. After all, we need to keep track to what a mark applies. Of course a
+font can provide regular latin accents as marks but that is ill practice because
+cut and paste might not work out as expected. A proper font will support composed
+characters and provide glyphs that have the accents built in. Marks are not dealt
+with in base mode.
+
+Talking of complex scripts, the above set of operations is far from enough. Take
+for instance Arabic, where a sequence of 5~characters with 3~marks can easily
+become two glyphs glued together with two marks only. In the process we can have
+single substitutions, ligatures being built, marks being anchored and glyphs
+being cursively positioned. But, in order to do this well, some contextual
+analysis has to be done as well. Again we have several variants of this:
+
+\startitemize[packed]
+\startitem with contextual substitution a replacement takes place depending on a matching sequence of glyphs,
+optionally preceded or followed by matches \stopitem
+\startitem with contextual positioning shifting and anchoring happens based on a matching sequence of glyphs,
+optionally preceded or followed by matches \stopitem
+\startitem multiple contextual substitutions or positionings can be chained together \stopitem
+\startitem this can also happen in the reverse order (for right|-|to|-|left scripts) \stopitem
+\stopitemize
+
+In practice there is no fundamental difference between these and we can collapse
+them all in a sequence of lookups resulting in a sequence of whatever other
+manipulation is wanted.
+
+Given this, what is a feature? It's mostly a sequence of actions expressed in the
+above. And although there is a whole repertoire of semi|-|standardized features
+like \type {liga} and \type {onum}, there is no real hard coded support for them
+in \CONTEXT. Instead we have a generic feature processor that deals with all of
+them. A feature, say \type {abcd}, has a definition that boils down to a sequence
+of lookups. A lookup is just a name that is associated to one of the mentioned
+actions. So, \type {abcd} can do a decomposition (multiple substitution), then a
+replacement (single substitution) based on neighbouring glyphs, then do some
+ligature building (ligature substitution) and finally position the resulting
+glyphs relative to each other (like cursive positioning and anchoring marks).
+
+Imagine that we start out with 5 characters in the input. Instead of real glyphs
+we represent them by rectangles. The third one is a mark.
+
+\startlinecorrection
+\startMPcode
+ draw MyRectangle(1,2,6, 0,0,.5red ) ;
+ draw MyRectangle(2,2,4, 3,0,.5green ) ; draw MyDot(4,4.25) ;
+ draw MyRectangle(3,2,1, 6,5,.5blue ) ; draw MyDot(7,4.75) ;
+ draw MyRectangle(4,2,5, 9,0,.5yellow ) ;
+ draw MyRectangle(5,2,5,12,0,.5magenta) ;
+ currentpicture := currentpicture ysized(4cm) ;
+\stopMPcode
+\stoplinecorrection
+
+In the next variant we see that four and five have been replaced by
+number six. This is a ligature replacement.
+
+\startlinecorrection
+\startMPcode
+ draw MyRectangle(1,2,6,0,0,.5red ) ;
+ draw MyRectangle(2,2,4,3,0,.5green) ; draw MyDot(4,4.25) ;
+ draw MyRectangle(3,2,1,6,5,.5blue ) ; draw MyDot(7,4.75) ;
+ draw MyRectangle(6,3,5,9,0,.5cyan ) ;
+ currentpicture := currentpicture ysized(4cm) ;
+\stopMPcode
+\stoplinecorrection
+
+The mark is an independent entity. Sometimes it has a width, sometimes it hasn't.
+In both cases we can position it. Here we move the shape left and down. There are
+two ways to do this: simple pairwise kerning but better is to use anchors. Here
+we have one anchor per shape but there can be many.
+
+\startlinecorrection
+\startMPcode
+ draw MyRectangle(1,2,6,0,0 ,.5red ) ;
+ draw MyRectangle(2,2,4,3,0 ,.5green) ;
+ draw MyRectangle(3,2,1,3,4.5,.5blue ) ; draw MyDot(4,4.25) ;
+ draw MyRectangle(6,3,5,6,0 ,.5cyan ) ;
+ currentpicture := currentpicture ysized(4cm) ;
+\stopMPcode
+\stoplinecorrection
+
+Next we apply some kerning. Of course the anchored marks need to move as well.
+
+\startlinecorrection
+\startMPcode
+ draw MyRectangle(1,2,6,0, 0 ,.5red ) ;
+ draw MyRectangle(2,2,4,2.5,0 ,.5green) ;
+ draw MyRectangle(3,2,1,2.5,4.5,.5blue ) ; draw MyDot(3.5,4.25) ;
+ draw MyRectangle(6,3,5,5, 0 ,.5cyan ) ;
+ currentpicture := currentpicture ysized(4cm) ;
+\stopMPcode
+\stoplinecorrection
+
+Alternatively we can connect the shapes in a cursive way. The name cursive is
+somewhat misleading as it just boils down to shifting. The cursive indicates that
+the shifts accumulate within a word.
+
+\startlinecorrection
+\startMPcode
+ draw MyRectangle(1,2,6,0,0 ,.5red ) ;
+ draw MyRectangle(2,2,4,2,0.5,.5green) ;
+ draw MyRectangle(3,2,1,2,5 ,.5blue ) ; draw MyDot(3,4.75) ;
+ draw MyRectangle(6,3,5,4,1 ,.5cyan ) ;
+ currentpicture := currentpicture ysized(4cm) ;
+\stopMPcode
+\stoplinecorrection
+
+\stopsubsection
+
+\startsubsection[title={Single substitution}]
+
+Single substitutions are probably the most used ones. For instance, when you
+ask for small caps, a lot of glyphs get replaced. When using oldstyle numerals
+only digits get replaced but even then each glyph has to be checked. This can be
+demonstrated with the Latin Modern fonts.
+
+\startlinecorrection
+\scale
+ [height=1cm]
+ {\strut
+ {\definedfont[lmroman10-bold*default]\$123.45}%
+ \quad
+ {\definedfont[lmroman10-bold*oldstyle]\$123.45}}
+\stoplinecorrection
+
+As you can see here, Latin Modern has an oldstyle dollar sign. If you don't like
+that one, you're in troubles as it comes with the rest of the oldstyles. The only
+way out is to apply the oldstyle numerals to digits only which involves more tagging
+than you might be willing to add. So, whenever you choose a substitution, be aware
+that you have not that much control over what gets substituted: it's the font that
+drives it. Here are some examples:
+
+\starttyping
+\definefontfeature[capsandold][smallcaps,oldstyle]
+
+\showotfcomposition{dejavu-serif*capsandold at 24pt}{}{It's 2013!}
+\showotfcomposition{cambria*capsandold at 24pt}{}{It's 2013!}
+\showotfcomposition{lmroman10regular*capsandold at 24pt}{}{It's 2013!}
+\showotfcomposition{texgyrepagellaregular*capsandold at 24pt}{}{It's 2013!}
+\stoptyping
+
+\definefontfeature[capsandold][smallcaps,oldstyle]
+
+\blank \showotfcomposition{dejavu-serif*capsandold at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{It's 2013!}} \blank
+\blank \showotfcomposition{cambria*capsandold at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{It's 2013!}} \blank
+\blank \showotfcomposition{lmroman10regular*capsandold at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{It's 2013!}} \blank
+\blank \showotfcomposition{texgyrepagellaregular*capsandold at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{It's 2013!}} \blank
+
+\stopsubsection
+
+\startsubsection[title={Multiple substitution}]
+
+In a multiple substitution a sequence of characters (glyphs) gets replaced by
+another sequence. In fact, you might wonder why one||to||one, multiple||to||one
+and multiple||to||multiple are not all generalized into this variant. Efficiency
+is probably the main reason. \footnote {Isn't it strange that complex mechanisms
+are designed to save a few bytes while at the same time we produce ridiculous
+large pictures with cameras.} For instance the many||to||one is often used for
+ligatures (\type {liga}) and as a consequence \type {liga} is often misused also
+for non||ligatures.
+
+One usage of multiple replacements is to avoid and or undo other replacements. In
+the next example we see a language dependent \type {fi} ligature. Take the dutch
+\type {ij} and \type {ie} diftongs. Here we need to prevent the \type {i}
+becoming combined with the \type {f} as it would look weird. Among the solutions
+for this are: context dependent ligatures (which involves a lot of rules), or
+multiple to multiple replacements (looking at the \type {fij} sequence).
+
+\startbuffer[definitions]
+\definefontfeature[default-fijn-en][default][language=eng,script=latn]
+\definefontfeature[default-fijn-nl][default][language=nld,script=latn]
+\stopbuffer
+
+\getbuffer[definitions] \typebuffer[definitions]
+
+\starttyping
+\definedfont[lmroman10-regular*default-fijn-en]\en effe fijn fietsen
+\definedfont[lmroman10-regular*default-fijn-nl]\nl effe fijn fietsen
+\stoptyping
+
+This gives:
+
+\startlinecorrection[blank]
+\scale [width=\textwidth] \bgroup
+ \framed [offset=overlay,frame=off,foregroundcolor=maincolor,align=normal,strut=no] \bgroup
+ \definedfont[lmroman10-regular*default-fijn-en]\en effe fijn fietsen\vskip-1ex
+ \definedfont[lmroman10-regular*default-fijn-nl]\nl effe fijn fietsen\par
+ \egroup
+\egroup
+\stoplinecorrection
+
+Of course from this result one cannot see what (combination of) substitution(s)
+was used, but it's a nice exercise to work out a solution.
+
+Multiple substitutions are mostly used for scripts more complex than latin or
+special fonts like Zapfino where advanced contextual analysis happens.
+
+\stopsubsection
+
+\startsubsection[title={Alternate substitution}]
+
+Alternates are simple one||to||one substitutions. Popular examples are small
+capitials and oldstyle numerals.
+
+A nice application of alternates is the punk font. This font is a Knuth original.
+As part of experimenting with the \METAPOST\ library in the early days of
+\LUATEX\ and \MKIV, runtime randomization was implemented. However, that variant
+used virtual fonts and was somewhat resource hungry. So, in a later stage Khaled
+Hosny made an \OPENTYPE\ version using \METAPOST\ output. Randomization is
+implemented through the \type {rand} feature.
+
+In \MKIV\ the \type {rand} feature is not really special and behaves just like
+any other (stylistic) alternate. The only difference is that for this feature a
+value of \type {yes} equals \type {random}. This also means that any feature that
+uses alternates use them randomly.
+
+\startbuffer
+\definefontfeature[punknova-first] [mode=node,kern=yes,rand=first]
+\definefontfeature[punknova-2] [mode=node,kern=yes,rand=2]
+\definefontfeature[punknova-yes] [mode=node,kern=yes,rand=yes]
+\definefontfeature[punknova-random][mode=node,kern=yes,rand=random]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We use this is:
+
+\startbuffer[sample]
+The original punk font is designed by Don Knuth: xxxxxxxxxxxx
+\stopbuffer
+
+\startbuffer
+\definedfont[punknova-regular at 15pt] \getbuffer[sample]
+\definedfont[punknova-regular*punknova-first at 15pt] \getbuffer[sample]
+\definedfont[punknova-regular*punknova-2 at 15pt] \getbuffer[sample]
+\definedfont[punknova-regular*punknova-yes at 15pt] \getbuffer[sample]
+\definedfont[punknova-regular*punknova-random at 15pt] \getbuffer[sample]
+\stopbuffer
+
+\typebuffer[sample]
+
+\typebuffer
+
+In order to illustrate the variants we show a sequence of \type {x}'s. There are
+upto ten different variants per characters.
+
+\startlines[color=maincolor] \getbuffer \stoplines
+
+There is one pitfall with random alternates: if each run leads to a different
+outcome, we can end up in oscillation: different shapes give different paragraphs
+and we can get more pages or cross references etc.\ that can end up differently
+so this is why \CONTEXT\ always uses the same random seed (which gets reset when
+you purge the auxiliary files.
+
+\stopsubsection
+
+\startsubsection[title={Ligature substitution}]
+
+A ligature is traditionally a combination of several characters into one. Popular
+ligatures are \quote {fi}, \quote {fl}, \quote {ffi} and , \quote {ffl}.
+Occasionally we see \quote {\ae}, \quote {\oe} and some more. Often ligatures are
+language dependant. For instance in languages like Dutch and German there can be
+compound words where one part ends with an \type {f} and the next part starts with
+an \type {f} and that looks bad or at least not intuitive. To some extent one
+can wonder if this tradition of ligatures is a good one. It definitely made
+sense ages ago, but I wouldn't be surprised if they are often added to fonts
+because the encoding vectors have them. After all, nothing prevents to go ahead
+and come up with way more ligatures.
+
+There can be many ligature features in a font. Although we support arbitrary
+features, that is: those not registered as being official one way or the other,
+the following are known by description:
+
+\startluacode
+context.starttabulate { "|lTCT{maincolor}|l|" }
+for k, v in table.sortedhash(fonts.handlers.otf.tables.features) do
+ if string.find(v,"ligature") then
+ context.NC()
+ context(k)
+ context.NC()
+ context(v)
+ context.NR()
+ end
+end
+context.stoptabulate()
+\stopluacode
+
+The \type {default} feature set has type {liga} as wel as the \TEX\ specific \type {tlig}
+that replaces successive hyphen signs into en- and emdashes. The \type {arabic} feature
+set also has \type {rlig} enabled.
+
+Now, there is one thing you should realize when we discuss specific features and
+the underlaying mechanisms: there is no real relationship between the features's
+name and the mechanisms used: any feature can use any underlying mechanism or
+combination. This is why deep down we see that what is internally called ligature
+gets used for any purpose where multiple||to||one replacements happen, and why the
+\type {liga} feature can use single substitutions or alternates to swap in
+another rendering so that the dot of the \type {i} stays free of the preceding
+\type {f}. And for some fonts relative positioning can be used to achieve a
+ligature effect.
+
+The next examples demonstrate how the \type {liga} feature deals with \type {ffi}.
+Possible solutions are: replace all three at once, replace the first two first and
+in a next step, combine a ligature and following character, replace one or more
+components by variants that have no interference with the dot of the~\quote{i}.
+
+\starttyping
+\showotfcomposition{dejavu-serif*default at 48pt}{}{ffi}
+\showotfcomposition{cambria*default at 48pt}{}{ffi}
+\showotfcomposition{lmroman10regular*default at 48pt}{}{ffi}
+\showotfcomposition{texgyrepagellaregular*default at 48pt}{}{ffi}
+\stoptyping
+
+\blank \showotfcomposition{dejavu-serif*default at 48pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{ffi}} \blank
+\blank \showotfcomposition{cambria*default at 48pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{ffi}} \blank
+\blank \showotfcomposition{lmroman10regular*default at 48pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{ffi}} \blank
+\blank \showotfcomposition{texgyrepagellaregular*default at 48pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{ffi}} \blank
+
+\stopsubsection
+
+\startsubsection[title={Single positioning}]
+
+Single positioning is also known as kerning, moving characters closer together so
+that we get a more uniformly spaced sequence of glyphs. It is a mistake to think
+that kerning is always needed! There are fonts that have hardly any kerns or no
+kerns at all and still look good.
+
+\start
+ \showfontkerns \blank
+ \definedfont[dejavu-serif*default at 8pt]Dejavu Serif: \input tufte (E.R. Tufte)\blank
+ \definedfont[cambria*default at 9pt]Cambria: \input tufte (E.R. Tufte)\blank
+ \definedfont[lmroman10regular*default at 10pt]Latin Roman Regular: \input tufte (E.R. Tufte)\blank
+ \definedfont[lucidabrightot*default at 8pt]Lucida Bright: \input tufte (E.R. Tufte)\blank
+ \definedfont[texgyrepagellaregular*default at 9pt]Pagella Regular: \input tufte (E.R. Tufte)\blank
+\stop
+
+The next couple of examples show the action for a few words:
+
+\blank \showotfcomposition{dejavu-serif*default at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{We thrive}} \blank
+\blank \showotfcomposition{cambria*default at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{We thrive}} \blank
+\blank \showotfcomposition{lmroman10regular*default at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{We thrive}} \blank
+\blank \showotfcomposition{lucidabrightot*default at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{We thrive}} \blank
+\blank \showotfcomposition{texgyrepagellaregular*default at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{We thrive}} \blank
+
+\stopsubsection
+
+\startsubsection[title={Pairwise positioning}]
+
+This variant of positioning involved the first, second or both glyphs of a glyph
+pair. The specification can influence the horizontal and vertical positions we
+well as the widths of the positioned glyphs.
+
+\startnotabene
+ We need an example here.
+\stopnotabene
+
+\stopsubsection
+
+\startsubsection[title={Mark positioning}]
+
+Marks are (often) small symbols that represent accents (in latin) or vowels (in
+arabic) that get attached to base glyphs. In the input stream they come after the
+character that they apply to. Many fonts come with precomposed latin characters
+which means that an \type {à} in the input is mapped directly onto its
+corresponding shape. When the input contains an \type {a} followed by a \type{̀ }
+input normalization will normally turn this into an \type {à}. But, when this
+doesn't happen, the font machinery has to make sure that the mark gets positioned
+right onto the base character. In traditional \TYPEONE\ fonts that more or less
+happened automatically by overlaying the shapes. In \OPENTYPE\ (single)
+positioning is used to place the mark right.
+
+\startnarrowtyping
+\showotfcomposition{dejavu-serif*default at 24pt}{}{à a\utfchar{"0300} à}
+\showotfcomposition{cambria*default at 24pt}{}{à a\utfchar{"0300} à}
+\showotfcomposition{lmroman10regular*default at 24pt}{}{à a\utfchar{"0300} à}
+\showotfcomposition{lucidabrightot*default at 24pt}{}{à a\utfchar{"0300} à}
+\showotfcomposition{texgyrepagellaregular*default at 24pt}{}{à a\utfchar{"0300} à}
+\stopnarrowtyping
+
+Of course a font can contain logic that replaces a sequence of base and mark into
+precomposed characters with the right \UNICODE\ entry.
+
+\blank \showotfcomposition{dejavu-serif*default at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{à a\utfchar{"0300} à}} \blank
+\blank \showotfcomposition{cambria*default at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{à a\utfchar{"0300} à}} \blank
+\blank \showotfcomposition{lmroman10regular*default at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{à a\utfchar{"0300} à}} \blank
+\blank \showotfcomposition{lucidabrightot*default at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{à a\utfchar{"0300} à}} \blank
+\blank \showotfcomposition{texgyrepagellaregular*default at 24pt}{}{\disabletrackers[otf.analyzing]\color[maincolor]{à a\utfchar{"0300} à}} \blank
+
+You can imagine that when marks are bound to characters that have become
+ligatures the anchoring is more complex as the font machinery has to keep track
+of onto which component the mark goes. For this purpose marks as well as base
+characters and base ligatures have anchors and feature lookups can explicitly
+refer to them.
+
+\stopsubsection
+
+\startsubsection[title={Contextual analysis}]
+
+What actually happens when turning a list of characters into a list of glyphs can
+range from real simple to pretty complex. For instance the \type {smcp} feature
+only has to run over the list and relate characters to a smallcaps shape. A
+slightly more complex feature might also demand some positioning. One step further
+is the use of contextual analysis, i.e. looking at previous, current and following
+characters (or glyphs). Because features can range from simple to complex the actual
+processing is not per feature! A font comes with a sequence of so called lookups that
+relate to a feature, script and language. Also, each feature can use one||to||one,
+multiple||to||one and many||to||many replacements as well as relative positioning.
+
+So, what actually happens is not that a feature is processed, but that all features
+are dealt with at the same time, in the order that the font prescribes. Enabling a
+specific feature means that a step is executed, while a disabled feature skips all
+steps that are tagged as belonging to that feature. And, as each feature can use
+contextual analysis, you can imagine that the effective sequence of actions can be
+a complex mix.
+
+A nice example of a contextual substitution is the centered period character in
+catalan in \type {ebgaramond}:
+
+\startbuffer
+\definefontfeature
+ [example]
+ [default]
+ [locl=yes,script=latn,language=cat]
+
+\definedfont[file:ebgaramond12-regular.otf*default at 40pt]l·l\quad
+\definedfont[file:ebgaramond12-regular.otf*example at 40pt]l·l
+\stopbuffer
+
+\typebuffer
+
+We show the boundingbox of the glyphs. The centered period between two l's is
+is replaced by a raised variant with no width.
+
+\blank \start \showglyphs \maincolor \midaligned{\getbuffer} \stop \blank
+
+It will be clear that in order to use such features you need to know what the font
+provides. For some fonts you need to explicitly enable the latin script (while others
+use default). Such a feature can be part of localized support but that is no rule.
+In that respect \OPENTYPE\ features are a rather unpredictable mess. For instance,
+nothing prevents such a feature to be a ligature, and in case you find that strange,
+especially ligature features are often abused for any purpose.
+
+\stopsubsection
+
+\startsubsection[reference=ligatures:hyphenation,title=Ligatures and hyphenation]
+
+In this section we will say a few words on how hyphenation interferes with
+(especially) ligature building. For this you need to know that:
+
+\starttyping
+effe
+\stoptyping
+
+But when hyphenation is permitted between the two \type{s}'s we actually have
+internally:
+
+\starttyping
+ef{-}{}{}fe
+\stoptyping
+
+The first snippet comes at the end of a line, the second at the beginning of a
+the next line and the last snippet is used when no hyphenation is needed. Such
+triplets need to be taken into account when we do replacements and positioning
+and also when we do contextual lookups.
+
+An \OPENTYPE\ font is just a container that collects the following:
+
+\startitemize[packed]
+\startitem
+ graphic representations of characters and symbols
+\stopitem
+\startitem
+ information about what characters the shapes represent
+\stopitem
+\startitem
+ rules about converting (sequences of) characters into one or more
+ representations
+\stopitem
+\startitem
+ rules about positioning representations relative to each other
+\stopitem
+\stopitemize
+
+Although the way this information is stored is standardized, the rules are not.
+You can imagine that there would be some standard way to turn an \type {f} and
+\type {i} into an \quote{fi} but we already saw that this is not the case. Here
+are some possibilities:
+
+\startitemize[packed]
+\startitem
+ The two characters get their own standard glyph, maybe with some kerning.
+\stopitem
+\startitem
+ The two characters are combined into one shape.
+\stopitem
+\startitem
+ The \type{f} gets a narrow representation and is kept close to the standard
+ \type{i}.
+\stopitem
+\startitem
+ A standard \type {f} is kerned with a dotless \type{i} (not to be confused
+ with the \UNICODE\ character).
+\stopitem
+\startitem
+ A special \type {f} is combined with a special \type {i}.
+\stopitem
+\stopitemize
+
+% maybe mark lig components when separate chars so that we can do spacing
+
+If the two characters are represented by their own shape, some contextual
+analysis takes place. Again there are several approaches to this:
+
+\startitemize[packed]
+\startitem
+ When an \type{f} is seen in the input, the next character is checked and one
+ or both gets replaced.
+\stopitem
+\startitem
+ When an \type{i} is seen in the input, the previous character is checked and
+ the \type {i} gets replaced.
+\stopitem
+\startitem
+ When an \type{f} several following characters are checked, for instance to
+ see if we need to take \type {ij} into account.
+\stopitem
+\stopitemize
+
+Traditionally the \type {f} followed by an \type{f}, \type{l} and \type{i} get a
+treatment, but some fonts also combine the \type {f} with \type {k}, \type {j},
+\type {b}, \type {t} and more.
+
+The \MKIV\ font handler is rather generic in the sense that it support what the
+font requires. However, a complication is that the scripts (languages) that use
+these diverse methods also expect hyphenation within such a ligature. Script like
+Arabic that are more demanding don't hyphenate so there interference with
+hyphenation is not a problem.
+
+Some ligatures are sensitive for languages. In languages that have compound words
+it might be undesirable to have a ligature at a word boundary, or in the Dutch
+word \type {fijn} we like to have a nice glyph (or combinations) for \type {ij}
+but no \type {fi} ligature. In a similar way hyphenation patterns can have
+rules and it will be no surprise that the hyphenation mechanism can compete with
+the ligature building for the best solution. This gets complicated by the fact
+that there is no real way to recognize in the font handler if we really are
+dealing with ligature building. Not only is the \type {liga} feature (and deep
+down the ligature gsub handling) not bound to ligatures (but simply a
+many|-|to|-|one mapper), some of the mentioned pseudo ligature builders use simple
+substitution and kerning and there is no way to recognize that as a ligature.
+
+Although it is possible to come up with a solution that is acceptable for many cases,
+there is no way to predict what kind of tricks font designers will use. A hyphenation
+point can be seen as follows:
+
+\starttabulate[||||]
+\NC \type{effe} \NC \type{ef-fe} \NC \type{e{f-}{f}{ff}e} \NC \NR
+\NC \type{efficient} \NC \type{ef-fi-cient} \NC \type{e{ffi-}{}{ffi}cient} \NC \NR
+\stoptabulate
+
+In the second case the larger ligatures has replaced the previous one. We could
+have kept the first one because there are ways to manage two|-|step bounding
+ligatures but it's not worth the trouble (read: way more complex code and
+increased runtime for the whole mechanism). Here the \type {{ff}} and \type
+{{ffi}} can be individual shapes or just one shape.
+
+The three components of a hyphenation point: the pre, post and replacement text
+need to be looked at independently so that we get the proper kerning with the
+preceding and following characters. Also, in more complex (chained) lookups we
+need to compare each element with its surrounding. A fully expanded solution tree
+is too time consuming so we take some shortcuts and limits the checks to the
+level that it has no big impact on performance. The occasionally needed
+backtracking and inspection of components is currently quite reasonable. We need
+to trade quality with convenience: the result should look okay but processing
+speed should also be as high as possible. There is no need to let other scripts
+or regular fonts suffer too much from excessive script demands of fonts that
+could have be done better.
+
+The complication is that we not only need to check and replace but also need to
+check the kerning with preceding and following characters. We also need to take
+the hyphen into account (here one, but there can also be one after the break.
+
+It is for this reason that in \MKIV\ we have a (we think) acceptable mix of
+heuristics around hyphenation points that deal with single and multiple
+substitution as well as kerning. It will never be 100\% pertect but we consider
+it better to drop an occasional hyphenation in favor of proper font handling. In
+practice \TEX\ is clever enough to break a paragraph in lines within these
+restrictions.
+
+In \CONTEXT\ we have the traditional \TEX\ hyphenator but also provide an
+extensible \LUA\ reimplementation. That one might become the default in future
+versions. In traditional \TEX\ there are several low level hyphenation
+representations: simple hyphen only points, injected by the hyphenator,
+explicitly injected by the user or originating from a hyphen character. Then
+there is the generic (pre, post, replace) discretionary that can be explicitly
+injected by the user (or a macro). In \MKIV\ all hyphenation points get
+normalized to this generic discretionary. There is no need for old|-|time
+optimizations and a consistent (expanded) representation is easier to deal with
+in other extensions. However, because the font handler is supposed to also work
+outside \CONTEXT\ we need to deal with traditional cases too. But \unknown\ the
+results might differ a bit.
+
+\stopsubsection
+
+\startsubsection[title=Color]
+
+% TODO: use emojionecolor-svginot-archived.ttf
+
+A recent new (and evolving) addition to \OPENTYPE\ is colored glyphs. One variant
+(by \MICROSOFT) uses overlays and this method is quite efficient.
+
+\startbuffer
+\definefontfeature[colored][colr=yes]
+\definefontsynonym[Emoji][file:seguiemj.ttf*default,colored]
+
+\definesymbol[bug][\getglyphdirect{Emoji}{\char"1F41B}]
+\definesymbol[ant][\getglyphdirect{Emoji}{\char"1F41C}]
+\definesymbol[bee][\getglyphdirect{Emoji}{\char"1F41D}]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Here we see a \symbol[bug], \symbol[ant] and \symbol[bee], and they come in
+color! Once \UNICODE\ started adding such symbols (and more get added) the
+distinction between characters and symbols get even fuzzier. Of course one
+can argue that we communicate in pictograms but even then, given that
+mankind lasts a while, the \UNICODE\ repertoire will explode.
+
+\startplacefigure[title={A few emojis from \type {seguiemj.ttf}}]
+ \startcombination [3*1]
+ {\scale[width=.3\textwidth]{\symbol[bug]}} {\type{U+1F41B}: bug}
+ {\scale[width=.3\textwidth]{\symbol[ant]}} {\type{U+1F41C}: ant}
+ {\scale[width=.3\textwidth]{\symbol[bee]}} {\type{U+1F41D}: bee}
+ \stopcombination
+\stopplacefigure
+
+Here we use \type {seguiemj.ttf}, a font that comes with \MSWINDOWS. Colors are
+achieved by combining glyphs rendered in different colors. A variant that uses
+\SVG\ instead of overlays is \type {emojionecolor-svginot.ttf}:
+
+\startbuffer
+\definefontfeature[svg][svg=yes]
+\definefontsynonym[Emoji][file:emojionecolor-svginot.ttf*default,svg]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+This time we get \symbol[bug], \symbol[ant] and \symbol[bee] and they look
+quite different. Both fonts also have ligatures and you can wonder what sense
+that makes. It makes it impossible to swap fonts and as there is no standard
+one never knows what to expect.
+
+\startplacefigure[title={A few emojis from \type {emojionecolor-svginot.ttf}}]
+ \startcombination [3*1]
+ {\scale[width=.3\textwidth]{\symbol[bug]}} {\type{U+1F41B}: bug}
+ {\scale[width=.3\textwidth]{\symbol[ant]}} {\type{U+1F41C}: ant}
+ {\scale[width=.3\textwidth]{\symbol[bee]}} {\type{U+1F41D}: bee}
+ \stopcombination
+\stopplacefigure
+
+\definefont[emoji][file:emojionecolor-svginot.ttf*default,svg]
+
+\def\FourFaces{\char128104\zwj\char128105\zwj\char128102\zwj\char128102\relax}
+
+\def\Man {\char"1F468\relax}
+\def\Woman{\char"1F469\relax}
+\def\Boy {\char"1F466\relax}
+\def\Girl {\char"1F467\relax}
+
+How do we know what faces add up to the ligature {\emoji\Man \zwj \Woman \zwj
+\Girl \zwj \Boy} and how are we supposed to know that there should {\darkgray
+\type {zwj}} in between? When we input four faces seoarated by zero width
+joiners, we get a four face symbol instead. The reason for having the joiners in
+between is probably to avoid unexpected ligatures. The sequence \type {man},
+\type {woman}, \type {boy}, \type {boy} gives \type {family}:
+%
+{\emoji\Man} + {\darkgray \type {zwj}}
+{\emoji\Woman} + {\darkgray \type {zwj}}
+{\emoji\Boy} + {\darkgray \type {zwj}}
+{\emoji\Boy} = {\emoji\Man \zwj \Woman \zwj \Boy \zwj \Boy},
+%
+but two girls also work:
+%
+{\emoji\Man} + {\darkgray \type {zwj}}
+{\emoji\Woman} + {\darkgray \type {zwj}}
+{\emoji\Girl} + {\darkgray \type {zwj}}
+{\emoji\Girl} = {\emoji\Man \zwj \Woman \zwj \Girl \zwj \Girl},
+%
+so does a mixture of kids:
+%
+{\emoji\Man} + {\darkgray \type {zwj}}
+{\emoji\Woman} + {\darkgray \type {zwj}}
+{\emoji\Girl} + {\darkgray \type {zwj}}
+{\emoji\Boy} = {\emoji\Man \zwj \Woman \zwj \Girl \zwj \Boy},
+%
+although (at least currently):
+%
+{\emoji\Man} + {\darkgray \type {zwj}}
+{\emoji\Woman} + {\darkgray \type {zwj}}
+{\emoji\Boy} + {\darkgray \type {zwj}}
+{\emoji\Girl} = {\emoji\Man \zwj \Woman \zwj \Boy \zwj \Girl},
+%
+gives twin boys. Of course the real family emoj is {\emoji\char"1F46A}.
+
+In our times for sure many combinations are possible, so:
+%
+{\emoji\Man} + {\darkgray \type {zwj}}
+{\emoji\Man} + {\darkgray \type {zwj}}
+{\emoji\Girl} + {\darkgray \type {zwj}}
+{\emoji\Girl} = {\emoji\Man \zwj \Man \zwj \Girl \zwj \Girl},
+%
+indeed gives a family, but I wonder at what point cultural bias will creep into
+font design. One can even wonder how clothing and haircut will demand frequent
+font updates: {\emoji\char"1F46B}, {\emoji\char"1F46C}, {\emoji\char"1F46D}.
+
+In the math alphabets we have a couple of annoying holes because some characters
+were already present in \UNICODE. The bad thing here is that we now always have
+to deal with these exceptions. But not so with emojis because here eventually all
+variants will show up. Where a character \type {A} in red or blue uses the same
+code point, a white telephone {\emoji\char"1F57E} and black telephone
+{\emoji\char"1F57F} have their own. And because obsolete scripts are already
+supported in \UNICODE\ and more get added, we can expect old artifacts also
+showing up at some time. Soon the joystick {\emoji\char"1F579} will be an unknown
+item to most of us, while the \MICROSOFT\ hololens migth get its slot.
+
+\startplacefigure[title={Will all animals come in stages of development?}]
+ \startcombination [3*1]
+ {\scale[width=.3\textwidth]{\emoji\char"1F423}} {\type{U+1F423}: hatching chick}
+ {\scale[width=.3\textwidth]{\emoji\char"1F424}} {\type{U+1F424}: baby chick}
+ {\scale[width=.3\textwidth]{\emoji\char"1F425}} {\type{U+1F425}: front-facing baby chick}
+ \stopcombination
+\stopplacefigure
+
+For sure these mechanisms will evolve and to what extent we support them depends
+on what users want. At least we have the basics implemented.
+
+\stopsubsection
+
+\stopsection
+
+\startsection[title=Extras]
+
+\startnotabene
+ Todo.
+\stopnotabene
+
+\stopsection
+
+\startsection[reference=goodies,title=Goodies]
+
+Goodies range from simple to complex. They share that they are defined in files
+and loaded at runtime. There is a good change that when you read this, that there
+are already more goodies than mentioned here. Here we will just mention a couple
+of goodies. More details can be found in the files that ship with \CONTEXT\ and
+have suffix \type {lfg}.
+
+A goodie file is a regular \LUA\ file and is supposed to return a table. This
+table collects data that is used for implementing the goodie or relates to a
+regular feature. It can also provide information that is used for patching a
+font. An example of a simple goodie file is the ones that accompanies the first
+release of the \OPENTYPE\ Lucida fonts.
+
+\starttyping
+return {
+ name = "lucida-opentype-math",
+ version = "1.00",
+ comment = "Goodies that complement lucida opentype.",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ mathematics = {
+ alternates = {
+ italic = {
+ feature = 'ss01',
+ value = 1,
+ comment = "Mathematical Alternative Italic"
+ },
+ }
+ }
+}
+\stoptyping
+
+This goodie file is only providing information about the meaning of a stylistic
+alternate. These have abstract tags like \type {ss01} and in this case this
+category collects alternative italic (calligraphic) shapes. Because math does
+not follow the same rules as text, this feature is enabled explicitly.
+
+In the goodie file of Xits math the alternates table has more entries:
+
+\startnarrowtyping
+alternates = {
+ cal = { ... comment = "Mathematical Calligraphic Alphabet" },
+ greekssup = { ... comment = "Mathematical Greek Sans Serif Alphabet" },
+ greekssit = { ... comment = "Mathematical Italic Sans Serif Digits" },
+ monobfnum = { ... comment = "Mathematical Bold Monospace Digits" },
+ mathbbbf = { ... comment = "Mathematical Bold Double-Struck Alphabet" },
+ mathbbit = { ... comment = "Mathematical Italic Double-Struck Alphabet" },
+ mathbbbi = { ... comment = "Mathematical Bold Italic Double-Struck Alphabet" },
+ upint = { ... comment = "Upright Integrals" },
+ vertnot = { ... comment = "Negated Symbols With Vertical Stroke" },
+}
+\stopnarrowtyping
+
+An alternate is triggered at the \TEX\ end with:
+
+\starttyping
+$ABC$ $\cal ABC$ $\mathalternate{cal}\cal ABC$
+\stoptyping
+
+This is an example of a dynamic feature that gets applied when enabled at a
+specific location in the input. The \type {cal} is only recognized when it
+is defined in a goodies file, where the value is defined (in all of the above cases
+the value is~\type {1}).
+
+The Xits math fonts has a goodie files that starts with:
+
+\starttyping
+return {
+ name = "xits-math",
+ version = "1.00",
+ comment = "Goodies that complement xits (by Khaled Hosny).",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ mathematics = {
+ italics = {
+ ["xits-math"] = italics,
+ },
+ alternates = {
+\stoptyping
+
+Here the \type {italics} variable is a table defined before the \type {return}
+that looks as follows:
+
+\starttyping
+local italics = {
+ defaultfactor = 0.025,
+ disableengine = true,
+ corrections = {
+ -- [0x1D44E] = 0.99, -- a (fraction of quad)
+ -- [0x1D44F] = 100, -- b (font points)
+ [0x1D453] = -0.0375, -- f
+ }
+}
+\stoptyping
+
+This rather specific table tells \CONTEXT\ that (when enabled) it has to apply
+italic correction. It disables support built into the \TEX\ engine (which in the
+case of \LUATEX\ is close to absent anyway). It will apply a default italic
+correction of \type {0.025} but for some shapes a different value is used. Again
+we have some commands at the \TEX\ end:
+
+\starttyping
+\setupmathematics[italics=1] % fontitalics
+\setupmathematics[italics=2] % fontdata
+\setupmathematics[italics=3] % quad based
+\setupmathematics[italics=4] % combination of 1 and 3
+\stoptyping
+
+Because (definitely at the start of the \LUATEX\ project) we had no
+proper \OPENTYPE\ math fonts, but at the same time wanted to move on
+to \OPENTYPE\ and \UNICODE\ math and no longer struggle with all
+those math families and definitions. The way out of this problem
+is to define a virtual math font. The code for doing this is built
+into the \MKIV\ core but is controlled by a goodie definition. Take
+for instance Antykwa Math:
+
+\startnarrowtyping
+return {
+ name = "antykwa-math",
+ version = "1.00",
+ comment = "Goodies that complement antykwa math.",
+ author = "Hans, Mojca, Aditya",
+ copyright = "ConTeXt development team",
+ mathematics = {
+ mapfiles = {
+ "antt-rm.map",
+ "antt-mi.map",
+ "antt-sy.map",
+ "antt-ex.map",
+ "mkiv-base.map",
+ },
+ virtuals = {
+ ["antykwa-math"] = {
+ { name = "file:AntykwaTorunska-Regular", features = "virtualmath", main = true },
+ { name = "mi-anttri.tfm", vector = "tex-mi", skewchar=0x7F },
+ { name = "mi-anttri.tfm", vector = "tex-it", skewchar=0x7F },
+ { name = "sy-anttrz.tfm", vector = "tex-sy", skewchar=0x30, parameters = true } ,
+ { name = "ex-anttr.tfm", vector = "tex-ex", extension = true } ,
+ { name = "msam10.tfm", vector = "tex-ma" },
+ { name = "msbm10.tfm", vector = "tex-mb" },
+ },
+\stopnarrowtyping
+
+Normally users will not define such tables but the keys give an indication of
+what is involved. The same is true for the previously shown tables: they are just
+provided in the \CONTEXT\ distribution.
+
+Text fonts also can have goodies. We start with a rather dumb one and there
+will be not that many of those. This one is needed to turn a \TYPEONE\ font
+with a rather special encoding into a \UNICODE\ font. The next mapping is
+possible because the dingbats are part of \UNICODE.
+
+\starttyping
+return {
+ name = "dingbats",
+ version = "1.00",
+ comment = "Goodies that complement dingbats (funny names).",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ remapping = {
+ tounicode = true,
+ unicodes = {
+ a1 = 0x2701,
+ a10 = 0x2721,
+ a100 = 0x275E,
+ a101 = 0x2761,
+ a102 = 0x2762,
+\stoptyping
+
+Applying this encoding happens in two steps. Because goodies like this are just
+features, we need to define a proper font feature set:
+
+\starttyping
+\definefontfeature
+ [dingbats]
+ [mode=base,
+ goodies=dingbats,
+ unicoding=yes]
+\stoptyping
+
+We have a base mode font, so no special processing takes place. The \type {goodies}
+key is used to communicate the goodies file. The \type {unicoding} key is used
+to apply the encoding. Of course this only works because the remapper code is present
+in the core and is hooked in to the font initialization code. The \type {dingbats}
+feature set is predefined, just as the font definition:
+
+\starttyping
+\definefontsynonym [ZapfDingbats] [file:uzdr] [features=dingbats]
+\stoptyping
+
+Here is a goodie file that I made a while ago:
+
+\starttyping
+return {
+ name = "oxoniensis",
+ version = "1.00",
+ comment = "Oxoniensis test file for Thomas Schmitz.",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ features = {
+ lunatesigma = {
+ type = "substitution",
+ data = {
+ sigma = 0x03F2,
+ sigma1 = 0x03F2,
+ Sigma = 0x03F9,
+ phi = phi1,
+ },
+ }
+ },
+}
+\stoptyping
+
+There is not that much to say about this, apart from that it's a sort of fake
+feature that gets enabled as regular one:
+
+\starttyping
+\definefontfeature[test]
+ [mode=node,
+ kern=yes,
+ lunatesigma=yes,
+ goodies=oxoniensis]
+
+\definefont[somefont][file:oxoniensis*test]
+\stoptyping
+
+A complete different kind of goodie is the following. At one of the \CONTEXT\ meetings
+Mojca Miklavec discussed the possibility to have an additional mechanism for
+defining combinations of fonts. Often fonts come in a set of four (regular, italic,
+bold and bold italic). In \MKII\ the complexity of typescripts depends on the amount of
+encodings that need to be supported but in \MKIV\ things are easier. For a set of four fonts
+a typescript looks as follows:
+
+\starttyping
+\starttypescript [sans] [somesansfont] [name]
+ \setups[font:fallback:sans]
+ \definefontsynonym [Sans] [file:somesans] [features=default]
+ \definefontsynonym [SansBold] [file:somesansb] [features=default]
+ \definefontsynonym [SansItalic] [file:somesansi] [features=default]
+ \definefontsynonym [SansBoldItalic] [file:somesansz] [features=default]
+\stoptypescript
+\stoptyping
+
+We still have the abstract notion of a \type {Sans} font so that we can refer to
+the regular shape without knowing the real name but the number of lines needed
+is small. Such a definition can then be referred to using:
+
+\starttyping
+\starttypescript[somefontset]
+ \definetypeface [somefontset] [rm] [serif] [someserif] [default]
+ \definetypeface [somefontset] [ss] [sans] [somesans] [default]
+ \definetypeface [somefontset] [tt] [mono] [somemono] [default]
+ \definetypeface [somefontset] [mm] [math] [somemath] [default]
+\stoptypescript
+\stoptyping
+
+So far things look simple. Given that many fonts follow a similar naming scheme
+Wolfgang made a module that avoids such definitions altogether. However, being
+involved in the development of the Antykwa fonts, Mojca ran into the situation
+that not just four fonts were part of the set but many more. There are several
+weight (think of light and heavy variants) as well as condensed variants and of
+course the whole set is not per se a multiple of four.
+
+In the meantime, in addition to the \type {file:} and \type {name:} accessors,
+\CONTEXT\ had an additional one tagged \type {spec:} where a string made out of
+weight, style, width etc.\ is turned into a (best guessed) font name. Therefore
+the most natural way to deal with the many|-|fonts|-|in|-|a|-|set dilemma was to
+provide an additional interface between this specification and the font set and
+the most robust method was to define all in a goodie file.
+
+In this case the goodies are loaded independent of the font, that is: not
+as a feature. For instance:
+
+\starttyping
+\loadfontgoodies[antykwapoltawskiego]
+\stoptyping
+
+This file maps obscure fontnames onto the \type {spec:} interface so that
+we can access them in a robust way.
+
+\starttyping
+\definefont
+ [MyFontA]
+ [file:Iwona-Regular*smallcaps]
+\definefont
+ [MyFontB]
+ [file:AntykwaTorunska-Regular*smallcaps]
+\definefont
+ [MyFontC]
+ [file:antpoltltcond-regular*smallcaps]
+\definefont
+ [MyFontD]
+ [spec:antykwapoltawskiego-bold-italic-condensed-normal*smallcaps]
+\definefont
+ [MyFontE]
+ [spec:antykwapoltawskiego-bold-italic-normal]
+\stoptyping
+
+The goodies file looks as follows:
+
+\starttyping
+return {
+ name = "antykwa-poltawskiego",
+ version = "1.00",
+ comment = "Goodies that complement Antykwa Poltawskiego",
+ author = "Hans & Mojca",
+ copyright = "ConTeXt development team",
+ files = {
+ name = "antykwapoltawskiego", -- shared
+ list = {
+ ["AntPoltLtCond-Regular.otf"] = {
+ weight = "light",
+ style = "regular",
+ width = "condensed",
+ },
+ ...
+ ["AntPoltExpd-BoldItalic.otf"] = {
+ weight = "bold",
+ style = "italic",
+ width = "expanded",
+ },
+ },
+ },
+ typefaces = {
+ ["antykwapoltawskiego-light"] = {
+ shortcut = "rm",
+ shape = "serif",
+ fontname = "antykwapoltawskiego",
+ normalweight = "light",
+ boldweight = "medium",
+ width = "normal",
+ size = "default",
+ features = "default",
+ },
+ ...
+ },
+}
+\stoptyping
+
+In addition to the files|-|to|-|specification mapping, there is
+also a typeface specification table. This permits the definition
+of a typeface in the following way:
+
+\starttyping
+\definetypeface
+ [name=mojcasfavourite,
+ preset=antykwapoltawskiego,
+ normalweight=light,
+ boldweight=bold,
+ width=expanded]
+
+\setupbodyfont
+ [mojcasfavourite]
+\stoptyping
+
+When resolving the definition, the best possible match will be taken from the
+typeface table in the goodie file. Of course this is not something that we expect
+the average user to deliver and deal with.
+
+As the Antykwa font is somewhat atypical and not used in everyday typesetting,
+you might wonder if all this overhead makes sense. However, there are type
+foundries that do ship their fonts in many weights and for those using a \LUA\
+goodie file instead of many typescripts in \TEX\ coding makes sense. Take for
+instance TheMix:
+
+\starttyping
+\loadfontgoodies
+ [themix]
+
+\definetypeface
+ [name=themix,
+ preset=themix-light]
+
+\definetypeface
+ [name=themix,
+ preset=themixmono-light]
+
+\setupbodyfont
+ [themix]
+\stoptyping
+
+In this case the goodie file can serve as a template for more such fonts.
+In order to be efficient this goodie file uses a couple of local
+tables (we could have used metatables instead).
+
+\starttyping
+local themix = {
+ name = "themix",
+ shortcut = "ss",
+ shape = "sans",
+ fontname = "themix",
+ width = "normal",
+ size = "default",
+ features = "default",
+}
+
+local themixmono = {
+ name = "themixmono",
+ shortcut = "tt",
+ shape = "mono",
+ fontname = "themixmono",
+ width = "normal",
+ size = "default",
+ features = "default",
+}
+\stoptyping
+
+The main goodie table defines a lot of weights:
+
+\startnarrowtyping
+return {
+ name = "themix",
+ version = "1.00",
+ comment = "Goodies that complement TheMix (by and for sale at www.lucasfonts.com).",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ files = {
+ list = {
+ ["TheMixOsF-ExtraLight"] = {
+ name = "themix",
+ weight = "extralight",
+ style = "regular",
+ width = "normal"
+ },
+ ["TheMixOsF-ExtraLightItalic"] = {
+ ...
+ },
+ ...
+ ["TheMixOsF-Black"] = {
+ ...
+ },
+ ["TheMixOsF-BlackItalic"] = {
+ ...
+ },
+ ...
+ --
+ ["TheMixMono-W2ExtraLight"] = {
+ name = "themixmono",
+ weight = "extralight",
+ style = "regular",
+ width = "normal"
+ },
+ ...
+ ["TheMixMono-W9BlackItalic"] = {
+ ...
+ },
+ },
+ },
+ typefaces = {
+ ["themix-extralight"] = table.merged(themix, {
+ normalweight = "extralight",
+ boldweight = "semilight"
+ }),
+ ["themix-light"] = table.merged(themix, {
+ normalweight = "light",
+ boldweight = "normal"
+ }),
+ ...
+ ["themixmono-bold"] = table.merged(themixmono, {
+ normalweight = "bold",
+ boldweight = "black"
+ }),
+ },
+}
+\stopnarrowtyping
+
+It's now time for some generic goodies. In the \CONTEXT\ distribution there
+is a goodie file that (at the time of this writing) looks as follows:
+
+\starttyping
+local default = {
+ analyze = "yes",
+ mode = "node",
+ language = "dflt",
+ script = "dflt",
+}
+
+local smallcaps = {
+ smcp = "yes",
+}
+
+local function statistics(tfmdata)
+ commands.showfontparameters(tfmdata)
+end
+
+local function squeeze(tfmdata)
+ for k, v in next, tfmdata.characters do
+ v.height = 0.75 * (v.height or 0)
+ v.depth = 0.75 * (v.depth or 0)
+ end
+end
+
+return {
+ name = "demo",
+ version = "1.01",
+ comment = "An example of goodies.",
+ author = "Hans Hagen",
+ featuresets = {
+ default = {
+ default,
+ },
+ smallcaps = {
+ default, smallcaps,
+ },
+ },
+ colorschemes = {
+ default = {
+ [1] = {
+ "one", "three", "five", "seven", "nine",
+ },
+ [2] = {
+ "two", "four", "six", "eight", "ten",
+ },
+ },
+ all = {
+ [1] = {
+ "*",
+ },
+ },
+ some = {
+ [1] = {
+ "0x0030:0x0035",
+ },
+ },
+ },
+ postprocessors = {
+ statistics = statistics,
+ squeeze = squeeze,
+ },
+}
+\stoptyping
+
+This demo file implements several goodies: featuresets, colors and
+postprocessors. Keep in mind that a goodie file can provide whatever information
+it wants but of course only known subtables will be dealt with.
+
+The coloring of glyphs can happen by name, which assumes that glyph names are
+used, or by number. Here we use generic glyph names, but for a specific font one
+might need to provide a special goodie file. For instance, the color section of
+the goodie file for the husayni font has entries like:
+
+\startnarrowtyping
+[3] = {
+ "Ttaa.waqf", "SsLY.waqf", "QLY.waqf", "Miim.waqf", "LA.waqf", "Jiim.waqf",
+ "Threedotsabove.waqf", "Siin.waqf", "Ssaad.waqf", "Qaaf.waqf", "SsL.waqf",
+ "QF.waqf", "SKTH.waqf", "WQFH.waqf", "Kaaf.waqf", "Ayn.ruku", "Miim.nuun_high",
+ "Siin.Ssaad", "Nuunsmall", "emptydot_low", "emptydot_high", "Sifr.fill",
+ "Miim.nuun_low", "Nuun.tanwiin",
+},
+\stopnarrowtyping
+
+Of course such a definition can only be made when the internals of the font are
+known and in this case it concerns a pretty complex font.
+
+\startbuffer
+\definefontfeature
+ [demo-colored]
+ [goodies=demo,
+ colorscheme=default,
+ featureset=default]
+
+\definefontfeature
+ [demo-colored-all]
+ [goodies=demo,
+ colorscheme=all,
+ featureset=default]
+
+\definefontfeature
+ [demo-colored-some]
+ [goodies=demo,
+ colorscheme=some,
+ featureset=default]
+
+\definefont[DemoFontA][MonoBold*demo-colored at 10pt]
+\definefont[DemoFontB][MonoBold*demo-colored-all at 10pt]
+\definefont[DemoFontC][MonoBold*demo-colored-some at 10pt]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+% \definecolor[colorscheme:1:1][s=.75]
+% \definecolor[colorscheme:1:2][r=.75]
+% \definecolor[colorscheme:1:3][g=.75]
+% \definecolor[colorscheme:1:4][b=.75]
+% \definecolor[colorscheme:1:5][c=.75]
+% \definecolor[colorscheme:1:6][m=.75]
+% \definecolor[colorscheme:1:7][y=.75]
+
+% \definecolor[colorscheme:2:7][s=.75]
+% \definecolor[colorscheme:2:6][r=.75]
+% \definecolor[colorscheme:2:5][g=.75]
+% \definecolor[colorscheme:2:4][b=.75]
+% \definecolor[colorscheme:2:3][c=.75]
+% \definecolor[colorscheme:2:2][m=.75]
+% \definecolor[colorscheme:2:1][y=.75]
+
+\startbuffer
+\starttabulate[||||]
+\NC
+ \DemoFontA \resetfontcolorscheme test 1234567890 \NC
+ \DemoFontA \setfontcolorscheme [1]test 1234567890 \NC
+ \DemoFontA \setfontcolorscheme [2]test 1234567890 \NC
+\NR
+\NC
+ \DemoFontB \resetfontcolorscheme test 1234567890 \NC
+ \DemoFontB \setfontcolorscheme [1]test 1234567890 \NC
+ \DemoFontB \setfontcolorscheme [2]test 1234567890 \NC
+\NR
+\NC
+ \DemoFontC \resetfontcolorscheme test 1234567890 \NC
+ \DemoFontC \setfontcolorscheme [1]test 1234567890 \NC
+ \DemoFontC \setfontcolorscheme [2]test 1234567890 \NC
+\NR
+\stoptabulate
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Here is an example that I made at the TUG 2013 conference in Japan,
+after a presentation by Chof. The font (adapted by by Dohyun Kim) can
+be downloaded from: \hyphenatedurl {http://ftp.ktug.org/KTUG/hcr-lvt/1.910_nomac/}.
+
+\startbuffer[korean-demo]
+\definefontfeature
+ [korean-composed]
+ [goodies=hanbatanglvt,
+ colorscheme=default,
+ mode=node,
+ ljmo=yes,
+ tjmo=yes,
+ vjmo=yes,
+ script=hang,
+ language=kor]
+
+\definefont
+ [KoreanJMO]
+ [hanbatanglvt*korean-composed]
+
+\definecolor[colorscheme:100:1][r=.75]
+\definecolor[colorscheme:100:2][g=.75]
+\definecolor[colorscheme:100:3][b=.75]
+
+\definecolor[colorscheme:101:1][g=.75,b=.75]
+\definecolor[colorscheme:101:2][r=.75,b=.75]
+\definecolor[colorscheme:101:3][r=.75,g=.75]
+\stopbuffer
+
+\typebuffer[korean-demo] \getbuffer[korean-demo]
+
+\startbuffer
+ % Hunminjeongeum: http://en.wikipedia.org/wiki/Hunminjeongeum
+ 나랏말ᄊᆞ미中듕國귁에달아문ᄍᆞᆼ와로서르ᄉᆞᄆᆞᆺ디아니ᄒᆞᆯᄊᆡ%
+ 사ᄅᆞᆷ마다ᄒᆡᅇᅧ수ᄫᅵ니겨나...% ᆯ로ᄡᅮ메便뼌安ᅙᅡᆫ킈ᄒᆞ고져ᄒᆞᇙᄯᆞᄅᆞ미니라
+\stopbuffer
+
+\startlinecorrection
+\startcombination[1*3]
+ {\framed{\startscript[hangul]\KoreanJMO \getbuffer\stopscript}} {no colorscheme}
+ {\framed{\startscript[hangul]\KoreanJMO\setfontcolorscheme[100]\getbuffer\stopscript}} {colorscheme 100}
+ {\framed{\startscript[hangul]\KoreanJMO\setfontcolorscheme[101]\getbuffer\stopscript}} {colorscheme 101}
+\stopcombination
+\stoplinecorrection
+
+The goodie definition looks as follows (watch how we use ranges):
+
+\starttyping
+return {
+ name = "hanbatanglvt",
+ version = "1.00",
+ comment = "Goodies that complement the hanbatanglvt fonts.",
+ author = "Hans Hagen",
+ colorschemes = {
+ default = {
+ { "0x01100:0x0115F" }, -- jamo_initial (r/c)
+ { "0x01160:0x011A7" }, -- jamo_medial (g/m)
+ { "0x011A8:0x011FF" }, -- jamo_final (b/y)
+ }
+ }
+}
+\stoptyping
+
+This is much shorter (and efficent) that defining a whole vector, as in:
+
+\starttyping
+local f_uni_base = string.formatters["uni%04X"]
+local f_uni_plus = string.formatters["uni%04X.y%s"]
+
+local function range(first,last)
+ local t = { }
+ for i=first,last do
+ t[#t+1] = f_uni_base(i)
+ for j=0,19 do
+ t[#t+1] = f_uni_plus(i,j)
+ end
+ end
+ return t
+end
+
+return {
+ name = "hanbatanglvt",
+ version = "1.00",
+ comment = "Goodies that complement the hanbatanglvt fonts.",
+ author = "Hans Hagen",
+ colorschemes = {
+ default = {
+ range(0x01100,0x0115F), -- jamo_initial (r/c)
+ range(0x01160,0x011A7), -- jamo_medial (g/m)
+ range(0x011A8,0x011FF), -- jamo_final (b/y)
+ }
+ }
+}
+\stoptyping
+
+By using names we don't depend on \UNICODE\ which sometimes is needed when glyphs
+have ended up in the private space. However, by default, after glyphs have been
+mapped to colors, an extra pass will make sure that characters pushed into
+private space will get the same mapping as their regular \UNICODE\ has gotten
+(given that the number is known). Of course explicitly assigned colors will be
+preserved.
+
+Another generic demo feature is postprocessing. In principle one can
+add additional postprocessors but for that the source code needs to
+be consulted which in turn assumes some knowledge of fonts and \CONTEXT\
+internals.
+
+\startbuffer
+\definefontfeature
+ [justademoa]
+ [default]
+ [goodies=demo,
+ postprocessor=squeeze]
+
+\definefontfeature
+ [justademob]
+ [default]
+ [goodies=demo,
+ postprocessor=statistics]
+
+\definefontfeature
+ [justademoc]
+ [default]
+ [goodies=demo,
+ postprocessor={statistics,squeeze}]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+The statistics just print some font parameters to the log so that one
+is not showing up here. The squeeze looks as follows:
+
+\startbuffer
+\definefont[DemoFontD][Serif*default at 30pt]
+\definefont[DemoFontE][Serif*justademoa at 30pt]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startlinecorrection
+\hbox\bgroup
+ \ruledhbox{\color[maincolor]{DemoFontD height \& depth}}\quad
+ \ruledhbox{\color[maincolor]{DemoFontE height \& depth}}
+\egroup
+\stoplinecorrection
+
+The squeezer just makes the height and depth of glyphs a bit smaller and it is
+not that hard to imagine other manipulations. The demo goodie file is good
+place to start playing with such things.
+
+Because there is less standardization with respect to features than one might
+suspect, goodie files provide a mean to define featuresets. We can use such a set
+in another definition:
+
+\starttyping
+\definefontfeature
+ [demo-smallcaps]
+ [goodies=demo,
+ featureset=smallcaps]
+\stoptyping
+
+Of course this only makes sense for more complex combinations. The already mentioned
+husayni font comes with many features and most of these work together.
+
+The basic goodie table looks as follows:
+
+\startnarrowtyping
+return {
+ name = "husayni",
+ version = "1.00",
+ comment = "Goodies that complement the Husayni font by Idris Samawi Hamid.",
+ author = "Idris Samawi Hamid and Hans Hagen",
+ featuresets = { },
+ solutions = { },
+ stylistics = { },
+ colorschemes = { },
+}
+\stopnarrowtyping
+
+We already saw the color schemes and now we will fill in the other tables. First
+we define a couple of sets:
+
+\startnarrowtyping
+local basics = {
+ analyze = "yes",
+ mode = "node",
+ language = "dflt",
+ script = "arab",
+}
+
+local analysis = {
+ ccmp = "yes",
+ init = "yes", medi = "yes", fina = "yes",
+}
+
+local regular = {
+ rlig = "yes", calt = "yes", salt = "yes", anum = "yes",
+ ss01 = "yes", ss03 = "yes", ss07 = "yes", ss10 = "yes", ss12 = "yes",
+ ss15 = "yes", ss16 = "yes", ss19 = "yes", ss24 = "yes", ss25 = "yes",
+ ss26 = "yes", ss27 = "yes", ss31 = "yes", ss34 = "yes", ss35 = "yes",
+ ss36 = "yes", ss37 = "yes", ss38 = "yes", ss41 = "yes", ss42 = "yes",
+ ss43 = "yes", js16 = "yes",
+}
+
+local positioning = {
+ kern = "yes", curs = "yes", mark = "yes", mkmk = "yes",
+}
+
+local minimal_stretching = {
+ js11 = "yes", js03 = "yes",
+}
+
+local medium_stretching = {
+ js12="yes", js05="yes",
+}
+local maximal_stretching= {
+ js13 = "yes", js05 = "yes", js09 = "yes",
+}
+
+local wide_all = {
+ js11 = "yes", js12 = "yes", js13 = "yes", js05 = "yes", js09 = "yes",
+}
+
+local shrink = {
+ flts = "yes", js17 = "yes", ss05 = "yes", ss11 = "yes", ss06 = "yes",
+ ss09 = "yes",
+}
+
+local default = {
+ basics, analysis, regular, positioning, -- xxxx = "yes", yyyy = 2,
+}
+\stopnarrowtyping
+
+Next we define some featuresets and we use the default as starting point:
+
+\startnarrowtyping
+ featuresets = {
+ default = {
+ default,
+ },
+ minimal_stretching = {
+ default, js11 = "yes", js03 = "yes",
+ },
+ medium_stretching = {
+ default, js12="yes", js05="yes",
+ },
+ maximal_stretching= {
+ default, js13 = "yes", js05 = "yes", js09 = "yes",
+ },
+ wide_all = {
+ default, js11 = "yes", js12 = "yes", js13 = "yes", js05 = "yes",
+ js09 = "yes",
+ },
+ shrink = {
+ default, flts = "yes", js17 = "yes", ss05 = "yes", ss11 = "yes",
+ ss06 = "yes", ss09 = "yes",
+ },
+ }
+\stopnarrowtyping
+
+When defining the font at the \TEX\ end we can now refer to for instance \type
+{wide_all} which saves us some typing. However, it does not stop here. In a later
+paragraph we will see how fonts can work in tandem with the parbuilder. For that
+purpose the goodie table has a \type {solutions} subtable:
+
+\startnarrowtyping
+solutions = {
+ experimental = {
+ less = {
+ "shrink"
+ },
+ more = {
+ "minimal_stretching", "medium_stretching", "maximal_stretching", "wide_all"
+ },
+ },
+}
+\stopnarrowtyping
+
+Here we define an experimental solution for optimizing the lines in a paragraph:
+we can narrow words or we can widen them according to a specific featureset. In
+order to reach the optimal solution the text will be retypeset under a different
+feature regime.
+
+{\em TODO: show how to apply.}
+
+%D \starttyping
+%D \setupfontsolutions[method={random,preroll},criterium=1,randomseed=101]
+%D
+%D \definefontsolution % actually only the last run needs to be done this way
+%D [FancyHusayni]
+%D [goodies=husayni,
+%D solution=experimental]
+%D
+%D \definedfont[husayni*husayni-default at 24pt]
+%D \setupinterlinespace[line=36pt]
+%D \righttoleft
+%D \enabletrackers[parbuilders.solutions.splitters.colors]
+%D \setfontsolution[FancyHusayni]
+%D alb alb alb \par
+%D \resetfontsolution
+%D \disabletrackers[parbuilders.solutions.splitters.colors]
+%D \stoptyping
+
+Because there are a some 55 stylistic and 21 justification variants the
+goodie file also provides a \type {stylistics} table and for tracing purposes
+the {colorschemes} table is populated.
+
+Yet another demonstration of manipulation is the following. Not all fonts come
+with all combined glyphs. Although we have an auto|-|compose feature in \CONTEXT\
+it sometimes helps to be specific with respect to some combinations. This is
+where the \type {compositions} goodie kicks in:
+
+\starttyping
+local compose = {
+ [0x1E02] = {
+ anchored = "top",
+ },
+ [0x1E04] = {
+ anchored = "bottom",
+ },
+ [0x0042] = { -- B
+ anchors = {
+ top = {
+ x = 300,
+ y = 700,
+ },
+ bottom = {
+ x = 300,
+ y = -30,
+ },
+ },
+ },
+ [0x0307] = {
+ anchors = {
+ top = {
+ x = -250,
+ y = 550,
+ },
+ },
+ },
+ [0x0323] = {
+ anchors = {
+ bottom = {
+ x = -250,
+ y = -80,
+ },
+ },
+ },
+}
+
+return {
+ name = "lm-compose-test",
+ version = "1.00",
+ comment = "Goodies that demonstrate composition.",
+ author = "Hans and Mojca",
+ copyright = "ConTeXt development team",
+ compositions = {
+ ["lmroman12-regular"] = compose,
+ }
+}
+\stoptyping
+
+Of course this assumes some knowledge of the font metrics (in base points) and
+\UNICODE\ slots, but it might be worth the trouble. After all, one only needs to
+figure it out once. But keep in mind that it will always be a kludge.
+
+A slightly different way to define such compositions is the following:
+
+\starttyping
+local defaultunits = 193 - 30
+
+local compose = {
+ DY = defaultunits,
+ -- [0x010C] = { DY = defaultunits }, -- Ccaron
+ -- [0x02C7] = { DY = defaultunits }, -- textcaron
+}
+
+-- fractions relative to delta(X_height - x_height)
+
+local defaultfraction = 0.85
+
+local compose = {
+ DY = defaultfraction, -- uppercase compensation
+}
+
+return {
+ name = "lucida-one",
+ version = "1.00",
+ comment = "Goodies that complement lucida.",
+ author = "Hans and Mojca",
+ copyright = "ConTeXt development team",
+ compositions = {
+ ["lbr"] = compose,
+ ["lbi"] = compose,
+ ["lbd"] = compose,
+ ["lbdi"] = compose,
+ }
+}
+\stoptyping
+
+Of course no one really needs this because \OPENTYPE\ Lucida fonts
+have replaced the \TYPEONE\ versions.
+
+The next goodie table is dedicated to the de facto standard \TEX\ font Latin
+Modern. There is a bit of history behind this file. When we started writing
+\CONTEXT\ there were not that many fonts available and so we ended up with a font
+system that was rather well suited for the predecessor of Latin Modern, called
+Computer Modern. And because these fonts came in design sizes the font system
+was made such that it could cope efficiently with many files in a font set. Although
+there is no additional overhead compared to small font sets, apart from more files,
+there is some burden in defining them. And, as they are the default fonts, these
+definitions slow down the initialization of \CONTEXT\ (which is due to the fact that
+the large typescript definitions were loaded and parsed). So, at some point
+the decision was made to kick out these definitions and move the burden of figuring
+out the right size to \LUA. When Latin Modern is chosen as font the effect is the
+same when design sizes are enabled. But, instead of many definitions (one for each
+combination of size and style) we now have an option. A non|-|designsize typeface
+is defined as follows:
+
+\startnarrowtyping
+\starttypescript [modern,modern-base]
+ \definetypeface [\typescriptone] [rm] [serif] [modern] [default]
+ \definetypeface [\typescriptone] [ss] [sans] [modern] [default]
+ \definetypeface [\typescriptone] [tt] [mono] [modern] [default]
+ \definetypeface [\typescriptone] [mm] [math] [modern] [default]
+ \quittypescriptscanning
+\stoptypescript
+\stopnarrowtyping
+
+The designsize variant looks like this:
+
+\startnarrowtyping
+\starttypescript [modern-designsize]
+ \definetypeface [\typescriptone]
+ [rm] [serif] [latin-modern-designsize] [default] [designsize=auto]
+ \definetypeface [\typescriptone]
+ [ss] [sans] [latin-modern-designsize] [default] [designsize=auto]
+ \definetypeface [\typescriptone]
+ [tt] [mono] [latin-modern-designsize] [default] [designsize=auto]
+ \definetypeface [\typescriptone]
+ [mm] [math] [latin-modern-designsize] [default] [designsize=auto]
+ \quittypescriptscanning
+\stoptypescript
+\stopnarrowtyping
+
+Of course there are accompanying typescripts that map the sans, serif, mono
+and math styles onto files. The \type {designsize} magic uses the following
+table. We show only part of the file, as it is in the \CONTEXT\ distribution.
+
+\starttyping
+return {
+ name = "latin modern",
+ version = "1.00",
+ comment = "Goodies that complement latin modern.",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ mathematics = {
+ tweaks = {
+ aftercopying = {
+ mathematics.tweaks.fixbadprime, -- prime is too low
+ },
+ },
+ },
+ designsizes = {
+ ["LMMathRoman-Regular"] = {
+ ["4pt"] = "LMMath5-Regular@lmroman5-math",
+ ...
+ ["12pt"] = "LMMath12-Regular@lmroman12-math",
+ default = "LMMath10-Regular@lmroman10-math"
+ },
+ ["LMMathRoman-Bold"] = { -- not yet ready
+ ...
+ },
+ ["LMRoman-Regular"] = {
+ ["4pt"] = "file:lmroman5-regular",
+ ...
+ ["12pt"] = "file:lmroman12-regular",
+ default = "file:lmroman10-regular",
+ },
+ ["LMRoman-Bold"] = {
+ ...
+ },
+ ["LMRoman-Demi"] = {
+ default = "file:lmromandemi10-regular",
+ },
+ ["LMRoman-Italic"] = {
+ ...
+ },
+ ...
+ ["LMRoman-Unslanted"] = {
+ default = "file:lmromanunsl10-regular",
+ },
+ ["LMSans-Regular"] = {
+ ...
+ },
+ ["LMTypewriter-Regular"] = {
+ ...
+ },
+ ...
+ ["LMTypewriterVarWd-DarkOblique"] = {
+ default = "file:lmmonoproplt10-boldoblique",
+ },
+ ...
+ ["LMTypewriter-CapsOblique"] = {
+ default = "file:lmmonocaps10-oblique",
+ },
+ }
+}
+\stoptyping
+
+The \type {auto} option will choose a best fit compatible to the
+\MKII\ implementation. When \type {default} is used instead, the
+default filename will be taken. Of course one might wonder if
+there will ever be similar goodie files because design sizes
+are not that popular nowadays.
+
+Not all fonts are perfect and of course the \LUATEX\ engine can have flaws as
+well. For this reason we can implement patches. Here is another example of a
+goodie file that has some more code than just a table:
+
+\starttyping
+local patches = fonts.handlers.otf.enhancers.patches
+
+local function patch(data,filename,threshold)
+ local m = data.metadata.math
+ if m then
+ local d = m.DisplayOperatorMinHeight or 0
+ if d < threshold then
+ patches.report("DisplayOperatorMinHeight(%s -> %s)",d,threshold)
+ m.DisplayOperatorMinHeight = threshold
+ end
+ end
+end
+
+patches.register("after","analyze math","asana",
+ function(data,filename) patch(data,filename,1350) end)
+
+local function less(value,target,original)
+ return 0.25 * value
+end
+
+local function more(value,target,original)
+ local o = original.mathparameters.DisplayOperatorMinHeight
+ if o < 2800 then
+ return 2800 * target.parameters.factor
+ else
+ return value -- already scaled
+ end
+end
+
+return {
+ name = "asana-math",
+ version = "1.00",
+ comment = "Goodies that complement asana.",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ mathematics = {
+ parameters = {
+ DisplayOperatorMinHeight = more,
+ StackBottomDisplayStyleShiftDown = less,
+ StackBottomShiftDown = less,
+ StackDisplayStyleGapMin = less,
+ StackGapMin = less,
+ StackTopDisplayStyleShiftUp = less,
+ StackTopShiftUp = less,
+ StretchStackBottomShiftDown = less,
+ StretchStackGapAboveMin = less,
+ StretchStackGapBelowMin = less,
+ StretchStackTopShiftUp = less,
+ }
+ }
+}
+\stoptyping
+
+In fact, in addition to already mentioned \type {mapfiles} and
+\type {virtuals} subtables, we can pass variables and
+overload parameters.
+
+\starttyping
+return {
+ name = "lm-math",
+ ...
+ mathematics = {
+ mapfiles = {
+ ...
+ },
+ virtuals = {
+ ...
+ variables = {
+ joinrelfactor = 3, -- default anyway
+ },
+ parameters = { -- test values
+ -- FactorA = 123.456,
+ -- FactorB = false,
+ -- FactorC = function(value,target,original)
+ -- return 7.89 * target.factor
+ -- end,
+ -- FactorD = "Hi There!",
+ },
+ }
+}
+\stoptyping
+
+This kind of goodie functionality is typical for the development of \LUATEX\ and
+experimental math fonts and no user should ever be bothered with it. However, it
+demonstrates that we're not stuck with only features built in the fonts.
+
+% mathdimensions
+
+It can be that a user is not satisfied by some aspects of a math font design.
+There is not much that we can do about the shapes, but we can manipulate for
+instance dimensions.
+
+For this there are two mechanism available: automatically applied dimensional
+fixes and a \type {mathdimensions} feature. Both work with the same goody
+specification.
+
+\starttyping
+mathematics = {
+ ...
+ dimensions = {
+ },
+ ...
+}
+\stoptyping
+
+The entries in a dimensions table are tables themselves. There can be many
+of them so one can organize dimensional tweaks in groups. The \type {default}
+group is always applied, while others are applied on demand. Say that want
+to tweak all \type {±} and \type {∓}. \footnote {In fact, this mechanism is a
+a response to a mail on the \CONTEXT\ mailing list.}
+
+\starttyping
+mathematics = {
+ dimensions = {
+ default = {
+ [0x00B1] = { -- ±
+ height = 500,
+ depth = 0,
+ },
+ [0x2213] = { -- ∓
+ height = 500,
+ depth = 0,
+ },
+ },
+ },
+}
+\stoptyping
+
+This will give these two characters a different height and depth. However, this
+will not have much effect in rendering (much larger dimensions might have).
+
+\starttyping
+mathematics = {
+ dimensions = {
+ default = {
+ [0x00B1] = { -- ±
+ yoffset = 100,
+ },
+ [0x2213] = { -- ∓
+ yoffset = -100,
+ },
+ },
+ },
+}
+\stoptyping
+
+This will raise and lower the glyphs in their bounding boxes and give them
+an appearance more close to their ancestors. But defined this way, they are
+always applied and that might not be what we want. So, we can do this:
+
+\starttyping
+mathematics = {
+ dimensions = {
+ signs = {
+ [0x00B1] = { -- ±
+ yoffset = 100,
+ },
+ [0x2213] = { -- ∓
+ yoffset = -100,
+ },
+ },
+ },
+}
+\stoptyping
+
+This time the application is feature driven. As with all features, setting them
+up has to happen {\em before} fonts are loaded. This will do the trick:
+
+\starttyping
+\definefontfeature [lm-math] [mathdimensions=signs]
+\stoptyping
+
+The \type {lm-math} feature is not defined by default but can be used for such
+purposes. It {\em is} defined with the fontname:
+
+\starttyping
+\definefontsynonym
+ [LMMathRoman-Regular]
+ [file:latinmodern-math-regular.otf]
+ [features={math\mathsizesuffix,lm-math},
+ goodies=lm]
+\stoptyping
+
+A rather specialized goodie is the one that is used to specify math cut|-|ins. A
+good quality math font has these kerns already defined but even then you might
+want to add or replace some by your own. Here is an example of such a patch.
+Normally there are multiple goodies defined in one file but we only show kerns
+here:
+
+\starttyping
+local kern_200 = { bottomright = { { kern = -200 } } }
+local kern_100 = { bottomright = { { kern = -100 } } }
+
+return {
+ name = "pagella-math",
+ version = "1.00",
+ comment = "Goodies that complement pagella.",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ mathematics = {
+ kerns = {
+ [0x1D449] = kern_200, -- math italic V
+ [0x1D44A] = kern_100, -- math italic W
+ },
+ },
+}
+\stoptyping
+
+As with other goodies the file is loaded with:
+
+\starttyping
+\definefontsynonym
+ [MathRoman] % names used in definitions
+ [file:texgyrepagella-math.otf] % the file to be loaded
+ [features=math\mathsizesuffix, % size dependent features
+ goodies=pagella-math] % the goodie file to be applied
+\stoptyping
+
+This is typically a goodie that is always applied and not driven by a feature.
+After all, the values given are passed to the engine (after being scaled).
+
+Most goodies are bound to fonts of collections of fonts. This is different for
+treatments. These ship with the distribution but you can also provide your own.
+As this is still somewhat experimental we just mention a few aspects. The entries
+are filenames that point to tables.
+
+\starttyping
+return {
+ name = "treatments",
+ version = "1.00",
+ comment = "Goodies that deals with some general issues.",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ treatments = {
+ ["adobeheitistd-regular.otf"] = {
+ embedded = false, -- not yet used
+ comment = "this font is part of acrobat",
+ },
+ ["crap.ttf"] = {
+ ignored = true,
+ comment = "a text file with suffix ttf",
+ },
+ ["latinmodern-math.otf"] = {
+ comment = "experimental",
+ },
+ ["rubish-regular.ttf"] = {
+ comment = "check output for missing à and á",
+ }
+ },
+}
+\stoptyping
+
+The comment entry in such a table becomes part of the message at the end
+of a run:
+
+\startnarrowtyping
+mkiv lua stats > loaded fonts: 2 files: latinmodern-math.otf (experimental), lmroman12-regular.otf
+\stopnarrowtyping
+
+The ignored flag signals the font name database builder to ignore the file. This
+means that the font can still be known as file, but that its (name based)
+properties are not collected. As you asked explicitly for a file, the file can
+still be loaded. You can use this trick to avoid issues with the database builder
+in case of a problematic file, but a real run will still try to load the file. After
+all, you get what you ask for. If loading and usage is successful you get at least
+the message reported at the end of the run.
+
+\stopsection
+
+\startsection[title=Analyzers]
+
+An \OPENTYPE\ font is kind of special in the sense that it provides some
+information on how to turn sequences of characters into sequences of glyphs. In
+fact, if all fonts had a reasonable repertoire of glyphs most of the information
+that concerns combining, remapping and shuffling the input and|/|or mapping onto
+glyphs could as well happen in the renderer. This means that fonts have many of
+their internal features tables in common, or more precisely could share many gsub
+related issues, if only there had been some predefined sets of substitutional
+features.
+
+So, for most of the time, a feature processor just does what the font demands and
+the font provides the information. There are however a few cases where font only
+provide part of the logic. Take for instance the \type {init}, \type {medi},
+\type {fina} and \type {isol} features that relate to positions in the word: the
+start, the end, in the middle or isolated. For these features to work the engine
+has to provide information about the state of a character (glyph) and this is where
+analysis kicks in. Just watch this:
+
+\startbuffer
+\definefontfeature
+ [default-with-analyze]
+ [default]
+ [script=latn,mode=node,
+ init=yes,medi=yes,fina=yes,isol=yes]
+
+\showotfcomposition
+ {dejavu-serif*default-with-analyze at 24pt}
+ {}
+ {I don't wanna know tha\utfchar{"300}t!}
+\stopbuffer
+
+\typebuffer
+
+In the tracer the different categories are colored. This kind of information is
+especially important for typesetting Arabic. Normally \CONTEXT\ can figure out
+itself when this is needed so you don't have to worry too much about this kind of
+additional actions.
+
+\blank \getbuffer \blank
+
+\stopsection
+
+\startsection[title=Processors]
+
+ \startnotabene
+ Todo.
+ \stopnotabene
+
+\stopsection
+
+\startsection[title=Optimizing]
+
+ \startnotabene
+ Todo.
+ \stopnotabene
+
+\stopsection
+
+\startsection[title=Tracing]
+
+There are a lot of tracing options in \MKIV, but most will never be seen by users. Most
+are enabled using the tracker mechanism. Some have a bit more visibility and have a dedicated
+command to trigger them.
+
+When something is going terribly wrong, you will always get a message but sometimes even an
+end|-|user has to request for more information. An example are missing characters. There are
+several ways to get them reported:
+
+\starttyping
+\enabletrackers[fonts.missing=replace]
+\enabletrackers[fonts.missing=remove]
+\enabletrackers[fonts.missing]
+\stoptyping
+
+For historic reasons we also have:
+
+\starttyping
+\checkcharactersinfont
+\removemissingcharacters
+\replacemissingcharacters
+\stoptyping
+
+which happens automatically when you enable the tracker. There is some extra
+overhead involved so you might want to turn on this feature on only if you really
+expect characters not to be present.
+
+Say that we use Latin Modern fonts and ask for some of the rare fractions:
+
+\startbuffer
+\definedfont[lmroman10-regular*default-with-missing at 10pt]
+a b c ½ ⅓ ¼ ⅕ ⅙ ⅛ Ɣ ɣ ʤ ʭ ʮ α β γ
+\stopbuffer
+
+\typebuffer
+
+\enabletrackers[fonts.missing=replace]
+We get this: \start \getbuffer \stop
+\removeunwantedspaces . \space
+In the log file you will find something like this:
+\par \disabletrackers[fonts.missing]
+
+\starttyping
+fonts > characters > start missing characters: lmroman10-regular.otf
+
+missing > U+00194 Ɣ LATIN CAPITAL LETTER GAMMA
+missing > U+00263 ɣ LATIN SMALL LETTER GAMMA
+missing > U+002A4 ʤ LATIN SMALL LETTER DEZH DIGRAPH
+missing > U+002AD ʭ LATIN LETTER BIDENTAL PERCUSSIVE
+missing > U+002AE ʮ LATIN SMALL LETTER TURNED H WITH FISHHOOK
+missing > U+003B1 α GREEK SMALL LETTER ALPHA
+missing > U+003B2 β GREEK SMALL LETTER BETA
+missing > U+003B3 γ GREEK SMALL LETTER GAMMA
+missing > U+02153 ⅓ VULGAR FRACTION ONE THIRD
+missing > U+02155 ⅕ VULGAR FRACTION ONE FIFTH
+missing > U+02159 ⅙ VULGAR FRACTION ONE SIXTH
+missing > U+0215B ⅛ VULGAR FRACTION ONE EIGHTH
+
+fonts > characters > stop missing characters
+\stoptyping
+
+If you're lucky your editor will use a font that shows the missing characters (dejavu
+monospace is a good candidate).
+
+The replacement characters can help you to locate the spots where something is missing
+so that an alternative can be considered. The replacements resemble the category
+of the missing character.
+
+\showmissingcharacterslegend
+
+You can call up this legend after loading an extra module:
+
+\starttyping
+\usemodule[s][fonts-missing]
+
+\showmissingcharacterslegend
+
+\showmissingcharacters
+\stoptyping
+
+The last command shows a detailed list of missing characters
+
+\showmissingcharacters
+
+Here the characters are shown, because we use a monospaced font that happens to
+have them. Of course this example uses characters that are rarely used and are
+unlikely to show up in future versions of the Latin Modern fonts.
+
+\startnotabene
+ Here a few more relevant trackers will be mentioned.
+\stopnotabene
+
+\stopsection
+
+\startsection[title=Some remarks]
+
+If you talk about features and fonts it is not difficult to end up speaking
+\OPENTYPE . However, in \CONTEXT\ we use the term in a more general way, if only
+because we provide more features. In traditional \TEX\ we have a few features:
+ligatures, smallcaps and kerns, and to some extent we can see oldstyle numerals
+also as feature. It is however important to notice that in \OPENTYPE\ ligatures
+are just a synonym for combining multiple characters into on. From the user
+interface point of view these operations are grouped into \type {liga}, \type
+{dlig}, \type {clig} and \type {rlig} and for \TEX ies we have \type {tlig}. The
+distinction is not as clear as one might think: any feature can use the ligature
+builder. And as a consequence we see that happen too, for instance some fonts use
+\type {ccmp} for constructing mandatory ligatures.
+
+Some of these interpretations (or maybe even tricks) are side effects of for
+instance user interfaces. If one can for instance not turn on or off the \type
+{ccmp} feature, but can do that for \type {liga}, then one way to keep some
+ligatures in for instance letter spaced text, is to put them into \type {ccmp},
+assuming that this one will always be enabled. Eventually that then becomes a
+sort of standard. Personally I don't like such pseudo standards but we have to
+live with them.
+
+Another example of such a standard is the used of non breakable spaces to
+influence treatment of some Devanagari characters. Where \UNICODE\ has special
+characters to influence mechanisms that combine and replace characters, the lack
+of some triggers others to be used and eventually that becomes a standard.
+Similar ambiguities arise with math: we have no way to indicate math (while we do
+have ways to indicate a change in writing order).
+
+Talking of math, take \OPENTYPE\ math: at some point there is a draft, that then
+gets implemented in one word processor using one font, but omissions or
+imperfections that surface (maybe because more fonts and engines are developed)
+stay around because the initial implementation is published and frozen, simply
+because there are many users that stick to expectations. Where \TEX ies accept a
+few years of development, this is not true for commercial applications. \footnote
+{Of course \HTML\ is the biggest example of this: we're stuck forever with open
+tags without close tags, mixed uppercase and lowercase tags, attributes without
+value or values without quotes.}
+
+So, although there is without doubt progress, some annoyances stay. The \TEX\
+community has always been able to adapt, and this is one reason why a \LUA\
+implementation is nice: it gives room for experiments, extensions, variants, etc.
+Of course it also makes a bit more independent, although one may wonder if that
+matters any longer in a rapidly changing world. The original idea behind \TEX,
+that it should be useable for ages, will survive, but users might see more
+changes in a lifetime than foreseen when \TEX\ showed up.
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/fonts/fonts/fonts-formats.tex b/doc/context/sources/general/fonts/fonts/fonts-formats.tex
new file mode 100644
index 000000000..dc98ee486
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-formats.tex
@@ -0,0 +1,873 @@
+% language=uk
+
+\startcomponent fonts-formats
+
+\environment fonts-environment
+
+\startchapter[title=Font formats][color=darkred]
+
+\startsection[title=Introduction]
+
+In this chapter the font formats as we know them will be introduced. The
+descriptions will be rather general but more details can be found in the
+appendix. Although in \MKIV\ we do support all these types eventually the focus
+will be on \OPENTYPE\ fonts but it does not hurt to see where we are coming from.
+
+\stopsection
+
+\startsection[title=Glyphs]
+
+A typeset text is mostly a sequence of characters turned into glyphs. We talk of
+characters when you input the text, but the visualization involves glyphs. When
+you copy a part of the screen in an open \PDF\ document or \HTML\ page back to
+your editor you end up with characters again. In case you wonder why we make this
+distinction between these two states we give an example.
+
+\startplacefigure [location=here,reference=fig:character-glyph,title=From characters to glyphs.]
+ \startcombination
+ {\color[maincolor]{\definedfont[Serif*default at 30pt]affiliation}} {upright}
+ {\color[maincolor]{\definedfont[SerifItalic*default at 30pt]affiliation}} {italic}
+ \stopcombination
+\stopplacefigure
+
+We see here that the shape of the \type {a} is different for an upright serif and
+an italic. We also see that in \type {ffi} there is no dot on the \type {i}. The
+first case is just a stylistic one but the second one, called a ligature, is
+actually one shape. The 11 characters are converted into 9 glyphs. Hopefully the
+final document format carries some extra information about this transformation so
+that a cut and paste will work out well. In \PDF\ files this is normally the
+case. In this document we will not be too picky about the distinction as in most
+cases the glyph is rather related to the character as one knows it.
+
+So, a font contains glyphs and it also carries some information about
+replacements. In addition to that there needs to be at least some information
+about the dimensions of them. Actually, a typesetting engine does not have to
+know anything about the actual shape at all.
+
+\startplacefigure [location=here,reference=fig:glyph-dimension-normal,title=The boundingbox of some normal glyphs.]
+ \startcombination[9*1]
+ {\ruledhbox{\color[maincolor]{\definedfont[Serif*default at 30pt]a}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[Serif*default at 30pt]b}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[Serif*default at 30pt]g}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[Serif*default at 30pt]l}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[Serif*default at 30pt]q}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[Serif*default at 30pt].}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[Serif*default at 30pt];}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[Serif*default at 30pt]?}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[Serif*default at 30pt]ffi}}} {}
+ \stopcombination
+\stopplacefigure
+
+\startplacefigure [location=here,reference=fig:glyph-dimension-italic,title=The boundingbox of some italic glyphs.]
+ \startcombination[9*1]
+ {\ruledhbox{\color[maincolor]{\definedfont[SerifItalic*default at 30pt]a}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[SerifItalic*default at 30pt]b}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[SerifItalic*default at 30pt]g}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[SerifItalic*default at 30pt]l}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[SerifItalic*default at 30pt]q}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[SerifItalic*default at 30pt].}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[SerifItalic*default at 30pt];}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[SerifItalic*default at 30pt]?}}} {}
+ {\ruledhbox{\color[maincolor]{\definedfont[SerifItalic*default at 30pt]ffi}}} {}
+ \stopcombination
+\stopplacefigure
+
+The rectangles around the shapes \in {figure} [fig:glyph-dimension-normal] and \in
+{figure} [fig:glyph-dimension-italic] are called boundingbox. The dashed line
+reflects the baseline where they eventually are aligned onto next to each other.
+The amount above the baseline is called height, and below is called depth. The
+piece of the shape above the baseline is the ascender and the bit below the
+descender. The width of the bounding box is not by definition the width of the
+glyph. In \TYPEONE\ and \OPENTYPE\ fonts each shape has a so called advance width
+and that is the one that will be used.
+
+\usemodule[fnt-40]
+
+\startplacefigure [location=here,reference=fig:glyph-kerns,title={Kerning in Latin Roman, Cambria, Pagella and Dejavu.}]
+ \scale[width=\textwidth]{\startcombination[1*4]
+ {\color[maincolor]{\definedfont[name:lmroman10-regular*default sa 1]\ShowKernedHBox{Very often glyphs get very small spaces inserted horizontally.}}} {}
+ {\color[maincolor]{\definedfont[name:cambria*default sa 1]\ShowKernedHBox{Very often glyphs get very small spaces inserted horizontally.}}} {}
+ {\color[maincolor]{\definedfont[name:texgyrepagellaregular*default sa 1]\ShowKernedHBox{Very often glyphs get very small spaces inserted horizontally.}}} {}
+ {\color[maincolor]{\definedfont[name:dejavuserif*default sa 0.9]\ShowKernedHBox{Very often glyphs get very small spaces inserted horizontally.}}} {}
+ \stopcombination}
+\stopplacefigure
+
+Another traditional property of a font is kerning. In \in {figure}
+[fig:glyph-kerns] you see this in action. These examples
+demonstrate that not all fonts need (or provide) the same kerns
+(in points).
+
+So, as a start, we have now met a couple of properties of a font.
+They can be summarized as follows:
+
+\starttabulate[|l|p|]
+\NC mapping to glyphs \EQ characters are represented by a shapes that have recognizable
+ properties so that readers know what they mean \NC \NR
+\NC ligature building \EQ a sequence of characters gets mapped onto one glyph \NC \NR
+\NC dimensions \EQ each glyph has a width, height and depth \NC \NR
+\NC inter-glyph kerning \EQ optionally a bit of positive or negative space has to be inserted between glyphs \NC \NR
+%NC italic correction \EQ a correction is applied between an oblique shape and what follows \NC \NR
+\stoptabulate
+
+Regular font kerning is hardly noticeable and improves the overall look of the
+page. Typesetting applications sometimes are capable of inserting additional
+spaces between shapes. This more excessive kerning is not that much related to
+the font and is used for special purposes, like making a snippet of text stand
+out. In \CONTEXT\ this kind of kerning is available but it is a font independent
+feature. Keep in mind that when applying that kind of rather visible kerning
+you'd better not have ligatures and fancy replacements enabled as \CONTEXT\
+already tries to deal with that as good as possible.
+
+\stopsection
+
+\startsection[title=The basic process]
+
+In \TEX\ a font is an abstraction: the engine only needs to know about the
+mapping from characters to glyphs, what the width, height and depth is, what
+sequences need to be translated into ligatures and when kerning has to be
+applied. If for the moment we forget about math, these are all the properties
+that matter and this is what the \TEX\ font metric files that we see in the next
+section provide.
+
+Because one of the principles behind \LUATEX\ is that the core engine (the
+binary) stays small and that new functionality is provided in \LUA\ code, the
+font subsystem largely looks like it always has been. As users will normally use
+a macro package most of the loading will be hidden from the user. It is however
+good to give a quick overview of how for instance \PDFTEX\ deals with fonts using
+traditional metric files.
+
+\startFLOWchart[pdftex]
+ \startFLOWcell
+ \name {source}
+ \location {1,1}
+ \shape {action}
+ \text {input}
+ \connection [rl] {parser}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {parser}
+ \location {2,1}
+ \shape {action}
+ \text {characters}
+ \connection [rl] {builder}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {builder}
+ \location {3,1}
+ \shape {action}
+ \text {glyphs}
+ \connection [rl] {backend}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {backend}
+ \location {4,1}
+ \shape {action}
+ \text {subset}
+ \stopFLOWcell
+\stopFLOWchart
+
+\startplacefigure [location=here,reference=fig:tfm-pdftex,title={Several translation steps in a traditonal \TEX\ flow.}]
+ \FLOWchart[pdftex]
+\stopplacefigure
+
+The input (bytes) gets translated into characters by the input parser. Normally
+this is a one|-|to|-|one translation but there are examples of some translation
+taking place. You can for instance make characters active and give them a
+meaning. So, the eight bit represention of an editors code page \type {ë} can
+become something else internally, for instance a regular \type {e} with an \type
+{¨} overlayed. It can also become another character, which in the code page
+would be shown as \type {á} but the user will not know this as by then this byte
+is already tokenized. Another example is multibyte translation, for instance
+\UTF\ sequences can get remapped to something that is known internally as being a
+character of some kind. The \LUATEX\ engine expects \UTF\ so a macro package has
+to make sure that translation to this encoding happens beforehand, for instance
+using a callback that intercepts the input from file. \footnote {In \CONTEXT\ we
+talk of input regimes and these can be mixed, although in practice most users
+will stick to \UTF\ and never use regimes.}
+
+So, the input character (sequence) becomes tokens representing a character. From
+these tokens \TEX\ will start building a (linked) node list where each character
+becomes a node. In this node there is a reference to the current font. If you
+know \TEX\ you will understand that a list can have more than characters: there
+can be skips, kerns, rules, references to images, boxes, etc.
+
+At some point \TEX\ will handle this list over to a routine that will turn them
+into something that resembles a paragraph or otherwise snippet of text. In that
+stage hyphenation kicks in, ligatures get built and kerning is added. Character
+references become glyph indices. This list can finally be broken into lines.
+
+It is no secret that \TEX\ can box and unbox material and that after unboxing
+some new formatting has to happen. The traditional engine has some optimizations
+that demand a partial reconstruction of the original list but in \LUATEX\ we
+removed this kind of optimization so there the process is somewhat simpler. We
+will see more of that later.
+
+When \TEX\ ships out a page, the backend will load the real font data and merge
+that into the final output. It will now take the glyph index and build the right
+data structures and references to the real font. As a font gets subset only the
+used glyphs end up in the final output.
+
+There is one tricky aspect involved here: re|-|encoding. In so called map files
+one can map a specific metric filename onto a real font name. One can also
+specify an encoding vector that tells what a given index really refers to. This
+makes it possible to use fonts that have more than 256 glyphs and refer to any of
+them. This is also the trick that makes it possible to use \TRUETYPE\ fonts in
+\PDFTEX: the backend code filters the right glyphs from the font, remapping
+\TEX's glyph indices onto real entries in the font happens via the encoding
+vector. In \in {figure} [fig:tfm-bytes] we show a possible route for input byte
+68.
+
+\startFLOWchart[bytes]
+ \startFLOWcell
+ \name {source}
+ \location {1,1}
+ \shape {action}
+ \text {bytes (68)}
+ \connection [rl] {parser}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {parser}
+ \location {2,1}
+ \shape {action}
+ \text {bytes (31)}
+ \connection [rl] {builder}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {builder}
+ \location {3,1}
+ \shape {action}
+ \text {index (31)}
+ \connection [rl] {backend}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {backend}
+ \location {4,1}
+ \shape {action}
+ \text {index (88)}
+ \stopFLOWcell
+\stopFLOWchart
+
+\startplacefigure [location=here,reference=fig:tfm-bytes,title={From bytes to indices.}]
+ \FLOWchart[bytes]
+\stopplacefigure
+
+As \LUATEX\ carries much of the bagage of older engines, you can still do it this
+way but in \CONTEXT\ \MKIV\ we have made our live much simpler: we use unicode as
+much as possible. This means that we effectively have removed two steps (see \in
+{figure} [fig:tfm-luatex]).
+
+\startFLOWchart[luatex]
+ \startFLOWcell
+ \name {source}
+ \location {1,1}
+ \shape {action}
+ \text {input}
+ \connection [rl] {builder}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {builder}
+ \location {2,1}
+ \shape {action}
+ \text {glyphs}
+ \stopFLOWcell
+\stopFLOWchart
+
+\startplacefigure [location=here,reference=fig:tfm-luatex,title={Simplified mapping in \LUATEX.}]
+ \FLOWchart[luatex]
+\stopplacefigure
+
+There is of course still some work to do for the backend, like subsetting, but
+the nasty dependency on the input encoding, font encoding (that itself relates to
+hyphenation) and backend re|-|encoding is gone. But keep in mind that the
+internal data structure of the font is still quite traditional.
+
+Before we move on to font formats I like to point out that there is no space in
+\TEX. Spaces in the input are converted into glue, either or not with some
+stretch and|/|or shrink. This also means that accessing character 32 in
+traditional \TEX\ will not end up as space in the output.
+
+\stopsection
+
+\startsection[title=\TEX\ metrics]
+
+\appendixdata{\in[fontdata:tfm]}
+\appendixdata{\in[fontdata:vf]}
+
+Traditional font metrics are packaged in a binary format. Due to the limitations
+of that time a font has at most 256 characters. In books dedicated to \TEX\ you
+will often find tables that show what glyphs are in a font, so we will not repeat
+that here as after all we got rid of that limitation in \LUATEX.
+
+Because 256 is not that much, especially when you mix many scripts and need lots
+of symbols from the same font, there are quite some encodings used in traditional
+\TEX, like \type {texnansi}, \type {ec} and \type {qx}. When you use \LUATEX\
+exclusively you can do with way less font files. This is easier for users,
+especially because most of those files were never used anyway. It's interesting
+to notice that some of the encodings contain symbols that are never used or used
+only once in a document, like the copyright or registered symbols. They are often
+accessed by symbolic names and therefore easily could have been omitted and
+collected in a dedicated symbol font thereby freeing slots for more useful
+characters anyway. The lack of coverage is probably one of the reasons why new
+encodings kept popping up. In the next table you see how many files are involved
+in Latin Modern which comes in a couple of design sizes. \footnote {The original
+Computer Modern fonts have \METAFONT\ source files and (runtime) generated bitmap
+files in whatever resolutions are needed for previewing and printing. The
+\TYPEONE\ follow|-|up came in several sets, organized by language support. The
+Latin Modern fonts have a few more weights and variants than Computer Modern.}
+
+\starttabulate[|l|c|r|r|r|]
+\HL
+\NC \bf font format \NC \bf type \NC \bf \# files \NC \bf size in bytes \NC \bf \CONTEXT \NC \NR
+\HL
+\NC type 1 \NC tfm \NC 380 \NC 3.841.708 \NC \NC \NR
+\NC \NC afm \NC 25 \NC 2.697.583 \NC \NC \NR
+\NC \NC pfb \NC 92 \NC 9.193.082 \NC \NC \NR
+\NC \NC enc \NC 15 \NC 37.605 \NC \NC \NR
+\NC \NC map \NC 9 \NC 42.040 \NC \NC \NR
+\HL[darkgray]
+\NC \NC \NC 521 \NC 15.812.018 \NC mkii \NC \NR
+\HL
+\NC opentype \NC otf \NC 73 \NC 8.224.100 \NC mkiv \NC \NR
+\HL
+\stoptabulate
+
+A \TFM\ file can contain so called italic corrections. This is an additional kern
+that can be added after a character in order to get better spacing between an
+italic shape and an upright one. As this is manual work, it's a not that advanced
+mechanism, but in addition to width, height, depth, kerns and ligatures it is
+nevertheless a useful piece of information. But, it's a rather \TEX\ specific
+quantity.
+
+Since \TEX\ showed up many fonts have been added. In addition support for
+commercial fonts was provided. In fact, for that to happen, one only needs
+accompanying metric files for \TEX\ itself and map files and encoding vectors
+for the backend. Because a metric file also has some general information, like
+spacing (including stretch and shrink), the ex|-|height and em|-|width, this
+means that sometimes guesses must be made when the original font does not come
+with such parameters.
+
+At some point virtual fonts were introduced. In a virtual font a \TFM\ file has
+an accompanying \VF\ file. In that file each glyph has a specification that tells
+where to find the real glyph. It is even possible to construct glyphs from other
+glyphs. In traditional \TEX\ this only concerns the backend, which in \PDFTEX\ is
+built in. In \LUATEX\ this mechanism is integrated into the frontend which means
+that users can construct such virtual fonts themselves. We will see more of that
+later, but for now it's enough to know that when we talk about the representation
+of font (the \TFM\ table) in \LUATEX, this includes virtual functionality.
+
+An important limitation of \TFM\ files cq.\ traditional \TEX\ is that the number
+of depths and heights is limited to 16 each. Although this results in somewhat
+inaccurate dimensions in practice this gets unnoticed, if only because many
+designs have some consistency in this. On the other hand, it is a limitation when
+we start thinking of accents or even multiple accents which lead to many more
+distinctive heights and depths.
+
+Concerning ligatures we can remark that there are quite some substitutions
+possible although in practice only the multiple to one replacement has been used.
+
+Some fonts that are used in \TEX\ started out as bitmaps but rather soon
+\TYPEONE\ outline fonts became the fashion. These are supported using the map
+files that we will discuss later. First we look into \TYPEONE\ fonts.
+
+\stopsection
+
+\startsection[title=\TYPEONE]
+
+\appendixdata{\in[fontdata:afm]}
+\appendixdata{\in[fontdata:enc]}
+\appendixdata{\in[fontdata:map]}
+
+For a long time \TYPEONE\ fonts have dominated the scene. These are \POSTSCRIPT\
+fonts that can have more that 256 glyphs in the file that defines the shapes, but
+only 256 of them can be used at one time. Of course there can be multiple subsets
+active in one document.
+
+In traditional \TEX\ a \TYPEONE\ font is used by making a \TFM\ file from a so
+called Adobe metric file (\AFM) that come with such a font. There are several
+tool chains for doing this and \CONTEXT\ \MKII\ ships with one that can be of
+help when you need to support commercial fonts. Projects like the Latin Modern
+Fonts and \TEX\ Gyre have normalized a whole lot of fonts that came in several
+more or less complete encodings into a consistent package of \TYPEONE\ fonts.
+This already simplified live a lot but still users had to choose a suitable input
+and font encoding for their language and|/|or script. As \TEX\ only cares about
+metrics and not about the rendering, it doesn't consider \TYPEONE\ fonts as
+something special. Also, as \TEX\ and \POSTSCRIPT\ were developed about the same
+time support for \TYPEONE\ fonts is rather present in \TEX\ distributions.
+
+You can still follow this route but for \CONTEXT\ \MKIV\ this is no longer the
+recommended way because there we have changed the whole subsystem to use
+\UNICODE. As a result we no longer use \TFM\ files derived from \AFM\ files, but
+directly interpret the \AFM\ data. This not only removes the 256 limitation, but
+also brings more resolution in height and depth as we no longer have at most 16
+alternatives. There can also be more kerns. Of course we need some heuristics to
+determine for instance the spacing but that is not different from former times.
+
+Because most \TEX\ users don't use commercial fonts, they will not notice that
+\CONTEXT\ \MKIV\ treats \TYPEONE\ fonts this way. One reason is that the free
+fonts also come as wide fonts in \OPENTYPE\ format and whenever possible
+\CONTEXT\ prefers \OPENTYPE\ over \TYPEONE\ over \TFM.
+
+In the beginning \LUATEX\ only could load a \TFM\ file, which is why loading
+\AFM\ files is implemented in \LUA. Later, when the \OPENTYPE\ loaded was added,
+loading \PFB\ and \AFM\ files also became possible but it's slower and we see no
+reason to rewrite the current code in \CONTEXT. We also do a couple of extra
+things when loading such a file. As more \TYPEONE\ fonts move on to \OPENTYPE\ we
+don't expect that much usage anyway.
+
+\stopsection
+
+\startsection[title=\OPENTYPE]
+
+\appendixdata{\in[fontdata:otf]}
+
+When an engine can deal with \UNICODE\ directly it also means that internally it
+uses pretty large numbers for storing characters and glyph indices. The first
+\TEX\ descendent that went wide was \OMEGA, later replaced by \ALEPH. However, this
+engine never took off and still used its own extended \TFM\ format: \OFM. In fact,
+as \LUATEX\ uses some of the \ALEPH\ code, it can also use these extended metric
+files but I don't think that there are any useful fonts around so we can forget
+about this.
+
+We use the term \OPENTYPE\ for a couple of font formats that share the same
+principles: \OPENTYPE\ (\OTF), \TRUETYPE\ (\TTF) and \TRUETYPE\ containers
+(\TTC). The \LUATEX\ font reader presents them in a similar format. In the case
+of a \TRUETYPE\ container, one does not load the whole font but selects an
+instance from it. Internally an \OPENTYPE\ font can have the glyphs organized in
+subfonts.
+
+The first \TEX\ descendent to really go wide from front to back is \XETEX. This
+engine can use \OPENTYPE\ fonts directly and for a whole category of users this
+opened up a new world. Hoever, it is still mostly a traditional engine. The
+transition from characters to glyphs is accomplished by external libraries, while
+in \LUATEX\ we code in \LUA. This has the disadvantage that it is slower
+(although that depends on the job) but the advantage is that we have much more
+control and can extend the font handler as we like.
+
+An \OPENTYPE\ font is much more complex than a \TYPEONE\ one. Unless it is a
+quick and dirty converted existing font, it will have more glyphs to start with.
+Quite likely it will have kerns and ligatures too and of course there are
+dimensions. However, there is no concept of a depth and height. These need to be
+deduced from the bounding box instead. There is an advance width. This means that
+we can start right away using such fonts if we map those properties onto the
+\TFM\ table that \LUATEX\ expects.
+
+But there is more, take ligatures. In a traditional font the sequence \type {ffi}
+always becomes a ligature, given that the font has such a glyph. In \LUATEX\
+there is a way to disable this mechanism, which is sometimes handy when dealing
+with mono|-|spaced fonts in verbatim. It's pretty hard to disable that. For
+instance one option is to insert kerns manually. In an \OPENTYPE\ font ligatures
+are collected in a so called feature. There can be many such features and even
+kerning is a feature. Other examples are old style numerals, fractions,
+superiors, inferiors, historic ligatures and stylistic alternates.
+
+\starttabulate[|lT|l|l|l|l|]
+\NC \type{onum} \NC \ruledhbox{\maincolor\DemoOnumLM\char45 1}
+ \NC \ruledhbox{\maincolor\DemoOnumLM1234567890}
+ \NC \ruledhbox{\maincolor\DemoOnumLM\char"A2}
+ \NC \ruledhbox{\maincolor\DemoOnumLM\char"24} \NC \NR
+%NC \type{lnum} \NC \ruledhbox{\maincolor\DemoLnumLM\char45 1}
+% \NC \ruledhbox{\maincolor\DemoLnumLM1234567890}
+% \NC \ruledhbox{\maincolor\DemoLnumLM\char"A2}
+% \NC \ruledhbox{\maincolor\DemoLnumLM\char"24} \NC \NR
+\NC \type{tnum} \NC \ruledhbox{\maincolor\DemoTnumLM\char45 1}
+ \NC \ruledhbox{\maincolor\DemoTnumLM1234567890}
+ \NC \ruledhbox{\maincolor\DemoTnumLM\char"A2}
+ \NC \ruledhbox{\maincolor\DemoTnumLM\char"24} \NC \NR
+\NC \type{pnum} \NC \ruledhbox{\maincolor\DemoPnumLM\char45 1}
+ \NC \ruledhbox{\maincolor\DemoPnumLM1234567890}
+ \NC \ruledhbox{\maincolor\DemoPnumLM\char"A2}
+ \NC \ruledhbox{\maincolor\DemoPnumLM\char"24} \NC \NR
+\stoptabulate
+
+To this all you need to add that features operate in two dimensions: languages
+and scripts. This means that when ligatures are enabled for Dutch the \type {ij}
+sequence becomes a single glyph but for German it gets mapped onto two glyphs.
+And, to make it even more complex, a substitution can depend on circumstances,
+which means that for Dutch \type {fijn} becomes \type {f ij n} but \type {fiets}
+becomes \type {fi ets}. It will be no surprise that not all \OPENTYPE\ fonts come
+with a complete and rich repertoire of rules. To make things worse, there can be
+rules that turn \type {1/2} into one glyph, or transfer the numbers into superior
+and inferior alternatives, but leaves us with an unacceptable rendered \type
+{1/a}, given that the \type {frac} features is enabled. It looks like features
+like this are to be applied to a manually selected range of characters.
+
+The fact that an \OPENTYPE\ font can contain many features and rules to apply
+them makes it possible to typeset scripts like Arabic. And this is where it gets
+vague. A generic \OPENTYPE\ sub|-|engine can do clever things using these rules,
+but if you read the specification for some scripts additional intelligence has to
+be provided by the typesetting engine.
+
+While users no longer have to care about encodings, map files and back|-|end
+issues, they do have to carry knowledge about the possibilities and limitations
+of features. Even worse, he or she needs to be aware that fonts can have bugs.
+Also, as font vendors have no tradition of providing updates this is something
+that we might need to take care of ourselves by tweaking the engine.
+
+One of the problems with the transition from \TYPEONE\ to \OPENTYPE\ is that font
+designers can take an existing design and start from that basic repertoire of
+shapes. If such a design had oldstyle figures only, there is a good chance that
+this will be the case in the \OPENTYPE\ variant too. However, such a default
+interferes with the fact that the \type {onum} feature is one that we explicitly
+have to enable. This means that writing a generic style where a font is later
+plugged in becomes somewhat messy if it assumes that features need to be turned
+on.
+
+\TEX\ users expect more control, which means that in practice just an \OPENTYPE\
+engine is not enough, but for the average font the \TEX\ model using the
+traditional approach still is quite acceptable. After all, not all users use
+complex scripts or need advanced features. And, in practice most readers don't
+notice the difference anyway.
+
+\stopsection
+
+\startsection[title=\LUA]
+
+\appendixdata{\in[fontdata:lua]}
+
+As mentioned support for virtual fonts is built into \LUATEX\ and loading the so
+called \VF\ files happens when needed. However, that concerns traditional fonts
+that we already covered. In \CONTEXT\ we do use the virtual font mechanism for
+creating missing glyphs out of existing ones or add fallbacks when this is not
+possible. But this is not related to some kind of font format.
+
+In 2010 and 2011 the first public \OPENTYPE\ math fonts showed up that replace
+their \TYPEONE\ originals. In \CONTEXT\ we already went forward and created
+virtual \UNICODE\ fonts out of traditional fonts. Of course eventually the
+defaults will change to the \OPENTYPE\ alternatives. The specification for such a
+virtual font is given in \LUA\ tables and therefore you can consider \LUA\ to be
+a font format as well. In \CONTEXT\ such fonts can be defined in so called
+goodies files. As we use these files for much more tuning, we come back to that
+in a later chapter. In a virtual font you can mix real \TYPEONE\ fonts and real
+\OPENTYPE\ fonts using whatever metrics suit best.
+
+An extreme example is the virtual \UNICODE\ Punk font. This font is defined in
+the \METAPOST\ language (derived from Don Knuths \METAFONT\ sources) where each
+glyph is one graphic. Normally we get \POSTSCRIPT, but in \LUATEX\ we can also
+get output in a comparable \LUA\ table. That output is converted to \PDF\
+literals that become part of the virtual font definitions and these eventually
+end up in the \PDF\ page stream. So, at the \TEX\ end we have regular (virtual)
+characters and all \TEX\ needs is their dimensions, but in the \PDF\ each glyph
+is shown using drawing operations. Of course the now available \OPENTYPE\ variant
+is more efficient, but it demonstrates the possibilities.
+
+\stopsection
+
+\startsection[title=Files]
+
+We summarize these formats in the following table where we explain what the file
+suffixes stand for:
+
+\starttabulate[|Tl|p|]
+\HL
+\NC tfm \NC This is the traditional \TEX\ font metric file format and it reflects
+ the internal quantities that \TEX\ uses. The internal data structures
+ (in \LUATEX) are an extension of the \TFM\ format. \NC \NR
+\NC vf \NC This file contains information about how to construct and where to
+ find virtual glyphs and is meant for the backend. With \LUATEX\ this
+ format gets more known. \NC \NR
+\NC pk \NC This is the bitmap format used for the first generation of \TEX\
+ fonts but the typesetter never deals with them. Bitmap files are more
+ or less obselete. \NC \NR
+\HL
+\NC ofm \NC This is the \OMEGA\ variant of the \type {tfm} files that caters for
+ larger fonts. \NC \NR
+\NC ovf \NC This is the \OMEGA\ variant of the \type {vf}. \NC \NR
+\HL
+\NC pfb \NC In this file we find the glyph data (outlines) and some basic
+ information about the font, like name|-|to|-|index mappings. A
+ differently byte|-|encoded variant of this format is \type {pfa}.\NC
+ \NR
+\NC afm \NC This file accompanies the \type {pfb} file and provides additional
+ metrics, kerns and information about ligatures. A binary variant of
+ this is the \PFA\ format. For \MSWINDOWS\ there is a variant that has the
+ \type {pfm} suffix. \NC \NR
+\NC map \NC The backend will consult this file for mapping metric file names onto
+ real font names. \NC \NR
+\NC enc \NC The backend will include (and use) this encoding vector to map
+ internal indices to font indices using glyph names, if needed. \NC
+ \NR
+\HL
+\NC otf \NC This binary format describes not only the font in terms of metrics,
+ features and properties but also contains the shapes. \NC \NR
+\NC ttf \NC This is the \MICROSOFT\ variant of \OPENTYPE. \NC \NR
+\NC ttc \NC This is the \MICROSOFT\ container format that combines multiple fonts
+ in one. \NC \NR
+\HL
+\NC fea \NC A (\FONTFORGE) feature definition file. Such a file can be loaded and
+ applied to a font. This is no longer supported in \CONTEXT\ as we have
+ other means to achieve the same goals. \NC \NR
+\NC cid \NC A glyph index (name) to \UNICODE\ mapping file that is referenced
+ from an \OPENTYPE\ font and is shared between fonts. \NC \NR
+\HL
+\NC lfg \NC These are \CONTEXT\ specific \LUA\ font goodie files providing
+ additional information. \NC \NR
+\HL
+\stoptabulate
+
+If you look at how files are organized in a \TEX\ distribution, you will notice
+that these files all get their own place. Therefore adding a \TYPEONE\ font to
+the distribution is not that trivial if you want to avoid clashes. Also, files
+are simply not found when they are not in the right spot. Just to mention a few
+paths:
+
+\starttyping
+<root>/fonts/tfm/vendor/typeface
+<root>/fonts/vf/vendor/typeface
+<root>/fonts/type1/vendor/typeface
+<root>/fonts/truetype/vendor/typeface
+<root>/fonts/opentype/vendor/typeface
+<root>/fonts/fea
+<root>/fonts/cid
+<root>/fonts/dvips/enc
+<root>/fonts/dvips/map
+\stoptyping
+
+There can be multiple roots and the right locations are specified in a
+configuration file. Currently all engines can use the \DVIPS\ encoding and map
+files, so luckily we don't need to duplicate this. For some reason \TRUETYPE\ and
+\OPENTYPE\ fonts have different locations and you need to be aware of the fact
+that some fonts come in both formats (just to confuse users) so you might end up
+with conflicts.
+
+In \CONTEXT\ we try to make live somewhat easier by also supporting a simple path
+structure:
+
+\starttyping
+<root>/fonts/data/vendor/typeface
+\stoptyping
+
+This way files are kept together and installing commercial fonts is less complex
+and error prone. Also, in practice we only have one set of files now: one of the
+other \OPENTYPE\ formats.
+
+If you want to see the difference between a traditional (\PDFTEX\ or \XETEX\ plus
+\CONTEXT\ \MKII) setup or a modern one (\LUATEX\ with \CONTEXT\ \MKIV) you can
+install the \CONTEXT\ suite (formerly known as minimals). If you explicitly
+choose for a \LUATEX\ only setup, you will notice that far less files get
+installed.
+
+\stopsection
+
+\startsection[title=Text]
+
+This is not an in|-|depth explanation of how to define and load fonts in
+\CONTEXT. First of all this is covered in other manuals, but more important is
+that we assume that the reader is already familiar with the way \CONTEXT\ deals
+with fonts. Therefore we limit ourselves to some remarks and expand on this a bit
+in later chapters.
+
+The font subsystem has evolved over years and when you look at the low level code
+you will probably find it complex. This is true, although in some aspects it is
+not as complex as in \MKII\ where we also had to deal with encodings due to the
+eight bit limitations. In fact, setting up fonts is easier due the fact that we
+have less files to deal with.
+
+The main properties of a (modern) font subsystem for typesetting text are the
+following:
+
+\startitemize[n]
+ \startitem
+ We need to be able to switch the look and feel efficiently and
+ consistently, for instance going from regular to bold or italic. So,
+ when we load a font family we not only load one file, but often
+ at least four: regular, bold, italic (oblique) and bolditalic
+ (boldoblique).
+ \stopitem
+ \startitem
+ When we change the size we also need to make sure that these related
+ sets are changed accordingly. You really want the bold shapes to scale
+ along with the regular ones.
+ \stopitem
+ \startitem
+ Shapes are organized in serif, sans serif, mono spaced and math and for
+ proper working of a typesetter that has math all over you need always
+ need the math. Again, when you change size, all these shapes need to
+ scale in sync.
+ \stopitem
+ \startitem
+ In one document several families can be combined so the subsystem should
+ make it possible to switch from one to the other without too much
+ overhead.
+ \stopitem
+ \startitem
+ Because section heads and other structural elements have their own sizes
+ there has to be a consistent way to deal with that. It should also be
+ possible to specify exceptions for them.
+ \stopitem
+\stopitemize
+
+In the next chapters we will cover some details, for instance font features. You
+can actually control these when setting up a body font, simply by redefining
+the \type {default} feature set, but not all features are dealt with this way.
+So let's continue the demands put on a font subsystem.
+
+\startitemize[continue]
+ \startitem
+ Sometimes inter|-|character kerning is needed. In \CONTEXT\ this is not a
+ property of a font because glyphs can be mixed with basically anything.
+ This kind of features is applied independent of a font.
+ \stopitem
+ \startitem
+ The same is true for casing (like uppercasing and such) which is not
+ related to a font but applied to a selected (or marked) piece of the
+ input stream.
+ \stopitem
+ \startitem
+ Using so called \quotation {small caps} or \quotation {old style}
+ numerals or \unknown\ can be dealt with by setting the default features
+ but often these are applied selectively. As these are applied using the
+ information in a font they do belong to the font subsystem but in
+ practice they can be seen as independent (assuming that the font supports
+ them at all).
+ \stopitem
+ \startitem
+ Protrusion (into margins) and expansion (to improve whitespace) are
+ applied to the font at load time because the engine needs to know about
+ them. But they two can selectively be turned on and off. They are more
+ related to line break handling than font defining.
+ \stopitem
+ \startitem
+ Slanting (to fake oblique) and expanding (to fake bold) are regular
+ features but are applied to the font because the engine needs to know
+ about them. They permanently influence the shape.
+ \stopitem
+\stopitemize
+
+We will discuss these in this manual too. What we will not discuss in depth is
+spacing, even when it depends on the (main body) font size. These use properties
+of fonts (like the ex|-|height or em|-|width and maybe the width of the space,
+but normally they are controlled by the spacing subsystem. We will however
+mention some rather specific possibilities:
+
+\startitemize[continue]
+ \startitem
+ The \CONTEXT\ font subsystem provides ways to combine multiple fonts
+ into one.
+ \stopitem
+ \startitem
+ You can construct artificial fonts, using existing fonts or \METAPOST\
+ graphics.
+ \stopitem
+ \startitem
+ Fonts can be fixed (dimensions) and completed (for instance accented
+ characters) when loading/
+ \stopitem
+ \startitem
+ There are extensive tracing options, not only for applied features but
+ also for loading, checking etc. There is a set of styles that can be
+ used to study fonts.
+ \stopitem
+\stopitemize
+
+Sometimes users ask for very special trickery and it no surprise then that some
+of that is now widely know (or even discussed in detail). When we get notice of
+that we can mention it in this manual.
+
+So how does this all relate to font formats? We mentioned that when loading we
+basically load some four files per family (and more if we use specific fonts for
+titling). These files just provide the data: metric information, shapes and ways
+to remap characters (or sequences) into glyphs, either of not positioned relative
+to each other. In traditional \TEX\ only dimensions, kerns and ligatures
+mattered, but in nowadays we also deal with specific \OPENTYPE\ features. But
+still, as you can deduce from the above, this is only part of the story. You need
+a complete and properly integrated system. It is no big deal to set up some
+environment that uses font files to achieve some typesetting goal, but to provide
+users with some consistent and extensible system is a bit more work.
+
+There are basically three font formats: good old bitmaps, \TYPEONE\ and
+\OPENTYPE. All need to be supported and expectations are that we also support
+their features. But is should be noticed that whatever font you use, the quality
+of the outcome depends on what information the font can provide. We can improve
+processing but are often stuck with the font. There are many thousands of
+fonts out there and we need to be able to use them all.
+
+\stopsection
+
+\startsection[title=Math]
+
+In the previous section we already mentioned math fonts. The fonts are just one
+aspect of typesetting math and math fonts are special in the sense that they have
+to provide the relevant information. For instance a parenthesis comes in several
+sizes and at some point turns in a symbol made out of pieces (like a top curve,
+middle lines and bottom curve) that overlap. The user never sees such details. In
+fact, there are ot that many math fonts and these are already set up so there is
+not much to mess up here. Nevertheless we mention:
+
+\startitemize [n]
+ \startitem
+ Math fonts are loaded in three sizes: text, script and scriptscript. The
+ optimal relative sizes ar defined in the font.
+ \stopitem
+ \startitem
+ There are direction aware math fonts and we support this in \CONTEXT.
+ \stopitem
+ \startitem
+ Bold math is in fact a bolder version of a regular math font (that can
+ have bold symbols too). Again this is supported.
+ \stopitem
+\stopitemize
+
+The way math is dealt with in \CONTEXT\ is different from the way it is done
+traditionally. Already when we started with \MKIV\ we moved to \UNICODE\ and
+the setup at the font level is kept simple by delegating some of the work to
+the \LUA\ end. We will see some of the mentioned aspects in more detail later.
+
+Because of it's complexity and because in a math text there can be many times
+activation of math fonts (and related settings) quite some effort has been put in
+making it efficient. But you need to keep in mind that when we discuss math
+related topics later on, this is hardly of concern. Math fonts are loaded only
+once so manipulating them a bit has no penalty. And using them later on is hardly
+related to the font subsystem.
+
+Concerning formats we can notice that traditional \TEX\ comes with math fonts
+that have properties that the engine can use. Because there were not many math
+fonts, this was no problem. The \OPENTYPE\ math fonts however are also used in
+other applications and therefore are a bit more generic. \footnote {Their
+internals are now defined in the \OPENTYPE\ specification.} For this we not only
+had to adapt the math engine in \LUATEX\ (although we kept that to the minimum)
+but we also had to think different about loading them. In later chapters we will
+see that in the transition to \UNICODE\ math fonts we implemented a mechanism for
+combining \TYPEONE\ fonts into virtual \UNICODE\ fonts. We did that because it
+made no sense to keep an old and new loader alongside.
+
+There will not be thousands of math fonts flying around. A few dozen is already a
+lot and the developers of macro packages can set them up for the users. So, in
+practice there is not much that a user needs to know about math font formats.
+
+\stopsection
+
+\startsection[title=Caching]
+
+Because fonts can be large and because we use \LUA\ tables to describe them
+a bit of effort has been put into managing them efficiently. Once converted
+to the representation that we need they get cached. You can peek into the cache
+which is someplace on your system (depending on the setup):
+
+\starttabulate[|l|p|]
+\NC \type{fonts/afm} \NC type one fonts, converted from \type {afm} and \type
+ {pfb} files \NC \NR
+\NC \type{fonts/data} \NC font name databases \NC \NR
+\NC \type{fonts/mp} \NC fonts created using \METAPOST \NC \NR
+\NC \type{fonts/otf} \NC open type fonts, converted from \type {ttf}, \type {otf},
+ \type {ttc} and \type {ttx} files loaded using the
+ \FONTFORGE\ loader \NC \NR
+\NC \type{fonts/otl} \NC open type fonts, converted from \type {ttf}, \type {otf},
+ \type {ttc} and \type {ttx} files loaded using the
+ \CONTEXT\ \LUA\ loader \NC \NR
+\NC \type{fonts/shapes} \NC outlines of fonts (for instance for use in \METAFUN) \NC \NR
+\stoptabulate
+
+There can be three types of files there. The \type{tma} files are just \LUA\
+tables and they can be large. These files can be compiled to bytecode where \type
+{tmc} is for stock \LUATEX\ and \type {tmb} for \LUAJITTEX. The \type {tma} files
+are optimized for space and memory (aka: packed) but you can expand them with
+\type {mtxrun --script font}.
+
+Fonts in the cache are automatically updated when you install new versions of a
+font or when the \CONTEXT\ font loader has been updated.
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/fonts/fonts/fonts-hooks.tex b/doc/context/sources/general/fonts/fonts/fonts-hooks.tex
new file mode 100644
index 000000000..9be69d6b8
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-hooks.tex
@@ -0,0 +1,585 @@
+% language=uk
+
+\startcomponent fonts-hooks
+
+\environment fonts-environment
+
+\startchapter[title=Hooks][color=darkcyan]
+
+\startsection[title=Introduction]
+
+One of the virtues of \TEX\ is its flexibility. Because we cannot predict what
+users want to mess around with, much of the underlying code has hooks. And because
+it's not too hard to add functionality that will break things we will not advocate
+all of it. Of course you can study the code and figure out what can be done and
+there is no problem with that. It's just that you shouldn't expect much support.
+
+In this chapter we collect some of these hooks. If you run into interesting ones
+that are worth mentioning, you can always ask us to add description here.
+
+\stopsection
+
+\startsection[title=Safe hooks]
+
+\startsubsection[title=Trimming fonts]
+
+Because we store font related information in \LUA\ tables there can be situations
+where the resources used outgrow memory. An example of such a font is \type
+{lastresort} that basically defined the whole \UNICODE\ range. The font is
+actually not that large as it uses similar placeholders for glyphs in a range,
+but it has rather verbose (redundant) names. As we normally don't need these, you
+can decide to strip them away.
+
+\starttyping
+\startluacode
+ fonts.handlers.otf.readers.registerextender {
+ name = "remove names from lastresort",
+ action = function(fontdata)
+ if fontdata.metadata.fullname == "LastResort" then
+ for k, v in next, fontdata.descriptions do
+ v.name = nil
+ end
+ end
+ end
+ }
+\stopluacode
+
+\definedfont[LastResort][lastresort*default sa 1]
+\stoptyping
+
+This will result in a much smaller font, one that has less change to crash the
+engine due to lack of memory. Extenders like this are applied once the font has
+been loaded but before it gets saved.
+
+\stopsubsection
+
+\stopsection
+
+\startsection[title=Loading]
+
+\startsubsection[title=Introduction]
+
+We basically have to deal with three font formats that can easily be recognized
+by the suffix of the files involved: \type {tfm} and \type {vf} files that
+describe 8 bit fonts, traditionally bitmap fonts, but as they carry only metric
+information, any 8 bit font can be described. Then there are \type {afm} files
+that contain metrics related to \TYPEONE\ fonts (stored in \type {pfb} files).
+Although such fonts could contain more than 256 shapes, the implementation was
+limited to 8 bits too. By converting \type {afm} files to \type {tfm} files,
+traditional \TEX\ can deal with \TYPEONE\ given that the backend can include them
+in the final result.
+
+In this section we will discuss some aspects of the \OPENTYPE\ font reader. As
+\TEX\ only deals with metrics (in the frontend) we need to parse them, filter
+information from it and pass the metrics to \TEX. In addition, we can use all
+kind of extra information to manipulate the so called node list but in the end
+\TEX\ is only interested in font id's (that point to a font resource) and glyph
+indexes.
+
+To overcome the 256 limitation of \TYPEONE\ fonts, in \CONTEXT\ we moved away
+from \type {tfm} files (we can of course still deal with them) and turn \type
+{afm} files into so called wide fonts. Basically we turn them in a more rich
+format that looks similar to the internal \OPENTYPE\ format we use. We will not
+go into much detail about that because \TYPEONE\ is kind of obsolete and being
+replaced by \OPENTYPE, but we will of course support the old formats simply
+because we have all these fonts around.
+
+Already early in the development of \LUATEX\ a font loader library was created
+that can turn an \OPENTYPE\ (but also a \TYPEONE) font into a \LUA\ table. This
+library is derived from \FONTFORGE\ which makes it possible to look into a font
+using that editor and at the same time get a similar view on the font in \LUA,
+which is quite handy. However, at some point in \CONTEXT\ we wanted to play with
+outlines in \METAPOST\ and for that purpose an \OPENTYPE\ reader was written in
+\LUA\ that could extract the data. Because \TYPEONE\ fonts already were done in
+\LUA\ it was a logical step to also do \OPENTYPE\ in \LUA\ so now we use an
+alternative loader that doesn't depend in the \FONTFORGE\ library. This not only
+gives more flexibility but also makes it possible to avoid some conversions
+needed to provide the \CONTEXT\ font handler with the needed information in an
+efficient way.
+
+\stopsubsection
+
+\startsubsection[title=Loading \OPENTYPE\ fonts]
+
+As with most binary media formats today an \OPENTYPE\ font file is a linked list
+of records. The top level structure is called table. There are two flavours of
+\OPENTYPE\ where the main difference is in the way the shapes are defined: they
+can be \TRUETYPE\ outlines using quadratric bezier curves or cff files using
+cubic bezier curves. The last variant is the same as \POSTSCRIPT\ \TYPEONE\
+fonts. Simplified, a quadratic curve defines the shape in points with a control
+point in between, while a quadratic one also has points but each with two control
+points (as in \METAPOST).
+
+An \OPENTYPE\ font can be large: there can be upto 65536 glyphs and lots of extra
+properties and features. In order to save space the data is rather packed using
+different numeric data types. Of course one can wonder if size really matters now
+that most bandwidth is taken by audio, video and pictures but we have to live
+with it.
+
+The definition of \OPENTYPE\ can be found on the \MICROSOFT\ website:
+\hyphenatedurl {https://www.microsoft.com/typography/otspec}. Most tables then
+could make sense for us are mentioned in the following list:
+
+\starttabulate[|Bl|l|l|]
+\NC required \NC cmap \NC character to glyph mapping \NC \NR
+\NC \NC head \NC font header \NC \NR
+\NC \NC hhea \NC horizontal header \NC \NR
+\NC \NC hmtx \NC horizontal metrics \NC \NR
+\NC \NC maxp \NC maximum profile \NC \NR
+\NC \NC name \NC naming table \NC \NR
+\NC \NC os/2 \NC os/2 and windows specific metrics \NC \NR
+\NC \NC post \NC postScript information \NC \NR
+\NC truetype \NC glyf \NC glyph data \NC \NR
+\NC \NC loca \NC index to location \NC \NR
+\NC postscript \NC cff \NC compact font format \NC \NR
+\NC \NC vorg \NC vertical origin \NC \NR
+\NC typographic \NC base \NC baseline data \NC \NR
+\NC \NC gdef \NC glyph definition data \NC \NR
+\NC \NC gpos \NC glyph positioning data \NC \NR
+\NC \NC gsub \NC glyph substitution data \NC \NR
+\NC \NC jstf \NC justification data \NC \NR
+\NC \NC math \NC math layout data \NC \NR
+\NC extras \NC kern \NC kerning \NC \NR
+\NC \NC ltsh \NC linear threshold data \NC \NR
+\NC \NC vhea \NC vertical metrics header \NC \NR
+\NC \NC vmtx \NC vertical metrics \NC \NR
+\NC \NC colr \NC color table \NC \NR
+\NC \NC cpal \NC color palette table \NC \NR
+\stoptabulate
+
+When we read these tables it depends on what we want to do with the result how
+much we will really read. For instance when we only want to identify a font and
+get some basic information we don't need to read all tables and certainly don't
+need to read them completely. If we want to have the outlines we need to read the
+\type {glyf} or \type {cff} table. If we also want to boundingbox of \POSTSCRIPT\
+shapes we even need to process the shapes so that we know the dimensions of the
+result. There is no need to summarize the format here in detail because you can
+find it on the \MICROSOFT\ site. Here I only cover some aspects that influence
+the way \TEX\ can use the fonts.
+
+One of the main differences between the readers is that the \FONTFORGE\ reader
+has a lot of (recovery) heuristics for bad fonts. Nowadays most fonts are quite
+okay, and in \CONTEXT\ we prefer to just reject bad ones. In the process of
+loading the built|-|in loader gives each glyph a name (it makes them up for
+variants needed for features). It also tries to figure out some font properties,
+like the weight. If does a pretty good job on that but it is also hard to repair
+at the \LUA\ end when it makes a bad guess. The \LUA\ variants stays closer to
+the specification, but delegates more to the final user, which is good because we
+need and want that level of control as controls is what \TEX\ is about. It also
+made it possible to support for instance colored fonts without too much effort.
+
+So what data needs to be collected? If we look at what we get eventually the list
+of glyphs is the bulk. For each glyph we collect some metric information. For
+instance we fetch the (advance) width of the glyph but also the boundingbox,
+which gives us the the height and depth.
+
+In the font file the list of glyphs starts at zero and runs up tot the total
+number of glyphs. The index in this table is used in for instance the tables that
+define the font features, for instance kerning between glyphs, or multiple glyphs
+that are turned into ligatures. Each glyph gets a name. That can be a meaningful
+one but also a rather dumb one, for instance the index number.
+
+Eventually (at least in \CONTEXT) we don't order by glyph index but by \UNICODE.
+The font file contains information about the mapping from index to \UNICODE. In
+principle other encodings are possible but we stick to \UNICODE. But, because
+many glyphs can refer to one \UNICODE\ slot, for instance a regular shape as well
+as a smallcaps or oldstyle variant. These extra glyphs we let end up in the
+private \UNICODE\ areas. This also means that with each glyph in the final table
+there is also a field that has the \UNICODE. Because we order by \UNICODE\ we
+also need to store the index. An example from a Latin Modern font is:
+
+\starttyping
+[97] = {
+ boundingbox = { 34, -10, 474, 446 },
+ index = 28,
+ name = "a",
+ unicode = 97,
+ width = 490,
+}
+\stoptyping
+
+Another example is the following. Here we end up in private space:
+
+\starttyping
+[983059] = {
+ boundingbox = { 30, -10, 734, 446 },
+ index = 19,
+ name = "oe.dup",
+ unicode = 339,
+ width = 762,
+}
+\stoptyping
+
+Yet another entry is:
+
+\starttyping
+[306] = {
+ boundingbox = { 28, -22, 790, 683 },
+ index = 357,
+ name = "I_J",
+ unicode = { 73, 74 },
+ width = 839,
+ },
+\stoptyping
+
+Here you see two \UNICODE\ numbers. That kind of information is deduced from the
+name of the glyph, using knowledge on how such names are supposed to be
+constructed, or, when that is not possible, from ligature information in the
+fonts.
+
+It makes no sense to discuss the whole font table in detail, if only because most users
+will never (need to) see it. But if your curious you can have a look at the fonts
+in the cache tree, in the \CONTEXT\ distribution from the \CONTEXT\ garden this is
+
+\starttyping
+.../tex/texmf-cache/luatex-cache/context/<somehash>/fonts/otl
+\stoptyping
+
+There can be three kind of files there, with suffixes \type {tma}, \type {tmc}
+and \type {tmb}. The first one is the table as converted from the binary font
+file. The second and third variants are just bytecode compilations of this file
+(for \LUATEX\ and|/|or \LUAJITTEX). The bytecode variants are smaller but more
+important, they load a bit faster. On my disk the largest \type{tma} file is just
+below 10 MByte (an extensive \CJK\ font) but normally they are in the few hundred
+KByte range (some are real small), with the bytecode files of course being
+relatively small to their original.
+
+However, there is a bit of cheating here. If we run the command:
+
+\starttyping
+mtxrun --script font --convert lmroman10-regular.otf
+\stoptyping
+
+A \LUA\ file is generated: \type {lmroman10-regular.lua}. This file is much larger
+than the \type {tma} file in the cache:
+
+\starttabulate[|T|T|]
+\NC 643.924 \NC lmroman10-regular.lua \NC 0.029 \NR
+\NC 209.950 \NC lmroman10-regular.tma \NC 0.010 \NR
+\NC 121.541 \NC lmroman10-regular.tmb \NC \NR
+\NC 134.564 \NC lmroman10-regular.tmc \NC 0.003 \NR
+\stoptabulate
+
+The reason for this is the following. Most information is stored in tables.
+Especially tables that describe font features can be the same all over the place.
+This is why we pack the table in a more compact format before saving it in the
+cache, and unpack it after loading. The effects on loading are neglectable but
+and it has the benefit that it saves a lot of memory. By looking at such numbers
+one should be careful with conclusions, but (assuming proper garbage collection)
+we see a memory footprint of the \type {lua} file of 2836 Kbyte, while the
+unpacked variant takes 704 Kbyte. You can imagine what happens with large \CJK\
+fonts. Loading the (larger unpacked) \type {lua} file currently costs me 0.029
+seconds, while loading and unpacking the \type {tma} file takes 0.010 seconds and
+the bytecode variant \type {tmc} 0.003 seconds.
+
+\stopsubsection
+
+\startsubsection[title=Loading \TYPEONE\ fonts]
+
+When we started with \CONTEXT\ \MKIV\ (which is shortly after we started with
+\LUATEX) the only \TFM\ files that were loaded, were those to make virtual
+\UNICODE\ math fonts, awaiting real \OPENTYPE\ math fonts. Math fonts are kind
+of special with respect to metrics and such.
+
+For \TYPEONE\ text fonts we didn't use the \TFM\ files but went for parsing \AFM\
+files. That way we could use all the glyphs provided by fonts and not be limited
+to 256 slots. So, effectively we made them \UNICODE\ and similar to \OPENTYPE. Of
+course the only features were ligatures, kerns and some special ones like \TEX\
+ligatures and replacements. With the old loader code, we always made them base
+mode fonts, which means that processing was delegated to \TEX. In the new loader
+we implement ligatures and kerns as node mode features, which means that we can
+use those fonts in base mode as well as node mode. The last options therefore
+permits to add or adapt features to \TYPEONE\ fonts as well.
+
+In the next sections we will focus on \OPENTYPE\ but as the \TYPEONE\ fonts are
+organized in a similar way, some of it also applies to this older type. The most
+important to keep in mind is that we only have \type {liga}, \type {kern} and a
+few \CONTEXT\ specific features.
+
+\stopsubsection
+
+\stopsection
+
+\startsection[title=The tables]
+
+\startsubsection[title=Structure]
+
+Getting a font read for \TEX\ happens in stages. The original \OPENTYPE\ file is
+read only once. At that moment the shapes are described in the \type
+{descriptions} subtable while by the time that we pass the information to \TEX\
+they are in \type {characters}. The reason is that we go from dimensions in font
+units to dimensions in scaled points. We start with the following table:
+
+\ctxlua{context.tocontext(fonts.tables.data.original,"original_table")}
+
+The table passed \TEX\ is constructed from this one and looks like:
+
+\ctxlua{context.tocontext(fonts.tables.data.scaled,"scaled_table")}
+
+There might be a few more (often obscure) fields for special purposes. The
+characters subtable conforms to what \TEX\ expects, while the descriptions stays
+closer to \OPENTYPE. The \type {kerns} and \type {ligatures} subtables are there
+for base mode and are not present in \type {node} mode. The \type {commands} and
+\type {fonts} subtables relate to virtual fonts.
+
+\startitemize[packed]
+\startitem
+ Start with the (already) loaded \OPENTYPE\ table.
+\stopitem
+\startitem
+ Copy relevant information from \type {descriptions} to \type {characters} etc.
+\stopitem
+\startitem
+ Construct \type {properties} and \type {parameters} tables.
+\stopitem
+\startitem
+ Apply additional manipulators, for instance extend the \type {characters}
+ table, with expansion and protrusion.
+\stopitem
+\startitem
+ Scale the \type {characters}, \type {properties} and \type {parameters}.
+\stopitem
+\startitem
+ Apply additional manipulators.
+\stopitem
+\startitem
+ Pass the table to \TEX, but keep it around for later access.
+\stopitem
+\stopitemize
+
+One of the things you need to be aware of is that all references to glyphs are
+\UNICODE\ slots, either natural ones (representing a character) or a private one
+(representing an alternative representation). In \OPENTYPE\ features are defined
+in terms of glyph indices but we prefer \UNICODE\ because that is easier to deal
+with when we run over the node list. Before font processing the character field
+in a glyph node is a \UNICODE\ slot and afterwards it's still a \UNICODE\ but
+when it's a private one it can always be resolved to a non private slot of
+sequence of slots. Of course that could also be done with indices but it's just
+more natural this way.
+
+Another thing to note is that in the descriptions we're still working with font
+units ranging from $-1000$ to $+1000$, $-2048$ to $+2048$ or similar ranges. At
+the \TEX\ end we need scaled points which are much larger numbers.
+
+The question is: how often do users need to access the raw data in a font? After
+a decade of \MKIV\ and \LUATEX\ hardly any user has requested such access,
+probably because when needed easier interfaces were provided. Also, in the
+\CONTEXT\ distrubution there are some examples of manipulations that can be
+copied and adapted to personal use. There's also a danger is messing with the
+fonts (similar messing with the node lists): you never know how it interferes
+with other (maybe future) features.
+
+If you still want to do it, best is probably to start with saving the
+to|-|be|-|passed|-|to|-|\TEX\ table in a file and have a look at it. The most
+prominent subtable is the \type {characters} table and messing a bit with
+dimensions is rather harmless. You could add characters, for instance virtual
+ones, which again is harmless unless you use invalid commands. You probably want
+to stay away from the resources subtable, if only because some of its subtables
+are shared and therefore adapting them can have side effects. The top level \type
+{shared} and \type {unscaled} subtable are off limits as is the \type
+{specification}.
+
+You can save a font by consulting one of the hashes but for a specific font
+you need to know its id. You can do this by using low level accessors but better
+is to use the helpers made for this, because they prevent saving redundant
+data.
+
+% \starttyping
+% \startluacode
+% local nullfont = fonts.hashes.identifiers[false]
+% local currentfont = fonts.hashes.identifiers[true]
+%
+% local id, tfmdata = fonts.definers.define {
+% name = "dejavusansmono*default",
+% size = tex.sp("6pt")
+% }
+%
+% table.save("temp-nullfont.lua", nullfont)
+% table.save("temp-currentfont.lua",currentfont)
+% table.save("temp-definedfont.lua",tfmdata)
+% table.save("temp-definedfont.lua",fonts.hashes.identifiers[id])
+% \stopluacode
+% \stoptyping
+
+\starttyping
+\startluacode
+fonts.tables.save {
+ filename = "temp-font-scaled.lua",
+ fontname = "dejavusansmono*default",
+ method = "original",
+}
+\stopluacode
+\stoptyping
+
+At the \TEX\ end you can use:
+
+\starttyping
+\savefont
+ [name=dejavusansmono*default,
+ file=temp-o.lua,
+ method=original]
+\savefont
+ [name=dejavusansmono*default,
+ file=temp-s.lua,
+ method=scaled]
+\stoptyping
+
+When no \type {name} is given, the current font is used and when no \type {file}
+is given a filename is made up. The default \type {method} is \type {scaled}. The
+saved name is reported.
+
+\stopsubsection
+
+\startsubsection[title=Plug-ins]
+
+There are several places where you can hook in code: before scaling
+(initalizers), after scaling (manipulators) and while processing (processors).
+Only the first two are meant for tweaks.
+
+\starttyping
+local do_something = {
+ name = "something",
+ description = "doing something",
+ initializers = {
+ -- position = 1,
+ base = function(tfmdata,value,features) ... end,
+ node = function(tfmdata,value,features) ... end,
+ },
+ manipulators = {
+ -- position = 1,
+ base = function(tfmdata,feature,value) ... end,
+ node = function(tfmdata,feature,value) ... end,
+ },
+ processors = {
+ -- position = 1,
+ base = function(tfmdata,font,attr) ... end,
+ node = function(tfmdata,font,attr) ... end,
+ }
+}
+
+fonts.constructors.features.register.otf(so_something)
+fonts.constructors.features.register.afm(so_something)
+\stoptyping
+
+A \type {initializer} is applied just before the font gets scaled. This means
+that the characterm properties and parameters are unscaled! Initializers can for
+instance be used to add extra features to fonts. You can provide an \type
+{position} key with a number to force a place in the list of initializers but of
+course you can never be sure of interference.
+
+A \type {manipulator} is applied when the font is scaled but before it gets
+passed to \TEX. It's a good place to tweak dimensions. Here you can also probide
+a \type {position}.
+
+The processors are applied when the node list gets processed, hence the \type
+{font} and optional \type {attr} arguments. The action is only applied to the
+specified font (id) and when an attribute gets passed, this is tested for a
+value. When an attribute is used, an unset attribute on the node will skip the
+action.
+
+If adapting characters and their properties is your main objetive, then there is a
+better plugin mechanism using sequencers. We illustrate this with a fake example:
+
+\starttyping
+\startluacode
+
+function document.b_copying(tfmdata)
+ logs.report("fonts","before copying: %s",tfmdata.properties.filename)
+end
+function document.a_copying(tfmdata)
+ logs.report("fonts","after copying: %s",tfmdata.properties.filename)
+end
+
+function document.b_math(tfmdata)
+ logs.report("fonts","before math: %s",tfmdata.properties.filename)
+end
+function document.a_math(tfmdata)
+ logs.report("fonts","after math: %s",tfmdata.properties.filename)
+end
+
+utilities.sequencers.appendaction(
+ "beforecopyingcharacters",
+ "before",
+ "document.a_copying"
+)
+
+utilities.sequencers.appendaction(
+ "aftercopyingcharacters",
+ "after",
+ "document.b_copying"
+)
+
+utilities.sequencers.appendaction(
+ "mathparameters",
+ "before",
+ "document.b_math"
+)
+
+utilities.sequencers.appendaction(
+ "mathparameters",
+ "after",
+ "document.a_math"
+)
+\stopluacode
+\stoptyping
+
+When we call the next command:
+
+\starttyping
+\definedfont[MathRoman at 3pt]
+\stoptyping
+
+we get this reported:
+
+\starttyping
+fonts > before math: ...../public/dejavu/texgyredejavu-math.otf
+fonts > after math: ...../public/dejavu/texgyredejavu-math.otf
+fonts > after copying: ...../public/dejavu/texgyredejavu-math.otf
+fonts > before copying: ...../public/dejavu/texgyredejavu-math.otf
+\stoptyping
+
+In between \type {before} and \type {after} we have \type {system} which is
+reserved for \CONTEXT\ actions. These actions are executed in the scaler
+function. The function get two tables passed: the original data as well as the
+target. If you ever need these hooks, you can probably best run an \type
+{inspect} on these arguments to see what you're dealing with.
+
+Fonts get reused when possible and for that a hash is calculated depending on the
+enabled features and size. If for some reason you want to adapt that hash you can
+use postprocessors. When the \type {tfmdata} table has a subtable \type
+{postprocessors}, then the actions in that subtable will be applied. When an
+action returns a string, the string will be combined with the hash. You can set
+(o rextend) the postprocessors table using the previopusly mentioned commands.
+However, in \CONTEXT\ you can best stay away from this as it might interfere. This
+mechanism is mostly provided for generic use.
+
+\stopsubsection
+
+\stopsection
+
+\startsection[title=Goodies]
+
+The font goodies are already discussed as an official mechanism to extend or enhance
+fonts with additional features. There are quite some goodies defined and for sure more will
+show up. Here is the full repertoire:
+
+\ctxlua{context.tocontext(fonts.tables.data.goodies,"goodie_table")}
+
+Of course you will never use all the options at the same time. The best place to
+look for examples are the \type {lfg} files in the \CONTEXT\ distribution.
+\footnote {At some point we might decide to also support goodies in the generic
+version.}
+
+\stopsection
+
+% - features
+% - subfonts
+% - outlines
+% - math
+% - hashes
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/fonts/fonts/fonts-introduction.tex b/doc/context/sources/general/fonts/fonts/fonts-introduction.tex
new file mode 100644
index 000000000..0ca91ee9f
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-introduction.tex
@@ -0,0 +1,95 @@
+% language=uk
+
+\startcomponent fonts-introduction
+
+\environment fonts-environment
+
+\startchapter[title=Introduction][color=darkgray]
+
+You sit in a cave and wonder how to keep track of your winter stock. While
+playing with some burned wood you end up with vertical strokes on the wall
+representing how much you have in store.
+
+You walk through the woods and wonder how to find your way back. Suddenly it
+strikes you that you can put markers on trees. Years from that moment the whole
+forest is marked with routes. Different symbols carry different meanings.
+
+The next thing you want to do is to carry around information and pass it onto
+following generations. So, you turn those symbols into shapes that make up the
+scripts that can be used to express your languages in.
+
+For ages scripts have evolved and the rendering of them on stone or wood and
+later paper has resulted in a multitude of coherent collections of so called
+glyphs. Manual labour turned into (semi) automated mass production and once that
+took off, developments went fast. But the quality was still somewhat dubious,
+especially when for instance specialized scripts like math had to be dealt with.
+
+Some 30 years ago Don Knuth wrote a book, and in the process invented the \TEX\
+typesetting system, the graphical language \METAFONT\ and a bunch of fonts. He
+made it open and free of charge. He was well aware that the new ideas were built
+on older ones that had evolved from common sense: how to keep track of things on
+paper.
+
+It is no surprise that an active community formed around these goodies. First of
+all the system has no strings attached: the licence is generous and there are no
+patents involved. There is also a network of user groups that takes care of
+coordinated updates to the whole machinery. Of course it helps that it all
+relates to Don Knuth.
+
+Since \TEX\ showed up several open and closed source typesetting systems have
+surfaced and only some of them survived. Also regular word processing has become
+more clever and still become better. The \TEX\ typesetting system also moved on.
+Some of its ideas have been used in other programs and some of the ideas of other
+programs made their way into \TEX. However, its main property is still there: you
+can tweak and tune it to your needs and are not hampered by too many limitations.
+
+Don Knuth had this chicken or egg problem: once you can typeset a source you need
+fonts but you can only make fonts if you can use them in a typesetting program.
+As a result \TEX\ came with its own fonts and it has special ways to deal with
+them. Given the limitations of that time \TEX\ puts some limitations on fonts and
+also expects them to have certain properties, something that is most noticeable
+in math fonts.
+
+Rather soon from the start it has been possible to use third party fonts in \TEX,
+for instance \TYPEONE. As \TEX\ only needs some information about the shapes, it
+was the backend that integrated the font resources in the final document. One of
+its descendants, \PDFTEX, had this backend built in and could do some more clever
+things with fonts in the typesetting process, like protrusion and expansion. The
+integration of front- and backend made live much easier. Another descendant,
+\XETEX\ made it possible to move on to the often large \OPENTYPE\ fonts. On the
+one hand this made live even more easy but at the other end it introduced users
+to the characteristics of such fonts and making the right choices, i.e.\ not fall
+in the trap of too fancy font usage.
+
+In this manual we will look at fonts from the perspective of yet another
+descendant, \LUATEX. It inherits the font technology from traditional \TEX, but
+also extends it so that we can deal with modern font technologies. Of course it
+offers much more, but in practice much relates to fonts one way or the other.
+
+Of course this exploration will be from the perspective of the \CONTEXT\ macro
+package but this is not a manual about how to use fonts in \CONTEXT\ as we have
+another manual for that. Much of what we say here applies to the generic font
+code as well, although some more advanced control is \CONTEXT\ specific. There is
+nothing real new here, and it all evolved from common sense and dealing with
+\TEX\ for many years. The perspective is mostly that of being a user myself so
+don't complain too loudly if things look complicated and unclear.
+
+There is some overlap between the chapters. This is because each chapter is
+written from another perspective and this document quite certainly will not be
+read as a whole but more by looking at examples.
+
+\startnotabene
+ This document will probably have an \quote {still under construction} state
+ for a long time. The functionality discussed here will stay and more might
+ show up. Of course there are errors, and they're all mine.
+\stopnotabene
+
+\startlines
+Hans Hagen
+PRAGMA ADE, Hasselt NL
+Summer 2011 \endash\ Spring 2016
+\stoplines
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/fonts/fonts/fonts-lookups.tex b/doc/context/sources/general/fonts/fonts/fonts-lookups.tex
new file mode 100644
index 000000000..7f1128302
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-lookups.tex
@@ -0,0 +1,347 @@
+% language=uk
+
+\startcomponent fonts-lookups
+
+\environment fonts-environment
+
+\startchapter[title=Lookups][color=darkblue]
+
+\startsection[title=Introduction]
+
+In traditional \TEX\ a font is defined by referring to its filename. A
+definition looks like this:
+
+\starttyping
+\font \MyFontA = lmr10
+\font \MyFontB = lmr10 at 20pt
+\font \MyFontC = lmr10 scaled 1500
+\stoptyping
+
+The first definition defines the command \type {MyFontA} as a reference to the
+font stored in the file \type {lmx10}. No scaling takes place so the natural size
+is taken. This so called designsize is in no way standardized. Just look at these
+three specimen:
+
+\startlines
+{\definedfont[file:dejavuserif*default]Design Size (Dejavu)}
+{\definedfont[file:cambria*default]Design Size (Cambria)}
+{\definedfont[file:lmroman10-regular*default]Design Size (Latin Modern)}
+\stoplines
+
+The designsize is normally 10 point, but as there is no real reference for this a
+designer decides how to translate this into a visual representation. As a
+consequence the \type {20pt} in the second line of the example definitions only
+means that the font is scaled to (normally) twice the designsize. The third line
+scaled by a factor \type {1.5} and the reason for using a value thousand times
+larger is that \TEX's numbers are integers.
+
+The next three lines are typical for Latin Modern (derived from Computer Modern)
+because this family comes in different design sizes.
+
+\starttyping
+\font \MyFontD = lmr12
+\font \MyFontE = lmr12 at 20pt
+\font \MyFontF = lmr12 scaled 1500
+\stoptyping
+
+Because the designsize is part of the font metrics the second line (\type
+{\MyFontE}) is of similar size as \type {\MyFontB} although the 12~point variant
+is visually better suited for scaling up.
+
+These definitions refer to files, but what file? What gets loaded is the file
+with name \type {name.tfm}. Eventually for embedding in the (let's assume \PDF)
+file the outlines are taken from \type {name.pfb}. At that stage, when present, a
+\type {name.vf} is consulted in order to resolve characters that are combinations
+of others (potentially from other \type {pfb} files). The mapping from \type
+{name.tfm} to \type {name.pfb} filename happens in the so called map file. This
+means that one can also refer to another file, for instance \type {name.ttf}.
+
+All this logic is hard coded in the engine and because the virtual font mechanism
+was introduced later without extending the \type {tfm} format, it can be hard at
+times to figure out issues when a (maybe obsolete) virtual file is present (this
+can be the case if you have generated the \type {tfm} file from an \type {afm}
+file that comes with the \type {pfb} file when you buy one.
+
+But, in \LUATEX\ we no longer use traditional fonts and as a consequence we have
+more options open. Before we move on to them, we mention yet another definition:
+
+\starttyping
+\font \MyFontG = lmr12 sa 1.2
+\stoptyping
+
+This method is not part of \TEX\ but is provided by \CONTEXT, \MKII\ as well as
+\MKIV. It means as much as \quotation {scale this font to 1.2 times the
+bodyfontsize}. As this involves parsing the specification, it does not work
+as advertised here, but the next definition works okay:
+
+\starttyping
+\definefont[MyFontG][lmr12 sa 1.2]
+\stoptyping
+
+This indicates that we already had a parser for font specifications on board
+which in turn made it relatively easy to do even more parsing, for instance for
+font features as introduced in \XETEX\ and \LUATEX.
+
+\stopsection
+
+\startsection[title=Specifications]
+
+In \LUATEX\ we intercept the font loader. We do so for several reasons.
+
+\startitemize[packed]
+
+\startitem We want to make decisions on what file to load, this is needed when
+for instance there are files with the same name but different properties. \stopitem
+
+\startitem We want to be able to lookup by file, by name, and by more abstract specification.
+In doing so, we want to be as tolerant as possible. \stopitem
+
+\startitem We want to support several scaling methods, as discussed in the previous section. \stopitem
+
+\startitem We want to implement several strategies for passing features and defining non
+standard approaches. \stopitem
+
+\stopitemize
+
+The formal specification of a font is as follows:
+
+\starttyping
+\definefont[PublicReference][filename]
+\definefont[PublicReference][filename at dimension]
+\definefont[PublicReference][filename scaled number]
+\stoptyping
+
+We already had that extended to:
+
+\starttyping
+\definefont[PublicReference][filename]
+\definefont[PublicReference][filename at dimension]
+\definefont[PublicReference][filename scaled number]
+\definefont[PublicReference][filename sa number]
+\stoptyping
+
+So let's generalize that to:
+
+\starttyping
+\definefont[PublicReference][filename scaling]
+\stoptyping
+
+And in \MKIV\ we now have:
+
+\starttyping
+\definefont[PublicReference][filename*featurenames scaling]
+\definefont[PublicReference][filename:featurespecication scaling]
+\definefont[PublicReference][filename@virtualconstructor scaling]
+\stoptyping
+
+The second variant is seldom used and is only provided because some users
+have fonts defined in the \XETEX\ way. Users are advised not to use this
+method. The last method is special in the sense that it's used to define
+fonts that are constructed using the built in virtual font constructors. This
+method is for instance used for defining virtual math fonts.
+
+The first method is what we use most. It is really important not to forget the
+feature specification. A rather safe bet is \type {*default}. In a next chapter
+we will discuss the difference between these two; here we focus on the name part.
+
+The \type {filename} is in fact a symbolic name. In \CONTEXT\ we have always used
+an indirect reference to fonts. Look at this:
+
+\starttyping
+\definefont[TitleFont][SerifBold*default sa 2]
+\stoptyping
+
+A reference like \type {SerifBold} makes it possible to define styles independent
+of the chosen font family. This reference eventually gets resolved to a real
+name and there can be a chain of references.
+
+Font definitions can be grouped into a larger setup using typescripts. In that
+case, we can set the features for a regular, italic, bold and bolditalic for the
+whole set but when a fontname has a specific feature associated (as in the
+previous examples) that one takes precedence.
+
+so far we talked about fonts being files, but in practice a lookup happens by
+file as well as by name as known to the system. In the next section this will be
+explained in more detail.
+
+\stopsection
+
+\startsection[title=File]
+
+You can force a file lookup with:
+
+\starttyping
+\definefont[TitleFont][file:somefilename*default sa 2]
+\stoptyping
+
+If you use more symbolic names you can use the \type {file:} prefix in the
+mapping:
+
+\starttyping
+\definefontsynonym[SerifBold][file:somefile]
+\definefont[TitleFont][SerifBold*default sa 2]
+\stoptyping
+
+In projects that are supposed to run for a long time I always use the file based
+lookup, because filenames tend to be rather stable. Also, as the lookup happens
+in the \TEX\ directory structure, file lookups will rely on the general file
+search routines. This has the benefit that case is ignored. When no match is found
+the lookup will also use the font name database. Spaces and special characters are
+ignored.
+
+The name alone is not enough as there can be similar filenames with different
+suffixes. Therefore the lookup will happen in the order \ctxcommand {
+concatcommalist { list = fonts.readers.sequence, separator = ", ", last = " and
+", command = "type" } }. You can force a lookup by being more explicit, like:
+
+\starttyping
+\definefont[TitleFont][file:somefilename.ttf*default sa 1]
+\stoptyping
+
+\stopsection
+
+\startsection[title=Name]
+
+Say that we want to use a Dejavu font and that instead of filenames we want to
+use its given name. The best way to find out what is available is to call for a
+list:
+
+\starttyping
+mtxrun --script font --list --all dejavu
+\stoptyping
+
+This produces the following list:
+
+\startnarrowtyping
+dejavusans dejavusans dejavusans.ttf
+dejavusansbold dejavusansbold dejavusans-bold.ttf
+dejavusansboldoblique dejavusansboldoblique dejavusans-boldoblique.ttf
+dejavusanscondensed dejavusanscondensed dejavusanscondensed.ttf
+dejavusanscondensedbold dejavusanscondensedbold dejavusanscondensed-bold.ttf
+dejavusanscondensedboldoblique dejavusanscondensedboldoblique dejavusanscondensed-boldoblique.ttf
+dejavusanscondensednormal dejavusanscondensed dejavusanscondensed.ttf
+dejavusanscondensedoblique dejavusanscondensedoblique dejavusanscondensed-oblique.ttf
+dejavusansextralight dejavusansextralight dejavusans-extralight.ttf
+dejavusanslight dejavusansextralight dejavusans-extralight.ttf
+dejavusansmono dejavusansmono dejavusansmono.ttf
+dejavusansmonobold dejavusansmonobold dejavusansmono-bold.ttf
+dejavusansmonoboldoblique dejavusansmonoboldoblique dejavusansmono-boldoblique.ttf
+dejavusansmononormal dejavusansmonooblique dejavusansmono-oblique.ttf
+dejavusansmonooblique dejavusansmonooblique dejavusansmono-oblique.ttf
+dejavusansnormal dejavusans dejavusans.ttf
+dejavusansoblique dejavusansoblique dejavusans-oblique.ttf
+dejavuserif dejavuserif dejavuserif.ttf
+dejavuserifbold dejavuserifbold dejavuserif-bold.ttf
+dejavuserifbolditalic dejavuserifbolditalic dejavuserif-bolditalic.ttf
+dejavuserifcondensed dejavuserifcondensed dejavuserifcondensed.ttf
+dejavuserifcondensedbold dejavuserifcondensedbold dejavuserifcondensed-bold.ttf
+dejavuserifcondensedbolditalic dejavuserifcondensedbolditalic dejavuserifcondensed-bolditalic.ttf
+dejavuserifcondenseditalic dejavuserifcondenseditalic dejavuserifcondensed-italic.ttf
+dejavuserifcondensednormal dejavuserifcondensed dejavuserifcondensed.ttf
+dejavuserifitalic dejavuserifitalic dejavuserif-italic.ttf
+dejavuserifnormal dejavuserif dejavuserif.ttf
+\stopnarrowtyping
+
+The first two columns mention the names that we can use to access a font. These
+are normalized names in the sense that we only kept letters and numbers. The next three
+definitions are equivalent:
+
+\starttyping
+\definefont[TitleFont][name:dejavuserif*default sa 1]
+\definefont[TitleFont][name:dejavuserifnormal*default sa 1]
+\definefont[TitleFont][name:dejavuserif.ttf*default sa 1]
+\stoptyping
+
+In the list you see two names that all point to \type {dejavusans-extralight.ttf}:
+
+\starttyping
+dejavusansextralight
+dejavusanslight
+\stoptyping
+
+There are some heuristics built into \CONTEXT\ and we do some cleanup as well.
+For instance we interpret \type {ital} as \type {italic}. In a font there is
+sometimes information about the weight and we look at those properties as well.
+Unfortunately font names (even within a collection) are often rather inconsistent
+so you still need to know what you're looking for. The more explicit you are, the
+less change of problems.
+
+\stopsection
+
+\startsection[title=Spec]
+
+There is often some logic in naming fonts but it's not robust and really depends on
+how consistent a font designer or typefoundry has been. In \CONTEXT\ we can
+access names by using a normalized scheme.
+
+\starttyping
+name-weight-style-width-variant
+\stoptyping
+
+The following values are valid:
+
+\starttabulate[|Bl|Tp|]
+\NC weight \NC \ctxcommand { concatcommalist { list = fonts.names.knownweights } } \NC \NR
+\NC style \NC \ctxcommand { concatcommalist { list = fonts.names.knownstyles } } \NC \NR
+\NC width \NC \ctxcommand { concatcommalist { list = fonts.names.knownwidths } } \NC \NR
+\NC variant \NC \ctxcommand { concatcommalist { list = fonts.names.knownvariants } } \NC \NR
+\stoptabulate
+
+The four specifiers are optional but the more you provide, the better the match. Let's
+give an example:
+
+\starttyping
+mtxrun --script fonts --list --spec dejavu
+\stoptyping
+
+This reports:
+
+\startnarrowtyping
+dejavuserifcondensed normal normal normal normal dejavuserifcondensed dejavuserifcondensed.ttf
+dejavuserif normal normal normal normal dejavuserif dejavuserif.ttf
+dejavusansmono normal normal normal normal dejavusansmono dejavusansmono.ttf
+dejavusanscondensed normal normal normal normal dejavusanscondensed dejavusanscondensed.ttf
+dejavusans normal normal normal normal dejavusans dejavusans.ttf
+\stopnarrowtyping
+
+We can be more specific, for instance:
+
+\starttyping
+mtxrun --script fonts --list --spec dejavu-bold
+\stoptyping
+
+\startnarrowtyping
+dejavuserif bold normal normal normal dejavuserifbold dejavuserif-bold.ttf
+dejavusansmono bold normal normal normal dejavusansmonobold dejavusansmono-bold.ttf
+dejavusans bold normal normal normal dejavusansbold dejavusans-bold.ttf
+\stopnarrowtyping
+
+We add another specifier:
+
+\starttyping
+mtxrun --script fonts --list --spec dejavu-bold-italic
+\stoptyping
+
+\startnarrowtyping
+dejavuserif bold italic normal normal dejavuserifbolditalic dejavuserif-bolditalic.ttf
+dejavusansmono bold italic normal normal dejavusansmonoboldoblique dejavusansmono-boldoblique.ttf
+dejavusans bold italic normal normal dejavusansboldoblique dejavusans-boldoblique.ttf
+\stopnarrowtyping
+
+As the first hit is used we need to be more specific with respect to the
+name, so lets do that in an example definition:
+
+\starttyping
+\definefont[TitleFont][spec:dejavuserif-bold-italic*default sa 1]
+\stoptyping
+
+Watch the prefix \type {spec}. Wolfgang Schusters \type {simplefonts} module
+nowadays uses this method to define sets of fonts based on a name only
+specification. Of course that works best if a fontset has well defined
+properties.
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/fonts/fonts/fonts-math.tex b/doc/context/sources/general/fonts/fonts/fonts-math.tex
new file mode 100644
index 000000000..7f226cb68
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-math.tex
@@ -0,0 +1,998 @@
+% language=uk
+
+\startcomponent fonts-math
+
+\environment fonts-environment
+
+\startchapter[title=Math][color=darkmix-3]
+
+\startsection[title=Introduction]
+
+As one can expect, math support in \CONTEXT\ is to some extend modelled after
+what plain \TEX\ provides, plus what was later decided to be standard. This
+mostly concerns the way fonts behave and what names are used to access glyphs or
+special constructs. It means that when you come from another macro package you
+can stick to coding math the way you did before, at least the basic coding. In
+addition to this, \CONTEXT\ gives control over fonts, structure and rendering and
+most of that was either driven by personal need or user demand. To be honest,
+many of the options are probably of not much interest to the average user.
+
+As we focus on fonts we will only touch this aspect of math here. Right from when
+we started with developing \LUATEX, cleaning op the math part of \CONTEXT\ was
+part of the game. Some primitives were added that would make it possible to avoid
+unnecessary complex macros to get certain glyphs rendered, like radicals, accents
+and extensibles. This was made easy because we also support \OPENTYPE\ math and
+because we knew that eventually the Latin Modern and Gyre fonts would also
+support \OPENTYPE. In order to move forward and get rid of traditional eight bit
+fonts \CONTEXT\ \MKIV\ can construct a virtual \OPENTYPE\ font from traditional
+math fonts. It makes not much sense to discuss that here as by now this method is
+only provided for reasons of compatibility and a reference to the past. As a lot
+of time went into this it will always stay around if only to remind us of what
+we went through to get where we are now.
+
+\stopsection
+
+\startsection[title=\UNICODE\ math]
+
+Due to the limited amount of glyphs in a \TYPEONE\ font a macro package has to
+jump through loops in order to get traditional \TEX\ engines behave well. As a
+practical consequence these fonts are often a mixture of characters, symbols,
+punctuation and snippets that make up larger shapes. The font dimensions in these
+files have often special meanings too.
+
+This has all changed considerably with math being part of \UNICODE. It was however
+\MICROSOFT\ where the real action took place: the development of the first font that
+combined \UNICODE\ with \OPENTYPE\ technology. The Cambria font can be considered
+the benchmark for fonts that surfaced later. The characteristic of a math font are
+the following:
+
+\startitemize[packed]
+ \startitem All math alphabets are present: latin as well as greek, in regular,
+ italic, bold, fraktur and script variants as well as some combinations of these. \stopitem
+ \startitem The symbols that make sense are present (read: the more obscure shapes
+ can be omited). \stopitem
+ \startitem For the characters that make sense, there are two variants that render well
+ at smaller sizes: script and scriptscript. In the font they have the same size but
+ the application will scale them down. This feature is named \type {ssty}. \stopitem
+ \startitem Characters that can extend horizontally (for instance accents and arrows) or vertically
+ (like radicals and fences) have associated larger variants and carries information about
+ how to grow indefinitely. \stopitem
+ \startitem There is a whole lot of special math dimensions. Most of the ones
+ already used in \TEX\ are present. \stopitem
+ \startitem Some glyphs come in variants in order to please special usage. There
+ can also be variants for script or fraktur alphabets. \stopitem
+\stopitemize
+
+This means that in practice an \OPENTYPE\ math font is quite large. We easily
+have thousands of glyphs. It also means that creating such a font involves some
+expertise and this is one of the reasons why \TEX\ usergroups have joined forces
+in developing a suite of fonts. There are also other initiatives in the \TEX\
+community, of which Xits is an example. \footnote {This is a useable
+variant of Stix fonts with proper math features, some extra glyphs and
+experimental right||to||left shapes.} The well known Lucida Bright math font
+package has also been upgraded to a set of \OPENTYPE\ math fonts.
+
+The fact that there are not that many math fonts out there has a positive side as
+well: \CONTEXT\ comes with them pre|-|configured. Because during the development
+of \LUATEX\ we needed to have at least a couple of fonts for testing, and because
+it makes no sense to waste time on traditional fonts, the Latin Modern, Palatino,
+Times and a few more fonts were (and still are) provided as virtual \UNICODE\
+fonts.
+
+In a regular text font, what you key in is what you get out. So, when you've
+chosen a font with an italic shape, you get italic shapes, even if the smallcaps
+feature is enabled. In math, if you use the right unicodes you also get the shape
+you expect. Because in this case italic shapes are situated in one of the
+alphabets you explicitly choose a rendering. You can enter the right codepoints
+directly, so for instance if you enter \UNICODE\ character \type {U+1D434} you
+will get \mathematics {\utfchar {"1D434}}. In practice something like \type {$\bi
+A$} should also give that character if only because that is what we have been
+doing for over three decades. This means that the engine has to map a regular
+\type {A} onto the bold italic alphabet. In a traditional approach you will use
+math families for this, but in \CONTEXT\ \MKIV\ we simply use one font and one
+family and let the \MKIV\ machinery do the rest.
+
+In text mode we switch fonts styles in the following way:
+
+\startbuffer
+regular {\it italic} {\bf bold} {\bi bold italic} and so on
+\stopbuffer
+
+\typebuffer
+
+The three commands shown here are shortcuts for font switches. This input is
+converted into an internal representation and after whatever manipulations
+are applied end up as:
+
+\blank \getbuffer \blank
+
+If we look at what fonts we end up with we get:
+
+\blank \markfonts{\getbuffer} \blank
+
+Now lets do the same in math mode:
+
+\startbuffer
+$regular {\it italic} {\bf bold} {\bi bold italic} and so on$
+\stopbuffer
+
+\typebuffer
+
+This time we get a different result:
+
+\blank \getbuffer \blank
+
+If again we analyze the fonts you see this:
+
+\blank \markfonts{\getbuffer} \blank
+
+All glyphs come from the same font. Instead of regular we get italic simply because
+math characters are italic by nature. The two character style switches are not
+really font switches but just make sure that the given input is mapped onto the
+right alphabet.
+
+A traditional approach using \TYPEONE\ fonts is to use a so called math family for
+each alphabet. In that case each alphabet maps one||to||one onto the font: when
+we switch to a bold family we just take the glyph that sits in that slot. In \MKIV\
+we have all characters in one family so behind the screens a given character is
+remapped.
+
+Now take a look at the following example:
+
+\startbuffer
+$text^{script^{scriptscript}}$
+\stopbuffer
+
+\typebuffer
+
+This renders to this, with the characters marked by font:
+
+\blank \markfonts{\getbuffer} \blank
+
+This time we have three different fonts: one for each of the three math sizes.
+But this representation is not entirely honest, because indeed we have three font
+instances for math, but the glyphs come from the same \OPENTYPE\ math font. We
+just load the same font three times, once for each size. In fact we load the
+font once, but use three copies, scaled accordingly to the relative scale the
+font prescribes.
+
+There is a whole bunch of commands to choose specific characters in math mode
+using a regular input. These are state switching commands.
+
+\def\SampleLine#1#2#3%
+ {\NC \type{#1}\space
+ \ifx#2\empty\else\type{#2}\fi\space
+ \ifx#3\empty\else\type{#3}\fi
+ \NC $#1 a$
+ \NC $#1 A$
+ \NC \NR}
+
+\starttabulate[|||||]
+\HL
+\SampleLine \mr \empty \empty
+\HL
+\SampleLine \mathdefault \empty \empty
+\SampleLine \mathscript \empty \empty
+\SampleLine \mathfraktur \empty \empty
+\SampleLine \mathblackboard\empty \empty
+\HL
+\SampleLine \rm \mathrm \empty
+\SampleLine \ss \mathss \empty
+\SampleLine \tt \mathtt \empty
+\HL
+\SampleLine \tf \mathtf \tfmath
+\SampleLine \sl \mathsl \slmath
+\SampleLine \it \mathit \itmath
+\HL
+\SampleLine \bf \mathbf \bfmath
+\SampleLine \bs \mathbs \bsmath
+\SampleLine \bi \mathbi \bimath
+\HL
+\stoptabulate
+
+As you can see here, some commands have synonyms. The short commands adapt
+themselves to text and mathmode, the longer ones are meant for use in math mode
+only.
+
+In text mode distinctive shapes are either a font property (the whole font looks
+that way) or a stylistic alternate (an extra feature of a font). In math mode we
+can have alternates, but in addition to the previously mentioned alphabet
+switchers we have a few more:
+
+\starttabulate[|||||]
+\HL
+\SampleLine \frak \empty \empty
+\SampleLine \cal \empty \empty
+\SampleLine \bbd \empty \empty
+\SampleLine \blackboard \empty \empty
+\SampleLine \fraktur \empty \empty
+\SampleLine \gothic \empty \empty
+\HL
+\stoptabulate
+
+This chapter is not meant as an introduction to math but it is good to know
+that math font support in \CONTEXT\ is rather flexible. There are several
+mechanisms for remapping and converting characters and sequences into
+others and more is possible. Here is one:
+
+\startbuffer
+\startformula
+\reals {\mathbf R} \utfchar{"0211D} \utfchar{"1D411}
+\stopformula
+\stopbuffer
+
+\typebuffer \blank \getbuffer \blank
+
+Compare this to:
+
+\startbuffer
+\setupmathematics[symbolset=blackboard-to-bold]
+\startformula
+\reals {\mathbf R} \utfchar{"0211D} \utfchar{"1D411}
+\stopformula
+\stopbuffer
+
+\typebuffer \blank \start \getbuffer \stop \blank
+
+Greek is always troublesome because instead of regular text shapes math uses a
+few variants. Because in \UNICODE\ characters are only included once, we have
+gaps in the math alphabets but \MKIV\ will take care of this. \footnote {This is
+a typical example of where exceptions in a standard force all applications that
+deal with it have to implement tweaks.} Depending on the field an author has to
+choose between upright and italic greek:
+
+\startbuffer
+$\nabla \alpha \mathgreekupright \nabla \alpha \mathgreekitalic \nabla \alpha$
+\stopbuffer
+
+\typebuffer \blank \start \getbuffer \stop \blank
+
+By default \CONTEXT\ is set up as follows:
+
+\starttyping
+\setupmathematics
+ [sygreek=normal,
+ lcgreek=italic,
+ ucgreek=normal]
+\stoptyping
+
+Again, these are not features of a font. The font just provides the glyphs and
+the \TEX\ engine, controlled by \CONTEXT\ takes care of mapping characters to
+glyphs and building special constructs. The same is true for spacing. Although
+math fonts do have kerning information, most of the math spacing is controlled
+by properties of characters and not by the font.
+
+\unexpanded\def\SampleLine#1%
+ {\NC
+ \type{$a #1{+} b$}
+ \NC
+ \ruledhbox{$\mathsurround\zeropoint a#1{+}b$}
+ \NC \NR}
+
+\starttabulate[|||]
+\SampleLine \mathord
+\SampleLine \mathpunct
+\SampleLine \mathinner
+\SampleLine \mathop
+\SampleLine \mathalpha
+\SampleLine \mathnothing
+\SampleLine \mathbin
+\SampleLine \mathrel
+\stoptabulate
+
+As a user you don't have to worry about these issues because characters are tagged
+according to their usage. \footnote {There are a few more commands, like \type
+{\mathlimop}, \type {\mathnolop} and \type {mathbox} but these are used
+differently.}
+
+With \TEX\ being the oldest and still dominant math renderer it is no surprise
+that \MICROSOFT\ modelled its math renderer after \TEX\ and Cambria quite well
+suits the concept. In retrospect it is somewhat unfortunate that we're still
+stuck with some left overs (or compromises) from the past with respect to spacing
+built into the font. However, as long as this is consistent over fonts it's not
+that relevant. You can always influence the spacing with the commands mentioned.
+
+If you look at the low level definitions in for instance plain \TEX\ but also in
+\CONTEXT\ \MKII\ that relate to prime symbols it probably takes a while before you
+figure out what happens there. For instance, the prime symbol is triggered by a
+quote and multiple in a row results in primes that are spaced tightly. In
+\UNICODE\ we have slots for single, double and tripple primes. Therefore, in
+\MKIV\ we have a mechanism that accepts different kinds of input that eventually
+all end up in one of these three glyphs.
+
+\unexpanded\def\SampleLine#1%
+ {\NC \type{#1} \NC #1 \NC \NR}
+
+\starttabulate[|||]
+\SampleLine{$f^2$}
+\SampleLine{$f\prime^2$}
+\SampleLine{$f\prime\prime^2$}
+\SampleLine{$f\prime\prime\prime^2$}
+\SampleLine{$f{\prime}^2$}
+\SampleLine{$f{\prime\prime}^2$}
+\SampleLine{$f{\prime\prime\prime}^2$}
+\SampleLine{$f'(x)$}
+\SampleLine{$f''(x)$}
+\SampleLine{$f'''(x)$}
+\SampleLine{$f\utfchar{0x2032}(x)$}
+\SampleLine{$f\utfchar{0x2033}(x)$}
+\SampleLine{$f\utfchar{0x2034}(x)$}
+\SampleLine{$f\utfchar{0x2032}\utfchar{0x2032}(x)$}
+\SampleLine{$f\utfchar{0x2032}\utfchar{0x2032}\utfchar{0x2032}(x)$}
+\SampleLine{$f\utfchar{0x2033}\utfchar{0x2032}(x)$}
+\SampleLine{$f\utfchar{0x2032}\utfchar{0x2033}(x)$}
+\stoptabulate
+
+Again, this is not the same as ligature building features in text fonts, but
+handled in a different way.
+
+The \TEX\ engine understands the concept of italic correction. When an italic
+shape is followed by for instance an upright shape, you can insert a \type {\/}
+and the engine will add a correction as defined in the font. In \OPENTYPE\ we
+don't have such corrections available but we can fake it, which is what the \type
+{itlc} feature in \CONTEXT\ does. However, you need to enable this feature
+explicitly. An example of a setup is:
+
+\starttyping
+\definefontfeature
+ [default]
+ [default]
+ [itlc=yes,textitalics=yes]
+
+\setupitaliccorrection
+ [global,always]
+\stoptyping
+
+This will make sure that the right amount of correction is added between
+italic shapes and non italics or boxes. Using \type {text} instead of
+\type {always} would limit the correction to glyphs only and leaving out
+the \type {global} would permit selective (grouped) usage at the cost
+of more runtime. There is no need for the \type {\/} here.
+
+In math we also can have italic correction but there it is built into the engine
+and in traditional \TEX\ no directives are needed. Italic correction properties
+in math fonts are somewhat troublesome as their application depends on what we're
+dealing with: symbols, super- and subscripts, etc. Because early versions of
+\LUATEX\ didn't handle all of it well, if only because the fonts were not yet okay,
+the \MKIV\ math handler provides a bit of control.
+
+\def\SampleLine#1#2%
+ {\NC #1
+ \NC \setupmathematics[italics=#1]\ruledhbox{$m$ t}
+ \NC \setupmathematics[italics=#1]\ruledhbox{$m$ {\it t}}
+ \NC \setupmathematics[italics=#1]\ruledhbox{t $m$ t $m$ {\it t}}
+ \NC #2
+ \NC \NR}
+
+\starttabulate[||||||]
+\SampleLine0{no correction}
+\SampleLine1{only apply italics when the font carries them}
+\SampleLine2{apply italics provided by the font or automatically calculated}
+\SampleLine3{apply italics based on an emwidth and character properties}
+\SampleLine4{use method 1 but fall back on 3 if needed}
+\stoptabulate
+
+Because we cannot rely on fonts too much, we default to method~3 which in practice
+works out well, so the setup is:
+
+\starttyping
+\setupmathematics
+ [italics=3]
+\stoptyping
+
+There are all kind of commands that can be used to build math constructs in such a
+way that super- and subscripts are consistently rendered. It goes beyond this
+chapter to discuss them and most users will never see or use those commands. The
+main message of the examples above is that text and math use different fonts and
+properties and therefore also different methods in rendering text or a formula.
+Even if the names of mechanisms are the same (like italics) you cannot assume
+that both modes do exactly the same.
+
+\stopsection
+
+\startsection[title=Bold math]
+
+If you look at what \UNICODE\ provides you will notice that there are quite some
+bold characters. First of all there are a bunch of alphabets and because bold is
+not present in the text part of \UNICODE\ these alphabets have no holes. Then
+there are some symbols that have special meaning.
+
+\startluacode
+local find = string.find
+local NC, NR = context.NC, context.NR
+
+context.starttabulate { "|Tl||l|" }
+for unicode, entry in table.sortedhash(characters.data) do
+ local description = entry.description
+ if find(description,"^MATHEMATICAL BOLD") then
+ NC() context("U+04X",unicode)
+ NC() context.mathematics(utf.char(unicode))
+ NC() context(description)
+ NC() NR()
+ end
+end
+context.stoptabulate()
+\stopluacode
+
+The biggest mistake one can make when discussing bold math is the assumption that
+these bold alphabets are meant for section titles and other structural elements
+that need some emphasis. This is not true, in that case we would expect the whole
+formula to be bold and the bold symbols or variables would be even more bold.
+Bold math boils down to {\em all} math being bold. The reason why we show the
+list of bold characters on the previous pages is that it gives a good impression of
+fact that we're mostly given alphabets in an otherwise regular font.
+
+As Latin Modern (being derived from Computer Modern) has some bold extras in
+\MKII\ to some extend we do support a complete bold math switch but mixing bold
+formulas with regular ones has some limitations. Math typesetting consists of two
+phases: first the input is translated into a special list where references to
+fonts are not yet resolved. Instead families are used and each family has three
+sizes: text, script and scriptscript. In a second pass the formula is typeset and
+the families get translated into fonts. So, if we change the definition of a
+family, say math italic into bold math italic, then the definition that is actual
+when the second pass takes place is used.
+
+Although \LUATEX\ provides for many more families and as a consequence we could
+have replaced the \MKII\ mechanism with a more complete one, instead we just
+forgot about it and stuck to one family for regular math and another one for bold
+math. Okay, this is not entirely true as later on we added some more in order to
+deal with bidirectional typesetting.
+
+Only a few math fonts come with a bold variant. One of the objectives of the \TEX
+Gyre math font project is to explore the possibilities of bold math companions,
+but such a font will probably have less coverage, simply because no real complex
+math will end up in for instance section titles.
+
+When I wrote this down there were not that many math fonts that come with a real
+(complete) bold variant. The \CONTEXT\ math font subsystem tries to fill this gap
+as good as possible by using pseudo fonts. When a typeface doesn't define a math
+bold variant a pseudo setup is used. When a real bold font is used, it could be
+that not all alphabets are supported in which case a suitable alternative is
+tried.
+
+The Xits font, assembed from Stix and enhanced by Khaled Hosny, comes with a bold
+variant but the coverage is not complete, at least not when I wrote this
+paragraph. This can go unnoticed because \CONTEXT\ tries to work around this. On
+the other hand, it definitely has bold properties, which can be seen from the
+next example. You switch between regular and bold math with the \type {\mr} and
+\type {\mb} commands.
+
+\startbuffer
+\switchtobodyfont[xitsbidi]
+
+$ \sqrt{x } \quad
+ \mb \sqrt{mb} \quad
+ \mathupright \sqrt{u } \quad
+ \mr \sqrt{mr} \quad
+ \mathupright \sqrt{u } \quad
+ \mathdefault \sqrt{d }
+$
+\stopbuffer
+
+\typebuffer \blank \start \getbuffer \stop \blank
+
+You can track some of what happens with:
+
+\starttyping
+\enabletrackers[math.remapping,math.families]
+\stoptyping
+
+You will get some information about remapping or when it fails if fallback
+remapping is used. But no matter what happens with glyphs, you will notice in
+this example that the radical symbol is bold indeed.
+
+\stopsection
+
+\startsection[title=Bidirectional math]
+
+There is not that much to tell about bidirectional math typesetting, simply
+because the fonts are still in development. However, Khaled Hosny added
+some support to the Xits font. Of course you need to load this font first:
+
+\starttyping
+\switchtobodyfont[xitsbidi]
+\stoptyping
+
+In the previous chapter we mentioned bold math and as Xits also comes with
+a bold variant which means that this command loads the whole lot (which is
+fast enough anyway).
+
+Easiest is to just show a few examples. When in left to right mode we get what we
+are accustomed to:
+
+\startbuffer
+\setupmathematics[align=l2r]
+
+\startformula
+\sqrt{x^2\over 4x} \eqno(1)
+\stopformula
+
+\startformula
+5 < 6 > 4
+\stopformula
+
+\startformula
+5 \leq 6 \geq 7
+\stopformula
+\stopbuffer
+
+\typebuffer \start \switchtobodyfont[xitsbidi] \getbuffer \stop
+
+However, when we go the other way, we automatically get digits converted to
+arabic.
+
+\startbuffer
+\setupmathematics[align=r2l,bidi=yes]
+
+\startformula
+\sqrt{ف^2\over 4ب} \eqno(1)
+\stopformula
+
+\startformula
+5 < 6 > 4
+\stopformula
+
+\startformula
+5 \leq 6 \geq 7
+\stopformula
+\stopbuffer
+
+\typebuffer \start \switchtobodyfont[xitsbidi] \getbuffer \stop
+
+You don't have to worry about how the font is set up, but not that much is needed
+because \CONTEXT\ does it for you and the Xits typescripts carries the right
+definitions. Just to give you an idea, we show a feature definition: The magic is
+in the \type {rtlm} feature combined with \type {locl}.
+
+\starttyping
+\definefontfeature
+ [mathematics-r2l]
+ [mathematics]
+ [language=ara,
+ rtlm=yes,
+ locl=yes]
+\stoptyping
+
+Some symbols are mirrored too:
+
+\startbuffer
+\setupmathematics[align=r2l,bidi=yes]
+
+\startformula
+\sum^\infty_{س=0} س^2 \eqno(2)
+\stopformula
+\stopbuffer
+
+\typebuffer \start \switchtobodyfont[xitsbidi] \getbuffer \stop
+
+And of course the extensible fences are done properly too:
+
+\startbuffer
+\setupmathematics[align=r2l,bidi=yes]
+
+\startformula
+\left(\root{2} \of{155}\right)
+\stopformula
+
+\startformula
+\left[\int^{55}_{123} 666^3\right]
+\qquad\textstyle\left[\int^{55}_{123} 666^3\right]
+\stopformula
+
+\startformula
+\left\{\sum^{55}_{123} 666^3\right\}
+\stopformula
+\stopbuffer
+
+\typebuffer \start \switchtobodyfont[xitsbidi] \getbuffer \stop
+
+The real torture test is the radical sign. A mirrored shape is used
+and it grows upwards as well as leftwards.
+
+\startbuffer
+\setupmathematics[align=r2l,bidi=yes]
+
+\startformula
+\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{\sqrt{55}}}}}}}}}}
+\stopformula
+\stopbuffer
+
+\typebuffer \start \switchtobodyfont[xitsbidi] \getbuffer \stop
+
+\stopsection
+
+\startsection[title=Styles]
+
+In text mode you use font switches like \type {\sl} that switches the current font
+to a slanted one. In math mode it is an alphabet switch in the same font. In
+fact, there isn't much to choose from fonts there, apart from a massive switch
+to bold, in which case \type {\bf} is just a bolder alphabet in that bolder font.
+
+A lot of things in math mode happen automatically. There are for instance always
+three instances of (the same) font active, each different in size: text, script
+and the smallest, scriptscript and when you ask for instance for a superscript
+the next smaller size is used.
+
+\starttabulate[|l|l|l|]
+\NC normal \NC \type {\textstyle} \NC $\textstyle text^{script^{scriptscript}}$ \NC \NR
+\NC smaller \NC \type {\scriptstyle} \NC $\scriptstyle text^{script^{scriptscript}}$ \NC \NR
+\NC smallest \NC \type {\scriptscriptstyle} \NC $\scriptscriptstyle text^{script^{scriptscript}}$ \NC \NR
+\stoptabulate
+
+In text style, superscripts can go twice smaller, but in script style only one
+smaller size is left, and in scriptscript style you're stuck with one size. The
+commands in the second column can be used to force a style.
+
+The math formula builder has an important property: the formula is typeset after
+it has been scanned completely. In a traditional setup that has some
+consequences. Take this:
+
+\starttyping
+one \sl two \bf three \bi four
+\stoptyping
+
+In a traditional setup four so called families are used and each character gets
+tagged with a family number. So we have (for instance):
+
+\blank \start \tttf
+o\low7n\low7e\low7 t\low6w\low6o\low6 t\low5h\low5r\low5e\low5e\low5 f\low9o\low9u\low9r\low9
+\stop \blank
+
+As the number of families was limited there could be at most 16 families. In
+fact, the first four were traditionally reserved for math roman, math italic,
+symbol and extensibles. Then, due to the limit of 256 characters per font,
+another few were used for additional symbol fonts. So, adding a few more variants
+could exhaust the family pool quite fast. You could argue that we could halfway
+redefine a family but this will not work as there is a one to one relationship
+between family numbers and fonts assigned to them when the formula has been
+read in (the last value counts). And grouping won't help you either.
+
+The actual (plain) situation is even more complex. As we have a limited number of
+characters per font, most symbols are accessed by name, and the name relates to a
+mathematical character definition using for instance \type {\mathchardef}. Such a
+definition refers to a slot in a specific family number and therefore font. It
+also puts a character in a so called math class. One of these, the alphanumeric
+class, with number~7, is special. Characters that are input directly on the
+keyboard (like \type {a}||\type {z} can also be tagged this way using \type
+{\mathcode}.
+
+When we switch a family, this will normally not affect a symbol defined as math
+character, simply because we refer to a specific family|/|slot combination, but
+when a character has class~7, then it will be taken from the current family. This
+permits latin letters, digits and greek letters to be typeset in different
+styles. So, in that traditional approach we have fonts that provide a bunch of
+symbols as well as some alphabets. Think for instance of a font with additional
+symbols where the regular alphabet slots contain blackboard shapes. The symbols
+are accessed directly and the characters are accessed via the regular \type
+{a}||\type {z} characters as these will adapt to the family and therefore font.
+In practice users will not notice this complication as macro packages hide the
+implementation details.
+
+In \MKIV\ the situation is different as there we have one family (or a few more
+if we use a full bold switch and|/|or bidirectional math). Although we no longer
+have the limit of 16 fonts we actually don't need that many families, at least
+not in the way we've set up \MKIV \footnote{A technical note: in principle the
+\MKIV\ approach can have a speed penalty compared to a multi||family approach but
+we don't care too much about it. Also, as we load less fonts the extra overhead gets
+compensated nicely.}
+
+\blank \start \tttf
+o\low1n\low1e\low1 t\low1w\low1o\low1 t\low1h\low1r\low1e\low1e\low1 f\low1o\low1u\low1r\low1
+\stop \blank
+
+So how does this relate to styles? Each family has three fonts and we can use the
+switch commands to choose any of these. In text mode we use the term style for a
+font switch, while in math mode it's more than that: indeed we switch a font, but
+only in size, but the spacing is also adapted. If a proper math font is used, the
+smaller sizes are actually alternates in the font, visually adapted to suit their
+use.
+
+In text mode we do this in order to limit the scope of a switch:
+
+\starttyping
+normal {\bf bold {\it italic} bold} normalbracket
+\stoptyping
+
+This is the same as:
+
+\starttyping
+normal \bgroup \bf bold \bgroup \it italic\egroup
+ \ bold\egroup \ normalbracket
+\stoptyping
+
+and:
+
+\starttyping
+normal \begingroup \bf bold \begingroup \it italic\endgroup
+ \ bold\endgroup \ normalbracket
+\stoptyping
+
+The \CONTEXT\ distribution ships with a plain math definition file that also uses
+one family but reassigns some math codes when we switch to another style. As the
+number of characters that this applies to this is efficient enough for a modern
+computer. A peek into \type {luatex-math.tex} gives an impression of what we deal
+with. However, keep in mind that the implementation in \MKIV\ goes it differently
+and is therefore more powerful. We also have hardly any definitions at the \TEX\
+end and use information from \type {char-def.lua} instead.
+
+In math mode there is a subtle difference in the way grouping works with styles:
+
+\starttyping
+text {\scriptstyle script} normal
+\stoptyping
+
+This is the same as:
+
+\starttyping
+text \bgroup\scriptstyle script\egroup\ normal
+\stoptyping
+
+but different from:
+
+\starttyping
+text \begingroup\scriptstyle script\endgroup\ script
+\stoptyping
+
+This has to do with the fact that a style switch is explicitly registered in the
+math list and grouping like this is not limiting the scope. In math mode the
+braced grouping mode actually does create a math group and there the scope of the
+switch is limited to that group. In practice users will not run into this but
+they can use macros that use \type {\begingroup}. Among other reasons, this is
+why we have a special mathstyle mechanism.
+
+\startbuffer
+\ruledhbox{$x\begingroup\scriptstyle x\endgroup x$} \quad
+\ruledhbox{$x\begingroup\setupmathstyle[script]x\endgroup x$} \quad
+\ruledhbox{$x{\setupmathstyle[script]x}x$} \quad
+\ruledhbox{$x\startmathstyle[script]x\stopmathstyle x$}
+\stopbuffer
+
+\typebuffer
+
+This gives:
+
+\startlinecorrection[blank] \dontleavehmode \getbuffer \stoplinecorrection
+
+Mechanisms that support the \type {mathstyle} parameter know how to apply the
+proper grouping so you don't have to worry there. You can best avoid using the
+verbose grouping command and stick to braces or the \type {start}||\type {stop}
+command. An example is the fence mechanism:
+
+\startbuffer
+\definemathfence
+ [fancybracket] [bracket]
+ [color=darkblue]
+\definemathfence
+ [smallbracket] [bracket]
+ [command=yes,color=darkgreen,mathstyle=small]
+\definemathfence
+ [normalbracket] [bracket]
+ [command=yes,color=darkred]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We apply this to an example:
+
+\startbuffer
+$x \fenced[bar]{\frac{1}{x}} x$ \quad
+$x \fenced[doublebar]{\frac{1}{x}} x$ \quad
+$x \fenced[bracket]{\frac{1}{x}} x$ \quad
+$x \fenced[fancybracket]{\frac{1}{x}} x$ \quad
+$x \frac{1}{n} \normalbracket{\frac{1}{n}} \smallbracket{\frac{1}{s}} x$
+\stopbuffer
+
+\typebuffer
+
+Of course these somewhat weird examples are not real but at least they
+demonstrate the principles.
+
+\startlinecorrection[blank] \dontleavehmode \getbuffer \stoplinecorrection
+
+A math style is a combination of the following keys. Their effect can depend on
+the current state, for instance you can switch cramp or size indepently.
+
+\starttabulate[|T||]
+\NC display \NC display style, like text style but somewhat more spacy \NC \NR
+\NC text \NC text style, normally used inline \NC \NR
+\NC script \NC smaller than text cq. display style \NC \NR
+\NC scriptscript \NC smaller than script style \NC \NR
+\NC cramped packed \NC more tightly positioned superscripts \NC \NR
+\NC uncramped normal \NC normal positioned superscripts \NC \NR
+\NC small \NC switch to the next smaller style but keep cramp state \NC \NR
+\NC big \NC switch to the next larger style but keep cramp state \NC \NR
+\stoptabulate
+
+Future versions of \MKIV\ will provide more features (like parameter sets driven
+by keywords). As you might prefer a more symbolic approach we provide:
+
+\starttyping
+\definemathstyle[default][text,cramped]
+\stoptyping
+
+After this you can use the keyword \type {default} which has the advantage that
+you only need to change one definition in order to get different rendering.
+
+\stopsection
+
+\startsection[title=Supported fonts]
+
+As in \CONTEXT\ MKIV\ I wanted to go ahead with \UNICODE\ math as soon as the
+first version of \LUATEX\ showed up. Because at that time only Cambria was
+available I decided to provide virtual \UNICODE\ math fonts as a prelude to
+proper replacements for the popular \TYPEONE\ math fonts. In the meantime Xits
+came around and in 2012 we had quite useable math companions for the public Latin
+Modern, Pagella and Termes fonts and the \TEX\ user groups started shipping
+\OPENTYPE\ variants of Lucida. The virtual variants will still around so that we
+can compare them with the new implementations. As the official specification of
+\OPENTYPE\ math is not always clear from the beginning the \OPENTYPE\ fonts get
+improved over time. In fact, this is true not only for math fonts. Just think of
+this:
+
+\startitemize
+
+\startitem As \UNICODE\ gets extended, fonts might get more glyphs and possibly
+alternate shapes. \stopitem
+
+\startitem The more languages are supported, the more glyphs are to be available
+and features have to get language dependent instances. \stopitem
+
+\startitem The larger the font, the bigger the chance that mistakes get unnoticed
+especially when contextual subtitutions and positioning are used. \stopitem
+
+\startitem Math fonts can get more script and scriptscript alternates, more size
+variants, more advanced extensibles, bidirectional support, etc. \stopitem
+
+\stopitemize
+
+So, like regular programs, \LUATEX\ and macro packages, we now have fonts as
+component that needs occasional updating. Of course resources like hyphenation
+patterns are also subjected to this, so it's not a new aspect. But still, best
+keep en eye on font updates.
+
+While there are lots of text fonts, there are not that many math fonts, so you
+can safely assume that \CONTEXT\ ships with the proper setup for those fonts. Of
+course you have to choose a specific instance when you set up your own
+combination of fonts, but a peek into the typescripts shows the way.
+
+In the font manual and on the wiki you can find more about typescript and what is
+possible, so here we just take a look at one definition:
+
+\startnarrowtyping
+\starttypescript [serif] [dejavu] [name]
+ \definefontsynonym [Serif] [name:dejavuserif] [features=default]
+ \definefontsynonym [SerifBold] [name:dejavuserifbold] [features=default]
+ \definefontsynonym [SerifItalic] [name:dejavuserifitalic] [features=default]
+ \definefontsynonym [SerifBoldItalic] [name:dejavuserifbolditalic] [features=default]
+\stoptypescript
+
+\starttypescript [sans] [dejavu] [name]
+ \definefontsynonym [Sans] [name:dejavusans] [features=default]
+ \definefontsynonym [SansBold] [name:dejavusansbold] [features=default]
+ \definefontsynonym [SansItalic] [name:dejavusansoblique] [features=default]
+ \definefontsynonym [SansBoldItalic] [name:dejavusansboldoblique] [features=default]
+\stoptypescript
+
+\starttypescript [mono] [dejavu] [name]
+ \definefontsynonym [Mono] [name:dejavusansmono] [features=none]
+ \definefontsynonym [MonoBold] [name:dejavusansmonobold] [features=none]
+ \definefontsynonym [MonoItalic] [name:dejavusansmonooblique] [features=none]
+ \definefontsynonym [MonoBoldItalic] [name:dejavusansmonoboldoblique] [features=none]
+\stoptypescript
+
+\starttypescript[dejavu]
+ \definetypeface [dejavu] [rm] [serif] [dejavu] [default]
+ \definetypeface [dejavu] [ss] [sans] [dejavu] [default]
+ \definetypeface [dejavu] [tt] [mono] [dejavu] [default]
+ \definetypeface [dejavu] [mm] [math] [xits] [default] [scale=1.2]
+\stoptypescript
+\stopnarrowtyping
+
+So, in many cases you can just copy this blob and replace the font names by your
+own.
+
+Loading a font, and Dejavu is a predefined one, is done as follows:
+
+\starttyping
+\setupbodyfont[dejavu]
+\stoptyping
+
+In a similar fashion you can enable \type {cambria}, \type {pagella}, \type
+{termes}, \type {lucidaot}, etc.\ and if you don't use this command at all, you
+get Latin Modern. These fonts are part of \TEX\ distributions, including
+\CONTEXT\ stand||alone that can be downloaded from \CONTEXT\ garden.
+
+If you want to use Lucida, all you have to do when you have bought the fonts, is
+to put the \OPENTYPE\ files in a place where they can be found, for instance:
+
+\starttyping
+tex/texmf-fonts/fonts/data/lucida
+\stoptyping
+
+Of course you need to run \type {mtxrun --generate} afterwards so that the files
+can be found.
+
+\startnotabene
+ Tracing and characters coverage will be discussed here as soon as the styles
+ that are used for them are normalized.
+\stopnotabene
+
+\stopsection
+
+\startsection[title={Stylistic alternates}]
+
+Some fonts provide stylistic alternates. These can be described in goodies files
+and the Lucida setup is a good example. Here we demonstrate the effects. We
+disable the default math rendering (which takes the italic variants).
+
+\startbuffer[sa:1]
+\switchtobodyfont[lucidaot,14.4pt]
+\setupmathrendering[lucidaot][it=]
+$x
+ ^{i \leftarrow 0 = ∅}
+ _{i \leftarrow 0 = ∅}
+$
+\stopbuffer
+
+\typebuffer[sa:1]
+
+The next code enabled three alternatives:
+
+\startbuffer[sa:2]
+\switchtobodyfont[lucidaot,14.4pt]
+\setupmathrendering[lucidaot][it=]
+$x
+ ^{i \leftarrow 0 = ∅}
+ _{\setmathfontalternate{arrow}
+ \setmathfontalternate{dotless}
+ \setmathfontalternate{zero}
+ i \leftarrow 0 = ∅}
+$
+\stopbuffer
+
+\typebuffer[sa:2]
+
+Here we set them in one go:
+
+\startbuffer[sa:3]
+\switchtobodyfont[lucidaot,14.4pt]
+\setupmathrendering[lucidaot][it=]
+$x
+ ^{i \leftarrow 0 = ∅}
+ _{\setmathfontalternate{arrow,dotless,zero}
+ i \leftarrow 0 = ∅}
+$
+\stopbuffer
+\
+\typebuffer[sa:3]
+
+The last example shows how to enable these features globally:
+
+\startbuffer[sa:4]
+\switchtobodyfont[lucidaot,14.4pt]
+\setupmathrendering[lucidaot][it=]
+\setupmathematics[stylealternative={arrow,dotless,zero}]
+$x
+ ^{i \leftarrow 0 = ∅}
+ _{i \leftarrow 0 = ∅}
+$
+\stopbuffer
+
+\typebuffer[sa:4]
+
+The results are collected here:
+
+\startlinecorrection[blank]
+\startcombination[4*1]
+ {\vbox{\hsize.2\hsize\midaligned{\nospacing\getbuffer[sa:1]}}} {\bf nothing}
+ {\vbox{\hsize.2\hsize\midaligned{\nospacing\getbuffer[sa:2]}}} {\bf stepwise}
+ {\vbox{\hsize.2\hsize\midaligned{\nospacing\getbuffer[sa:3]}}} {\bf combined}
+ {\vbox{\hsize.2\hsize\midaligned{\nospacing\getbuffer[sa:4]}}} {\bf global}
+\stopcombination
+\stoplinecorrection
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/fonts/fonts/fonts-methods.tex b/doc/context/sources/general/fonts/fonts/fonts-methods.tex
new file mode 100644
index 000000000..eac86d694
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-methods.tex
@@ -0,0 +1,376 @@
+% language=uk
+
+\startcomponent fonts-methods
+
+\environment fonts-environment
+
+\startchapter[title=Methods][color=darkyellow]
+
+\startsection[title=Introduction]
+
+A font definition looks as follows:
+
+\starttyping
+\definefont
+ [MyFont]
+ [namepart method specification size]
+\stoptyping
+
+For example:
+
+\starttyping
+\definefont
+ [MyFont]
+ [Bold*default at 12.3pt]
+\stoptyping
+
+We have already discussed the namepart and size in a previous chapter and here
+we will focus on the method. The method is represented by a character and although
+we currently only have a few methods there can be many more.
+
+\stopsection
+
+\startsection[title=: (direct features)]
+
+This one is seldom used, but those coming from another macro package to \CONTEXT\
+might use it as first attempt to defining a font.
+
+\starttyping
+\definefont
+ [MyFont]
+ [Bold:+kern;+liga; at 12.3pt]
+\stoptyping
+
+This is the \XETEX\ way of defining fonts. A \type {+} means as much as
+\quotation {turn on this feature} so you can guess what the minus sign does.
+Alternatively you can use a key/value approach with semicolons as separator. If
+no value is given the value \type {yes} is assumed.
+
+\starttyping
+\definefont
+ [MyFont]
+ [Bold:kern=yes;liga=yes; at 12.3pt]
+\stoptyping
+
+When we started supporting \XETEX\ we ran into issues with already present
+features of \CONTEXT\ as the \XETEX\ syntax also has some more obscure properties
+using slashes and brackets for signalling a file or name lookup. As in \CONTEXT\
+we prefer a more symbolic approach anyway, it never was a real issue.
+
+\stopsection
+
+\startsection[title=* (symbolic features)]
+
+The most natural way to associate a set of features with a font instance
+is the following:
+
+\starttyping
+\definefont
+ [MyFont]
+ [Bold*default at 12.3pt]
+\stoptyping
+
+This will use the featureset named \type {default} and this one is defined in
+\type {font-pre.mkiv} which might be worth looking at.
+
+\starttyping
+\definefontfeature
+ [always]
+ [mode=auto,
+ script=auto,
+ kern=yes,
+ mark=yes,
+ mkmk=yes,
+ curs=yes]
+
+\definefontfeature
+ [default]
+ [always]
+ [liga=yes,
+ tlig=yes,
+ trep=yes] % texligatures=yes,texquotes=yes
+
+\definefontfeature
+ [smallcaps]
+ [always]
+ [smcp=yes,
+ tlig=yes,
+ trep=yes] % texligatures=yes,texquotes=yes
+
+\definefontfeature
+ [oldstyle]
+ [always]
+ [onum=yes,
+ liga=yes,
+ tlig=yes,
+ trep=yes] % texligatures=yes,texquotes=yes
+
+\definefontfeature % == default unless redefined
+ [ligatures]
+ [always]
+ [liga=yes,
+ tlig=yes,
+ trep=yes]
+
+\definefontfeature % can be used for type1 fonts
+ [complete]
+ [always]
+ [compose=yes,
+ liga=yes,
+ tlig=yes,
+ trep=yes]
+
+\definefontfeature
+ [none]
+ [mode=none,
+ features=no]
+\stoptyping
+
+These definitions show that you can construct feature sets on top of existing
+ones, but keep in mind that they are defined instantly, so any change in the
+parent is not reflected in its kids.
+
+In a font definition you can specify more than one set:
+
+\starttyping
+\definefont
+ [MyFont]
+ [Bold*always,oldstyle at 12.3pt]
+\stoptyping
+
+\stopsection
+
+\startsection[title=@ (virtual features)]
+
+This method is somewhat special as it demands knowledge of the internals
+of the \CONTEXT\ font code. Much of it is still experimental but it is a
+nice playground. A good example of its usage can be found in the file
+\type {m-punk.mkiv} where we create a font out of \METAPOST\ graphics.
+
+Another example is virtual math. As in the beginning of \LUATEX\ and \MKIV\
+there were only a few \OPENTYPE\ math fonts, and as I wanted to get rid
+of the old mechanisms, it was decided to virtualize the math fonts. For
+instance a Latin Modern Roman 10 point math font can be defined as follows:
+
+\starttyping
+\definefontsynonym
+ [LMMathRoman10-Regular]
+ [LMMath10-Regular@lmroman10-math]
+\stoptyping
+
+The \type {lmroman10-math} refers to a virtual definition and in this case
+it is one using a built|-|in constructor and therefore we use a goodies
+file to specify the font. That file looks as follows:
+
+\starttyping
+return {
+ name = "lm-math",
+ version = "1.00",
+ comment = "Goodies that complement latin modern math.",
+ author = "Hans Hagen",
+ copyright = "ConTeXt development team",
+ mathematics = {
+ ...
+ virtuals = {
+ ...
+ ["lmroman10-math"] = ten,
+ ...
+ },
+ ...
+ }
+}
+\stoptyping
+
+Here \type {ten} is a previously defined table:
+
+\startnarrowtyping
+local ten = {
+ { name = "lmroman10-regular.otf", features = "virtualmath", main = true },
+ { name = "rm-lmr10.tfm", vector = "tex-mr-missing" } ,
+ { name = "lmmi10.tfm", vector = "tex-mi", skewchar = 0x7F },
+ { name = "lmmi10.tfm", vector = "tex-it", skewchar = 0x7F },
+ { name = "lmsy10.tfm", vector = "tex-sy", skewchar = 0x30, parameters = true } ,
+ { name = "lmex10.tfm", vector = "tex-ex", extension = true } ,
+ { name = "msam10.tfm", vector = "tex-ma" },
+ { name = "msbm10.tfm", vector = "tex-mb" },
+ { name = "stmary10.afm", vector = "tex-mc" },
+ { name = "lmroman10-bold.otf", vector = "tex-bf" } ,
+ { name = "lmmib10.tfm", vector = "tex-bi", skewchar = 0x7F } ,
+ { name = "lmsans10-regular.otf", vector = "tex-ss", optional = true },
+ { name = "lmmono10-regular.otf", vector = "tex-tt", optional = true },
+ { name = "eufm10.tfm", vector = "tex-fraktur", optional = true },
+ { name = "eufb10.tfm", vector = "tex-fraktur-bold", optional = true },
+}
+\stopnarrowtyping
+
+This says as much as: take \type {lmroman10-regular.otf} as starting point
+and overload slots with ones found in the following fonts. The vectors are
+predefined as they are shared with other font sets like \type {px} and
+\type {tx}.
+
+In due time more virtual methods might end up in \CONTEXT\ because they are
+a convenient way to extend or manipulate fonts.
+
+\stopsection
+
+\startsection[title=Lua fonts]
+
+You can define a font in \LUA. In the process you can use all kind of helper
+functions that \CONTEXT\ provides. Here is an example:
+
+\typefile{fonts-demo-rule.lua}
+
+This code is stored in \type {fonts-demo-rule.lua} and we can load that font
+in the usual way, by specifying a filename:
+
+\startbuffer
+\definefont
+ [MyRuleFont]
+ [file:fonts-demo-rule.lua*default sa 1]
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+{\MyRuleFont So when we use it we get text typeset where all vowels are replaced
+by rules. The actualtext injection (in theory) makes it possible to cut and paste
+the text from the \PDF\ document but while writing this (mid 2016) a {\maincolor
+\type {mupdf}} based viewer couldn't handle it and {\maincolor \type {acrobat}}
+had problems with spaces.}
+
+\startbuffer
+\definefontfeature
+ [myrulefont]
+ [default]
+ [original=file:texgyrepagella-regular.otf]
+\definefont
+ [MyRuleFont]
+ [file:fonts-demo-rule.lua*myrulefont]
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+{\showfontkerns \MyRuleFont The previous code demonstrates how we can pass a
+fontname to be used as base to the generator. In case you wonder how features
+behave with such fonts: as you can see here, font kerns are indeed injected.
+Compared to {\maincolor \type {Dejavu}}, the {\maincolor \type {Pagella}} font
+has quite some more kerns.}
+
+\startbuffer
+\definefontfeature
+ [myrulefont]
+ [default]
+ [original=file:texgyrepagella-regular.otf,
+ option=line]
+\definefont
+ [MyRuleFont]
+ [file:fonts-demo-rule.lua*myrulefont]
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+{\MyRuleFont Here we show how the passed {\maincolor \type {option}} is handled.
+Because we no longer have a relationship with the height and depth, the real text
+is a bit harder to guess.}
+
+\stopsection
+
+\startsection[title=Old fuzzy fonts]
+
+Most natural is to use \OPENTYPE\ or \TYPEONE\ fonts. In the case of \TYPEONE\ a
+matching pair of \type {afm} and \type {pfb} files is needed. However, there can
+be situations where there is only a \type{tfm} and \type {pfb} file (or not even
+that: just a bitmap file).
+
+I will not show specimen here, simply because I don't have (nor want to have) the
+fonts needed in my development and production environments. The implementation
+was tested with a specific czech computer modern font.
+
+In a traditional (8 bit) setup we have an \type {tfm} file, a \type {pfb} file
+and a \type {enc file}. The order of the characters in the \type {tfm} file
+directly relates to the input encoding. The \type {enc} file relates that order
+to the order in the \type {pfb} file. The mapping from input encoding to font
+shape encoding happens via glyph names. In the \type {map} file we tell what
+\type {pfb} file to use with what \type {enc} file.
+
+However, in the case of the \type {csr.tfm} and \type {csr.pfb} file it looks
+like in practice the \type {enc} file is not used, probably because in the \type
+{pfb} file the standard encoding matches the order in the \type {tfm} file. This
+is of course a rather dangerous assumption, especially if information lacks to
+check it.
+
+The next example definitions demonstrate several paths to go from \UNICODE\ input
+(source file) to rendered shapes. As this is mostly meant for generic usage we
+use the low level definition code (\CONTEXT\ users are not supposed to use that
+method).
+
+\starttyping
+\font\foo=file:csr10.tfm:reencode=auto;mode=node;liga=yes;kern=yes
+\stoptyping
+
+This is the easiest way. We use the \type {tfm} file for dimensions, ligatures
+and kerns. The \type {auto} option will use the \type {pfb} file to identify the
+right mapping. We enable ligatures and kerns and we use node mode. This indicates
+that we're dealing with a pseudo \OPENTYPE\ setup here. You can provide a \type
+{pfb} file with the \type {pfbfile} feature in case the name differes from the
+\type {tfm} file.
+
+\starttyping
+\font\foo=file:csr10.tfm:reencode=csr.enc;mode=node;liga=yes;kern=yes
+\stoptyping
+
+Now we use the \type {enc} file for the encoding vector but we still need the
+\type {pfb} file for mapping that onto the right shape. You probably can best use
+\type {auto} instead.
+
+\starttyping
+\font\foo=file:csr10.tfm:reencode=csr.enc;bitmap=yes;mode=node;liga=yes;kern=yes
+\stoptyping
+
+Here we force bitmap shapes. This is a bit tricky as a different code path is
+followed in the backend. Unless the situation is too confusing, a proper \type
+{ToUnicode} is included in the output, so that cut and paste works all right,
+given that the viewer is able to deal with it (always use \ACROBAT\ as
+reference).
+
+Why do we need modes and|/|or to simulate \OPENTYPE\ behaviour? Indeed it seldom
+makes sense with \type {tfm} files but in this particular case teh font has a
+quote cheat.
+
+\starttyping
+\startluacode
+ fonts.handlers.otf.addfeature {
+ name = "czechdqcheat",
+ type = "substitution",
+ data = {
+ quotedblright = "csquotedblright",
+ },
+ }
+\stopluacode
+\stoptyping
+
+We could make this a language specific feature but as this font is not meant for
+other languages it makes no sense to do so. This feature is enabled with:
+
+\starttyping
+czechdqcheat=yes
+\stoptyping
+
+This will replace one quote by another with different side bearings. Of course a
+properly bounded quote with proper kerning makes much more sense. A test case is:
+
+\starttyping
+\quotedblleft X\quotedblright
+\quotedblright X\quotedblleft
+\stoptyping
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/fonts/fonts/fonts-mkiv.tex b/doc/context/sources/general/fonts/fonts/fonts-mkiv.tex
new file mode 100644
index 000000000..43da5870f
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-mkiv.tex
@@ -0,0 +1,71 @@
+% language=uk
+
+% author : Hans Hagen
+% copyright : PRAGMA ADE & ConTeXt Development Team
+% license : Creative Commons Attribution ShareAlike 4.0 International
+% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
+% origin : the ConTeXt distribution
+%
+% comment : Because this manual is distributed with TeX distributions it comes with a rather
+% liberal license. We try to adapt these documents to upgrades in the (sub)systems
+% that they describe. Using parts of the content otherwise can therefore conflict
+% with existing functionality and we cannot be held responsible for that. Many of
+% the manuals contain characteristic graphics and personal notes or examples that
+% make no sense when used out-of-context.
+
+% \definefontfeature[default][default][globalkern=true]
+%
+% \usemodule[speedtest]
+
+\enabletrackers[fonts.files]
+
+\enablemode[simple] % ,oversized
+
+\startbuffer[abstract]
+
+ This book is about fonts and how they are dealt with in \CONTEXT\ \MKIV\ and
+ \LUATEX. Although we use \CONTEXT\ as starting point, much applies to the
+ generic font handler that ships as part of this macro package. We discuss the
+ way fonts are dealt with in the engine, font formats, standard features and
+ additional goodies. Tracing and the extensibility of code are also discussed.
+ This book is the more technical companion of the regular \CONTEXT\ font
+ manual.
+
+\stopbuffer
+
+\environment fonts-environment
+
+\startdocument
+ [author=Hans Hagen,
+ title=Fonts out of \ConTeXt,
+ subtitle=explaining luatex and mkiv,
+ affiliation=PRAGMA ADE,
+ comment=work in progress,
+ cover:color:1=darkred,
+ cover:color:2=darkgreen,
+ cover:color:3=darkblue,
+ cover:color:4=darkyellow,
+ cover:color:5=darkgray]
+
+ \startfrontmatter
+ \component manuals-explaining-contents
+ \component fonts-introduction
+ \stopfrontmatter
+
+ \startbodymatter
+ \component fonts-formats
+ \component fonts-modes
+ \component fonts-lookups
+ \component fonts-methods
+ \component fonts-features
+ \component fonts-scripts
+ \component fonts-math
+ \component fonts-extensions
+ \component fonts-hooks
+ \stopbodymatter
+
+ \startappendices
+ \component fonts-appendix
+ \stopappendices
+
+\stopdocument
diff --git a/doc/context/sources/general/fonts/fonts/fonts-modes.tex b/doc/context/sources/general/fonts/fonts/fonts-modes.tex
new file mode 100644
index 000000000..95cb95732
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-modes.tex
@@ -0,0 +1,817 @@
+% language=uk
+
+\definefontfeature
+ [otftracker-husayni]
+ [analyze=yes,mode=node,language=dflt,script=arab,
+ ccmp=yes,init=yes,medi=yes,fina=yes,
+ rlig=yes,tlig=yes,anum=yes,calt=yes,salt=yes,
+ ss01=yes,ss03=yes,ss10=yes,ss12=yes,ss15=yes,
+ ss16=yes,ss19=yes,ss24=yes,ss25=yes,ss26=yes,
+ ss27=yes,ss31=yes,ss34=yes,ss35=yes,ss36=yes,
+ ss37=yes,ss38=yes,ss41=yes,ss42=yes,ss43=yes,
+ ss60=yes,js16=yes,
+ kern=yes,curs=yes,mark=yes,mkmk=yes]
+
+\startbuffer[nodechart:1a]
+
+ \switchtobodyfont[6pt]
+
+ \definecolor[nodechart:glyph][maincolor]
+
+ \hboxtoFLOWchart[dummy]{\definedfont[Normal*none]\language0 test BLAtest}
+
+ \FLOWchart[dummy][width=14em,height=3em,dx=.5em,dy=.75em,offset=1em,hcompact=yes]
+
+\stopbuffer
+
+\startbuffer[nodechart:1b]
+
+ \switchtobodyfont[6pt]
+
+ \definecolor[nodechart:glyph][maincolor]
+
+ \hboxtoFLOWchart[dummy]{test BLAtest}
+
+ \FLOWchart[dummy][width=14em,height=3em,dx=.5em,dy=.75em,offset=1em,hcompact=yes]
+
+\stopbuffer
+
+\startbuffer[nodechart:2a]
+
+ \switchtobodyfont[6pt]
+
+ \definecolor[nodechart:glyph][maincolor]
+
+ \hboxtoFLOWchart[dummy]{affiliation}
+
+ \FLOWchart[dummy][width=14em,height=3em,dx=.5em,dy=.75em,offset=1em,hcompact=yes]
+
+\stopbuffer
+
+\startbuffer[nodechart:2b]
+
+ \switchtobodyfont[6pt]
+
+ \definecolor[nodechart:glyph][maincolor]
+
+ \hboxtoFLOWchart[dummy]{abc\discretionary{d}{e}{f}ghi}
+
+ \FLOWchart[dummy][width=14em,height=3em,dx=.5em,dy=.75em,offset=1em,hcompact=yes]
+
+\stopbuffer
+
+\startbuffer[nodechart:2c]
+
+ \switchtobodyfont[6pt]
+
+ \definecolor[nodechart:glyph][maincolor]
+
+ \hboxtoFLOWchart[dummy]{\nl effe fijn fietsen}
+
+ \FLOWchart[dummy][width=12em,height=3em,dx=.5em,dy=.75em,offset=1em,hcompact=yes]
+
+\stopbuffer
+
+\startbuffer[nodechart:3a]
+
+ \switchtobodyfont[6pt]
+
+ \definecolor[nodechart:glyph][maincolor]
+
+ \hboxtoFLOWchart[dummy]{\tttf\righttoleft فَخَا}
+
+ \FLOWchart[dummy][width=12em,height=3em,dx=.5em,dy=.75em,offset=1em,hcompact=yes]
+
+\stopbuffer
+
+\startbuffer[nodechart:3b]
+
+ \switchtobodyfont[6pt]
+
+ \definecolor[nodechart:glyph][maincolor]
+
+ \hboxtoFLOWchart[dummy]{{\definedfont[name:husayni*otftracker-husayni at 6pt]\righttoleft فَخَا}}
+
+ \FLOWchart[dummy][width=12em,height=3em,dx=.5em,dy=.75em,offset=1em,hcompact=yes]
+
+\stopbuffer
+
+\startcomponent fonts-modes
+
+\environment fonts-environment
+
+\startchapter[title=Modes][color=darkgreen]
+
+\startsection[title=Introduction]
+
+We use the term modes for classifying the several ways characters are turned into
+glyphs. When a font is defined, a set of features can be associated and one of
+them is the mode.
+
+\starttabulate[|l|p|]
+\NC none \NC Characters are just mapped onto glyphs and no substitution or
+ positioning takes place. \NC \NR
+\NC base \NC The routines built into the engine are used. For many Latin fonts
+ this is a rather useable and efficient method. \NC \NR
+\NC node \NC Here alternative routines written in \LUA\ are used. This mode is
+ needed for more complex scripts as well as more advanced features
+ that demand some analysis. \NC \NR
+\NC auto \NC This mode will determine the most suitable mode for the given
+ feature set. \NC \NR
+\stoptabulate
+
+When we talk about features, we refer to more than only features provided by
+fonts as \CONTEXT\ adds some of its own. In the following section each of these
+modes is discussed. Before we do so a short introduction to font tables that we
+use is given.
+
+\stopsection
+
+\startsection[title=The font table]
+
+The internal representation of a font in \CONTEXT\ is such that we can
+conveniently access data that is needed in the mentioned modes. When a font is
+used for the first time, or when it has changed, it is read in its most raw form.
+After some cleanup and normalization the font gets cached when it is a \TYPEONE\
+or \OPENTYPE\ font. This is done in a rather efficient way. A next time the
+cached copy is used.
+
+The normalized table is shared among instances of a font. This means that when a
+font is used at a different scale, or when a different feature set is used, the
+font gets loaded only once and its data is shared when possible. In \in {figure}
+[fig:tfm-loading] we have visualized the process. Say that you ask for font \type
+{whatever} at \type {12pt} using featureset \type {smallcaps}. In low level code
+this boils down to:
+
+\starttyping
+\font\MySmallCaps=whatever*smallcaps at 12pt
+\stoptyping
+
+In \CONTEXT\ we have overloaded the font loader so \LUA\ code takes care of the
+loading. Basically there is a function hooked into \LUATEX's font definer (the
+\type {\font} primitive) that returns a table and from that on \LUATEX\ will
+create its internal representation that is identified by a number, the so called
+font id. So, in fact the \type {\Whatever} command is a reference to a font id, a
+positive number. When this font is already loaded, \CONTEXT\ will reuse the id
+and pas that one.
+
+\startFLOWchart[loading]
+ \startFLOWcell \name {tfm 1} \location {2,1} \text {raw tfm} \connection [bt]{tfm 2} \stopFLOWcell
+ \startFLOWcell \name {tfm 2} \location {2,2} \text {normalized tfm} \connection [rl]{tfm 3} \stopFLOWcell
+ \startFLOWcell \name {tfm 3} \location {4,2} \text {featured tfm} \connection[+rl]{tfm 5a}
+ \connection [rl]{tfm 5b}
+ \connection[-rl]{tfm 5c} \stopFLOWcell
+
+ \startFLOWcell \name {tfm 5a} \location {5,1} \text {scaled tfm} \connection[r+t]{tfm} \stopFLOWcell
+ \startFLOWcell \name {tfm 5b} \location {5,2} \text {scaled tfm} \connection [rt]{tfm} \stopFLOWcell
+ \startFLOWcell \name {tfm 5c} \location {5,3} \text {scaled tfm} \connection[r-t]{tfm} \stopFLOWcell
+
+ \startFLOWcell \name {afm 1} \location {2,4} \text {raw afm} \connection [bt]{afm 2} \stopFLOWcell
+ \startFLOWcell \name {afm 2} \location {2,5} \text {normalized afm} \connection [rl]{afm 3} \stopFLOWcell
+ \startFLOWcell \name {afm 3} \location {3,5} \text {cached afm} \connection[+rl]{afm 4a}
+ \connection [rl]{afm 4b} \stopFLOWcell
+ \startFLOWcell \name {afm 4a} \location {4,4} \text {featured afm} \connection [rl]{afm 5a} \stopFLOWcell
+ \startFLOWcell \name {afm 4b} \location {4,5} \text {featured afm} \connection [rl]{afm 5b}
+ \connection[-rl]{afm 5c} \stopFLOWcell
+ \startFLOWcell \name {afm 5a} \location {5,4} \text {scaled afm} \connection[r+l]{tfm} \stopFLOWcell
+ \startFLOWcell \name {afm 5b} \location {5,5} \text {scaled afm} \connection [rl]{tfm} \stopFLOWcell
+ \startFLOWcell \name {afm 5c} \location {5,6} \text {scaled afm} \connection[r-l]{tfm} \stopFLOWcell
+
+ \startFLOWcell \name {otf 1} \location {2,7} \text {raw otf} \connection [bt]{otf 2} \stopFLOWcell
+ \startFLOWcell \name {otf 2} \location {2,8} \text {normalized otf} \connection [rl]{otf 3} \stopFLOWcell
+ \startFLOWcell \name {otf 3} \location {3,8} \text {cached otf} \connection[+rl]{otf 4a}
+ \connection [rl]{otf 4b} \stopFLOWcell
+ \startFLOWcell \name {otf 4a} \location {4,7} \text {featured otf} \connection [rl]{otf 5a} \stopFLOWcell
+ \startFLOWcell \name {otf 4b} \location {4,8} \text {featured otf} \connection [rl]{otf 5b}
+ \connection[-rl]{otf 5c} \stopFLOWcell
+ \startFLOWcell \name {otf 5a} \location {5,7} \text {scaled otf} \connection[r-b]{tfm} \stopFLOWcell
+ \startFLOWcell \name {otf 5b} \location {5,8} \text {scaled otf} \connection [rb]{tfm} \stopFLOWcell
+ \startFLOWcell \name {otf 5c} \location {5,9} \text {scaled otf} \connection[r+b]{tfm} \stopFLOWcell
+
+ \startFLOWcell \name {tfm} \location {6,5} \text {engine tfm} \stopFLOWcell
+\stopFLOWchart
+
+\startplacefigure [location=here,reference=fig:tfm-loading,title={Defining a font.}]
+ \FLOWchart[loading][dx=.75\bodyfontsize,dy=.5\bodyfontsize,width=6\bodyfontsize,offset=0pt,x=2]
+\stopplacefigure
+
+The first step is loading the font (or using the cached copy). From that a copy
+is made that has some additional data concerning the features set and from that a
+scaled copy is constructed. These copies share as much data as possible to keep
+the memory footprint as small as possible. The table that is passed to \LUATEX\
+gets cleaned up afterwards. In practice the \TFM\ loader only kicks in for
+creating virtual math fonts. The \AFM\ reader is used for \TYPEONE\ fonts and as
+there is no free upgrade path from \TYPEONE\ to \OPENTYPE\ for commercial fonts,
+that one will get used for older fonts. Of course most loading is done by the
+\OTF\ reader(s).
+
+\appendixdata{\in[fonts:trackers:tables]}
+
+The data in the final \TFM\ table is organized in subtables. The biggest ones are
+the \type {characters} and \type {descriptions} tables that have information
+about each glyph. Later we will see more of that. There are a few additional
+tables of which we show two: \type {properties} and \type {parameters}. For the
+current font the first one has the following entries:
+
+\showfontproperties
+
+The \type {parameters} table has variables that have been (re)assigned in the
+process. A period in the key indicates that we are dealing with a subtable, for
+instance \type {expansion}.
+
+\showfontparameters
+
+To give you an impression of what we are dealing with, the positional features
+are shown next:
+
+\showfontpositionings
+
+The substitution features of the current font are as follows:
+
+\showfontsubstitutions
+
+This is clearly an \OPENTYPE\ font. Normally there are a default
+script and default language supported. If this is not the case you
+need to provide them as part of the featureset, otherwise there
+will be no features applied.
+
+\stopsection
+
+\startsection[title=Base mode]
+
+We talk of base mode processing when the font machinery is used that is built in
+\LUATEX. So what does this traditional mechanism provide?
+
+Before we discuss this, a somewhat simplified model of how \TEX\ works has to be
+given. Say that we have the following input:
+
+\starttyping
+\def\bla{BLA}
+test \bla test
+\stoptyping
+
+This input gets translated into tokens and those tokens are either processed
+later or they become something else directly. Take the first line. Characters in
+the input have a so called catcode property that determines how the parser
+tokenized them. Effectively we therefore get something like this:
+
+\starttyping
+<command def>
+<command bla>
+<begingroup>
+<character B>
+<character L>
+<character A>
+<endgroup>
+\stoptyping
+
+and finally in the hash table there will be an entry for \type {bla} that has the
+meaning \type {BLA} expressed in three characters.
+
+The second line refers to \type {\bla} and in the process this macro gets
+expanded, so we get:
+
+\starttyping
+<character t>
+<character e>
+<character s>
+<character t>
+<space>
+<character B>
+<character L>
+<character A>
+<character t>
+<character e>
+<character s>
+<character t>
+\stoptyping
+
+Because the parser gobbles spaces after a macro name, there is no space before
+the second \type {test}. In practice there will be no intermediate list like
+this, because as soon as possible \TEX\ will add something to a so called node
+list. When the moment is there, this list will be passed to the typesetting
+routine that constructs a horizontal list. Later this list can be converted into
+a horizontal box or broken into lines when it concerns a paragraph.
+
+In traditional \TEX\ characters are stored into char nodes and the builder turns
+them into glyph nodes. In \LUATEX\ they start out as glyph nodes and the subtype
+number will flag them as glyphs. Any value larger than 255 is a signal that the
+list has been processed. The previous example leads to the list shown in \in
+{figure} [nodechart:1a].
+
+\startplacefigure[title={The text \quote {\typ {test BLAtest}} converted to nodes.},reference=nodechart:1a]
+ \getbuffer[nodechart:1a]
+\stopplacefigure
+
+Here we have turned off inter|-|character kerning and hyphenation. When we turn
+that on, we get a slightly more complex list, as shown in \in {figure}
+[nodechart:1b]. Hyphenation points are represented by discretionary nodes and
+these have pointers to a pre break, post break and replacement text.
+
+\startplacefigure[title={The text \quote {\typ {test BLAtest}} converted to nodes, hyphenated and kerned.},reference=nodechart:1b]
+ \getbuffer[nodechart:1b]
+\stopplacefigure
+
+In addition to hyphenation and kerning we can have ligatures. The list in \in
+{figure} [nodechart:2a] shows that we get a reference to a ligature in the glyph
+node but that the components are still known. This figure also demonstrates that
+the ligature is build in steps.
+
+\startplacefigure[title={The rendering of the word \quote {\typ {affiliation}}.},reference=nodechart:2a]
+ \getbuffer[nodechart:2a]
+\stopplacefigure
+
+% \appendixdata{\in[nodes:discretionaries]}
+
+If we insert an explicit \type {\discretionary} command, we see in
+\in {figure} [nodechart:2b] that we get three variants. In \in
+{figure} [nodechart:2c] we render some Dutch words and these have
+quite some ligatures.
+
+\startplacefigure[title={The rendering of the bogus word \quote {\typ {abcghi}} with an
+ explicit discretionary added.},reference=nodechart:2b]
+ \getbuffer[nodechart:2b]
+\stopplacefigure
+
+\startplacefigure[title={The rendering of the Dutch words \quote { \typ{effe fijn fietsen}}.},reference=nodechart:2c]
+ \getbuffer[nodechart:2c]
+\stopplacefigure
+
+So, we have hyphenation, ligature building and kerning and to some extent these
+mechanisms hook into each other. This process is driven by information stored in
+the font and rules related to the language. The hyphenation happens first, so the
+builder just sees discretionary nodes and needs to act properly on them. Although
+languages play an important role in formatting the text, for the moment we can
+forget about that. This leaves the font.
+
+As we already mentioned in a previous chapter, in \CONTEXT\ we use \UNICODE\
+internally. This also means that fonts are organized this way. By default the
+glyph representation of a \UNICODE\ character sits in the same slot in the glyph
+table. All additional glyphs, like ligatures or alternates are pushed in the
+private unicode space. This is why in the lists shown in the figures the
+ligatures have a private \UNICODE\ number.
+
+The basic mode of operation in the builder in \LUATEX\ is as follows:
+
+\startitemize[packed]
+\startitem hyphenate the node list \stopitem
+\startitem build ligatures \stopitem
+\startitem inject kerns \stopitem
+\startitem optionally break into lines \stopitem
+\stopitemize
+
+In traditional \TEX\ the first step is not that independent. There hyphenation
+takes place when the text is broken into lines, and only in places that are
+candidate for such a break. In \LUATEX\ the whole text is hyphenated. This has
+the advantage that the steps are clearly separated and that no complex
+reconstruction and re|-|hyphenation has to take place. The speed penalty can be
+neglected and the extra memory overhead is small compared to what is needed
+anyway.
+
+In base mode the raw font data is read in and from that only basic information is
+used to construct the \TFM\ table: dimensions, ligatures and kerns. In a node
+list, all glyph ranges that refer to such a font get the standard ligature and
+kern routines applied, but only if the subtype is still less than 256. This check
+on subtype prevents duplicate processing that might happen as a side effect of
+for instance unboxing some material in a yet to be typeset text.
+
+Given that the majority of what \TEX\ has to deal with is relatively simple latin
+script, base mode processing is rather convenient and efficient. It is also the
+reference point of other kinds of processing. The most simple way to force base
+mode is the following:
+
+\starttyping
+\definefontfeature[basemode][mode=base,kern=yes,liga=yes]
+
+\definefont[MyTitleFont][SerifBold*basemode at 12pt]
+\stoptyping
+
+Here \type {\MyTitleFont} will be a bold serif with ligatures and kerns applied.
+However, as an \OPENTYPE\ font can have many features, the following definitions
+are also valid:
+
+\starttyping
+\definefontfeature[basemode-o][mode=base,kern=yes,onum=yes,liga=yes]
+\definefontfeature[basemode-s][mode=base,kern=yes,smcp=yes]
+\stoptyping
+
+The \TFM\ constructor will filter the right information from the font data and
+construct a proper table based on these specifications. But you need to keep in
+mind that when for instance old style numerals or small caps are activated, that
+their rendering (the glyph) will always be used. So, for instance \type {3} and
+\type {A} keep their \UNICODE\ points but as part of their specification they
+will get an index pointing to the oldstyle or small caps variant and the
+dimensions of that shape will be used.
+
+\stopsection
+
+\startsection[title=Node mode]
+
+Node mode is by far the most interesting of the modes. When enabled we only pass
+a few properties of glyphs to the engine: the width, height and depth and
+optionally protrusion, expansion factors as well as some extra \CONTEXT\ specific
+quantities. So there is no kerning and no ligature building done by the engine.
+Instead we do this in \LUA\ by walking over the node list and checking if some
+action is needed.
+
+\appendixdata{\in[fonts:trackers:features]}
+
+The default feature set enables kerning and ligature building for default and/or
+Latin scripts and the default language. Being a relative simple feature,
+ligatures don't take much action. Next we show a trace of a ligature replacement.
+
+\blank
+\showotfcomposition{name:dejavuserif*default at 24pt}{1}{affiliation}
+\blank
+
+Be warned that this \type {f f i} sequence not always becomes a ligature.
+Actually this is one area where tradition is quite visible: for some reason most
+fonts do have these f|-|related ligatures but lack others. These ligatures even
+have code points in \UNICODE\ which is quite debatable. Just as there are fonts
+with hardly any kerns (like Lucida) there are fonts that follow a different route
+to improve the look and feel of neighbouring glyphs, like Cambria:
+
+\blank
+\showotfcomposition{name:cambria*default at 24pt}{1}{affiliation}
+\blank
+
+Instead of representing multiple characters by one glyph the designer has decided
+to replace the \type {f} by a slightly narrower one so that the dot of the \type
+{i} stays loose.
+
+An example where much more is involved is the following. The Husayni font that is
+used for typesetting Arabic is built upon a solid but complex \OPENTYPE\
+foundation and can only be dealt with in node mode. When the \LUATEX\ project
+started we assumed that more power in the engine was needed to accomplish this,
+but so far the results with standard \OPENTYPE\ functionality are quite good.
+\CONTEXT\ has an additional paragraph optimizer that can apply additional
+features to get even better results but discussing this falls beyond this
+chapter. A trace of just one Arabic word is much longer than the previously shown
+traces.
+
+\blank
+\showotfcomposition{name:husayni*otftracker-husayni at 48pt}{-1}{فَخَا}
+\blank
+
+What we see here is a stepwise substitution process, sometimes based on a
+contextual analysis, followed by positioning. The coloring concerns the outcome
+of the analysis which in this case flags initial, final, medial and isolated
+characters.
+
+The starting point of this Arabic word is visualized in \in {figure}
+[nodechart:3a] and as expected we see no discretionary nodes here. The result as
+seen in \in {figure} [nodechart:3b] has (interestingly) no kerns as all
+replacements happen via offsets in the glyph node.
+
+\startplacefigure[title={The Arabic input \quote {\tttf\righttoleft فَخَا} before rendering.},reference=nodechart:3a]
+ \getbuffer[nodechart:3a]
+\stopplacefigure
+
+\startplacefigure[title={The Arabic input \quote {\tttf\righttoleft فَخَا} after rendering.},reference=nodechart:3b]
+ \getbuffer[nodechart:3b]
+\stopplacefigure
+
+\stopsection
+
+\startsection[title=Auto mode]
+
+Base mode is lean and mean and relatively fast while node mode is more powerful
+and slower. So how do you know what to choose? The safest bet is to use node mode
+for everything. In \CONTEXT\ however, we also have the so called auto mode. In that
+case there is some analysis going on that chooses between base mode and node mode
+depending on the boundary conditions of script and language and there are specific
+demands in terms of feature processing. So, auto mode will resolve to base or
+node mode.
+
+\stopsection
+
+\startsection[title=None mode]
+
+Sometimes no features have to be applied at all. A good example is verbatim.
+There you don't want ligatures, kerning or fancy substitutions. Contrary to what
+you might expect, monospaced fonts can have such features. Some might actually
+make sense, like rendering zeros. However, you cannot assume such a feature to be
+present so this is an example of where some more knowledge about a particular
+font is needed. This is what Latin Modern provides.
+
+\starttabulate[|l|l|l|]
+\NC \type{none} \NC typewriter \NC \ruledhbox{\maincolor\DemoNoneLT1234567890} \NC \NR
+\NC \type{zero} \NC typewriter \NC \ruledhbox{\maincolor\DemoZeroLT1234567890} \NC \NR
+\NC \type{none} \NC regular \NC \ruledhbox{\maincolor\DemoNoneLM1234567890} \NC \NR
+\NC \type{zero} \NC regular \NC \ruledhbox{\maincolor\DemoZeroLM1234567890} \NC \NR
+\stoptabulate
+
+Normally using mode none for situations that need to be predictable is quite
+okay.
+
+\stopsection
+
+\startsection[title=Dynamics]
+
+Sometimes you want to enable or disable a specific feature only for a specific
+span of text. Defining a font for only this occasion is overkill, especially when
+for instance features are used to fine|-|tune the typography as happens in the
+Oriental \TEX\ project, which is related to \LUATEX. Instead of defining yet
+another font instance we can therefore enable and disable specific features. For
+this it is not needed to know the current font and its size. \footnote {Dynamics
+are a \CONTEXT\ specific feature and is not available in the generic version of
+the font code. There are several reasons for this: it complicates the code, it
+assumes the \CONTEXT\ feature definition mechanism to be used, and it is somewhat
+slower as some extra analysis has to be done.}
+
+Dynamics are a special case of node mode and you don't need to set it up when
+defining a font. In fact, a font defined in base mode can also be dynamic. We
+show some simple examples of applying dynamic features.
+
+% First we define two feature sets, one for ligatures and one for oldstyle. As in
+% our example we want to start fresh we also define a simple set with only kerning
+% enabled. In a next chapter we will see more of how featuresets are defined.
+%
+% \startbuffer
+% \definefontfeature[l][script=latn,liga=yes]
+% \definefontfeature[o][script=latn,onum=yes]
+% \definefontfeature[k][script=latn,kern=yes]
+%
+% \definefont[LOKfont][file:lmroman10-regular*k]
+% \stopbuffer
+%
+% \typebuffer \getbuffer
+
+% \startbuffer[demo]
+% {\LOKfont fiets 123 fiets 123 fiets 123}\par
+% {\LOKfont fiets 123 \addff{l}fiets 123 \addff{o}fiets 123}\par
+% {\LOKfont fiets 123 \addff{o}fiets 123 \addff{l}fiets 123}\par
+% {\LOKfont fiets 123 \addfs{l}fiets 123 \addfs{o}fiets 123}\par
+% {\LOKfont fiets 123 \addfs{o}fiets 123 \addfs{l}fiets 123}\par
+% {\LOKfont fiets 123 \addfs{l}fiets 123 \subfs{l}fiets 123}\par
+% {\LOKfont fiets 123 \addfs{o}fiets 123 \subfs{o}fiets 123}\par
+% \stopbuffer
+%
+% We use the following test line:
+%
+% \typebuffer
+%
+% In the first line we do nothing but in the following lines we add features to the
+% font (replacing existing ones), we add features to the current set (nothing gets
+% replaced) and finally we remove some from the set. The typeset result is shown in
+% \in {figure} [fig:modes:dynamics].
+%
+% \placefigure
+% [here]
+% [fig:modes:dynamics]
+% {Selectively applying ligatures and oldstyle numerals using dynamic features in
+% Latin Modern Roman.}
+% {\color[maincolor]{\externalfigure[demo.buffer][width=.75\textwidth]}}
+%
+% Although for reasons of symmetry we have a few more commands, in practice only
+% the following make sense, and even the first one is mostly of interest or
+% testing.
+%
+% \starttabulate[|l|l|]
+% \NC \type {\addff} \NC set a feature to be the one applied \NC \NR
+% \NC \type {\addfs} \NC add a feature to current set \NC \NR
+% \NC \type {\subfs} \NC remove a feature from the current set \NC \NR
+% \stoptabulate
+%
+% Keep in mind that the given feature set can set a combination of
+% features. Also be aware of the fact that these commands don't
+% accumulate: the last one is applied.
+
+% A more sophisticated dynamic feature mechanism is the following. This
+% time we do stack up features. We can add, subtract or even replace
+% feature sets.
+
+Let's first define some feature sets:
+
+\startbuffer
+\definefontfeature[f:smallcaps][smcp=yes]
+\definefontfeature[f:nocaps] [smcp=no]
+\definefontfeature[f:oldstyle] [onum=yes]
+\definefontfeature[f:newstyle] [onum=no]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We can add and subtract these features from the current feature set
+that is bound to the current font.
+
+\startbuffer
+\switchtobodyfont[pagella] 123 normal
+\addfeature {f:oldstyle} 123 oldstyle
+\addfeature {f:smallcaps} 123 olstyle smallcaps
+\subtractfeature{f:oldstyle} 123 smallcaps
+\subtractfeature{f:smallcaps} 123 normal
+\stopbuffer
+
+\typebuffer
+
+Here we choose a font that has oldstyle numerals as well as small caps: pagella.
+
+\blank \start \getbuffer \stop \blank
+
+The following does the same, but only uses addition:
+
+\startbuffer
+\switchtobodyfont[pagella] 123 normal
+\addfeature{f:oldstyle} 123 oldstyle
+\addfeature{f:smallcaps} 123 olstyle smallcaps
+\addfeature{f:newstyle} 123 smallcaps
+\addfeature{f:nocaps} 123 normal
+\stopbuffer
+
+\typebuffer
+
+You can also completely replace a feature set. Of course the set is only
+forgotten inside the current group.
+
+\startbuffer
+\switchtobodyfont[pagella] 123 normal
+\addfeature {f:oldstyle} 123 oldstyle
+\addfeature {f:smallcaps} 123 olstyle smallcaps
+\replacefeature{f:oldstyle} 123 oldstyle
+\replacefeature{f:smallcaps} 123 smallcaps
+\stopbuffer
+
+\typebuffer
+
+and now we get:
+
+\blank \start \getbuffer \stop \blank
+
+You can exercise some control with \type {\resetfeature}:
+
+\startbuffer
+\switchtobodyfont[pagella] 123 normal
+\addfeature [f:oldstyle] 123 oldstyle
+\addfeature [f:smallcaps] 123 olstyle smallcaps
+\resetfeature 123 reset
+\addfeature [f:oldstyle] 123 oldstyle
+\addfeature [f:smallcaps] 123 olstyle smallcaps
+\stopbuffer
+
+\typebuffer
+
+Watch how we use the \type {[]} variant of the commands. The braced and
+bracketed variants behave the same.
+
+\blank \start \getbuffer \stop \blank
+
+There is also a generic command \type {\feature} that takes two arguments. Below
+we show all calls, with long and short variants:
+
+\starttyping
+\addfeature [f:mine] \feature [more][f:mine] \feature[+][f:mine]
+\subtractfeature [f:mine] \feature [less][f:mine] \feature[-][f:mine]
+\replacefeature [f:mine] \feature [new][f:mine] \feature[=][f:mine]
+\resetandaddfeature[f:mine] \feature[local][f:mine] \feature[!][f:mine]
+\revivefeature [f:mine] \feature [old][f:mine] \feature[>][f:mine]
+\resetfeature \feature[reset] \feature[<]
+\stoptyping
+
+Each variant also accepts \type {{}} instead of \type {[]} so that they can
+conveniently be used in square bracket arguments. As a bonus, the following also
+works:
+
+\startbuffer
+\switchtobodyfont[pagella]
+123 normal
+\feature[+][f:smallcaps,f:oldstyle]
+123 SmallCaps and OldStyle
+\stopbuffer
+
+\typebuffer
+
+Here is the proof:
+
+\blank \start \getbuffer \stop \blank
+
+\stopsection
+
+\startsection[title=Discretionaries]
+
+One of the complications in supporting more complex features is that we can have
+discretionary nodes. These are either inserted by the hyphenation engine, or
+explicitly by the user (directly or via macros). In most cases we don't need to
+bother about this. For instance, more demanding scripts like Arabic don't
+hyphenate, languages using the Latin script seldom want ligatures at hyphenation
+points (as they can be compound words) and|/|or avoid confusing hyphenation
+points, so what is left are specific user inserted discretionaries. Add to that,
+that a proper font has not much kerning between lowercase characters and it will
+be clear that we can ignore most of this. Anyway, as we explicitly deal with user
+discretionaries, the next works out okay. Watch how we normally only have
+something special in the replacements text that shows up when no hyphenation is
+needed.
+
+\startbuffer
+\language[nl]
+\definedfont[file:texgyrepagella-regular.otf*default]
+\hsize 1mm vereffenen \par
+\hsize 1mm effe \par
+\hsize 1mm e\discretionary{f-}{f}{ff}e \par
+\hsize 20mm e\discretionary{f-}{f}{ff}e \par
+\smallcaps
+\hsize 1mm vereffenen \par
+\hsize 1mm effe \par
+\hsize 1mm e\discretionary{f-}{f}{ff}e \par
+\hsize 20mm e\discretionary{f-}{f}{ff}e \par
+\stopbuffer
+
+\typebuffer
+
+\blank
+\startcolumns[n=6]
+ \indenting[no]
+ \maincolor
+ \getbuffer
+\stopcolumns
+\blank
+
+In base mode such things are handled by the \TEX\ engine itself and it can deal
+with pretty complex cases. In node mode we use a simplification which in practice
+suffices. We will come back to this in \in {section} [ligatures:hyphenation].
+
+\stopsection
+
+\startsection[title=Efficiency]
+
+The efficiency of the mechanisms described here depends on several factors. It
+will be clear that the larger the font, the more time it will take to load it.
+But what is large? Most \CJK\ fonts are pretty large but also rather simple. A
+font like Zapfino on the other hand covers only latin but comes with many
+alternative shapes and a large set of rules. The Husayni font focusses on Arabic,
+which in itself has not that large an alphabet, but being an advanced script
+font, it has a lot of features and definitely a lot of rules.
+
+In terms of processing it's safe to say that Latin is of average complexity. At
+most you will get some substitutions, like regular numerals being replaced by
+oldstyles, or ligature building, which involves a bit of analysis, and some
+kerning at the end. In base mode the substitutions have no overhead, simply
+because the character table already has references to the substituents and the
+replacement already takes place when defining the font. There ligature building
+and kerning are also fast because of the limited amount of lookups that also are
+already kept with the characters. In node mode however, the lists have to be
+parsed and tables have to be consulted so even Latin processing has some
+overhead: each glyph node is consulted and analyzed (either or not in its
+context), often multiple times. However, the code is rather optimized and we use
+caching of already analyzed data when possible.
+
+A \CJK\ script is somewhat more complex on the one hand, but pretty simple on the
+other. Instead of font based kerning, we need to prevent or encourage breaks
+between certain characters. This information is not in the font and is processed
+otherwise but it does cost some time. The font part however is largely idle as
+there are no features to be applied. Even better, because the glyphs are large
+and the information density is high, the processing time per page is not much
+different from Latin. Base mode is good enough for most \CJK.
+
+The Arabic script is another matter. There we definitely go beyond what base mode
+offers so we always end up in node mode. Also, because there is some analysis
+involved, quite some substitutions and in the end also positioning, these are the
+least efficient fonts in terms of processing time. Of course the fact that we mix
+directions also plays a role. If in the Husayni font you enable 30 features with
+an average of 5 rules per feature, a 300 character paragraph will take 45.000
+actions. \footnote {For a modern machine this amount is no real issue, but as
+each action involves function calls and possibly some garbage collection there
+is some price to pay.} When multiple fonts are combined in a paragraph there will
+be more sweeps over the list and of course the replacements also have to happen.
+
+In a time when the average photo camera produces megabyte pictures it makes no
+sense to whine about the size of a font file. On the other hand as each font
+eventually ends up in memory as a \LUA\ table, it makes sense to optimize that
+bit. This is why fonts are converted into a more efficient intermediate table
+that is cached on disk. This makes loading a font quite fast and due to shared
+tables memory usage rather efficient. Of course a scaled instance has to be
+generated too, but that is acceptable. To some extent loading and defining a font
+also depends on the way the macro package is set up.
+
+When comparing \LUATEX\ with for instance \PDFTEX\ or \XETEX\ you need to take
+into account that in \CONTEXT\ \MKIV\ we tend to use \OPENTYPE\ fonts only so
+there are less fonts loaded than in a more traditional setup. In \CONTEXT\
+startup time of \MKIV\ is less than \MKII\ although overall processing time is
+slower, which is due to \UNICODE\ being used and more functionality being
+provided. On the other hand, immediate \METAPOST\ processing and more clever
+multipass handling wins back time. The impact of fonts on processing time in a
+regular document is therefore not that impressive. In practice a \MKIV\ run can
+be faster than a \MKII\ run, especially when \METAPOST\ is used.
+
+In \CONTEXT\ processing of node lists with respect to fonts is only one of the
+many manipulations of such lists and by now fonts are not really the bottleneck.
+The more not font related features users demand and enable, the less the relative
+impact of font processing becomes.
+
+Also, there are some advanced typographic extras that \LUATEX\ offers, like
+protrusion (think of hanging punctuation) and hz optimization (glyph scaling) and
+these slow down processing quite a lot, and they are not taking place at the
+\LUA\ end at all, but this might change in \MKIV. And, of course, typesetting
+involves more than fonts and other aspects can be way more demanding.
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
+
+% oldstyle not in math (old school tex)
+% funny tex ligatures
+% features=yes
+% analysis
+% mode=none (tt)
diff --git a/doc/context/sources/general/fonts/fonts/fonts-scripts.tex b/doc/context/sources/general/fonts/fonts/fonts-scripts.tex
new file mode 100644
index 000000000..aed4f0a5c
--- /dev/null
+++ b/doc/context/sources/general/fonts/fonts/fonts-scripts.tex
@@ -0,0 +1,18 @@
+% language=uk
+
+\startcomponent fonts-scripts
+
+\environment fonts-environment
+
+\startchapter[title=Scripts][color=darkmix-6]
+
+\startsection[title=Introduction]
+
+As \OPENTYPE\ fonts can provide specific features to deal with scripts and
+languages it makes sense to spend some word on this.
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/fonts/manuals-explaining-contents.tex b/doc/context/sources/general/fonts/manuals-explaining-contents.tex
new file mode 100644
index 000000000..3e1fadabc
--- /dev/null
+++ b/doc/context/sources/general/fonts/manuals-explaining-contents.tex
@@ -0,0 +1,11 @@
+% language=uk
+
+\startcomponent manuals-explaining-contents
+
+ \starttitle[title=Contents][color=darkgray]
+
+ \placelist[chapter][criterium=text]
+
+ \stoptitle
+
+\stopcomponent
diff --git a/doc/context/sources/general/fonts/manuals-explaining-cover.tex b/doc/context/sources/general/fonts/manuals-explaining-cover.tex
new file mode 100644
index 000000000..8b4f3e891
--- /dev/null
+++ b/doc/context/sources/general/fonts/manuals-explaining-cover.tex
@@ -0,0 +1,199 @@
+% language=uk
+
+% Please try to be original and don't just copy this cover page as I don't want
+% confusion and be associated with (or responsibility for the look of) similar
+% looking documents.
+
+\startenvironment manuals-explaining-cover
+
+\startsetups document:abstract
+ \framed [
+ foregroundstyle=bold,
+ foregroundcolor=white,
+ width=7.5cm,
+ align={normal,tolerant},
+ frame=off,
+ strut=no,
+ ] {
+ \getbuffer[abstract]
+ }
+\stopsetups
+
+\startMPinclusions
+
+ def DrawCoverPage (expr what) =
+
+ numeric variant ; variant := 1 ;
+
+ StartCover ;
+
+ save width, height, size, anchor, offset, colors ;
+
+ numeric width, height, size ; pair anchor, offset ; string colors[] ;
+
+ colors[1] := "\documentvariable{cover:color:1}" ;
+ colors[2] := "\documentvariable{cover:color:2}" ;
+ colors[3] := "\documentvariable{cover:color:3}" ;
+ colors[4] := "\documentvariable{cover:color:4}" ;
+ colors[5] := "\documentvariable{cover:color:5}" ;
+
+ fill CoverPage enlarged PaperBleed withcolor colors[5] ;
+
+ fill Spine bottomenlarged -.5PaperHeight withcolor colors[3] ;
+ fill Spine topenlarged -.5PaperHeight withcolor colors[2] ;
+
+ width := FrontPageWidth ;
+ height := FrontPageHeight ;
+ size := 4 * width / 3 ;
+ offset := (-1cm,1cm) ;
+ anchor := .5[lrcorner CoverPage,urcorner CoverPage] ;
+
+ fill anchored.llft(lltriangle scaled size, urcorner FrontPage) withcolor colors[1] ;
+ fill anchored.urt (urtriangle scaled size, llcorner FrontPage) withcolor colors[2] ;
+ fill anchored.lrt (lrtriangle scaled size, ulcorner FrontPage) withcolor colors[3] ;
+ fill anchored.ulft(ultriangle scaled size, lrcorner FrontPage) withcolor colors[4] ;
+
+ fill anchored.lrt (lrtriangle scaled size, ulcorner BackPage) withcolor colors[1] ;
+ fill anchored.llft(lltriangle scaled size, urcorner BackPage) withcolor colors[3] ;
+ fill anchored.ulft(ultriangle scaled size, lrcorner BackPage) withcolor colors[2] ;
+ fill anchored.urt (urtriangle scaled size, llcorner BackPage) withcolor colors[4] ;
+
+ draw thetextext.llft(
+ textext("\bf \documentvariable{title}\hskip-.1em")
+ rotated 45 ysized .350height,
+ anchor shifted (6*offset+offset)
+ ) withcolor white ;
+ draw thetextext.llft(
+ textext("\bf \documentvariable{subtitle}")
+ rotated 45 ysized .275height,
+ anchor shifted (5*offset+offset)
+ ) withcolor white ;
+ draw thetextext.llft(
+ textext("\bf \documentvariable{author}")
+ rotated 45 ysized .200height,
+ anchor shifted (2*offset+offset)
+ ) withcolor white ;
+ draw thetextext.llft(
+ textext("\bf \documentvariable{affiliation}")
+ rotated 45 ysized .200height,
+ anchor shifted (1*offset+offset)
+ ) withcolor white ;
+
+ % for the moment
+
+ if (what = "back") or (what = "cover") :
+
+ draw
+ thetextext.top(
+ textext("\bf \documentvariable{comment}")
+ xsized 4cm,
+ lrcorner Page shifted (-3cm,1cm)
+ ) withcolor white ;
+
+ fi ;
+
+ % till here
+
+ width := BackPageWidth ;
+
+ if (what = "back") or (what = "cover") :
+
+ draw thetextext(
+ textext("\bf\setups[document:abstract]")
+ xsized .65width rotated 45,
+ center BackPage
+ ) withcolor white ;
+
+ fi ;
+
+ if what = "cover" :
+
+ draw thetextext.bot(
+ textext("\bf \documentvariable{title}\hskip-.1em")
+ rotated 90 xsized .8SpineWidth,
+ .5[ulcorner Spine,urcorner Spine] shifted (0,-1cm)
+ ) withcolor white ;
+
+ draw thetextext.top(
+ textext("\bf \documentvariable{author}")
+ rotated 90 xsized .8SpineWidth,
+ .5[llcorner Spine,lrcorner Spine] shifted (0,1cm)
+ ) withcolor white ;
+
+ fi ;
+
+ StopCover ;
+
+ if what = "front" :
+ clip currentpicture to FrontPage ;
+ elseif what = "back" :
+ clip currentpicture to BackPage ;
+ else :
+ drawboundary CoverPage ;
+ fi ;
+
+ enddef ;
+
+\stopMPinclusions
+
+\startsetups document:start
+
+ % \startcovermatter[front]
+
+ \setupbackgrounds[page][background=]
+
+ \doifmodeelse {simple} {
+
+ \startMPpage
+ DrawCoverPage("front") ;
+ \stopMPpage
+
+ } {
+
+ \startMPpage
+ DrawCoverPage("cover") ;
+ \stopMPpage
+
+ }
+
+ \page[dummy]
+
+ \setupbackgrounds[page][background=page]
+
+ \resetuserpagenumber
+
+ % \stopcovermatter
+
+\stopsetups
+
+\startsetups document:stop
+
+ \doifmodeelse {simple} {
+
+ % \startcovermatter[back]
+
+ \page
+
+ \setuppagenumbering[page=]
+
+ \setupbackgrounds[page][background=]
+
+ \page[empty,left]
+
+ \setupmakeup[doublesided=no,page=no]
+
+ \startMPpage
+ DrawCoverPage("back") ;
+ \stopMPpage
+
+ % \stopcovermatter
+
+ } {
+
+ % not needed as it's part of the cover page
+
+ }
+
+\stopsetups
+
+\stopenvironment
diff --git a/doc/context/sources/general/fonts/manuals-explaining-environment.tex b/doc/context/sources/general/fonts/manuals-explaining-environment.tex
new file mode 100644
index 000000000..f896c219b
--- /dev/null
+++ b/doc/context/sources/general/fonts/manuals-explaining-environment.tex
@@ -0,0 +1,325 @@
+\startenvironment manuals-explaining-environment
+
+\usemodule[abr-01]
+\usemodule[visual]
+\usemodule[simulate]
+\usemodule[chart]
+\usemodule[nodechart]
+
+% done
+
+\dontcomplain
+
+\definepapersize
+ [book]
+ [width=18cm,
+ height=24cm]
+
+\setuppapersize
+ [book]
+
+\startmode[oversized]
+
+ \setuppapersize
+ [book]
+ [oversized]
+
+ \setuplayout
+ [marking=on]
+
+\stopmode
+
+\setuplayout
+ [location=middle,
+ topspace=1.5cm,
+ bottomspace=2cm,
+ backspace=2cm,
+ cutspace=2cm,
+ header=0cm,
+ footer=0cm,
+ margindistance=.25cm,
+ margin=1.25cm,
+ width=middle,
+ height=middle]
+
+\setuplayout
+ [style=\ss]
+
+\usetypescript
+ [dejavu-condensed]
+
+\setupbodyfont
+ [ipaex,9pt]
+
+\setupbodyfont
+ [dejavu,9pt]
+
+\definetyping
+ [narrowtyping]
+ [typing]
+ [bodyfont=dejavu-condensed]
+
+% This is way too ugly for a manual:
+%
+% \setuptyping
+% [indentnext=no]
+%
+% \setupindenting
+% [medium,yes]
+
+\setupwhitespace
+ [big]
+
+\defineoverlay
+ [page]
+ [\useMPgraphic{page}]
+
+\setupbackgrounds
+ [page]
+ [background=page]
+
+\setuphead
+ [chapter,section,subsection]
+ [color=\namedstructureuservariable{chapter}{color}]
+
+\setuphead
+ [chapter]
+ [style=\bfc]
+
+\setuphead
+ [section]
+ [style=\bfb]
+
+\setuphead
+ [subsection]
+ [style=\bf,
+ before=\blank,
+ after=\blank]
+
+\startsetups document:chapter:inside
+ \definecolor[maincolor][1.0(\namedheadparameter{chapter}{color})] % this expands the color
+ \definecolor[halfcolor][0.5(maincolor,white)]
+\stopsetups
+
+\setuphead
+ [chapter]
+ [insidesection=\directsetup{document:chapter:inside}]
+
+\setuppagenumbering
+ [alternative=doublesided,
+ location=]
+
+\setuplist
+ [aligntitle=yes]
+
+\setuplist
+ [chapter]
+ [pagenumber=no,
+ style=bold,
+ before={\blank\startcolor[\structurelistuservariable{color}]},
+ after={\placelist[section]\stopcolor}]
+
+\setuplist
+ [chapter,section]
+ [width=3em]
+
+\startuseMPgraphic{page}
+
+ StartPage ;
+
+ linecap := butt ;
+
+ if OnRightPage :
+
+ path p ; p := (
+ urcorner Page shifted (-2cm,0) --
+ urcorner Page --
+ urcorner Page shifted (0,-2cm) -- cycle
+ ) shifted (-2.5mm,-2.5mm) ;
+
+ else :
+
+ path p ; p := (
+ ulcorner Page shifted (2cm,0) --
+ ulcorner Page --
+ ulcorner Page shifted (0,-2cm) -- cycle
+ ) shifted (2.5mm,-2.5mm) ;
+
+ fi ;
+
+ fill p
+ withpen pencircle scaled 1mm
+ withcolor "maincolor" ;
+
+ draw thetextext("\bf\userpagenumber",
+ if OnRightPage : urcorner p shifted (-5mm,-5mm) else : ulcorner p shifted (5mm,-5mm) fi)
+ withcolor white ;
+
+ if OnRightPage :
+
+ path p ; p := (
+ lrcorner Page shifted (-5cm,0) --
+ lrcorner Page
+ ) shifted (-5mm,10mm)
+
+ else :
+
+ path p ; p := (
+ llcorner Page shifted (5cm,0) --
+ llcorner Page
+ ) shifted (5mm,10mm) ;
+
+ fi ;
+
+ draw p
+ withpen pencircle scaled 1mm
+ withcolor "maincolor" ;
+
+ draw if OnRightPage :
+ thetextext.lft("\bf\getspecificstructuretitle{chapter}",lrcorner Page shifted (-5mm,5mm))
+ else :
+ thetextext.rt ("\bf\getspecificstructuretitle{chapter}",llcorner Page shifted ( 5mm,5mm))
+ fi withcolor "\namedstructureuservariable{chapter}{color}" ;
+
+ StopPage ;
+\stopuseMPgraphic
+
+\definecolor[orange] [r=1,g=.6,b=.1]
+
+\definecolor[middlegray] [s=.75]
+\definecolor[darkgray] [s=.25]
+\definecolor[darkred] [r=.5]
+\definecolor[darkgreen] [g=.5]
+\definecolor[darkblue] [b=.5]
+
+\definecolor[darkyellow] [.5(red,green)]
+\definecolor[darkmagenta][.5(red,blue)]
+\definecolor[darkcyan] [.5(green,blue)]
+
+\definecolor[darkorange] [.5(orange)]
+
+\definecolor[maincolor] [darkgray]
+
+\definecolor [mix-1] [r=1,g=.75,b=.25] \definecolor [darkmix-1][.5(mix-1)]
+\definecolor [mix-2] [r=1,g=.25,b=.75] \definecolor [darkmix-2][.5(mix-2)]
+\definecolor [mix-3] [r=.75,g=1,b=.25] \definecolor [darkmix-3][.5(mix-3)]
+\definecolor [mix-4] [r=.75,g=.25,b=1] \definecolor [darkmix-4][.5(mix-4)]
+\definecolor [mix-5] [r=.25,g=1,b=.75] \definecolor [darkmix-5][.5(mix-5)]
+\definecolor [mix-6] [r=.25,g=.75,b=1] \definecolor [darkmix-6][.5(mix-6)]
+
+% \blackrule[height=1cm,width=10cm,color=mix-1] \blackrule[height=1cm,width=10cm,color=darkmix-1]
+% \blackrule[height=1cm,width=10cm,color=mix-2] \blackrule[height=1cm,width=10cm,color=darkmix-2]
+% \blackrule[height=1cm,width=10cm,color=mix-3] \blackrule[height=1cm,width=10cm,color=darkmix-3]
+% \blackrule[height=1cm,width=10cm,color=mix-4] \blackrule[height=1cm,width=10cm,color=darkmix-4]
+% \blackrule[height=1cm,width=10cm,color=mix-5] \blackrule[height=1cm,width=10cm,color=darkmix-5]
+% \blackrule[height=1cm,width=10cm,color=mix-6] \blackrule[height=1cm,width=10cm,color=darkmix-6]
+
+% modules
+
+\setupsorting
+ [logo]
+ [style=]
+
+\setupFLOWchart
+ [width=6em,
+ height=3em,
+ offset=-2em, % maybe default : todo: hoffset and voffset
+ dx=2em,
+ dy=2em]
+
+\setupFLOWlines
+ [color=maincolor]
+
+\setupFLOWshapes
+ [rulecolor=maincolor]
+
+% tables
+
+\setuptabulate
+ [rulethickness=.5mm,
+ rulecolor=maincolor]
+
+% special commands
+
+\startuniqueMPgraphic{reference}{color}
+ fill
+ .5[llcorner OverlayBox,ulcorner OverlayBox] --
+ .5[ulcorner OverlayBox,urcorner OverlayBox] --
+ .5[urcorner OverlayBox,lrcorner OverlayBox] --
+ .5[lrcorner OverlayBox,llcorner OverlayBox] -- cycle
+ withcolor \MPvar{color} ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{reference}{color}
+ path p ; p := OverlayBox enlarged -1mm ;
+ filldraw
+ ulcorner p --
+ urcorner p --
+ lrcorner p --
+ .5[lrcorner p,llcorner p] shifted (0,-1ExHeight) --
+ llcorner p -- cycle
+ withpen pencircle scaled 1mm
+ withcolor \MPvar{color} ;
+ setbounds currentpicture to OverlayBox enlarged 1ExHeight ;
+\stopuniqueMPgraphic
+
+\defineoverlay
+ [reference]
+ [\uniqueMPgraphic{reference}{color=maincolor,}]
+
+\definecolor
+ [maincolor]
+ [red]
+
+\definemargindata
+ [appendixdata]
+ %[inner]
+ [outer]
+ [stack=yes]
+
+\definemarginframed
+ [appendixdata]
+ [width=3.5em,
+ height=\lineheight, % we know what goes in there
+ align=middle,
+ offset=overlay,
+ foregroundcolor=white,
+ background=reference]
+
+% todo:
+%
+% \appendixdata[reference=bla]{}
+%
+% whole data
+
+% interaction
+
+\setupinteraction
+ [state=start,
+ click=no,
+ color=,
+ contrastcolor=,
+ style=]
+
+% whatever
+
+\definestartstop
+ [notabene]
+ [before=\blank,
+ after=\blank,
+ style=\em]
+
+\setuphyphenation
+ [method=default]
+
+
+\startbuffer[underconstruction]
+\startnotabene
+ This document is still under construction. The functionality discussed here
+ will stay and more might show up. Of course there are errors, and they're all
+ mine. The text is not checked for spelling errors. Feel free to let me know
+ what should get added.
+\stopnotabene
+\stopbuffer
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-000.tex b/doc/context/sources/general/manuals/columnsets/columnsets-000.tex
new file mode 100644
index 000000000..429a067de
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-000.tex
@@ -0,0 +1,63 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\usemodule[visual]
+\usemodule[simulate]
+
+\dontcomplain
+
+\startenvironment columnsets-000
+
+\useMPlibrary[dum]
+
+\setupbodyfont
+ [palatino]
+
+\setuplayout
+ [grid=yes]
+
+\setuplayout
+ [backspace=20mm,
+ cutspace=15mm,
+ width=middle,
+ height=middle]
+
+\setupsystem
+ [random=1234]
+
+\setuppagenumbering
+ [alternative=doublesided,
+ location=]
+
+\setupheadertexts
+ [pagenumber][right]
+ [left][pagenumber]
+
+\setupfootertexts
+ [\inputfilename]
+
+\setupfooter
+ [style=\tttf]
+
+\setuptolerance
+ [verytolerant,stretch]
+
+\definecolor[color-1][.5(red,green)]
+\definecolor[color-2][.5(green,blue)]
+\definecolor[color-3][.5(blue,red)]
+\definecolor[color-4][.5(white,black)]
+\definecolor[color-5][.5(white,color-4)]
+
+\startuniqueMPgraphic{frame}
+ fill OverlayBox withcolor \MPcolor{color-1} ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{contrast}
+ fill OverlayBox withcolor \MPcolor{color-3} ;
+\stopuniqueMPgraphic
+
+\defineoverlay[frame] [\uniqueMPgraphic{frame}]
+\defineoverlay[contrast][\uniqueMPgraphic{contrast}]
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-001.tex b/doc/context/sources/general/manuals/columnsets/columnsets-001.tex
new file mode 100644
index 000000000..689f4e044
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-001.tex
@@ -0,0 +1,17 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=2]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{20}{\fakewords{100}{200}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-002.tex b/doc/context/sources/general/manuals/columnsets/columnsets-002.tex
new file mode 100644
index 000000000..a67dd3161
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-002.tex
@@ -0,0 +1,17 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][nleft=3,nright=2,width=5cm]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{15}{\fakewords{100}{200}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-003.tex b/doc/context/sources/general/manuals/columnsets/columnsets-003.tex
new file mode 100644
index 000000000..eed0286f8
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-003.tex
@@ -0,0 +1,35 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=2,page=left]
+
+\setupbackgrounds[text][background=color,backgroundcolor=color-1]
+
+\setupcolumnsetstart[example][1][1][2]
+\setupcolumnsetstart[example][1][2][4]
+\setupcolumnsetstart[example][2][1][6]
+\setupcolumnsetstart[example][2][2][6]
+\setupcolumnsetstart[example][3][1][4]
+\setupcolumnsetstart[example][3][2][2]
+
+\setupcolumnsetlines[example][1][1][-2]
+\setupcolumnsetlines[example][1][2][-4]
+\setupcolumnsetlines[example][2][1][-6]
+\setupcolumnsetlines[example][2][2][-6]
+\setupcolumnsetlines[example][3][1][-4]
+\setupcolumnsetlines[example][3][2][-2]
+\setupcolumnsetlines[example][4][1][4]
+\setupcolumnsetlines[example][4][2][10]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{20}{\fakewords{100}{200}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-004.tex b/doc/context/sources/general/manuals/columnsets/columnsets-004.tex
new file mode 100644
index 000000000..a58ddf621
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-004.tex
@@ -0,0 +1,32 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=3,page=left]
+
+\definecolor[fakerulecolor]
+
+\definecolumnsetspan[wide] [n=2,background=contrast,color=white]
+\definecolumnsetspan[wider][n=4,background=contrast,color=white]
+
+\starttext
+
+\startcolumnset[example]
+
+ \startcolumnsetspan[wider]
+ wider: \dorecurse{2}{#1: \fakewords{25}{50}\par}
+ \stopcolumnsetspan
+
+ inbetween: \fakewords{25}{50}\par
+
+ \startcolumnsetspan[wide]
+ wide : \dorecurse{2}{#1: \fakewords{25}{50}\par}
+ \stopcolumnsetspan
+
+ after: \dorecurse{15}{#1: \fakewords{100}{200}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-005.tex b/doc/context/sources/general/manuals/columnsets/columnsets-005.tex
new file mode 100644
index 000000000..f1d970d9e
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-005.tex
@@ -0,0 +1,29 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=3,page=left]
+
+\definecolumnsetspan[wide][n=2,background=contrast,color=white]
+
+\definecolor[fakerulecolor]
+
+\starttext
+
+\startcolumnset[example]
+
+ \startcolumnsetspan[wide][default=btlr]
+
+ \startsimplecolumns
+ \dorecurse{2}{\fakewords{25}{40}\par}
+ \stopsimplecolumns
+
+ \stopcolumnsetspan
+
+ \dorecurse{15}{\fakewords{100}{200}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-006.tex b/doc/context/sources/general/manuals/columnsets/columnsets-006.tex
new file mode 100644
index 000000000..033619970
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-006.tex
@@ -0,0 +1,35 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=3,page=left]
+
+\definecolor[fakerulecolor]
+
+\definecolumnsetspan[wide][n=2,background=contrast,color=white]
+
+\starttext
+
+\startcolumnset[example]
+
+ \startcolumnsetspan[wide]
+ \fakewords{25}{50}
+ \stopcolumnsetspan
+
+ \fakewords{25}{50}
+
+ \startcolumnsetspan[wide]
+ \fakewords{25}{50}
+ \stopcolumnsetspan
+
+ \startcolumnsetspan[wide][default=btrl]
+ \fakewords{25}{50}
+ \stopcolumnsetspan
+
+ \dorecurse{15}{\fakewords{100}{200}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-007.tex b/doc/context/sources/general/manuals/columnsets/columnsets-007.tex
new file mode 100644
index 000000000..137a414d9
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-007.tex
@@ -0,0 +1,43 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=3,page=left]
+
+\definecolor[fakerulecolor]
+
+\definecolumnsetspan[wide][n=2,background=contrast,color=white]
+
+\starttext
+
+\startbuffer
+
+ \startcolumnsetspan[wide]
+ \fakewords{25}{50}
+ \stopcolumnsetspan
+
+ \fakewords{25}{50}
+
+ \startcolumnsetspan[wide]
+ \fakewords{25}{50}
+ \stopcolumnsetspan
+
+ \startcolumnsetspan[wide][default=btrl]
+ \fakewords{25}{50}
+ \stopcolumnsetspan
+
+ \dorecurse{3}{\fakewords{100}{200}\par}
+
+\stopbuffer
+
+\startcolumnset[example]
+
+ \dorecurse{4}{\getbuffer}
+
+ \dorecurse{5}{\fakewords{100}{200}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-101.tex b/doc/context/sources/general/manuals/columnsets/columnsets-101.tex
new file mode 100644
index 000000000..f9c7b59cb
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-101.tex
@@ -0,0 +1,30 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\starttext
+
+\startbuffer
+\fakewords{100}{200}
+\placefigure
+ {}
+ {\externalfigure[placeholder][width=\columnsetspanwidth{1}]}
+\fakewords{100}{200}
+\placefigure
+ {}
+ {\externalfigure[placeholder][width=\columnsetspanwidth{2}]}
+\fakewords{100}{200}
+\stopbuffer
+
+\startcolumnset[example]
+
+ \dorecurse {5}{\getbuffer}
+ \dorecurse{10}{\fakewords{100}{200}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-102.tex b/doc/context/sources/general/manuals/columnsets/columnsets-102.tex
new file mode 100644
index 000000000..3cf4dcd0e
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-102.tex
@@ -0,0 +1,36 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\starttext
+
+\startbuffer
+\placefigure [tbrl]
+ {tblr}
+ {\externalfigure[fake][width=\columnsetspanwidth{1},lines=5]}
+\placefigure [fxtb:6*4]
+ {fxtb}
+ {\externalfigure[fake][width=\columnsetspanwidth{2},lines=5]}
+\placefigure [btlr]
+ {btlr}
+ {\externalfigure[fake][width=\columnsetspanwidth{2},lines=5]}
+\placefigure [btlr]
+ {btlr}
+ {\externalfigure[fake][width=\columnsetspanwidth{3},lines=5]}
+
+\dorecurse {5} {
+ \fakewords{100}{200}\par
+}
+\stopbuffer
+
+\startcolumnset[example]
+
+ \dorecurse{6}{\getbuffer}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-103.tex b/doc/context/sources/general/manuals/columnsets/columnsets-103.tex
new file mode 100644
index 000000000..f1d4dbedc
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-103.tex
@@ -0,0 +1,37 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\starttext
+
+\startcolumnset[example]
+
+\useexternalfigure[fake][fake][width=\textwidth,lines=3]
+
+\placefigure[btlr]{brlr}{\externalfigure[fake]}
+\placefigure[btlr]{brlr}{\externalfigure[fake]}
+\placefigure[btrl]{btrl}{\externalfigure[fake]}
+\placefigure[btrl]{btrl}{\externalfigure[fake]}
+\placefigure[tblr]{tblr}{\externalfigure[fake]}
+\placefigure[tblr]{tblr}{\externalfigure[fake]}
+\placefigure[tbrl]{tbrl}{\externalfigure[fake]}
+\placefigure[tbrl]{tbrl}{\externalfigure[fake]}
+
+\placefigure[lrbt]{lrbt}{\externalfigure[fake]}
+\placefigure[lrbt]{lrbt}{\externalfigure[fake]}
+\placefigure[lrtb]{lrtb}{\externalfigure[fake]}
+\placefigure[lrtb]{lrtb}{\externalfigure[fake]}
+\placefigure[rlbt]{rlbt}{\externalfigure[fake]}
+\placefigure[rlbt]{rlbt}{\externalfigure[fake]}
+\placefigure[rltb]{rltb}{\externalfigure[fake]}
+\placefigure[rltb]{rltb}{\externalfigure[fake]}
+
+\dorecurse{10}{\fakewords{50}{100}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-201.tex b/doc/context/sources/general/manuals/columnsets/columnsets-201.tex
new file mode 100644
index 000000000..37b26c391
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-201.tex
@@ -0,0 +1,31 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\definecolumnsetarea
+ [one]
+ [type=both,
+ x=1,y=1,nx=2,ny=6,
+ background=contrast,
+ state=repeat]
+
+\definecolumnsetarea
+ [two]
+ [type=both,
+ x=4,y=10,nx=1,ny=6,
+ background=contrast,
+ state=repeat]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{40}{\fakewords{50}{100}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-202.tex b/doc/context/sources/general/manuals/columnsets/columnsets-202.tex
new file mode 100644
index 000000000..1721d9cbc
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-202.tex
@@ -0,0 +1,32 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\definecolumnsetarea
+ [one][left]
+ [x=1,y=1,nx=2,ny=6,
+ background=contrast,state=repeat]
+
+\definecolumnsetarea
+ [two][right]
+ [x=3,y=1,nx=2,ny=6,
+ background=contrast,state=repeat]
+
+\definecolumnsetarea
+ [three][both]
+ [x=2,y=10,nx=2,ny=6,
+ background=contrast,state=repeat]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{30}{\fakewords{50}{100}}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-203.tex b/doc/context/sources/general/manuals/columnsets/columnsets-203.tex
new file mode 100644
index 000000000..6c15578bc
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-203.tex
@@ -0,0 +1,29 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\definecolumnsetarea
+ [one]% [left]
+ [x=1,y=1,nx=6,ny=6,
+ background=contrast,state=start]
+
+\definecolumnsetarea
+ [two]%[left]
+ [x=3,y=10,nx=4,ny=6,
+ background=contrast,state=start]
+
+\stopsetups
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{25}{\fakewords{50}{100}}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-204.tex b/doc/context/sources/general/manuals/columnsets/columnsets-204.tex
new file mode 100644
index 000000000..d390f468e
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-204.tex
@@ -0,0 +1,41 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\usemodule[oldfun]
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\definecolumnsetarea
+ [title]
+ [x=1,y=1,nx=8,ny=8,
+ background=contrast,
+ color=white,
+ align={lohi,right},
+ state=start]
+
+\setupcolumnsetareatext
+ [title]
+ [\setups{the title}]
+
+\startsetups[the title]
+
+ \GapText
+ {\dimexpr\makeupwidth+\backspace\relax}
+ {6pt}
+ {RegularBold*default} {sa 4}
+ {A Title Spanni\+ng 2 Pages}
+
+\stopsetups
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{30}{\fakewords{50}{100}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-205.tex b/doc/context/sources/general/manuals/columnsets/columnsets-205.tex
new file mode 100644
index 000000000..b53709770
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-205.tex
@@ -0,0 +1,42 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\usemodule[oldfun]
+
+\environment columnsets-000
+
+\unprotected \def\SpreadGapText#1#2{{\def\+{\blackrule[\c!width=#1]}#2}}
+
+\definecolumnset[example][n=4,page=left]
+
+\definecolumnsetarea
+ [title]
+ [x=1,y=1,nx=8,ny=8,
+ background=contrast,
+ color=white,
+ align={lohi,right},
+ state=start]
+
+\setupcolumnsetareatext
+ [title]
+ [\setups{the title}]
+
+\startsetups[the title]
+
+ \GapText
+ {\dimexpr(\makeupwidth+\backspace)} {6pt}
+ {RegularBold} {sa 4}
+ {A Title Spanni\+ng 2 Pages}
+
+\stopsetups
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{30}{\fakewords{50}{100}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-206.tex b/doc/context/sources/general/manuals/columnsets/columnsets-206.tex
new file mode 100644
index 000000000..8b9f524b1
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-206.tex
@@ -0,0 +1,29 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\definecolumnsetarea
+ [first]
+ [x=2,y=4,nx=2,ny=8,
+ background=contrast,
+ state=start]
+
+\definecolumnsetarea
+ [second]
+ [x=1,y=20,nx=1,ny=3,
+ background=contrast,
+ state=start]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{50}{\fakewords{50}{100}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-301.tex b/doc/context/sources/general/manuals/columnsets/columnsets-301.tex
new file mode 100644
index 000000000..4d21f2b02
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-301.tex
@@ -0,0 +1,29 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4]
+
+\starttext
+
+\startcolumnset[example]
+
+ 1: \fakewords{50}{75} \column
+ 2: [] \fakewords{50}{75} \column[yes]
+ 3: [yes] \fakewords{50}{75} \column[page]
+ \column[page] % redundant
+ 4: [page] \fakewords{50}{75} \column[3]
+ 5: [3] \fakewords{50}{75} \column[4]
+ 6: [4] \fakewords{50}{75} \column[first]
+ 7: [first] \fakewords{50}{75} \column[last]
+ 8: [last] \fakewords{50}{75} \page
+ 9: (page) \fakewords{50}{75} \page
+ \page % redundant
+ 10: (page) \fakewords{50}{75} \column[3*5]
+ 11: [3*5] \fakewords{50}{75}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-401.tex b/doc/context/sources/general/manuals/columnsets/columnsets-401.tex
new file mode 100644
index 000000000..ee91e608c
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-401.tex
@@ -0,0 +1,26 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\setupbackgrounds[text][text][background=contrast]
+
+\definecolor[fakerulecolor][white]
+
+\setupcolumnset[example:2][distance=36pt]
+\setupcolumnset[example:3][distance=72pt]
+\setupcolumnset[example:4][distance=24pt]
+\setupcolumnset[example:5][distance=48pt]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{25}{\fakewords{100}{150}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-402.tex b/doc/context/sources/general/manuals/columnsets/columnsets-402.tex
new file mode 100644
index 000000000..00db6017c
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-402.tex
@@ -0,0 +1,24 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\setupbackgrounds[text][text][background=contrast]
+
+\setupcolumnset[example] [distance=24pt]
+\setupcolumnset[example:1][distance=96pt]
+
+\definecolor[fakerulecolor][white]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{25}{\fakewords{100}{150}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-403.tex b/doc/context/sources/general/manuals/columnsets/columnsets-403.tex
new file mode 100644
index 000000000..c9bc2e648
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-403.tex
@@ -0,0 +1,23 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\setupbackgrounds[text][text][background=contrast]
+
+\definecolor[fakerulecolor][white]
+
+\setupcolumnset[example][width=.15\makeupwidth]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{25}{\fakewords{100}{150}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-404.tex b/doc/context/sources/general/manuals/columnsets/columnsets-404.tex
new file mode 100644
index 000000000..05a25acfe
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-404.tex
@@ -0,0 +1,34 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=3,page=left]
+
+\setupbackgrounds[text][text][background=contrast]
+
+\setupcolumnset[frame=on,framecolor=color-4,rulethickness=1mm]
+
+\definecolor[fakerulecolor][white]
+
+\setupcolumnset[example:1][width=2cm]
+\setupcolumnset[example:2][width=4cm]
+\setupcolumnset[example:3][width=3cm]
+
+\setupcolumnset[example:4][width=3cm]
+\setupcolumnset[example:5][width=4cm]
+\setupcolumnset[example:6][width=6cm]
+
+\starttext
+
+\startcolumnset[example]
+
+\dorecurse{15}{
+ \dorecurse{3}{\fakewords{10}{15}\par}
+ \column[yes]
+}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-405.tex b/doc/context/sources/general/manuals/columnsets/columnsets-405.tex
new file mode 100644
index 000000000..fa20ef34c
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-405.tex
@@ -0,0 +1,29 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\setupbackgrounds[text][text][background=contrast]
+
+\setupcolumnset[frame=on,framecolor=color-4,rulethickness=1mm]
+
+\definecolor[fakerulecolor][white]
+
+\setupcolumnset[example:1][width=.3\makeupwidth]
+
+\starttext
+
+\startcolumnset[example]
+
+ \fakewords{150}{150}
+ \column
+ \fakewords{25}{50}
+
+ \dorecurse{25}{\fakewords{50}{75}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-601.tex b/doc/context/sources/general/manuals/columnsets/columnsets-601.tex
new file mode 100644
index 000000000..b139210f4
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-601.tex
@@ -0,0 +1,29 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left,direction=reverse]
+
+\setupbackgrounds[text][text][background=contrast]
+
+\definecolor[fakerulecolor][color-1]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{50}{
+ \dontleavehmode
+ \snaptogrid\hbox
+ {\scale[height=2.5\lineheight]{\color[white]{#1}}}%
+ \space
+ \fakewords{30}{60}
+ %\simulatewords[n=30,m=60,min=1,max=5,color=color-1,line=yes]\par
+ \par
+ }
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-701.tex b/doc/context/sources/general/manuals/columnsets/columnsets-701.tex
new file mode 100644
index 000000000..b2c50cfaf
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-701.tex
@@ -0,0 +1,23 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\setupcolumnset
+ [example]
+ [background=contrast]
+
+\definecolor[fakerulecolor][white]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{30}{\fakewords{50}{100}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-702.tex b/doc/context/sources/general/manuals/columnsets/columnsets-702.tex
new file mode 100644
index 000000000..5b9a879c1
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-702.tex
@@ -0,0 +1,27 @@
+content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\setupcolumnset
+ [example]
+ [background=contrast,
+ backgroundoffset=4pt,
+ frame=on,
+ framecolor=white,
+ rulethickness=2pt]
+
+\definecolor[fakerulecolor][white]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{30}{\fakewords{50}{100}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-703.tex b/doc/context/sources/general/manuals/columnsets/columnsets-703.tex
new file mode 100644
index 000000000..549b49f61
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-703.tex
@@ -0,0 +1,34 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=4,page=left]
+
+\definecolumnsetarea
+ [title][left]
+ [x=1,y=1,nx=8,ny=8,
+ background=contrast,state=repeat]
+
+\setupcolumnsetareatext
+ [title][left][\setups{cow}]
+
+\startsetups[cow]
+
+ \externalfigure
+ [cow.pdf]
+ [height=15\lineheight,
+ width=2\dimexpr\makeupwidth+\backspace\relax]
+
+\stopsetups
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{30}{\fakewords{50}{100}\par}
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-704.tex b/doc/context/sources/general/manuals/columnsets/columnsets-704.tex
new file mode 100644
index 000000000..7fa6cb313
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-704.tex
@@ -0,0 +1,69 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\startuseMPgraphic{mpos:par:columns}
+ path p ; numeric h ;
+ for i=1 upto nofmultipars :
+ p := multipars[i] ;
+ h := bbheight(p) ;
+ if multikind[i] = "single" :
+ fill p topenlarged -.5h
+ withshademethod "linear"
+ withshadedirection shadedup
+ withcolor \MPcolor{color-1} shadedinto white ;
+ fill p bottomenlarged -.5h
+ withshademethod "linear"
+ withshadedirection shadedup
+ withcolor white shadedinto \MPcolor{color-1} ;
+ elseif multikind[i] = "first" :
+ fill p
+ withshademethod "linear"
+ withshadedirection shadedup
+ withcolor \MPcolor{color-2} shadedinto white ;
+ elseif multikind[i] = "middle" :
+ fill p topenlarged -.5h
+ withshademethod "linear"
+ withshadedirection shadedup
+ withcolor \MPcolor{color-2} shadedinto white ;
+ fill p bottomenlarged -.5h
+ withshademethod "linear"
+ withshadedirection shadedup
+ withcolor white shadedinto \MPcolor{color-3} ;
+ elseif multikind[i] = "last" :
+ fill p
+ withshademethod "linear"
+ withshadedirection shadedup
+ withcolor white shadedinto \MPcolor{color-3} ;
+ fi ;
+ endfor ;
+\stopuseMPgraphic
+
+\definecolumnset
+ [example]
+ [n=4,
+ page=left]
+
+\definetextbackground
+ [shade]
+ [location=paragraph,
+ mp=mpos:par:columns,
+ before=\blank,
+ after=\blank]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse {40} {
+ \starttextbackground[shade]
+ \fakewords{10}{200}
+ \stoptextbackground
+ \par
+ }
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-801.tex b/doc/context/sources/general/manuals/columnsets/columnsets-801.tex
new file mode 100644
index 000000000..1a84f99ab
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-801.tex
@@ -0,0 +1,19 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset [example-1] [n=2]
+\definecolumnset [example-2] [n=3]
+
+\starttext \showgrid
+
+ \startcolumnset [example-1]
+ \dorecurse {1}{\input tufte \par}
+ \stopcolumnset
+ \startcolumnset [example-2]
+ \dorecurse {2}{\input ward \par}
+ \stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-802.tex b/doc/context/sources/general/manuals/columnsets/columnsets-802.tex
new file mode 100644
index 000000000..a126d0012
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-802.tex
@@ -0,0 +1,22 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset [example-1] [n=2,balance=yes]
+\definecolumnset [example-2] [n=3,balance=yes]
+
+\starttext \showgrid
+
+ \setupcolumnsetlines[example-1][1][1] [8]
+ \setupcolumnsetlines[example-1][1][2][10]
+
+ \startcolumnset [example-1]
+ \dorecurse {1}{\input tufte \par}
+ \stopcolumnset
+ \startcolumnset [example-2]
+ \dorecurse {2}{\input ward \par}
+ \stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-803.tex b/doc/context/sources/general/manuals/columnsets/columnsets-803.tex
new file mode 100644
index 000000000..58a278bb1
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-803.tex
@@ -0,0 +1,26 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset [example-1] [n=2,balance=yes]
+\definecolumnset [example-2] [n=3,balance=yes]
+
+\starttext \showgrid
+
+ \setupcolumnsetlines[example-1][1][1] [8]
+ \setupcolumnsetlines[example-1][1][2][10]
+
+ \setupcolumnsetlines[example-2][1][1][19]
+ \setupcolumnsetlines[example-2][1][2][18]
+ \setupcolumnsetlines[example-2][1][3][19]
+
+ \startcolumnset [example-1]
+ \dorecurse {1}{\input tufte \par}
+ \stopcolumnset
+ \startcolumnset [example-2]
+ \dorecurse {2}{\input ward \par}
+ \stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-804.tex b/doc/context/sources/general/manuals/columnsets/columnsets-804.tex
new file mode 100644
index 000000000..c2b7a6b1e
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-804.tex
@@ -0,0 +1,26 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset [example-1] [n=2,balance=yes]
+\definecolumnset [example-2] [n=3,balance=yes]
+
+\starttext \showgrid
+
+ \setupcolumnsetlines[example-1][1][1] [8]
+ \setupcolumnsetlines[example-1][1][2][10]
+
+ \setupcolumnsetlines[example-2][1][1] [0]
+ \setupcolumnsetlines[example-2][1][2][-2]
+ \setupcolumnsetlines[example-2][1][3] [0]
+
+ \startcolumnset [example-1]
+ \dorecurse {1}{\input tufte \par}
+ \stopcolumnset
+ \startcolumnset [example-2]
+ \dorecurse {6}{\input ward \par}
+ \stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-805.tex b/doc/context/sources/general/manuals/columnsets/columnsets-805.tex
new file mode 100644
index 000000000..fc80e7e9c
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-805.tex
@@ -0,0 +1,26 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset [example-1] [n=2,balance=yes]
+\definecolumnset [example-2] [n=3,balance=yes]
+
+\starttext \showgrid
+
+ \setupcolumnsetlines[example-1][1][1] [8]
+ \setupcolumnsetlines[example-1][1][2][10]
+
+ \setupcolumnsetstart[example-2][1][1][19]
+ \setupcolumnsetstart[example-2][1][2][17]
+ \setupcolumnsetstart[example-2][1][3][19]
+
+ \startcolumnset [example-1]
+ \dorecurse {1}{\input tufte \par}
+ \stopcolumnset
+ \startcolumnset [example-2]
+ \dorecurse {2}{\input ward \par}
+ \stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-806.tex b/doc/context/sources/general/manuals/columnsets/columnsets-806.tex
new file mode 100644
index 000000000..0322a336f
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-806.tex
@@ -0,0 +1,26 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset [example-1] [n=2,balance=yes]
+\definecolumnset [example-2] [n=3,balance=yes]
+
+\starttext \showgrid
+
+ \setupcolumnsetlines[example-1][1][1] [8]
+ \setupcolumnsetlines[example-1][1][2][10]
+
+ \setupcolumnsetstart[example-2][1][1][29]
+ \setupcolumnsetstart[example-2][1][2][29]
+ \setupcolumnsetstart[example-2][1][3][29]
+
+ \startcolumnset [example-1]
+ \dorecurse {1}{\input tufte \par}
+ \stopcolumnset
+ \startcolumnset [example-2]
+ \dorecurse {2}{\input ward \par}
+ \stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-901.tex b/doc/context/sources/general/manuals/columnsets/columnsets-901.tex
new file mode 100644
index 000000000..300458bf5
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-901.tex
@@ -0,0 +1,38 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=2,page=left,distance=1cm]
+
+\setupcolumnset
+ [example]
+ [background=contrast]
+
+\definecolor[fakerulecolor][white] \faketriggertrue
+
+\setuphead
+ [section]
+ [style=\bfd]
+
+\setuplinenumbering
+ [style=bold,
+ distance=0pt,
+ align=inner]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{30}{
+ \startsection[title=foo #1]
+ \startlinenumbering
+ \fakewords{50}{100}\par
+ \stoplinenumbering
+ \stopsection
+ }
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-902.tex b/doc/context/sources/general/manuals/columnsets/columnsets-902.tex
new file mode 100644
index 000000000..fda2969af
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-902.tex
@@ -0,0 +1,38 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=3,page=left,distance=1cm]
+
+\setupcolumnset
+ [example]
+ [background=contrast]
+
+\definecolor[fakerulecolor][white] \faketriggertrue
+
+\setuphead
+ [section]
+ [style=\bfd]
+
+\setuplinenumbering
+ [style=bold,
+ distance=0pt,
+ align=inner]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{30}{
+ \startsection[title=foo #1]
+ \startlinenumbering
+ \fakewords{50}{100}\par
+ \stoplinenumbering
+ \stopsection
+ }
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-903.tex b/doc/context/sources/general/manuals/columnsets/columnsets-903.tex
new file mode 100644
index 000000000..68cd31ae2
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-903.tex
@@ -0,0 +1,41 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\environment columnsets-000
+
+\definecolumnset[example][n=3,page=left,distance=1cm]
+
+\setupcolumnset
+ [example]
+ [background=contrast]
+
+\definecolor[fakerulecolor][white] \faketriggertrue
+
+\setupblank
+ [line]
+
+\setuphead
+ [section]
+ [style=\bfd]
+
+\setuplinenumbering
+ [style=bold,
+ distance=0pt,
+ align=inner]
+
+\starttext
+
+\startcolumnset[example]
+
+ \dorecurse{30}{
+ \startsection[title=foo #1]
+ \startlinenumbering
+ \fakewords{50}{100}\par
+ \stoplinenumbering
+ \stopsection
+ }
+
+\stopcolumnset
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets.tex b/doc/context/sources/general/manuals/columnsets/columnsets.tex
new file mode 100644
index 000000000..7d68872ef
--- /dev/null
+++ b/doc/context/sources/general/manuals/columnsets/columnsets.tex
@@ -0,0 +1,873 @@
+% engine=luatex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\dontcomplain
+
+\definepagebreak[mine][yes]
+
+% A complete otf optima pack is too expensive for this (I only have the
+% type one set).
+%
+% \usetypescriptfile
+% [type-ghz]
+%
+% \usetypescript
+% [sans]
+% [optima-nova]
+%
+% \setupbodyfont
+% [optima-nova,11pt]
+%
+% \definefont[QuiteLarge][SansBold sa 3]
+% \definefont[NotSoLarge][SansBold sa 1.5]
+%
+% So we could use:
+%
+% \setupbodyfont
+% [pagella,11pt]
+%
+% \definefont[QuiteLarge][Bold sa 2.50]
+% \definefont[NotSoLarge][Bold sa 1.25]
+%
+% But this one has a matching sans:
+
+\setupbodyfont
+ [dejavu,11pt]
+
+\definefont[QuiteLarge][SansBold sa 2.50]
+\definefont[NotSoLarge][SansBold sa 1.25]
+
+\setuplayout
+ [backspace=.1\paperwidth,
+ topspace=.025\paperheight,
+ header=0.025\paperheight,
+ footer=0.025\paperheight,
+ headerdistance=0.025\paperheight,
+ footerdistance=0.025\paperheight,
+ width=middle,
+ height=middle]
+
+\setuppagenumbering
+ [alternative=doublesided,
+ location=]
+
+\setupwhitespace
+ [line]
+
+\setupblank
+ [line]
+
+\setuptyping
+ [blank=halfline]
+
+\startsetups [pagenumber]
+ \hbox to .2\paperwidth {
+ \hss
+ Page \pagenumber
+ \hss
+ }
+\stopsetups
+
+\setupfooter [before=\vfill,after=\vfill,style=\bf,color=color-4]
+\setupheader [before=\vfill,after=\vfill,style=\bf,color=color-4]
+
+\setupfootertexts [] [\setups{pagenumber}]
+\setupheadertexts [] [\setups{chapterhead}]
+
+\startsetups [chapterhead]
+ \hbox to .2\paperwidth {
+ \hss
+ \getmarking[chapter]
+ \hss
+ }
+\stopsetups
+
+\setuphead
+ [chapter]
+ [header=empty]
+
+\definecolor[color-1][.5(red,green)]
+\definecolor[color-2][.5(green,blue)]
+\definecolor[color-3][.5(blue,red)]
+\definecolor[color-4][.5(white,black)]
+\definecolor[color-5][.5(white,color-4)]
+\definecolor[color-6][.2(white,color-4)]
+
+\startuseMPgraphic{page}
+StartPage ;
+ path p ;
+ numeric n; n := PageNumber ;
+ numeric w; w := bbwidth(Page) ;
+ numeric h; h := bbheight(Page) ;
+ def DrawBit (expr bit, dx, dy) =
+ path p ; p := unitsquare xyscaled(w/5,h/40) shifted (dx*w/10,dy*(h-h/40)) ;
+ if n div bit > 0 :
+ n := n - (n div bit)*bit ;
+ fill p withcolor \MPcolor{color-1} ;
+ else :
+ fill p withcolor \MPcolor{color-2} ;
+ fi ;
+ enddef ;
+ DrawBit(32,7,1) ;
+ DrawBit(16,4,1) ;
+ DrawBit( 8,1,1) ;
+ DrawBit( 4,7,0) ;
+ DrawBit( 2,4,0) ;
+ DrawBit( 1,1,0) ;
+StopPage ;
+\stopuseMPgraphic
+
+\startuniqueMPgraphic{frame}
+ fill OverlayBox withcolor \MPcolor{color-5} ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{contrast}
+ fill OverlayBox withcolor \MPcolor{color-4} ;
+\stopuniqueMPgraphic
+
+\defineoverlay[page] [\useMPgraphic{page}]
+\defineoverlay[frame] [\useMPgraphic{frame}]
+\defineoverlay[contrast][\useMPgraphic{contrast}]
+
+\setupexternalfigures
+ [background=frame]
+
+\definecombination
+ [sixpages]
+ [%inbetween=\blank,
+ style=mono,
+ distance=.5\bodyfontsize,
+ width=\textwidth]
+
+\definecombination
+ [fourpages]
+ [%inbetween=\blank,
+ style=mono,
+ distance=.5\bodyfontsize,
+ width=\textwidth]
+
+\definecombination
+ [twopages]
+ [style=mono]
+
+\definemeasure[twopages] [\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
+\definemeasure[fourpages] [\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
+\definemeasure[eightpages][\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
+\definemeasure[sixpages] [\dimexpr\dimexpr\textwidth-2.5\bodyfontsize\relax/6\relax]
+
+\starttexdefinition unexpanded OnePage #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][1*1]
+ {\typesetfile[#1.tex][page=1,lines=15]} {1}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded OneSpread #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][1*1]
+ {\typesetfile[#1.tex][page=2,lines=15]} {2}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded TwoPages #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][2*1]
+ {\typesetfile[#1.tex][page=1,width=\measure{twopages}]} {1}
+ {\typesetfile[#1.tex][page=2,width=\measure{twopages}]} {2}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded TwoSpread #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][2*1]
+ {\typesetfile[#1.tex][page=2,width=\measure{twopages}]} {2}
+ {\typesetfile[#1.tex][page=3,width=\measure{twopages}]} {3}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded FourPages #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][4*1]
+ {\typesetfile[#1.tex][page=1,width=\measure{fourpages}]} {1}
+ {\typesetfile[#1.tex][page=2,width=\measure{fourpages}]} {2}
+ {\typesetfile[#1.tex][page=3,width=\measure{fourpages}]} {3}
+ {\typesetfile[#1.tex][page=4,width=\measure{fourpages}]} {4}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded FourSpread #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][4*1]
+ {\typesetfile[#1.tex][page=2,width=\measure{fourpages}]} {2}
+ {\typesetfile[#1.tex][page=3,width=\measure{fourpages}]} {3}
+ {\typesetfile[#1.tex][page=4,width=\measure{fourpages}]} {4}
+ {\typesetfile[#1.tex][page=5,width=\measure{fourpages}]} {5}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded SixPages #1
+ \startlinecorrection[blank]
+ \startcombination[sixpages][6*1]
+ {\typesetfile[#1.tex][page=1,width=\measure{sixpages}]} {1}
+ {\typesetfile[#1.tex][page=2,width=\measure{sixpages}]} {2}
+ {\typesetfile[#1.tex][page=3,width=\measure{sixpages}]} {3}
+ {\typesetfile[#1.tex][page=4,width=\measure{sixpages}]} {4}
+ {\typesetfile[#1.tex][page=5,width=\measure{sixpages}]} {5}
+ {\typesetfile[#1.tex][page=6,width=\measure{sixpages}]} {6}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded SixSpread #1
+ \startlinecorrection[blank]
+ \startcombination[sixpages][6*1]
+ {\typesetfile[#1.tex][page=2,width=\measure{sixpages}]} {2}
+ {\typesetfile[#1.tex][page=3,width=\measure{sixpages}]} {3}
+ {\typesetfile[#1.tex][page=4,width=\measure{sixpages}]} {4}
+ {\typesetfile[#1.tex][page=5,width=\measure{sixpages}]} {5}
+ {\typesetfile[#1.tex][page=6,width=\measure{sixpages}]} {6}
+ {\typesetfile[#1.tex][page=7,width=\measure{sixpages}]} {7}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded EightPages #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][4*2]
+ {\typesetfile[#1.tex][page=1,width=\measure{eightpages}]} {#1 / 1}
+ {\typesetfile[#1.tex][page=2,width=\measure{eightpages}]} {#1 / 2}
+ {\typesetfile[#1.tex][page=3,width=\measure{eightpages}]} {#1 / 3}
+ {\typesetfile[#1.tex][page=4,width=\measure{eightpages}]} {#1 / 4}
+ {\typesetfile[#1.tex][page=5,width=\measure{eightpages}]} {#1 / 5}
+ {\typesetfile[#1.tex][page=6,width=\measure{eightpages}]} {#1 / 6}
+ {\typesetfile[#1.tex][page=7,width=\measure{eightpages}]} {#1 / 7}
+ {\typesetfile[#1.tex][page=8,width=\measure{eightpages}]} {#1 / 8}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded EightSpread #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][4*2]
+ {\typesetfile[#1.tex][page=2,width=\measure{eightpages}]} {#1 / 2}
+ {\typesetfile[#1.tex][page=3,width=\measure{eightpages}]} {#1 / 3}
+ {\typesetfile[#1.tex][page=4,width=\measure{eightpages}]} {#1 / 4}
+ {\typesetfile[#1.tex][page=5,width=\measure{eightpages}]} {#1 / 5}
+ {\typesetfile[#1.tex][page=6,width=\measure{eightpages}]} {#1 / 6}
+ {\typesetfile[#1.tex][page=7,width=\measure{eightpages}]} {#1 / 7}
+ {\typesetfile[#1.tex][page=8,width=\measure{eightpages}]} {#1 / 8}
+ {\typesetfile[#1.tex][page=9,width=\measure{eightpages}]} {#1 / 9}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\setuphead
+ [chapter]
+ [style=\QuiteLarge,
+ color=color-3,
+ number=no]
+
+\setuplist
+ [chapter]
+ [command=\MyListCommand,
+ alternative=command]
+
+\starttexdefinition unexpanded MyListCommand #1#2#3
+ \snaptogrid
+ [line,-line]\vbox {
+ \tfb
+ \setstrut
+ \strut#2
+ \quad#3
+ }
+\stoptexdefinition
+
+\setupmargindata
+ [style=\tttf,
+ color=color-3]
+
+\starttexdefinition unexpanded ShowFile #1
+ \margintext
+ {\cldcontext{string.match("#1","\letterpercent d+")}}
+ \typefile
+ [range={environment}]
+ {#1}
+\stoptexdefinition
+
+% \typefile[range=4] {...}
+% \typefile[range={=}]{...} % start after comment lines
+
+\starttexdefinition unexpanded ShowEnvironmentFile #1
+ \margintext
+ {\cldcontext{string.match("#1","\letterpercent d+")}}
+ \typefile
+ [range={=startenvironment}]
+ {#1}
+\stoptexdefinition
+
+\startdocument
+
+\startMPpage
+StartPage ;
+ path p ; numeric w, h, d ; picture q ;
+ if true :
+ q := image(draw textext.urt("\ssbf COLUMNS") withcolor \MPcolor{color-6}) ;
+ else :
+ q := image(draw textext.urt("\ssbf COLUMNSETS") withcolor \MPcolor{color-6}) ;
+ fi ;
+ w := bbwidth(Page) ;
+ h := bbheight(Page) ;
+ d := h/100 ;
+ fill Page withcolor \MPcolor{color-1} ;
+ p := Page xysized (w,d) ;
+ for i := 5d step 2d until h-5d :
+ fill p shifted (0,i) withcolor \MPcolor{color-2} ;
+ endfor
+ p := Page xysized(w/10,h) ;
+ for i = 0, .3, .6, .9 :
+ fill p shifted (i*w,0) withcolor \MPcolor{color-1} withtransparency(1,.75) ;
+ endfor ;
+ def do_it(expr sz, sh) =
+ p := Page xysized sz ;
+ fill p shifted sh withcolor \MPcolor{color-3} withtransparency(1,.5) ;
+ draw q xysized (bbwidth(p),bbheight(p)) shifted sh ;
+ enddef ;
+ if true :
+ do_it ((2w/10,17d),(.1w,20d)) ;
+ do_it ((2w/10,15d),(.1w,56d)) ;
+ do_it ((2w/10,21d),(.4w,66d)) ;
+ do_it ((2w/10,13d),(.7w,38d)) ;
+ do_it ((5w/10,13d),(.4w,13d)) ;
+ draw textext.urt("\ssbf Hans Hagen")
+ xysized (5w/10,5d)
+ shifted (.4w,6d)
+ withcolor \MPcolor{color-5} ;
+ else :
+ do_it ((2w/10,17d),(.1w,15d)) ;
+ do_it ((2w/10,15d),(.1w,51d)) ;
+ do_it ((2w/10,21d),(.4w,61d)) ;
+ do_it ((2w/10,13d),(.7w,31d)) ;
+ do_it ((5w/10,13d),(.4w, 7d)) ;
+ fi ;
+StopPage ;
+\stopMPpage
+
+\page[empty] \setuppagenumber[number=1]
+
+\setupbackgrounds
+ [page]
+ [background=page]
+
+\starttitle[title=Contents]
+
+ \placelist[chapter]
+
+\stoptitle
+
+\startchapter[title=Introduction]
+
+This manual introduces {\em column sets}, one of the output routines of \CONTEXT.
+Although column sets are mainly meant for typesetting journals in a
+semi||automated way, you can also use them for books. We assume that the user is
+familiar with \CONTEXT\ and only discuss the commands that are related to column
+sets.
+
+This mechanism performs okay but it needs to be used with care: an occasional
+manual intervention is needed to get optimal results. After all, we're operating
+in the area where normally click and point desktop publishing is used.
+
+{\bf For the moment you need to load the new code with: \type{\usemodule[newcolumnsets]}}
+
+\startlines
+Hans Hagen
+PRAGMA ADE
+Hasselt, 2003\endash2016
+\stoplines
+
+\stopchapter
+
+\startchapter[title=Basics]
+
+As soon as enough content is collected to build a page, \TEX\ will invoke the
+output routine. This is not a fixed piece of code, but a collection of macro
+calls. The default output routine is a meant for typesetting a single column, as
+in this document. A multi||column output routine is available as well. This
+routine mixes well with the single column one, and is activated by:
+
+\starttyping
+\startcolumns
+some text ...
+\stopcolumns
+\stoptyping
+
+In \MKIV\ a new mixed column mechanism has been introduced that will be
+developped further and eventually replace the old multi column handler. In \MKII\
+there is also a columnset mechanism that can be used to construct complex multi
+column pages. In \MKIV\ this gets replaced by grid columns. All these multi
+column mechanisms have in common that the output routine is more complex because
+now a page is in fact a collection of pages wrapped onto one. Each column is
+(from \TEX's perspective) similar to a one narrow column page. Here we focus on
+columnsets (page grids).
+
+There are some limitations to what you can do with this kind of multi columns,
+which is why we have a third routine at out disposal: {\em column sets}. This
+routine can be used for rather complex layouts with graphics all over the place,
+and text spanning columns or even spreads. There are of course some shortcomings,
+which we will discuss later.
+
+In the examples that follow we use the following style to set up the layout. The
+number in the margin serves a reference to the file where this snippet of \TEX\
+is stored.
+
+\ShowEnvironmentFile{columnsets-000}
+
+\page[mine]
+
+Before we will demonstrate more complex layouts, we will introduce a few
+features. In the next series of examples we use fake text. You can enlarge the
+pages in your viewer if you want to see more detail.
+
+\FourSpread{columnsets-001}
+
+These pages were typeset with the following code:
+
+\ShowFile{columnsets-001}
+
+We will showmost examples on a spread, so we don't show a first page. On a
+spread like above we number columns from~1 to~4, which in practice means that in
+this case columns starting on right page start with column~3!
+
+\SixPages{columnsets-001}
+
+\page[mine]
+
+The number of columns is not fixed to two. You can even have a different number
+of columns on left and right pages.
+
+\FourSpread{columnsets-002}
+
+This time the input is:
+
+\ShowFile{columnsets-002}
+
+Again, we started on a right page but showed the spreads. You can see it from the
+positioning of the header texts.
+
+\SixPages{columnsets-002}
+
+\page[mine]
+
+In order to get the balancing you want, you can manually influence the height of
+a column.
+
+\FourSpread{columnsets-003}
+
+When you set the number of column lines to a positive value, that will be the
+number of lines. A negative value will be subtracted from the maximum number of
+lines.
+
+\ShowFile{columnsets-003}
+
+\page[mine]
+
+In articles you may want to let the introduction span multiple columns. A column
+span is defined independent of a column set and shows up as follows:
+
+\FourSpread{columnsets-004}
+
+Here we've given the span a background so that it stands out.
+
+\ShowFile{columnsets-004}
+
+\page[mine]
+
+A column span can be positioned like any graphic. Later we will discuss the
+placement options in more detail, for the moment all you need to know is that
+\type {btlr} tells \CONTEXT\ to place the graphic in the left bottom of the the
+text area.
+
+\FourSpread{columnsets-005}
+
+Here we pass the \type {default} placement as parameter to the span, but you can
+also set it at definition time. We use a brute force simple column splitter to
+fake columns inside the span.
+
+\ShowFile{columnsets-005}
+
+\page[mine]
+
+You are not limited to one column span. In this sense a span is like a graphic:
+as long as there is room, it will be placed where you want it to be placed. The
+main difference between a span and a graphic is that a span expects text and
+tries to align the baselines with the rest of the text. In many ways a column
+span behaves like a framed text.
+
+\FourSpread{columnsets-006}
+
+This time we flushed one of the spans from bottom to top, starting at the right
+edge: \type {btrl}.
+
+\ShowFile{columnsets-006}
+
+\page[mine]
+
+Column spans are treated like graphics, which means that they will float if
+needed. In the process, the width is limited to the available space, which in
+some cases may lead to a smaller span than you may expect. Think of a column
+span, calculated (and prepared) in the last column and ending up on the next page
+in the first column, where a broader span would have been possible.
+
+\FourSpread{columnsets-007}
+
+\ShowFile{columnsets-007}
+
+\stopchapter
+
+\startchapter[title=Graphics]
+
+Most documents have graphics, and therefore column sets can contain them. The
+main thing that you have to keep in mind when placing graphics, is that column
+sets are based on grids. Therefore spacing around graphics is also grid based.
+
+\FourSpread{columnsets-101}
+
+\ShowFile{columnsets-101}
+
+\page[mine]
+
+You can tell \CONTEXT\ where it should place the graphic, but this will only be
+honored when there is still place.
+
+\EightSpread{columnsets-102}
+
+The prefered location is passed as a four character directive:
+
+\ShowFile{columnsets-102}
+
+\page[mine]
+
+The following directives are available:
+
+\starttabulate[|lT|p|]
+\NC btlr \NC flush from bottom to top and left to right \NC \NR
+\NC btrl \NC flush from bottom to top and right to left \NC \NR
+\NC tblr \NC flush from top to bottom and left to right \NC \NR
+\NC tbrl \NC flush from top to bottom and right to left \NC \NR
+\NC lrbt \NC flush from left to right and bottom to top \NC \NR
+\NC lrtb \NC flush from left to right and top to bottom \NC \NR
+\NC rlbt \NC flush from right to left and bottom to top \NC \NR
+\NC rltb \NC flush from right to left and top to bottom \NC \NR
+\NC here \NC try to place the graphic here \NC \NR
+\NC fixd \NC force the graphic here and don't float \NC \NR
+\NC fxtb:c*r \NC place the graphic at (c,r) or lower if needed \NC \NR
+\NC fxbt:c*r \NC place the graphic at (c,r) or higher if needed \NC \NR
+\NC tops \NC place the graphic at the top of the page \NC \NR
+\NC bots \NC place the graphic at the bottom of the page \NC \NR
+\NC page \NC place the graphic at a separate page \NC \NR
+\stoptabulate
+
+In the next example we show the directional locations:
+
+\OneSpread{columnsets-103}
+
+\ShowFile{columnsets-103}
+
+\stopchapter
+
+\startchapter[title=Areas]
+
+So far we have seen texts and graphics that span multiple columns using span
+commands and floats placement commands. We have also seen that you can define a
+different number of columns for left and right pages. Now that we have arrives at
+column areas you will see how we can span information over not only a page but
+also over pages in a spread.
+
+\FourSpread{columnsets-201}
+
+Being a framed text, by default an area is aligned at the baseline. You can lower
+an area by setting the \type {location} to \type {depth}.
+
+\ShowFile{columnsets-201}
+
+\page[mine]
+
+You can position areas on the left, right or next page or on both pages. When you
+set \type {state} to \type {repeat}, an area is repeated, otherwise it is only
+placed once.
+
+\FourSpread{columnsets-202}
+
+Here we just repeat the areas. Normally this only make sense when the content is
+worth repeating.
+
+\ShowFile{columnsets-202}
+
+\page[mine]
+
+Areas can span a spread, as is demonstrated in the next example.
+
+\FourSpread{columnsets-203}
+
+\ShowFile{columnsets-203}
+
+\page[mine]
+
+An application of a spread area is a title. In the next example we show two
+spread pages.
+
+\FourSpread{columnsets-204}
+
+Watch how we explicitly go to a left page.
+
+\ShowFile{columnsets-204}
+
+\page[mine]
+
+The \type {\GapText} macro is an experimental fun macro and is used to make sure
+that we don't end up with a clipped character.
+
+\startlinecorrection[blank]
+\startcombination
+ {\scale[width=.4\textwidth]{\clip
+ [nx=2,ny=6,x=2,y=2]
+ {\typesetfile[columnsets-204.tex][page=2]}}}
+ {left page}
+ {\scale[width=.4\textwidth]{\clip
+ [nx=2,ny=6,x=1,y=2]
+ {\typesetfile[columnsets-204.tex][page=3]}}}
+ {right page}
+\stopcombination
+\stoplinecorrection
+
+This is a typical example of the kind of optimizations that are needed when you
+make documents of styles with text that spans a spread. In the next clip we
+visualize the gap.
+
+\startlinecorrection[blank]
+\startcombination
+ {\scale[width=.4\textwidth]{\clip
+ [nx=2,ny=6,x=2,y=2]
+ {\typesetfile[columnsets-205.tex][page=2]}}}
+ {left page}
+ {\scale[width=.4\textwidth]{\clip
+ [nx=2,ny=6,x=1,y=2]
+ {\typesetfile[columnsets-205.tex][page=3]}}}
+ {right page}
+\stopcombination
+\stoplinecorrection
+
+At some moment you may want to set up an area in advance as we have done in the
+following example.
+
+\FourSpread{columnsets-206}
+
+The \type {page} key is used to specify the page in the column set that the area
+should go into. Column set pages start numbering at~1. The \type {fixed} stands
+for left or right, whatever comes first.
+
+\ShowFile{columnsets-206}
+
+\stopchapter
+
+\startchapter[title=Columns]
+
+You can use \type {\page} to go to a new page in a column set. Likewise you can
+use \type {\column} to force a column break.
+
+\FourPages{columnsets-301}
+
+This example demonstrates that you can supply \type {\column} with explicit
+directives.
+
+\ShowFile{columnsets-301}
+
+You can use \type {\column[page]} as an alternative for \type {\page}.
+
+\stopchapter
+
+\startchapter[title=Details]
+
+This chapter will cover a couple of cosmetic details of column sets. {\em Some
+features need to be improved, especially in combination with areas, graphics and
+alike. We will also provide side floats etc.}
+
+\FourSpread{columnsets-401}
+
+You can set the distance between columns for each pair of columns. {\em Todo:
+left and right page distances and margins.}
+
+\ShowFile{columnsets-401}
+
+\page[mine]
+
+When you can the distance of the first column as well. This creates a margin.
+
+\FourSpread{columnsets-402}
+
+This time we used equal distances:
+
+\ShowFile{columnsets-402}
+
+\page[mine]
+
+The width of columns is normally calculated automatically, but you can also set
+the width explicitly:
+
+\FourSpread{columnsets-403}
+
+In code:
+
+\ShowFile{columnsets-403}
+
+\page[mine]
+
+For special effects, you can set the width per column. In that case you need to
+be aware of the fact that \TEX\ works its way through the document per paragraph.
+Changing the width halfway a paragraph is possible but will affect the whole
+paragraph. Therefore, this feature works best when you also goto the next column
+explicitly.
+
+\FourSpread{columnsets-404}
+
+In code:
+
+\ShowFile{columnsets-404}
+
+\page[mine]
+
+If you really want to change the width in the middle of a paragraph, you can do a
+trial run and include a breakpoint at the palce where you want it to occur:
+
+\FourSpread{columnsets-405}
+
+In the second spread you see how the narrow hsize carries on in the wider
+column. A \type {\column} command will synchronize the hsize.
+
+\ShowFile{columnsets-405}
+
+% \page[mine]
+
+\stopchapter
+
+\startchapter[title=Directions]
+
+\FourSpread{columnsets-601}
+
+The direction of flushing columns is determined by the \type {direction}
+parameters as demonstrated below.
+
+\ShowFile{columnsets-601}
+
+% \page[mine]
+
+\stopchapter
+
+\startchapter[title=Backgrounds]
+
+As with many \CONTEXT\ components, column sets can have backgrounds.
+
+\FourSpread{columnsets-701}
+
+Watch how we use the \type {each} keyword to tell \CONTEXT\ that we want to apply
+the background to each column of the set.
+
+\ShowFile{columnsets-701}
+
+\page[mine]
+
+Normally, if you apply backgrounds this way, you will also set the background
+offset. In a similar fashion you can apply backgrounds to areas and spans. Such
+backgrounds can be a color, or any overlay or layer you want.
+
+\FourSpread{columnsets-702}
+
+Here we've set the background offset as well as the frame.
+
+\ShowFile{columnsets-702}
+
+\page[mine]
+
+When dealing with areas, you need to be aware of the fact that they are clipped,
+the content as well as the background.
+
+\FourSpread{columnsets-703}
+
+De default clip offset is two times the lineheight, except in the binding, where
+it is set to zero points. You can set the clip offset with the \type {clipoffset}
+parameter.
+
+\ShowFile{columnsets-703}
+
+\page[mine]
+
+The text background mechanism is rather well adapted to column sets. The
+following example is a variant on an example shown in the manual titled
+{details}.
+
+\EightSpread{columnsets-704}
+
+Watch how we adapt the background to the fact and extent that the text spans one
+or more columns.
+
+\ShowFile{columnsets-704}
+
+Backgrounds that follow the paragraph shape also work ok in column sets.
+
+{\em todo: an example of a bleeding graphic with column feed back (from
+techniek)}
+
+% \page[mine]
+
+\stopchapter
+
+\startchapter[title=Numbering lines]
+
+\FourSpread{columnsets-901}
+
+This example shows how numbering lines in columns works out. In a two column
+layout the numbers end up in the outer margins by default. If you want you can
+set the \type {location} to for instance \type {left} or \type {right}.
+
+\ShowFile{columnsets-901}
+
+\page[mine]
+
+\FourSpread{columnsets-902}
+
+In a three column setup the numbers end up in the left margins.Make sure you make
+the distance large enough.
+
+\ShowFile{columnsets-902}
+
+% \page[mine]
+%
+% \FourSpread{columnsets-903}
+%
+% This example shows again lune numbers but here we made sure that there is no
+% stretch in the whitespace.
+%
+% \ShowFile{columnsets-903}
+
+\stopchapter
+
+% \startchapter[title=Spanning and More]
+%
+% {\em todo: explanation} \page
+%
+% \TwoPages{columnsets-801} \ShowFile{columnsets-801} \page[mine]
+% \TwoPages{columnsets-802} \ShowFile{columnsets-802} \page[mine]
+% \TwoPages{columnsets-803} \ShowFile{columnsets-803} \page[mine]
+% \TwoPages{columnsets-804} \ShowFile{columnsets-804} \page[mine]
+% \TwoPages{columnsets-805} \ShowFile{columnsets-805} \page[mine]
+% \TwoPages{columnsets-806} \ShowFile{columnsets-806} \page[mine]
+%
+% \stopchapter
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/epub/epub-mkiv-demo.tex b/doc/context/sources/general/manuals/epub/epub-mkiv-demo.tex
new file mode 100644
index 000000000..b4b979874
--- /dev/null
+++ b/doc/context/sources/general/manuals/epub/epub-mkiv-demo.tex
@@ -0,0 +1,43 @@
+
+% \usemodule[luacalls]
+
+\usemodule[mathml]
+
+\setupexternalfigures
+ [location=default]
+
+\setupbackend
+ [export=yes]
+
+\setupexport
+ [svgstyle=mathtest-style,
+ hyphen=yes,
+ width=60em]
+
+\setupbodyfont[pagella]
+
+\definefloat[graphic][graphics][figure]
+
+% \environment [mathtest-style]
+
+\starttext
+
+ \startsection[title=First]
+
+ \startitemize
+ \startitem one \stopitem
+ \startitem two \stopitem
+ \stopitemize
+
+ \startplacefigure[title=First]
+ \externalfigure[cow.pdf]
+ \stopplacefigure
+
+ \startplacegraphic[title=Second]
+ \externalfigure[cow.pdf]
+ \stopplacegraphic
+
+ some math: \m{e=mc^2}
+
+ \stopsection
+\stoptext
diff --git a/doc/context/sources/general/manuals/epub/epub-mkiv.tex b/doc/context/sources/general/manuals/epub/epub-mkiv.tex
new file mode 100644
index 000000000..6fc4ed9d4
--- /dev/null
+++ b/doc/context/sources/general/manuals/epub/epub-mkiv.tex
@@ -0,0 +1,466 @@
+% language=uk
+
+% todo:
+%
+% metadata
+% properties
+% \dontleavehmode before hbox
+% cover page
+%
+% http://www.cnet.com/news/google-subtracts-mathml-from-chrome-and-anger-multiplies/
+
+% \usemodule[luacalls]
+
+\usemodule[art-01,abr-02]
+
+\definehighlight[notabene][style=bold]
+
+\definecolor[darkorange] [.70(green,red)]
+\definecolor[lightorange][.45(orange,white)]
+\definecolor[lesswhite] [.90(white)]
+
+\setuptyping[color=darkorange]
+\setuptype [color=darkorange]
+
+\starttext
+
+\startMPpage
+
+numeric w ; w := 21cm ;
+numeric h ; h := 29.7cm ;
+numeric ww ; ww := 9w/10 ;
+numeric oo ; oo := (w-ww) / 2 ;
+numeric hh ; hh := h/5.5 ;
+path p ; p := unitsquare xysized(w,h) ;
+
+color orange ; orange := \MPcolor{darkorange} ; % .7[green,red] ;
+
+fill p enlarged 2mm withcolor orange ;
+
+draw image (
+ draw anchored.top(
+ textext("\ttbf\setupinterlinespace[line=1.7ex]\framed[frame=off,align=middle,offset=0mm]{\smash{<div/>}\\\smash{<div >}\\\smash{</div>}}")
+ xsized w,
+ center topboundary p shifted (0,-12mm)) withcolor \MPcolor{lightorange} ; % 0.45[white,orange] ;
+ draw anchored.bot(
+ textext("\ssbf\setupinterlinespace[line=2.2ex]\framed[frame=off,align=middle]{exporting\\xml and epub\\from context}")
+ xsized w,
+ center bottomboundary p shifted (0,4mm)) withcolor \MPcolor {lesswhite} ; % 0.90white ;
+) ;
+
+setbounds currentpicture to p ;
+
+\stopMPpage
+
+\startsection[title=Introduction]
+
+There is a pretty long tradition of typesetting math with \TEX\ and it looks like
+this program will dominate for many more years. Even if we move to the web, the
+simple fact that support for \MATHML\ in some browsers is suboptimal will drive
+those who want a quality document to use \PDF\ instead.
+
+I'm writing this in 2014, at a time when \XML\ is widespread. The idea of \XML\ is
+that you code your data in a very structured way, so that it can be manipulated and
+(if needed) validated. Text has always been a target for \XML\ which is a follow|-|up
+to \SGML\ that was in use by publishers. Because \HTML\ is less structured (and also
+quite tolerant with respect to end tags) we prefer to use \XHTML\ but unfortunately
+support for that is less widespread.
+
+Interestingly, documents are probably among the more complex targets of the
+\XML\ format. The reason is that unless the author restricts him|/|herself or
+gets restricted by the publisher, tag abuse can happen. At \PRAGMA\ we mostly
+deal with education|-|related \XML\ and it's not always easy to come up with
+something that suits the specific needs of the educational concept behind a
+school method. Even if we start out nice and clean, eventually we end up with a
+polluted source, often with additional structure needed to satisfy the tools used
+for conversion.
+
+We have been supporting \XML\ from the day it showed up and most of our projects
+involve \XML\ in one way or the other. That doesn't mean that we don't use \TEX\
+for coding documents. This manual is for instance a regular \TEX\ document. In
+many ways a structured \TEX\ document is much more convenient to edit, especially
+if one wants to add a personal touch and do some local page make|-|up. On the other hand,
+diverting from standard structure commands makes the document less suitable for
+output other than \PDF. There is simply no final solution for coding a document,
+it's mostly a matter of taste.
+
+So we have a dilemma: if we want to have multiple output, frozen \PDF\ as well as
+less-controlled \HTML\ output, we can best code in \XML, but when we want to code
+comfortably we'd like to use \TEX. There are other ways, like Markdown, that can
+be converted to intermediate formats like \TEX, but that is only suitable for
+simple documents: the more advanced documents get, the more one has to escape
+from the boundaries of (any) document encoding, and then often \TEX\ is not a bad
+choice. There is a good reason why \TEX\ survived for so long.
+
+It is for this reason that in \CONTEXT\ \MKIV\ we can export the content in a
+reasonable structured way to \XML. Of course we assume a structured document. It
+started out as an experiment because it was relatively easy to implement, and it
+is now an integral component.
+
+\stopsection
+
+\startsection[title=The output]
+
+The regular output is an \XML\ file but as we have some more related data it gets
+organized in a tree. We also export a few variants. An example is given below:
+
+\starttyping
+./test-export
+./test-export/images
+./test-export/images/...
+./test-export/styles
+./test-export/styles/test-defaults.css
+./test-export/styles/test-images.css
+./test-export/styles/test-styles.css
+./test-export/styles/test-templates.css
+./test-export/test-raw.xml
+./test-export/test-raw.lua
+./test-export/test-tag.xhtml
+./test-export/test-div.xhtml
+\stoptyping
+
+Say that we have this input:
+
+\starttyping
+\setupbackend
+ [export=yes]
+
+\starttext
+ \startsection[title=First]
+ \startitemize
+ \startitem one \stopitem
+ \startitem two \stopitem
+ \stopitemize
+ \stopsection
+\stoptext
+\stoptyping
+
+The main export ends up in the \type {test-raw.xml} export file and looks like
+the following (we leave out the preamble and style references):
+
+\starttyping
+<document> <!-- with some attributes -->
+ <section detail="section" chain="section" level="3">
+ <sectionnumber>1</sectionnumber>
+ <sectiontitle>First</sectiontitle>
+ <sectioncontent>
+ <itemgroup detail="itemize" chain="itemize" symbol="1" level="1">
+ <item>
+ <itemtag><m:math ..><m:mo>•</m:mo></m:math></itemtag>
+ <itemcontent>one</itemcontent>
+ </item>
+ <item>
+ <itemtag><m:math ..><m:mo>•</m:mo></m:math></itemtag>
+ <itemcontent>two</itemcontent>
+ </item>
+ </itemgroup>
+ </sectioncontent>
+ </section>
+</document>
+\stoptyping
+
+This file refers to the stylesheets and therefore renders quite well in a browser
+like Firefox that can handle \XHTML\ with arbitrary tags.
+
+The \type {detail} attribute tells us what instance of the element is used.
+Normally the \type {chain} attribute is the same but it can have more values.
+For instance, if we have:
+
+\starttyping
+\definefloat[graphic][graphics][figure]
+
+.....
+
+\startplacefigure[title=First]
+ \externalfigure[cow.pdf]
+\stopplacefigure
+
+.....
+
+\startplacegraphic[title=Second]
+ \externalfigure[cow.pdf]
+\stopplacegraphic
+\stoptyping
+
+we get this:
+
+\starttyping
+<float detail="figure" chain="figure">
+ <floatcontent>...</floatcontent>
+ <floatcaption>...</floatcaption>
+</float>
+<float detail="graphic" chain="figure graphic">
+ <floatcontent>...</floatcontent>
+ <floatcaption>...</floatcaption>
+</float>
+\stoptyping
+
+This makes it possible to style specific categories of floats by using a
+(combination of) \type {detail} and|/|or \type {chain} as filters.
+
+The body of the \type {test-tag.xhtml} file looks similar but it is slightly more
+tuned for viewing. For instance, hyperlinks are converted to a way that \CSS\ and
+browsers like more. Keep in mind that the raw file can be the base for conversion
+to other formats, so that one stays closest to the original structure.
+
+The \type {test-div.xhtml} file is even more tuned for viewing in browsers as it
+completely does away with specific tags. We explicitly don't map onto native
+\HTML\ elements because that would make everything look messy and horrible, if only
+because there seldom is a relation between those elements and the original. One
+can always transform one of the export formats to pure \HTML\ tags if needed.
+
+\starttyping
+<body>
+ <div class="document">
+ <div class="section" id="aut-1">
+ <div class="sectionnumber">1</div>
+ <div class="sectiontitle">First</div>
+ <div class="sectioncontent">
+ <div class="itemgroup itemize symbol-1">
+ <div class="item">
+ <div class="itemtag"><m:math ...><m:mo>•</m:mo></m:math></div>
+ <div class="itemcontent">one</div>
+ </div>
+ <div class="item">
+ <div class="itemtag"><m:math ...><m:mo>•</m:mo></m:math></div>
+ <div class="itemcontent">two</div>
+ </div>
+ </div>
+ <div class="float figure">
+ <div class="floatcontent">...</div></div>
+ <div class="floatcaption">...></div>
+ </div>
+ <div class="float figure graphic">
+ <div class="floatcontent">...</div></div>
+ <div class="floatcaption">...></div>
+ </div>
+ </div>
+ </div>
+</body>
+\stoptyping
+
+The default \CSS\ file can deal with tags as well as classes. The file
+of additional styles contains definitions of so|-|called highlights. In the \CONTEXT\ source
+one is better off using explicit named highlights instead of local font and color
+switches because these properties are then exported to the \CSS. The images style
+defines all images used. The templates file lists all the elements used and can
+be used as a starting point for additional \CSS\ styling.
+
+Keep in mind that the export is \notabene{not} meant as a one|-|to|-|one visual
+representation. It represents structure so that it can be converted to whatever
+you like.
+
+In order to get an export you must start your document with:
+
+\starttyping
+\setupbackend
+ [export=yes]
+\stoptyping
+
+So, we trigger a specific (extra) backend. In addition you can set up the export:
+
+\starttyping
+\setupexport
+ [svgstyle=test-basic-style.tex,
+ cssfile=test-extras.css,
+ hyphen=yes,
+ width=60em]
+\stoptyping
+
+The \type {hyphen} option will also export hyphenation information so that the
+text can be nicely justified. The \type {svgstyle} option can be used to specify
+a file where math is set up; normally this would only contain a \type{bodyfont} setup,
+and this option is only needed if you want to create an \EPUB\ file afterwards which
+has math represented as \SVG.
+
+The value of \type {cssfile} ends up as a style reference in the exported files.
+You can also pass a comma|-|separated list of names (between curly braces). These
+entries come after those of the automatically generated \CSS\ files so you need
+to be aware of default properties.
+
+\stopsection
+
+\startsection[title=Images]
+
+Inclusion of images is done in an indirect way. Each image gets an entry in a
+special image related stylesheet and then gets referred to by \type {id}. Some
+extra information is written to a status file so that the script that creates
+\EPUB\ files can deal with the right conversion, for instance from \PDF\ to \SVG.
+Because we can refer to specific pages in a \PDF\ file, this subsystem deals with
+that too. Images are expected to be in an \type {images} subdirectory and because in \CSS\
+the references are relative to the path where the stylesheet resides, we use
+\type {../images} instead. If you do some postprocessing on the files or relocate
+them you need to keep in mind that you might have to change these paths in the
+image|-|related \CSS\ file.
+
+\stopsection
+
+\startsection[title=Epub files]
+
+At the end of a run with exporting enabled you will get a message to the console that
+tells you how to generate an \EPUB\ file. For instance:
+
+\starttyping
+mtxrun --script epub --make --purge test
+\stoptyping
+
+This will create a tree with the following organization:
+
+\starttyping
+./test-epub
+./test-epub/META-INF
+./test-epub/META-INF/container.xml
+./test-epub/OEBPS
+./test-epub/OEBPS/content.opf
+./test-epub/OEBPS/toc.ncx
+./test-epub/OEBPS/nav.xhtml
+./test-epub/OEBPS/cover.xhtml
+./test-epub/OEBPS/test-div.xhtml
+./test-epub/OEBPS/images
+./test-epub/OEBPS/images/...
+./test-epub/styles
+./test-epub/styles/test-defaults.css
+./test-epub/styles/test-images.css
+./test-epub/styles/test-styles.css
+./test-epub/mimetype
+\stoptyping
+
+Images will be moved to this tree as well and if needed they will be converted,
+for instance into \SVG. Converted \PDF\ files can have a \typ {page-<number>} in
+their name when a specific page has been used.
+
+You can pass the option \type {--svgmath} in which case math will be converted to
+\SVG. The main reason for this feature is that we found out that \MATHML\ support
+in browsers is not currently as widespread as might be expected. The best bet is Firefox which
+natively supports it. The Chrome browser had it for a while but it got dropped
+and math is now delegated to \JAVASCRIPT\ and friends. In Internet Explorer
+\MATHML\ should work (but I need to test that again).
+
+This conversion mechanism is
+kind of interesting: one enters \TEX\ math, then gets \MATHML\ in the export, and
+that gets rendered by \TEX\ again, but now as a standalone snippet that then gets
+converted to \SVG\ and embedded in the result.
+
+\stopsection
+
+\startsection[title=Styles]
+
+One can argue that we should use native \HTML\ elements but since we don't have a nice
+guaranteed|-|consistent mapping onto that, it makes no sense to do so. Instead, we
+rely on either explicit tags with details and chains or divisions with classes
+that combine the tag, detail and chain. The tagged variant has some more
+attributes and those that use a fixed set of values become classes in the
+division variant. Also, once we start going the (for instance) \type {H1}, \type
+{H2}, etc.\ route we're lost when we have more levels than that or use a
+different structure. If an \type {H3} can reflect several levels it makes no
+sense to use it. The same is true for other tags: if a list is not really a list
+than tagging it with \type {LI} is counterproductive. We're often dealing with
+very complex documents so basic \HTML\ tagging becomes rather meaningless.
+
+If you look at the division variant (this is used for \EPUB\ too) you will notice
+that there are no empty elements but \type {div} blocks with a comment as content.
+This is needed because otherwise they get ignored, which for instance makes table
+cells invisible.
+
+The relation between \type {detail} and \type {chain} (reflected in \type {class})
+can best be seen from the next example.
+
+\starttyping
+\definefloat[myfloata]
+\definefloat[myfloatb][myfloatbs][figure]
+\definefloat[myfloatc][myfloatcs][myfloatb]
+\stoptyping
+
+This creates two new float instances. The first inherits from the main float
+settings, but can have its own properties. The second example inherits from
+the \type {figure} so in fact it is part of a chain. The third one has a longer
+chain.
+
+\starttyping
+<float detail="myfloata">...</float>
+<float detail="myfloatb" chain="figure">...</float>
+<float detail="myfloatc" chain="figure myfloatb">...</float>
+\stoptyping
+
+In a \CSS\ style you can now configure tags, details, and chains as well as
+classes (we show only a few possibilities). Here, the \CSS\ element on the
+first line of each pair is invoked by the \CSS\ selector on the second line.
+
+\starttyping
+div.float.myfloata { } float[detail='myfloata'] { }
+div.float.myfloatb { } float[detail='myfloatb'] { }
+div.float.figure { } float[detail='figure'] { }
+div.float.figure.myfloatb { } float[chain~='figure'][detail='myfloata'] { }
+div.myfloata { } *[detail='myfloata'] { }
+div.myfloatb { } *[detail='myfloatb'] { }
+div.figure { } *[chain~='figure'] { }
+div.figure.myfloatb { } *[chain~='figure'][detail='myfloatb'] { }
+\stoptyping
+
+The default styles cover some basics but if you're serious about the export
+or want to use \EPUB\ then it makes sense to overload some of it and|/|or
+provide additional styling. You can find plenty about \CSS\ and its options
+on the Internet.
+
+\stopsection
+
+\startsection[title=Coding]
+
+The default output reflects the structure present in the document. If that is not
+enough you can add your own structure, as in:
+
+\starttyping
+\startelement[question]
+Is this right?
+\stopelement
+\stoptyping
+
+You can also pass attributes:
+
+\starttyping
+\startelement[question][level=difficult]
+Is this right?
+\stopelement
+\stoptyping
+
+But these will be exported only when you also say:
+
+\starttyping
+\setupexport
+ [properties=yes]
+\stoptyping
+
+You can create a namespace. The following will generate attributes
+like \type {my-level}.
+
+\starttyping
+\setupexport
+ [properties=my-]
+\stoptyping
+
+In most cases it makes more sense to use highlights:
+
+\starttyping
+\definehighlight
+ [important]
+ [style=bold]
+\stoptyping
+
+This has the advantage that the style and color are exported to a special
+\CSS\ file.
+
+Headers, footers, and other content that is part of the page builder are not
+exported. If your document has cover pages you might want to hide them too. The
+same is true when you create special chapter title rendering with a side
+effect that content ends up in the page stream. If something shows up that you
+don't want, you can wrap it in an \type {ignore} element:
+
+\starttyping
+\startelement[ignore]
+Don't export this.
+\stopelement
+\stoptyping
+
+\stopsection
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/languages/languages-appendix.tex b/doc/context/sources/general/manuals/languages/languages-appendix.tex
new file mode 100644
index 000000000..d8f33e44a
--- /dev/null
+++ b/doc/context/sources/general/manuals/languages/languages-appendix.tex
@@ -0,0 +1,48 @@
+% language=uk
+
+\startcomponent languages-appendix
+
+\environment languages-environment
+
+\startchapter[title=Appendix][color=darkgray]
+
+\startsection[title=The language files]
+
+ Todo.
+
+\stopsection
+
+\startsection[title=The \type {mtx-patterns} script]
+
+ Todo.
+
+\stopsection
+
+\startsection[title=Installed sorters]
+
+\startbuffer
+\usemodule[s-languages-sorting]
+
+\showinstalledsorting
+\stopbuffer
+
+\typebuffer \blank[2*line] \getbuffer
+
+\stopsection
+
+\startsection[title=Verbose counters]
+
+\startbuffer
+\usemodule[s-languages-counters]
+
+\showverbosecounters[language={en,es}]
+\stopbuffer
+
+\typebuffer \blank[2*line] \getbuffer
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
+
diff --git a/doc/context/sources/general/manuals/languages/languages-basics.tex b/doc/context/sources/general/manuals/languages/languages-basics.tex
new file mode 100644
index 000000000..840897096
--- /dev/null
+++ b/doc/context/sources/general/manuals/languages/languages-basics.tex
@@ -0,0 +1,348 @@
+% language=uk
+
+\startcomponent languages-basics
+
+\environment languages-environment
+
+\startchapter[title=Some basics][color=darkyellow]
+
+\startsection[title={Introduction}]
+
+In this chapter we will see how we can toggle between languages. A first
+introduction to patterns will be given. Some details of how to control the
+hyphenation with specific patterns will be given in a later chapter.
+
+\stopsection
+
+\startsection[title={Available languages}]
+
+When you use the English version of \CONTEXT\ you will default to US English as
+main language. This means that hyphenation will be US specific, which by the way
+is different from the rules in GB. All labels that are generated by the system
+are also in English. Languages can often be accessed by names like \type
+{english} or \type {dutch} although it is quite common to use the short tags like
+\type {en} and \type {nl}. Because we want to be as compatible as possible with
+\MKII, there are quite some synonyms. The following table lists the languages that
+for which support is built|-|in.\footnote {More languages can be defined. It is
+up to users to provide the information.}
+
+\startbuffer
+\usemodule[languages-system]
+
+\loadinstalledlanguages
+\showinstalledlanguages
+\stopbuffer
+
+\getbuffer
+
+You can call up such a table with the following commands:
+
+\typebuffer
+
+Instead you can run \type {context --global languages-system.mkiv}.
+
+As you can see, many languages have hyphenation patterns but for Japanese,
+Korean, Chinese as well as Arabic languages they make no sense. The patterns are
+loaded on demand. The number is the internal number that is used in the engine; a
+user never has to use that number. Numbers $<1$ are used to disable hyphenation.
+The file tag is used to locate and load a specification. Such files have names
+like type {lang-nl.lua}.
+
+Some languages share the same hyphenation patterns but can have demands that
+differ, like labels or quotes. The characters shown in the table are those found
+in the pattern files. The number of patterns differs a lot between languages.
+This relates to the systematic behind them. Some languages use word stems, others
+base their hyphenation on syllables. Some language have inflections which adds to
+the complexity while others can combine words in ways that demand special care
+for word boundaries. Of course a low or high number can signal a low quality as
+well, but most pattern collections are assembled over many years and updated when
+for instance spelling rules change. I think that we can safely say that most patterns
+are quite stable and of good quality.
+
+\stopsection
+
+\startsection[title=Switching]
+
+The document language is set with
+
+\starttyping
+\mainlanguage[en]
+\stoptyping
+
+but when you want to apply the proper hyphenation rules to an embedded language
+you can use:
+
+\starttyping
+\language[en]
+\stoptyping
+
+or just:
+
+\starttyping
+\en
+\stoptyping
+
+The main language determines what labels show up, how numbering happens, in what
+way dates get formatted, etc. Normally the \typ {\mainlanguage} command comes
+before the \typ {\starttext} command.
+
+\stopsection
+
+\startsection[title=Hyphenation]
+
+In \LUATEX\ each character that gets typeset not only carries a font id and character
+code, but also a language number. You can switch language whenever you want and
+the change will be carried with the characters. Switching within a word doesn't make
+sense but it is permitted:
+
+\starttabulate[|||T|]
+\NC 1 \NC \type{\de incrediblykompliziert} \NC \hyphenatedword{\de incrediblykompliziert} \NC \NR
+\NC 2 \NC \type{\en incrediblykompliziert} \NC \hyphenatedword{\en incrediblykompliziert} \NC \NR
+\NC 3 \NC \type{\en incredibly\de kompliziert} \NC \hyphenatedword{\en incredibly\de kompliziert} \NC \NR
+\NC 4 \NC \type{\en incredibly\de\-kompliziert} \NC \hyphenatedword{\en incredibly\de\-kompliziert} \NC \NR
+\NC 5 \NC \type{\en incredibly\de-kompliziert} \NC \hyphenatedword{\en incredibly\de-kompliziert} \NC \NR
+\stoptabulate
+
+In the line 4 we have a \type {\-} between the two words, and in the last
+line just a \type {-}. If you look closely you will notice that the snippets
+can be quite small. If we typeset a word with a 1mm text width we get this:
+
+\blank \start \en \hsize 1mm incredibly \par \stop \blank
+
+If you are familiar with the details of hyphenation, you know that the number of
+characters at the end and beginning of a word is controlled by the two variables
+\typ {\lefthyphenmin} and \typ {\righthyphenmin}. However, these only influence
+the hyphenation process. What bits and pieces eventually end up on a line is
+determined by the par builder and there the \type {\hsize} matters. In practice
+you will not run into these situations, unless you have extreme long words and a
+narrow column.
+
+Hyphenation normally is limited to regular characters that make up the alphabet of
+a language. It is insensitive for capitalization as the following text shows:
+
+\blank
+
+\startnarrower
+\hyphenatedword {This time the musical distraction while developing code came
+from watching youtube performances of Cory Henry (also known from Snarky Puppy,
+a conglomerate of excellent players). Just search the web for his name with \quote
+{Stevie Wonder and Michael Jackson Tribute}. There is no keyboard he can't play.
+Another interesting keyboard player is Sun Rai (a short name for Rai
+Thistlethwayte, just google for \quote {The Beatles, Come Together, Live Piano
+Acoustic with Loop Pedal}, or do a combined search with \quote {Matt
+Chamberlain}. Okay, and talking of keyboards, let's not forget Vika Yermolyeva
+(vkgoeswild) as she's one of a kind too on the web. And then there is Jacob
+Collier, in one word: incredible (or hyphenated the Dutch way {\nl incredible},
+let me repeat that in French {\fr incredible}).} \footnote {Get me right, there
+are of course many more fantastic musicians.}
+\stopnarrower
+
+\blank
+
+Of course, names are often short and don't need to be hyphenated
+(or the left and right settings prohibit it). Another complication with names is
+that they can come from another language so we either need to switch language
+temporarily or we need to add an exception (more about that later).
+
+\stopsection
+
+\startsection[title=Primitives]
+
+In traditional \TEX\ the language is not a property of a character but is
+triggered by a signal in the (so called) list. Think of:
+
+\starttyping
+<language 1>this is <language 2>nederlands<language 1> mixed with english
+\stoptyping
+
+This number is set by the primitive \typ {\language}. Language triggers are
+injected into the list depending on the value of this number. There is also a \typ
+{\setlanguage} primitive that can inject triggers without setting the \typ
+{\language} number. Because in \LUATEX\ the state is kept with the character
+you don't need to worry about the subtle differences here.
+
+In \CONTEXT\ the \typ {\language} and \typ {\setlanguage} commands are overloaded
+by a more advanced switch macro. You cannot assume that they work as explained in
+general manuals about \TEX. Currently you can still assign a number but that
+might change. Just consider the language to be an abstraction and don't mess with
+this number. Both commands not only change the current language but also do
+specific initializations when needed.
+
+What characters get involved in hyhenation is historically determines by the so
+called \type {\lccode} values. Each character can have such a value which maps
+an uppercase to a lowercase character. This concept has been extended in \ETEX\
+where it binds to a pattern set (language). However, in \CONTEXT\ the user never
+has to worry about such details.
+
+% The \type {\patterns} primitive is
+% The \type {\hyphenation} primitive is
+
+In traditional hyphenation there will not be hyphenated if the sum of \typ
+{\lefthyphenmin} and \typ {\righthyphenmin} exceeds 62. This limitation is not
+present in the to be presented \LUA\ variant of this routine as there is no
+good reason for this limitation other than implementation constraints.
+
+\stopsection
+
+\startsection[title=Control]
+
+We already mentioned \typ {\lefthyphenmin} and \typ {\righthyphenmin}. These
+two variables control the area in a word that is subjected to hyphenation.
+Setting these values is a matter of taste but making them too small can result in
+bad hyphenation when the patterns are made with the assumptions that certain
+minima are used. Using a \typ {\lefthyphenmin} of 2 while the patterns are made
+with a value of 3 in mind is a bad idea.
+
+\startlinecorrection[blank]
+\startluacode
+context.bTABLE { option = "stretch", align= "middle" }
+ context.bTR()
+ context.bTD { ny = 2, align = "middle,lohi", style = "monobold" }
+ context.verbatim("\\lefthyphenmin")
+ context.eTD()
+ context.bTD { nx = 5, style = "monobold" }
+ context.verbatim("\\righthyphenmin")
+ context.eTD()
+ context.eTR()
+ context.bTR()
+ for right=1,5 do
+ context.bTD()
+ context.mono(right)
+ context.eTD()
+ end
+ context.eTR()
+ for left=1,5 do
+ context.bTR()
+ context.bTD()
+ context.mono(left)
+ context.eTD()
+ for right=1,5 do
+ context.bTD()
+ context("\\lefthyphenmin %s \\righthyphenmin %s \\hyphenatedword{interesting}",left,right)
+ context.eTD()
+ end
+ context.eTR()
+ end
+context.eTABLE()
+\stopluacode
+\stoplinecorrection
+
+When \TEX\ breaks a paragraph into lines it will try do so without hyphenation.
+When that fails (read: when the badness becomes too high) a next effort will take
+hyphenation into account. \footnote {Because in \LUATEX\ we always hyphenate
+there is no real gain in trying not to hyphenate. Because in traditional \TEX\
+hyphenation happens on the fly a pass without hyphenating makes more sense.} When
+the badness is still too high, an optional emergency pass can be made but only
+when the tolerances are set to permit this. In \CONTEXT\ you can try these
+settings when you get too many over- or underfull boxes reported on the console.
+
+\starttyping
+\setupalign[tolerant]
+\setupalign[verytolerant]
+\setupalign[verytolerant,stretch]
+\stoptyping
+
+Personally I tend to use the last setting, especially in automated flows. After
+all, \TEX\ will not apply stretch unless it's really needed.
+
+The two \typ {\*hyphenmin} parameters can be set any time and the current value
+is stored with each character. They can also be set with the language which we
+will see later.
+
+When \TEX\ hyphenates words it has to decide where a word starts and ends. In
+traditional \TEX\ the words starts normally at a character that falls within the
+scope of the hyphenator. It ends at when a box (hlist or vlist) is seen, but also
+at a rule, discretionary, accent (forget about this in \CONTEXT) or math. An
+example will be given in the chapter that discussed the \LUA\ alternative.
+
+\stopsection
+
+\startsection[title=Installing]
+
+ todo
+
+\stopsection
+
+\startsection[title=Modes]
+
+Languages are one of the mechanisms where you can access the current state. There are
+for instance two (official) macros that contain the current (main) language:
+
+\startbuffer
+\starttabulate[||Tc|]
+\HL
+\NC \bf macro \NC \bf value \NC \NR
+\HL
+\NC \type {\currentmainlanguage} \NC \currentmainlanguage \NC \NR
+\NC \type {\currentlanguage} \NC \currentlanguage \NC \NR
+\HL
+\stoptabulate
+\stopbuffer
+
+\getbuffer
+
+When we have set \type {\language[nl]} we get this:
+
+\start \nl \getbuffer \stop
+
+If you write a style that needs to adapt to a language you can use modes. There
+are several ways to do this:
+
+\startbuffer
+\language[nl]
+
+\startmode[**en]
+ \color[darkred]{main english}
+\stopmode
+
+\startmode[*en]
+ \color[darkred]{local english}
+\stopmode
+
+\startmode[**nl]
+ \color[darkblue]{main dutch}
+\stopmode
+
+\startmode[*nl]
+ \color[darkblue]{local dutch}
+\stopmode
+
+\startmodeset
+ [*en] {\color[darkgreen]{english set}}
+ [*nl] {\color[darkgreen]{dutch set}}
+\stopmodeset
+\stopbuffer
+
+\typebuffer
+
+This typesets:
+
+\blank \startpacked \setupindenting[no] \getbuffer \stoppacked \blank
+
+When you use setups you can use the following trick:
+
+\startbuffer
+\language[nl]
+
+\startsetups language:en
+ \color[darkorange]{something english}
+\stopsetups
+
+\startsetups language:nl
+ \color[darkorange]{something dutch}
+\stopsetups
+
+\setups[language:\currentlanguage]
+\stopbuffer
+
+\typebuffer
+
+As expected we get:
+
+\blank \start \setupindenting[no] \getbuffer \stop \blank
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/languages/languages-environment.tex b/doc/context/sources/general/manuals/languages/languages-environment.tex
new file mode 100644
index 000000000..2669fe0c5
--- /dev/null
+++ b/doc/context/sources/general/manuals/languages/languages-environment.tex
@@ -0,0 +1,15 @@
+\startenvironment languages-environment
+
+ \environment manuals-explaining-environment
+ \environment manuals-explaining-cover
+
+ \usemodule [s] [languages-hyphenation]
+ \usemodule [s] [languages-frequencies]
+ \usemodule [s] [languages-sorting]
+ \usemodule [s] [languages-counters]
+ \usemodule [s] [languages-system]
+
+ \usemodule [s] [math-extensibles]
+
+\stopenvironment
+
diff --git a/doc/context/sources/general/manuals/languages/languages-goodies.tex b/doc/context/sources/general/manuals/languages/languages-goodies.tex
new file mode 100644
index 000000000..32de54db3
--- /dev/null
+++ b/doc/context/sources/general/manuals/languages/languages-goodies.tex
@@ -0,0 +1,138 @@
+% language=uk
+
+\startcomponent languages-goodies
+
+\environment languages-environment
+
+\startchapter[title=Goodies][color=darkorange]
+
+\startsection[title=Introduction]
+
+There are some features that will only be used in rare cases. They were often
+implemented as experiment but found useful enough to keep around.
+
+\stopsection
+
+\startsection[title=Spell checking]
+
+There are some means to check the spelling of words in your document but get it
+right: \CONTEXT\ is not a spell|-|checker. These features were added in order to
+be able to do some quick checking of documents written by multiple authors. There
+are currently three options and we only show a simple examples.
+
+First you need to load word lists. These are either text files with just words
+separated by spacing.
+
+\starttyping[color=maincolor]
+foobar foo-bar foo=bar foo{}{}{}bar foo{}{}{bar}
+\stoptyping
+
+All these words become \type {foobar} which means that one can use words with
+discretionary specifications. A text list is loaded with:
+
+\startbuffer
+\loadspellchecklist[en][t:/manuals/lua/words-en.txt]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Instead you can load a \LUA\ file with words. Here we use the same structure that
+we use for the spell checker provided for \SCITE:
+
+\starttyping[color=maincolor]
+return {
+ max = 9,
+ min = 6,
+ n = 2,
+ words = {
+ ["barfoo"] = "Barfoo"
+ ["foobarred"] = "foobarred",
+ }
+}
+\stoptyping
+
+We use the same load command (you can also load bytecode files with suffix \type
+{luc} this way):
+
+\startbuffer
+\loadspellchecklist[nl][t:/scite/data/context/lexers/data/spell-nl.lua]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Usage boils down to enabling the checker. If needed we can add more methods. The
+first method colors the known and unknown colors. Words shorter then the
+threshold of 4 will be skipped.
+
+\startbuffer
+\setupspellchecking[state=start,method=1]
+\en Is this written right or is this wromg?\par % m -> n error
+\nl Is dit goed geschreven of niet?\par
+\setupspellchecking[state=stop]
+\stopbuffer
+
+\typebuffer \startpacked \getbuffer \stoppacked
+
+You can change the colors:
+
+\starttyping
+\definecolor[word:yes] [g=.75]
+\definecolor[word:no] [r=.75]
+\stoptyping
+
+The second method doesn't show anything but produces a file \type
+{jobname.words}) with used words. The \type {found} value of \type {list} is used
+as key in the produced table.
+
+\startbuffer
+\setupspellchecking[state=start,method=2,list=found]
+\en Is this written right or is this wrong?\par
+\nl Is dit goed geschreven of niet?\par
+\setupspellchecking[state=stop]
+\stopbuffer
+
+\typebuffer \startpacked \getbuffer \stoppacked
+
+The produced table is:
+
+\typefile{\jobname.words}
+
+The result can be traced with a module:
+
+\startbuffer
+\usemodule[s-languages-words]
+
+\showwords
+\stopbuffer
+
+\typebuffer
+
+This shows up as:
+
+\getbuffer
+
+The third mechanism colors languages differently. We only defined a few colors:
+
+\starttyping
+\definecolor[word:en] [b=.75]
+\definecolor[word:de] [r=.75]
+\definecolor[word:nl] [g=.75]
+\definecolor[word:unknown][r=.75,g=.75]
+\stoptyping
+
+but you can of course define a color for your favourite language in a similar way.
+
+\startbuffer
+\setupspellchecking[state=start,method=3]
+\en Is this written right or is this wrong?\par
+\nl Is dit goed geschreven of niet?\par
+\setupspellchecking[state=stop]
+\stopbuffer
+
+\typebuffer \startpacked \getbuffer \stoppacked
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/languages/languages-hyphenation.tex b/doc/context/sources/general/manuals/languages/languages-hyphenation.tex
new file mode 100644
index 000000000..6698717be
--- /dev/null
+++ b/doc/context/sources/general/manuals/languages/languages-hyphenation.tex
@@ -0,0 +1,876 @@
+% language=uk
+
+\startcomponent languages-hyphenation
+
+\environment languages-environment
+
+\startchapter[title=Hyphenation][color=darkmagenta]
+
+\startsection[title=How it works]
+
+Proper hyphenation is one of the strong points of \TEX. Hyphenation in \TEX\ is
+done using so called hyphenation patterns. Making these patterns is an art
+and most users (including me) happily use whatever is available. Patterns can be
+created automatically using \type {patgen} but often manual tweaking is needed
+too. A pattern looks as follows:
+
+\starttyping
+pat1tern
+\stoptyping
+
+This means as much as: you can split the word \type {pattern} in two pieces, with
+a hyphen between the two \type {t}'s. Actually it will also split the word \type
+{patterns} because the hyphenation mechanism looks at substrings. When no number
+between characters in a pattern is given, a zero is assumed. This means as much
+as {\em undefined}. An even number inhibits hyphenation, an odd number permits
+it. The larger the number (weight), the more influence it has. A more restricted
+pattern is:
+
+\starttyping
+.pat1tern.
+\stoptyping
+
+Here the periods set the word boundaries. The pattern dictionary for us
+english has smaller patterns and the next trace shows how these are applied.
+
+\starthyphenation[traditional]
+\showhyphenationtrace[en][pattern]
+\stophyphenation
+
+The effective hyphenation of a word is determined by several factors:
+
+\startitemize[packed]
+\startitem the current language, each language can have different patterns \stopitem
+\startitem the characters, as some characters might block hyphenation \stopitem
+\startitem the settings of \type {\lefthyphenmin} and \type {\righthyphenmin} \stopitem
+\stopitemize
+
+A place where a word can be hyphenated is called a discretionary. When \TEX\
+analyzes a stream, it will inject discretionary nodes into that stream.
+
+\starttyping
+pat\discretionary{-}{}{}tern.
+\stoptyping
+
+In traditional \TEX\ hyphenation, ligature building and kerning are tightly
+interwoven which is quite effective. However, there was also a strong
+relationship between the current font and hyphenation. This is a side effect of
+traditional \TEX\ having at most 256 characters in a font and the fact that the
+used character is fact a reference to a slot in a font. There a character in the
+input initially ends up as a character node and eventually becomes a glyph node.
+For instance two characters \type {fi} can become a ligature glyph representing
+this combination.
+
+In \LUATEX\ the hyphenation, ligature building and kerning stages are separated
+and can be overloaded. In \CONTEXT\ all three can be replaced by code written in
+\LUA. Because normally hyphenation happens before font logic is applied, there is
+no relationship with font encoding. I wrote the first \LUA\ version of the
+hyohenator on a rainy weekend and the result was not that bad so it was presented
+at the 2014 \CONTEXT\ meeting. After some polishing I decided to add this routine
+to the standard \MKIV\ repertoire which then involved some proper interfacing.
+
+You can enable the \LUA\ variant with the following command:
+
+\starttyping
+\setuphyphenation[method=traditional]
+\stoptyping
+
+We call this method \type {traditional} because in principle we can have
+many more methods and this one is (supposed to be) mostly compatible to the
+built-in method. This is a global setting. You can switch back with:
+
+\starttyping
+\setuphyphenation[method=default]
+\stoptyping
+
+In the next sections we will see how we can provide alternatives within the
+traditional method. These alternatives can be set local and therefore can operate
+over a limited range of characters.
+
+One complication in interfacing is that \TEX\ has grouping (which permits local
+settings) and we want to limit some of the above functionality using groups. At
+the same time hyphenation is a paragraph related action so we need to enable the
+hyphenation related code at a global level (or at least make sure that it gets
+exercised by forcing a \type {\par}). That means that the alternative
+hyphenator has to be quite compatible so that we could just enable it for a whole
+document. This can have an impact on performance but in practice that can be
+neglected. In \LUATEX\ the \LUA\ variant is 4~times slower than the built-in one,
+in \LUAJITTEX\ it's 3~times slower. But the good news is that the amount of time
+spent in the hyphenator is relatively small compared to other manipulations and
+macro expansion. The additional time needed for loading and preparing the
+patterns into a more \LUA\ specific format can be neglected.
+
+You can check how words get hyphenated using the patterns management script:
+
+\starttyping
+>mtxrun --script patterns --hyphenate language
+
+hyphenator |
+hyphenator | . l a n g u a g e . . l a n g u a g e .
+hyphenator | 0a2n0 0 0 2 0 0 0 0 0 0
+hyphenator | 2a0n0g0 0 2 2 0 0 0 0 0 0
+hyphenator | 0n1g0u0 0 2 2 1 0 0 0 0 0
+hyphenator | 0g0u4a0 0 2 2 1 0 4 0 0 0
+hyphenator | 2g0e0.0 0 2 2 1 0 4 2 0 0
+hyphenator | .0l2a2n1g0u4a2g0e0. . l a n-g u a g e .
+hyphenator |
+mtx-patterns | us 3 3 : language : lan-guage
+\stoptyping
+
+\stopsection
+
+\startsection[title=The last words]
+
+Mid 2014 we had to upgrade a style for a \PDF\ assembly service: chapters from
+(technical) school books are combined into arbitrary new books. There are some
+nasty aspects with this flow: for instance, all section numbers in a chapter are
+replaced by new numbers and this also involves figure and table prefixes.
+It boils down to splitting up books, analyzing the typeset content and
+preparing it for replacements. The structure is described in \XML\ files so that
+we can generate tables of contents. The reason for not generating from \XML\
+sources is that the publisher doesn't have a \XML\ workflow and that books
+already were available. Also, books from several series are combined and even
+within a series structure (and rendering) differs.
+
+What has this to do with hyphenation? Writing a style for such a flow always
+results in a more complex one that estimated and as usual it's in the details.
+The original style was written in \MKII\ and used some box juggling to achieve
+reasonable results but in \MKIV\ we can do better.
+
+Each chapter has a title and books get titles and subtitles as well. The titles
+are typeset each time a new book is composed. This happens within some layout
+constraints. Think of constraints like these:
+
+\startitemize[packed]
+\startitem the title goes on top of a shape that doesn't permit much overflow \stopitem
+\startitem there can be very long words (not uncommon in Dutch or German) \stopitem
+\startitem a short word or hyphenated part should not end up on the last line \stopitem
+\startitem the left and right hyphenation minima are at least four \stopitem
+\stopitemize
+
+The last requirement is a compromise because in most cases publishers seem to
+want ragged right not hyphenated rendering (at least in Dutch schoolbooks). The
+arguments for this are quite weak and probably originate in fear of bad rendering
+given past experiences. It's this kind of situations that drive the development
+of the more obscure features that ship with \CONTEXT\ and a (partial) solution
+for this specific case will be given later.
+
+If you look at thousands of titles and turn these into (small) paragraphs \TEX\
+does a pretty good job. It's the few exceptions that we need to catch. The next
+examples demonstrate such an extreme case.
+
+\startbuffer[example]
+\dorecurse{5} { % dejavu
+ \startlinecorrection[blank]
+ \bTABLE
+ \bTR
+ \bTD[align=middle,width=2em,foregroundstyle=bold]
+ #1
+ \eTD
+ \bTD[align={verytolerant,flushleft},width=15em,offset=1ex]
+ \hsize \dimexpr11\emwidth-#1\dimexpr.5\emwidth\relax
+ \dontcomplain
+ \lefthyphenmin=4\righthyphenmin=4
+ \blackrule[color=darkyellow,width=\hsize,height=-3pt,depth=5pt]\par
+ \begstrut\getbuffer[long]\endstrut\par
+ \eTD
+ \bTD[align={verytolerant,flushleft},width=15em,offset=1ex]
+ \sethyphenationfeatures[demo]
+ \hsize \dimexpr11\emwidth-#1\dimexpr.5\emwidth\relax
+ \dontcomplain
+ \blackrule[color=darkyellow,width=\hsize,height=-3pt,depth=5pt]\par
+ \begstrut\getbuffer[long]\endstrut\par
+ \eTD
+ \eTR
+ \eTABLE
+ \stoplinecorrection
+}
+\stopbuffer
+
+\definehyphenationfeatures
+ [demo]
+ [rightwords=1,
+ lefthyphenmin=4,
+ righthyphenmin=4]
+
+\startbuffer[long]
+a verylongword and then anevenlongerword
+\stopbuffer
+
+\starthyphenation[traditional]
+ \enabletrackers[hyphenator.visualize]
+ \getbuffer[example]\par
+ \disabletrackers[hyphenator.visualize]
+\stophyphenation
+
+Of course in practice there need to be some reasonable width and when we pose
+these limits the longest possible word should fit into the allocated space. In
+these examples the rule shows the width. In the right columns we see a red
+colored word and that one will not get hyphenated.
+
+\stopsection
+
+\startsection[title=Explicit hyphens]
+
+Another special case that we needed to handle were (compound) words with explicit
+hyphens. Because often data comes from \XML\ files we can not really control the
+typesetting as in a \TEX\ document where the author sees what gets done. So here
+we need a way to turn these hyphens into proper hyphenation directives and at the
+same time permit the words to be hyphenated.
+
+\definehyphenationfeatures
+ [demo]
+ [hyphens=yes,
+ lefthyphenmin=4,
+ righthyphenmin=4]
+
+\startbuffer[long]
+a very-long-word and then an-even-longer-word
+\stopbuffer
+
+\starthyphenation[traditional]
+ \enabletrackers[hyphenator.visualize]
+ \getbuffer[example]\par
+ \disabletrackers[hyphenator.visualize]
+\stophyphenation
+
+\stopsection
+
+\startsection[title=Extended patterns]
+
+As with more opened up mechanisms, in \MKIV\ we can extend functionality. As an
+example I have implemented the extensions discussed in the article by László
+Németh in the Proceedings of Euro\TEX\ 2006: {\em Hyphenation in OpenOffice.org}
+(TUGboat, Volume 27, 2006). The syntax for these extension is somewhat ugly and
+involves optional offsets and ranges. \footnote {I'm not sure if there were ever
+patterns released that used this syntax.}
+
+\startbuffer
+\registerhyphenationpattern[nl][e1ë/e=e]
+\registerhyphenationpattern[nl][a9atje./a=t,1,3]
+\registerhyphenationpattern[en][eigh1tee/t=t,5,1]
+\registerhyphenationpattern[de][c1k/k=k]
+\registerhyphenationpattern[de][schif1f/ff=f,5,2]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+These patterns result in the following hyphenations:
+
+\starthyphenation[traditional]
+ \switchtobodyfont[big]
+ \starttabulate[|||]
+ \NC reëel \NC \language[nl]\hyphenatedcoloredword{reëel} \NC \NR
+ \NC omaatje \NC \language[nl]\hyphenatedcoloredword{omaatje} \NC \NR
+ \NC eighteen \NC \language[en]\hyphenatedcoloredword{eighteen} \NC \NR
+ \NC Zucker \NC \language[de]\hyphenatedcoloredword{Zucker} \NC \NR
+ \NC Schiffahrt \NC \language[de]\hyphenatedcoloredword{Schiffahrt} \NC \NR
+ \stoptabulate
+\stophyphenation
+
+In a specification, the \type {.} indicates a word boundary and numbers indicate
+the weight of a breakpoint. The optional extended specification comes after the
+\type {/}. The values separated by a \type {=} are the pre and post sequences:
+these end up at the end of the current line and beginning of the next one. The
+optional numbers are the start position and length. These default to~1 and~2, so
+in the first example they identify \type {eë} (the weights don't count).
+
+There is a pitfall here. When the language already has patterns that for
+instance prohibit a hyphen between \type {e} and type {ë}, like \type{e2ë}, we
+need to make sure that we give our new one a higher priority, which is why we
+used a \type{e9ë}.
+
+This feature is somewhat experimental and can be improved. Here is a more \LUA-ish
+way of setting such patterns:
+
+\starttyping
+local registerpattern =
+ languages.hyphenators.traditional.registerpattern
+
+registerpattern("nl","e1ë", {
+ start = 1,
+ length = 2,
+ before = "e",
+ after = "e",
+} )
+
+registerpattern("nl","a9atje./a=t,1,3")
+\stoptyping
+
+Just adding extra patterns to an existing set without much testing is not wise. For
+instance we could add these to the dutch dictionary:
+
+\starttyping
+\registerhyphenationpattern[nl][e3ë/e=e]
+\registerhyphenationpattern[nl][o3ë/o=e]
+\registerhyphenationpattern[nl][e3ï/e=i]
+\registerhyphenationpattern[nl][i3ë/i=e]
+\registerhyphenationpattern[nl][a5atje./a=t,1,3]
+\registerhyphenationpattern[nl][toma8at5je]
+\stoptyping
+
+That would work oke well for words like
+
+\starttyping
+coëfficiënt
+geïntroduceerd
+copiëren
+omaatje
+tomaatje
+\stoptyping
+
+However, the last word only goes right because we explicitly added a pattern
+for it. One reason is that the existing patterns already contain rules to
+prevent weird hyphenations. The same is true for the accented characters. So,
+consider these examples and coordinate additional patterns with other users
+so that errors can be identified.
+
+\stopsection
+
+\startsection[title=Exceptions]
+
+We have a variant on the \TEX\ primitive \type {\hyphenation}, the official way
+to register a specific way to hyphenate a word.
+
+\startbuffer
+\registerhyphenationexception[aaaaa-bbbbb]
+aaaaabbbbb \par
+\stopbuffer
+
+\typebuffer
+
+This code is self explaining and results in:
+
+\blank
+
+\starthyphenation[traditional]
+\setupindenting[no]\hsize 1mm \lefthyphenmin 1 \righthyphenmin 1 \getbuffer
+\stophyphenation
+
+There can be multiple hyphens and even multiple words in such a specification:
+
+\startbuffer
+\registerhyphenationexception[aaaaa-bbbbb cc-ccc-ddd-dd]
+aaaaabbbbb \par
+cccccddddd \par
+\stopbuffer
+
+\typebuffer
+
+We get:
+
+\blank
+
+\starthyphenation[traditional]
+\setupindenting[no]\hsize 1mm \lefthyphenmin 1 \righthyphenmin 1 \getbuffer
+\stophyphenation
+
+
+\stopsection
+
+\startsection[title=Boundaries]
+
+A box, rule, math or discretionary will end a word and prohibit hyphenation
+of that word. Take this example:
+
+\startbuffer[demo]
+whatever \par
+whatever\hbox{!} \par
+\vl whatever\vl \par
+whatever$x$ \par
+whatever-whatever \par
+\stopbuffer
+
+\typebuffer[demo]
+
+These lines will hyphenate differently and in traditional \TEX\ you need to
+insert penalties and|/|or glue to get around it. In the \LUA\ variant we can
+enable that limitation.
+
+\startbuffer
+\definehyphenationfeatures
+ [strict]
+ [rightedge=tex]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Here we show the three variants: traditional \TEX\ and \LUA\ with and without
+strict settings.
+
+\starttabulate[|p|p|p|]
+\HL
+\NC \ttbf \hbox to 11em{default\hss}
+\NC \ttbf \hbox to 11em{traditional\hss}
+\NC \ttbf \hbox to 11em{traditional strict\hss}
+\NC \NR
+\HL
+\NC \starthyphenation[default] \hsize1mm \getbuffer[demo] \stophyphenation
+\NC \starthyphenation[traditional] \hsize1mm \getbuffer[demo] \stophyphenation
+\NC \starthyphenation[traditional] \sethyphenationfeatures[strict]
+ \hsize1mm \getbuffer[demo] \stophyphenation
+\NC \NR
+\HL
+\stoptabulate
+
+By default \CONTEXT\ is configured to hyphenate words that start with an
+uppercase character. This behaviour is controlled in \TEX\ by the \typ {\uchyph}
+variable. A positive value will enable this and a negative one disables it.
+
+\starttabulate[|p|p|p|p|]
+\HL
+\NC \ttbf \hbox to 8em{default 0\hss}
+\NC \ttbf \hbox to 8em{default 1\hss}
+\NC \ttbf \hbox to 8em{traditional 0\hss}
+\NC \ttbf \hbox to 8em{traditional 1\hss}
+\NC \NR
+\HL
+\NC \starthyphenation[default] \hsize1mm \uchyph\zerocount TEXified \dontcomplain \stophyphenation
+\NC \starthyphenation[traditional] \hsize1mm \uchyph\zerocount TEXified \dontcomplain \stophyphenation
+\NC \starthyphenation[default] \hsize1mm \uchyph\plusone TEXified \dontcomplain \stophyphenation
+\NC \starthyphenation[traditional] \hsize1mm \uchyph\plusone TEXified \dontcomplain \stophyphenation
+\NC \NR
+\HL
+\stoptabulate
+
+The \LUA\ variants behaves the same as the built-in implementation (that of course
+remains the reference).
+
+\stopsection
+
+\startsection[title=Plug-ins]
+
+The default hyphenator is similar to the built-in one, with a couple of
+extensions as mentioned. However, you can plug in your own code, given that it
+does return a proper hyphenation result. One reason for providing this plug is
+that there are users who want to play with hyphenators based on a different
+logic. In \CONTEXT\ we already have some methods to deal with languages that
+(for instance) have no spaces but split on words or syllabes. A more tight
+integration with the hyphenator can have advantages so I will explore these
+options when there is demand.
+
+A result table indicates where we can break a word. If we have a four character
+word and can break after the second character, the result looks like this:
+
+\starttyping
+result = { false, true, false, false }
+\stoptyping
+
+Instead of \type {true} we can also have a table that has entries like the
+extensions discussed in a previous section. Let's give an example of a
+plug-in.
+
+\startbuffer
+\startluacode
+ local subset = {
+ a = true,
+ e = true,
+ i = true,
+ o = true,
+ u = true,
+ y = true,
+ }
+
+ languages.hyphenators.traditional.installmethod("test",
+ function(dictionary,word,n)
+ local t = { }
+ for i=1,#word do
+ local w = word[i]
+ if subset[w] then
+ t[i] = {
+ before = "<" .. w,
+ after = w .. ">",
+ left = false,
+ right = false,
+ }
+ else
+ t[i] = false
+ end
+ end
+ return t
+ end
+ )
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Here we hyphenate on vowels and surround them by angle brackets when
+split over lines. This alternative is installed as follows:
+
+\startbuffer
+\definehyphenationfeatures
+ [demo]
+ [alternative=test]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We can now use it as follows:
+
+\starttyping
+\setuphyphenation[method=traditional]
+\sethyphenationfeatures[demo]
+\stoptyping
+
+When applied to one the tufte example we get:
+
+\startbuffer[demo]
+\starthyphenation[traditional]
+ \setuptolerance[tolerant]
+ \sethyphenationfeatures[demo]
+ \dontleavehmode
+ \input tufte\relax
+\stophyphenation
+\stopbuffer
+
+\blank \startnarrower \getbuffer[demo] \stopnarrower \blank
+
+A more realistic (but not perfect) example is the following:
+
+\startbuffer
+\startluacode
+ local packslashes = false
+
+ local specials = {
+ ["!"] = "before", ["?"] = "before",
+ ['"'] = "before", ["'"] = "before",
+ ["/"] = "before", ["\\"] = "before",
+ ["#"] = "before",
+ ["$"] = "before",
+ ["%"] = "before",
+ ["&"] = "before",
+ ["*"] = "before",
+ ["+"] = "before", ["-"] = "before",
+ [","] = "before", ["."] = "before",
+ [":"] = "before", [";"] = "before",
+ ["<"] = "before", [">"] = "before",
+ ["="] = "before",
+ ["@"] = "before",
+ ["("] = "before",
+ ["["] = "before",
+ ["{"] = "before",
+ ["^"] = "before", ["_"] = "before",
+ ["`"] = "before",
+ ["|"] = "before",
+ ["~"] = "before",
+ --
+ [")"] = "after",
+ ["]"] = "after",
+ ["}"] = "after",
+ }
+
+ languages.hyphenators.traditional.installmethod("url",
+ function(dictionary,word,n)
+ local t = { }
+ local p = nil
+ for i=1,#word do
+ local w = word[i]
+ local s = specials[w]
+ if s == "after" then
+ s = {
+ start = 1,
+ length = 1,
+ after = w,
+ left = false,
+ right = false,
+ }
+ specials[w] = s
+ elseif s == "before" then
+ s = {
+ start = 1,
+ length = 1,
+ before = w,
+ left = false,
+ right = false,
+ }
+ specials[w] = s
+ end
+ if not s then
+ s = false
+ elseif w == p and w == "/" then
+ t[i-1] = false
+ end
+ t[i] = s
+ if packslashes then
+ p = w
+ end
+ end
+ return t
+ end
+ )
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Again we define a plug:
+
+\startbuffer
+\definehyphenationfeatures
+ [url]
+ [characters=all,
+ alternative=url]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+So, we only break a line after symbols.
+
+\startlinecorrection[blank]
+ \starthyphenation[traditional]
+ \tt
+ \sethyphenationfeatures[url]
+ \scale[width=\hsize]{\hyphenatedcoloredword{http://www.pragma-ade.nl}}
+ \stophyphenation
+\stoplinecorrection
+
+A quick test can look as follows:
+
+\startbuffer
+\starthyphenation[traditional]
+ \sethyphenationfeatures[url]
+ \tt
+ \dontcomplain
+ \hsize 1mm
+ http://www.pragma-ade.nl
+\stophyphenation
+\stopbuffer
+
+\typebuffer
+
+Or:
+
+\getbuffer
+
+\stopsection
+
+\startsection[title=Blocking ligatures]
+
+Yet another predefined feature is the ability to block a ligature. In
+traditional \TEX\ this can be done by putting a \type {{}} between
+the characters, although that effect can get lost when the text is
+manipulated. The natural way to do this in a \UNICODE\ environment
+is to use the special characters \type {zwj} and \type {zwnj}.
+
+We use the following example lines:
+
+\startbuffer[sample]
+supereffective \blank
+superef\zwnj fective
+\stopbuffer
+
+\typebuffer[sample]
+
+and define two featuresets:
+
+\startbuffer
+\definehyphenationfeatures
+ [demo-1]
+ [characters=\zwnj\zwj,
+ joiners=yes]
+
+\definehyphenationfeatures
+ [demo-2]
+ [joiners=no]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We limit the width to 1mm and get:
+
+\startlinecorrection[blank]
+\bTABLE[option=stretch,offset=.5ex]
+ \bTR
+ \bTD \tx
+ \type{method=default}
+ \eTD
+ \bTD \tx
+ \type{method=traditional}
+ \eTD
+ \bTD \tx
+ \type{method=traditional}\par
+ \type{featureset=demo-1}
+ \eTD
+ \bTD \tx
+ \type{method=traditional}\par
+ \type{featureset=demo-2}
+ \eTD
+ \eTR
+ \bTR
+ \bTD
+ \hsize 1mm \dontcomplain
+ \starthyphenation[default]
+ \getbuffer[sample]
+ \stophyphenation
+ \eTD
+ \bTD
+ \hsize 1mm \dontcomplain
+ \starthyphenation[traditional]
+ \getbuffer[sample]
+ \stophyphenation
+ \eTD
+ \bTD
+ \hsize 1mm \dontcomplain
+ \starthyphenation[traditional]
+ \sethyphenationfeatures[demo-1]
+ \getbuffer[sample]
+ \stophyphenation
+ \eTD
+ \bTD
+ \hsize 1mm \dontcomplain
+ \starthyphenation[traditional]
+ \sethyphenationfeatures[demo-2]
+ \getbuffer[sample]
+ \stophyphenation
+ \eTD
+ \eTR
+\eTABLE
+\stoplinecorrection
+
+\stopsection
+
+\startsection[title=Special characters]
+
+The \type {characters} example can be used (to some extend) to do the
+same as the breakpoints mechanism (compounds).
+
+\startbuffer
+\definehyphenationfeatures
+ [demo-3]
+ [characters={()[]}]
+\stopbuffer
+
+\typebuffer \blank \getbuffer \blank
+
+\startbuffer[demo]
+\starthyphenation[traditional]
+ \sethyphenationfeatures[demo-3]
+ \dontcomplain
+ \hsize 1mm
+ we use (super)special(ized) patterns
+\stophyphenation
+\stopbuffer
+
+\typebuffer[demo] \blank \getbuffer[demo] \blank
+
+We can make this more clever by adding patterns:
+
+\startbuffer
+\registerhyphenationpattern[en][)9]
+\registerhyphenationpattern[en][9(]
+\stopbuffer
+
+\typebuffer \blank \getbuffer \blank
+
+This gives:
+
+\blank \getbuffer[demo] \blank
+
+A detailed trace shows that these patterns get applied:
+
+\starthyphenation[traditional]
+ \ttx
+ \showhyphenationtrace[en][(super)special(ized)]
+\stophyphenation
+
+\unregisterhyphenationpattern[en][)9]
+\unregisterhyphenationpattern[en][9(]
+
+The somewhat weird hyphens at the edges will in practice not show up because
+there is always one regular character there.
+
+\stopsection
+
+\startsection[title=Counting]
+
+There is not much you can do about patterns. It's a craft to make them and so
+they are shipped with the distribution. In order to hyphenate well, \TEX\ looks
+at some character properties. In \CONTEXT\ only the characters used in the
+patterns of a language get tagged as valid in a word.
+
+The following example illustrates that there can be corner cases. In fact, this
+example might render differently depending on the patterns available. First we
+define an extra language, based on French.
+
+\startbuffer
+\installlanguage[frf][default=fr,patterns=fr,factor=yes]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Here we set the \type {factor} parameter which tells the loader that it should
+look at the characters used in a special way: some count for none, and some count
+for more than one when determining the min values used to determine if and where
+hyphenation is to be applied.
+
+\startbuffer
+\startmixedcolumns[n=3,balance=yes]
+ \hsize 1mm \dontcomplain
+ \language[fr] aesop oedipus æsop œdipus \column
+ \hsize 1mm \dontcomplain
+ \language[frf] aesop oedipus æsop œdipus \column
+ \startexceptions æ-sop \stopexceptions
+ \hsize 1mm \dontcomplain
+ \language[frf] aesop oedipus æsop œdipus
+\stopmixedcolumns
+\stopbuffer
+
+\typebuffer
+
+We get three (when writing this manual) different columns:
+
+\getbuffer
+
+The trick is in the \type {factor}: when set to \type {yes} an \type {æ} is
+counted as two characters. Combining marks count as zero but you will not
+find them being used as we already resolve them in an earlier stage.
+
+\startluacode
+context.startcolumns { n = 2 }
+context.starttabulate { "|Tc|c|c|l|" }
+for u, data in table.sortedhash(languages.hjcounts) do
+ if data.category ~= "combining" then
+ context.NC() context("%05U",u)
+ context.NC() context("%c",u)
+ context.NC() context(data.count)
+ context.NC() context(data.category)
+ context.NC() context.NR()
+ end
+end
+context.stoptabulate()
+context.stopcolumns()
+\stopluacode
+
+It is very unlikely to find an \type {ffi} in the input and even an \type {ij} is
+rare. The \type {æ} is marked as character and the \type {œ} a ligatyure in
+\UNICODE. Maybe all the characters here are dubious but al least we provide a
+way to experiment with them.
+
+\stopsection
+
+\startsection[title=Tracing]
+
+Among the tracing options (low level trackers) there is one for pattern developers:
+
+\startbuffer
+\usemodule[s-languages-hyphenation]
+
+\startcomparepatterns[de,nl,en,fr]
+ \input zapf \quad (\showcomparepatternslegend)
+\stopcomparepatterns
+\stopbuffer
+
+\typebuffer
+
+The different hyphenation points are shown with colored bars. Some valid points
+might not be shown because the font engine can collapse successive
+discretionaries.
+
+\getbuffer
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/languages/languages-introduction.tex b/doc/context/sources/general/manuals/languages/languages-introduction.tex
new file mode 100644
index 000000000..25bbb1a90
--- /dev/null
+++ b/doc/context/sources/general/manuals/languages/languages-introduction.tex
@@ -0,0 +1,69 @@
+% language=uk
+
+\startcomponent languages-introduction
+
+\environment languages-environment
+
+\startchapter[title=Introduction][color=darkgray]
+
+This document describes an important property of the \TEX\ typesetting system and
+\CONTEXT\ in particular: the ability to deal with different languages at the same
+time. With languages we refer to natural languages. So, we're not going to
+discuss the \TEX\ language itself, not \METAPOST, nor \LUA.
+
+The original application of \TEX\ was English that uses the Latin script. The
+fonts that came with \TEX\ were suitable for that usage. When lines became too
+long they could be hyphenated using so called hyphenation patterns. Due to the
+implementation for many years there was a close relationship between fonts and
+hyphenation. Although at some point many more languages and scripts were
+supported, it was only when the \UNICODE\ aware variants showed up that
+hyphenation and fonts were decoupled. This makes it much more easier to mix
+languages that use different scripts. Although Greek, Cyrillic, Arabic, Chinese,
+Japanese, Korean and other languages have been supported for a while using
+(sometimes dirty) tricks, we now have cleaner implementations.
+
+We can hyphenate words in all languages (and scripts) that have a need for it,
+that is, split it at the end of a line and add a symbol before and|/|or after the
+break. The way words are broken into parts is called hyphenation and so called
+patterns are used to achieve that goal. The way these patterns are constructed
+and applied was part of the research related to \TEX\ development. The method
+used is also applied in other programs and is probably one of the few popular
+ways to deal with hyphenation. There have been ideas about extensions that cover
+the demands of certain languages but so far nothing better has shown up. In the
+end \TEX\ does a pretty decent job and more advanced tricks don't necessarily
+lead to better results.
+
+Hyphenation is driven by a language number and that's about it. This means that
+one cannot claim that \TEX\ in its raw form supports languages, other than that
+it can hyphenate and use fonts that provide the glyphs. It's upto a macro package
+to wrap this into a mechanism that provides the user an interface. So, when we
+speak about language support, hyphenation is only one aspect. Labels, like the
+\type {figure} in {\em figure~1.2} need to adapt to the main document language.
+When dates are shown they can be language specific. Scientific units and math
+function names can also be subjected to translation. Registers and other lists
+have to be sorted according to specific rules. Spacing dan differ per language.
+
+In this manual we will cover some of functionality in \CONTEXT\ \MKIV\ that
+relates to languages (and scripts). This manual is a compliment to other manuals,
+articles and documentation. Here we mostly focus on the language aspects. Some of
+the content (or maybe most) might looks alien and complex to you. This is because
+one purpose of this manual is to provide a place to wrap up some aspects of
+\CONTEXT. If you're not interested in that, just stick to the more general
+manuals that also cover language aspects.
+
+\startnotabene
+ This document is still under construction. The functionality discussed here
+ will stay and more might show up. Of course there are errors, and they're all
+ mine. The text is not checked for spelling errors. Feel free to let me know
+ what should get added.
+\stopnotabene
+
+\startlines
+Hans Hagen
+PRAGMA ADE, Hasselt NL
+2013 \emdash\ 2016
+\stoplines
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/languages/languages-labels.tex b/doc/context/sources/general/manuals/languages/languages-labels.tex
new file mode 100644
index 000000000..6c806ab1c
--- /dev/null
+++ b/doc/context/sources/general/manuals/languages/languages-labels.tex
@@ -0,0 +1,141 @@
+% language=uk
+
+\startcomponent languages-labels
+
+\environment languages-environment
+
+\startchapter[title=Labels][color=darkcyan]
+
+\startsection[title=Introduction]
+
+When we started using \TEX, I naturally started with plain \TEX. But it didn't
+take long before we tried \LATEX. Because our documents were in Dutch one of the
+first fights with this package was to get rid of the english labels. Because
+rather soon we decided to cook up an alternative package, a decent label
+mechanism was one of the first things to show up. And as soon as multiple
+language typesetting gets into view, such a mechanism becomes one of those
+language dependent features. In this chapter the basics will be covered.
+
+\stopsection
+
+\startsection[title=Defining labels]
+
+Before we define a label we need to define a label class. You probably seldom
+need that but this is how it's done:
+
+\startbuffer
+\definelabelclass [mylabel]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+There are some classes predefined:
+
+\starttabulate[|lB|l|]
+ \NC head \NC (complete) titles like \headtext {chapter} and \headtext {figure} \NC \NR
+ \NC label \NC in||text labels like \labeltext {chapter} and \labeltext {figure} \NC \NR
+ \NC mathlabel \NC function names like \mathlabeltext{sin} and \mathlabeltext{cos} \NC \NR
+ \NC taglabel \NC labels used for tagging purposed in the backend \NC \NR
+ \NC btxlabel \NC labels used in typesetting bibliographic items \NC \NR
+\stoptabulate
+
+The physical units mechanism also uses labels: unit, operator, prefix and suffix.
+All these labels are defined per language with a fall back on english.
+
+Given that we have defined class \type {mylabel}, a label itself is set like
+this:
+
+\startbuffer
+\setupmylabeltext
+ [en]
+ [first={<after first},
+ second={{before second>},{<after second}}]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+The first argument (the language) is optional. In the next section we will see
+how these labels are used. A lot of labels are predefined, in \MKIV\ this happens
+in the file \type {lang-txt.lua}. There is no need to adapt this file as you can
+always add labels run time.
+
+\stopsection
+
+\startsection[title=Using labels]
+
+How a label is called depends on the way it needs to be used. In any case the
+main language set determines the language of the label. So, when in an Dutch text
+we temporary switch to German, the Dutch labels are used.
+
+\startbuffer
+\starttabulate[||||]
+ \NC \bf command \NC \ttbf first \NC \ttbf {second} \NC \NR
+ \HL
+ \NC \type {\leftmylabeltext {tag}} \NC \leftmylabeltext {first} \NC \leftmylabeltext {second} \NC \NR
+ \NC \type {\rightmylabeltext{tag}} \NC \rightmylabeltext{first} \NC \rightmylabeltext{second} \NC \NR
+ \NC \type {\mylabeltext {tag}} \NC \mylabeltext {first} \NC \mylabeltext {second} \NC \NR
+ \NC \type {\mylabeltexts {tag}{text}} \NC \mylabeltexts {first}{text} \NC \mylabeltexts {second}{text} \NC \NR
+\stoptabulate
+\stopbuffer
+
+\getbuffer
+
+\stopsection
+
+\startsection[title=Hooks]
+
+Some mechanisms have label support built in, most noticeably sections
+heads and numbered items, like figure captions.
+
+\startbuffer
+\definehead
+ [myhead]
+ [subsection]
+
+\setuphead
+ [myhead]
+ [bodypartlabel=bodypartmyhead]
+
+\setuplabeltext
+ [en]
+ [bodypartmyhead=My Head: ]
+
+\myhead{Welcome}
+\stopbuffer
+
+\typebuffer \getbuffer
+
+The head text label class can be used as follows:
+
+\startbuffer
+\setupheadtext
+ [SomeHead=Just A Title]
+
+\subsection
+ [title=\headtext{SomeHead}]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+A label will obey the style settings, as in:
+
+\startbuffer
+\definehead
+ [MyFancyHead]
+ [subsection]
+ [style={\bs\setcharactercasing[Words]}]
+
+\setupheadtext
+ [SomeHead=just another title]
+
+\MyFancyHead
+ [title=\headtext{SomeHead}]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/languages/languages-mkiv.tex b/doc/context/sources/general/manuals/languages/languages-mkiv.tex
new file mode 100644
index 000000000..98ca84814
--- /dev/null
+++ b/doc/context/sources/general/manuals/languages/languages-mkiv.tex
@@ -0,0 +1,61 @@
+% language=uk
+
+% author : Hans Hagen
+% copyright : PRAGMA ADE & ConTeXt Development Team
+% license : Creative Commons Attribution ShareAlike 4.0 International
+% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
+% origin : the ConTeXt distribution
+%
+% comment : Because this manual is distributed with TeX distributions it comes with a rather
+% liberal license. We try to adapt these documents to upgrades in the (sub)systems
+% that they describe. Using parts of the content otherwise can therefore conflict
+% with existing functionality and we cannot be held responsible for that. Many of
+% the manuals contain characteristic graphics and personal notes or examples that
+% make no sense when used out-of-context.
+
+\enablemode[simple] % ,oversized
+
+\startbuffer[abstract]
+
+ This book explains how we support languages (and scripts) in \CONTEXT\ \MKIV\
+ and \LUATEX. Some of the mechanisms discussed are generic and not \CONTEXT\
+ specific. We discuss the way languages are dealt with in the engine,
+ hyphenation, standard features and additional goodies. Tracing and the
+ extensibility of code are also discussed.
+
+\stopbuffer
+
+\environment languages-environment
+
+\startdocument
+ [author=Hans Hagen,
+ title=Languages in \ConTeXt,
+ subtitle=explaining luatex and mkiv,
+ affiliation=PRAGMA ADE,
+ comment=work in progress,
+ cover:color:1=darkmagenta,
+ cover:color:2=darkorange,
+ cover:color:3=darkyellow,
+ cover:color:4=darkcyan,
+ cover:color:5=darkgray]
+
+ \startfrontmatter
+ \component manuals-explaining-contents
+ \component languages-introduction
+ \stopfrontmatter
+
+ \startbodymatter
+ \component languages-basics
+ \component languages-hyphenation
+ \component languages-labels
+ \component languages-numbering
+ \component languages-typesetting
+ \component languages-goodies
+ \component languages-sorting
+ \stopbodymatter
+
+ \startappendices
+ \component languages-appendix
+ \stopappendices
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/languages/languages-numbering.tex b/doc/context/sources/general/manuals/languages/languages-numbering.tex
new file mode 100644
index 000000000..3464826df
--- /dev/null
+++ b/doc/context/sources/general/manuals/languages/languages-numbering.tex
@@ -0,0 +1,307 @@
+% language=uk
+
+\startcomponent languages-numbering
+
+\environment languages-environment
+
+\startchapter[title=Numbering][color=darkgreen]
+
+\startsection[title=Introduction]
+
+Numbering is complex and in \CONTEXT\ it's not easy either. This is because we
+not only have 1, 2, 3 \unknown\ but also sub numbers like 1a, 1b, 1ic \unknown\
+or 1.a, 1.b, 1.c \unknown\ There can be many levels, different separators, final
+symbols. As we're talking languages we only discuss conversion here: the
+mechanism that turns a number in for instance a letter. It happens that the
+mapping from a number onto a letter is language dependent. The next lines show
+how English, Spanish and Slovenian numbers:
+
+\blank
+\startpacked
+\startcolor[maincolor]
+\dontleavehmode
+ {\ttbf\mainlanguage[en]\dorecurse{28}
+ {\hbox to 1.5em{\convertnumber{alphabetic}{#1}\hss}}}\par
+\dontleavehmode
+ {\ttbf\mainlanguage[es]\dorecurse{28}
+ {\hbox to 1.5em{\convertnumber{alphabetic}{#1}\hss}}}\par
+\dontleavehmode
+ {\ttbf\mainlanguage[sl]\dorecurse{28}
+ {\hbox to 1.5em{\convertnumber{alphabetic}{#1}\hss}}}\par
+\stopcolor
+\stoppacked
+\blank
+
+You convert a number into a letter with:
+
+\starttyping
+\convertnumber{alphabetic}{15}
+\stoptyping
+
+There is also \type {\uconvertnumber} which does not expand unless typesetting
+is going on. Normally you don't need to bother about this.
+
+The \type {alphabetic} converter adapts to the current main language. When a
+language has no special alphabet, the regular 26 characters are used.
+
+A converter can also convert to a roman numeral, a language specific ordered
+list, a day or month, an ordinal string and again there can be a language
+specific conversion. The general conversion macro takes a conversion name and
+a number. When a conversion can be set (for instance in an itemized list, or in
+section numbering) you can use these names. You can define additional
+converters if needed, as long as the converter can handle a number.
+
+\starttyping
+\defineconversion [alphabetic] [\alphabeticnumerals]
+\stoptyping
+
+Here \type {\alphabeticnumerals} is a converter. If you look into the source of
+\CONTEXT\ you will see that many converters are calling out to \LUA, where we
+have implemented those specific conversions. The following table has long and
+short names. The short one are historic.
+
+\starttabulate
+\FL
+\NC month \NC \type {\monthlong} \NC \NR
+\NC month:mnem \NC \type {\monthshort} \NC \NR
+\ML
+\NC character \NC \type {\character} \NC \NR
+\NC Character \NC \type {\Character} \NC \NR
+\NC characters \NC \type {\characters} \NC \NR
+\NC Characters \NC \type {\Characters} \NC \NR
+\ML
+\NC AK \NC \type {\smallcappedcharacters} \NC \NR
+\NC KA \NC \type {\smallcappedcharacters} \NC \NR
+\ML
+\NC alphabetic a \NC \type {\alphabeticnumerals} \NC \NR
+\NC Alphabetic A \NC \type {\Alphabeticnumerals} \NC \NR
+\ML
+\NC number numbers n \NC \type {\numbers} \NC \NR
+\NC Numbers N \NC \type {\Numbers} \NC \NR
+\NC mediaeval m \NC \type {\mediaeval} \NC \NR
+\ML
+\NC word words \NC \type {\verbosenumber} \NC \NR
+\NC Word Words \NC \type {\VerboseNumber} \NC \NR
+\ML
+\NC ordinal \NC \type {\ordinalnumber} \NC \NR
+\NC Ordinal \NC \type {\Ordinalnumber} \NC \NR
+\ML
+\NC romannumerals i r \NC \type {\romannumerals} \NC \NR
+\NC Romannumerals I R \NC \type {\Romannumerals} \NC \NR
+\ML
+\NC o \NC \type {\oldstylenumerals} \NC \NR
+\NC O \NC \type {\oldstylenumerals} \NC \NR
+\NC or \NC \type {\oldstyleromannumerals} \NC \NR
+\ML
+\NC KR \NC \type {\smallcappedromannumerals} \NC \NR
+\NC RK \NC \type {\smallcappedromannumerals} \NC \NR
+\ML
+\NC greek g \NC \type {\greeknumerals} \NC \NR
+\NC Greek G \NC \type {\Greeknumerals} \NC \NR
+\NC mathgreek \NC \type {\mathgreek} \NC \NR
+\ML
+\NC abjadnumerals \NC \type {\abjadnumerals} \NC \NR
+\NC abjadnodotnumerals \NC \type {\abjadnodotnumerals} \NC \NR
+\NC abjadnaivenumerals \NC \type {\abjadnaivenumerals} \NC \NR
+\ML
+\NC thainumerals \NC \type {\thainumerals} \NC \NR
+\NC devanagarinumerals \NC \type {\devanagarinumerals} \NC \NR
+\NC gurmurkhinumerals \NC \type {\gurmurkhinumerals} \NC \NR
+\NC gujaratinumerals \NC \type {\gujaratinumerals} \NC \NR
+\NC tibetannumerals \NC \type {\tibetannumerals} \NC \NR
+\NC greeknumerals \NC \type {\greeknumerals} \NC \NR
+\NC Greeknumerals \NC \type {\Greeknumerals} \NC \NR
+\NC arabicnumerals \NC \type {\arabicnumerals} \NC \NR
+\NC persiannumerals \NC \type {\persiannumerals} \NC \NR
+\NC arabicexnumerals \NC \type {\arabicexnumerals} \NC \NR
+\NC arabicdecimals \NC \type {\arabicdecimals} \NC \NR
+\NC persiandecimals \NC \type {\persiandecimals} \NC \NR
+\ML
+\NC koreannumerals kr \NC \type {\koreannumerals} \NC \NR
+\NC koreanparenthesisnumerals kr-p \NC \type {\koreanparenthesisnumerals} \NC \NR
+\NC koreancirclenumerals kr-c \NC \type {\koreancirclenumerals} \NC \NR
+\ML
+\NC chinesenumerals cn \NC \type {\chinesenumerals} \NC \NR
+\NC chinesecapnumerals cn-c \NC \type {\chinesecapnumerals} \NC \NR
+\NC chineseallnumerals cn-a \NC \type {\chineseallnumerals} \NC \NR
+\ML
+\NC sloveniannumerals \NC \type {\sloveniannumerals} \NC \NR
+\NC slovenianNumerals \NC \type {\slovenianNumerals} \NC \NR
+\ML
+\NC spanishnumerals \NC \type {\spanishnumerals} \NC \NR
+\NC spanishNumerals \NC \type {\spanishNumerals} \NC \NR
+\LR
+\stoptabulate
+
+The \type {alphabetic} and \type {Alphabetic} converters adapt to slovenian and
+spanish as do their small capped alternatives. There are more general helpers for it
+too:
+
+\starttyping
+\languagecharacters{number}
+\languageCharacters{number}
+\stoptyping
+
+Also language related is the \type {\continuednumber} macro. Here we see an
+application:
+
+\startbuffer
+1 \continuednumber{1}
+1, 2 \continuednumber{2}
+1, 2, 3 \continuednumber{3}
+\stopbuffer
+
+\typebuffer
+
+What renders as:
+
+\startlines[color=maincolor]
+\getbuffer
+\stoplines
+
+Such a macro is typically used in combination with counters ant it just typesets
+a label text depending on the valu ebeing non|-|zero.
+
+\startbuffer
+\setuplabeltext[en][continued={and so on}]
+1, 2, 3 \continuednumber{3}
+1, 2, 3 \convertnumber{continued}{3}
+\stopbuffer
+
+\typebuffer
+
+This gives:
+
+\startlines[color=maincolor]
+\getbuffer
+\stoplines
+
+In the rare case that you want to check if a conversion is defined you can use
+
+\starttyping
+\doifelseconversiondefined{name}{true}{false}
+\stoptyping
+
+So,
+
+\startbuffer
+\doifelseconversiondefined{characters}{we can convert}{forget about it}
+\stopbuffer
+
+\typebuffer
+
+Gives:
+
+\startlines[color=maincolor]
+\getbuffer
+\stoplines
+
+There are also some non language related converters that we mention here for
+completeness:
+
+\blank
+\type {set 0}: \startcolor[maincolor]\dorecurse{20}{\convertnumber{set 0}{#1} }\stopcolor\par
+\type {set 1}: \startcolor[maincolor]\dorecurse{20}{\convertnumber{set 1}{#1} }\stopcolor\par
+\type {set 2}: \startcolor[maincolor]\dorecurse{20}{\convertnumber{set 2}{#1} }\stopcolor\par
+\type {set 3}: \startcolor[maincolor]\dorecurse{20}{\convertnumber{set 3}{#1} }\stopcolor\par
+\blank
+
+When a set overruns we start again at the first element.
+
+The ordinal converter produces output like \color [maincolor] {\convertnumber
+{ordinal}{123}} and \color [maincolor] {\convertnumber {ordinal}{654}}. The
+corresponding string renderer is \type {\highordinalstr}.
+
+% quite limited currently op not documented here:
+%
+% \wordtonumber{two}{3}
+% \wordtonumber{fivethousand}{unknown}
+
+\stopsection
+
+\startsection[title=Dates]
+
+Dates are also language dependent. The following macros take a number and return
+the name of the month or day.
+
+\starttabulate
+\NC \type {\monthlong } \NC \monthlong {10} \NC \NR
+\NC \type {\monthshort} \NC \monthshort{10} \NC \NR
+\NC \type {\MONTH } \NC \MONTH {10} \NC \NR
+\NC \type {\MONTHLONG } \NC \MONTHLONG {10} \NC \NR
+\NC \type {\MONTHSHORT} \NC \MONTHSHORT{10} \NC \NR
+\NC \type {\weekday } \NC \weekday {5} \NC \NR
+\NC \type {\WEEKDAY } \NC \WEEKDAY {5} \NC \NR
+\stoptabulate
+
+The current date can be typeset with \type {\currentdate} and a
+specific date with \type {\date}, for instance:
+
+\startbuffer
+\currentdate[weekday,day,month,year]
+\currentdate[WEEKDAY,day,MONTH,year]
+\date[d=12,m=12,y=1998][weekday]
+\date[d=12,m=12,y=1998]
+\stopbuffer
+
+\typebuffer
+
+\startlines[color=maincolor]
+\getbuffer
+\stoplines
+
+Possible elements of the specification are:
+
+\starttabulate
+\FL
+\NC + ord \NC ordinal suffix \NC \NR
+\NC ++ highord \NC high ordinal suffix \NC \NR
+\ML
+\NC mnem: \NC mnemonic prefix \NC \NR
+\ML
+\NC Y y year \NC year 4 digits \NC \NR
+\NC yy \NC year 2 digits \NC \NR
+\ML
+\NC M \NC month 1 or 2 digits \NC \NR
+\NC mm \NC month 2 digits \NC \NR
+\ML
+\NC D \NC day 1 or 2 digits \NC \NR
+\NC dd \NC day 2 digits \NC \NR
+\ML
+\NC W \NC 1 digit \NC \NR
+\ML
+\NC month m \NC language dependent (can be mnemonic) \NC \NR
+\NC day d \NC language dependent \NC \NR
+\NC weekday w \NC language dependent \NC \NR
+\ML
+\NC MONTH \NC month uppercased \NC \NR
+\NC WEEKDAY \NC weekday uppercased \NC \NR
+\ML
+\NC referral \NC YYYMMDD \NC \NR
+\ML
+\NC space \\ \NC space \NC \NR
+\NC <word> \NC word \NC \NR
+\LL
+\stoptabulate
+
+There are also some converters built in (more can be added), for instance:
+
+\startbuffer
+The current {\em gregorian} date \currentdate [month, day, {, }, year] is
+in {\em jalali} \currentdate [jalali:to, month, day, {, }, year] but we
+can also as a specific one, so {\em jalali} \date [y=1395, m=4, d=18]
+[month, day, {, }, year] is {\em gregorian} \date [y=1395, m=4, d=18]
+[jalali:from, month, day, {, }, year].
+\stopbuffer
+
+\typebuffer \startnarrower \getbuffer \stopnarrower
+
+\stopsection
+
+% \startsection[title=Counters]
+%
+% \stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/languages/languages-sorting.tex b/doc/context/sources/general/manuals/languages/languages-sorting.tex
new file mode 100644
index 000000000..ce24f385c
--- /dev/null
+++ b/doc/context/sources/general/manuals/languages/languages-sorting.tex
@@ -0,0 +1,235 @@
+% language=uk
+
+\startcomponent languages-sorting
+
+\environment languages-environment
+
+\startchapter[title=Sorting][color=darkblue]
+
+\startsection[title=Introduction]
+
+Sorting is complex, not so much for English, Dutch, German, etc. only texts but
+there are languages and scripts that are more demanding. There are several
+complications:
+
+\startitemize
+
+ \startitem
+ There can be characters that have accents, like à, á, â, ã, ä
+ \unknown\ that have a base shape a and in an index these often end up
+ close to each other. The order can differ per language.
+ \stopitem
+
+ \startitem
+ There are upper and lowercase words and there can be different
+ expectations to them being mixed or separated.
+ \stopitem
+ \startitem
+ Some scripts have characters that are combinations, like Æ, and
+ one might want to see them as one character or two, in which the
+ second one obeys the sorting order. The shape can dominate here.
+ \stopitem
+ \startitem
+ Some scripts, like Japanese, are a combination of several scripts
+ and sorting then depends on normalization.
+ \stopitem
+ \startitem
+ When there are many glyphs, like in Chinese, the order can depend
+ on the complexity of the glyph and when we're lucky that order is
+ reflected in the numeric character order.
+ \stopitem
+\stopitemize
+
+Often the rules are somewhat strict and one can doubt of the same rules would
+have been imposed if computers had been developed earlier. Given discussions one
+can doubt if the rules are really consistent or just there because someone (or a
+group) with influence set the standard (not so much different from grammar). So,
+if we deal with sorting, we do that in such a way that users can (to some extend)
+influence the outcome. After all, one important aspect of typesetting and
+organizing content is that the users gets the feeling of control and a diversion
+from a standard can be part of that. The reader will often not notice these
+details. In the next sections we will explore the way sorting is done in
+\CONTEXT. The method evolved over a few decades. In \MKII\ sorting happened
+between runs and it was just part of the processing of a document that users
+never really saw in action. Sorting just happened and few users will have noticed
+that we moved from a \MODULA\ program to a \PERL\ script and ended up with a
+\RUBY\ script. In fact, there is a \LUA\ replacement but it never got tested well
+because we moved in to \MKIV. There all happens inside the engine using \LUA.
+Some principles stayed the same but we are more flexible now.
+
+\stopsection
+
+\startsection[title=How it works]
+
+How does sorting work out? Take these words:
+
+\startlines
+abracadabra
+abräcàdábra
+àbracádabrä
+ábracadàbra
+äbrácadabrà
+\stoplines
+
+As long as they end up in an order where the reader can find it, we're okay.
+After all we're pretty good in pattern recognition.
+
+There are probably many ways to implement a sorter but the one we uses is more or
+less a follow up on the one we had for over a decade and was the result of an
+evolution based on user demand. It boils down to cleaning up the string in such a
+way that it can be split into meaningful characters. One can argue that we should
+use some kd of standardized sorting method but the problem is that we always have
+to deal with for instance embedded tex commands and mixed content, for instance
+numbers. And users using the same language can have different opinions about the
+rules too.
+
+A word (or sequence of words) is split into characters. Because there can be
+\TEX\ commands in there some cleanup happens beforehand. After that we create
+several lists with numbers that will be compared when sorting two entries.
+
+\startluacode
+
+-- local ignoredoffset = sorters.constants.ignoredoffset
+-- local replacementoffset = sorters.constants.replacementoffset
+-- local digitsoffset = sorters.constants.digitsoffset
+-- local digitsmaximum = sorters.constants.digitsmaximum
+
+local context = context
+
+local utfchar = utf.char
+local utfyte = utf.byte
+local concat = table.concat
+local gsub = string.gsub
+local formatters = string.formatters
+
+local f_char = formatters["%s"]
+local f_byte = formatters["x%02X"]
+
+local meaning = {
+ ch = "raw character",
+ mm = "minus mapping",
+ zm = "zero mapping",
+ pm = "plus mapping",
+ mc = "lowercase - 1",
+ zc = "lowercase",
+ pc = "lowercase + 1",
+ uc = "unicode",
+}
+
+local function show(s,key,bodyfont)
+ local c = s[key]
+ local t = { }
+ for i=1,#c do
+ local ci = c[i]
+ if type(ci) == "string" then
+ t[i] = f_char(ci)
+ else
+ t[i] = f_byte(ci)
+ end
+ end
+ t = concat(t,"~")
+ context.NC() context.maincolor() context(key)
+ context.NC() context.maincolor() context(meaning[key])
+ context.NC() if bodyfont then context.switchtobodyfont{bodyfont} end context(t)
+ context.NC() context.NR()
+end
+
+function document.ShowSortSplit(str,language,bodyfont)
+ sorters.setlanguage(language or "en")
+ local s = sorters.splitters.utf(str)
+ context.starttabulate{ "|Tl|Tlj2|Tp|" }
+ context.FL()
+ context.NC()
+ context.NC() context.maincolor() context(language)
+ context.NC() if bodyfont then context.switchtobodyfont{bodyfont} end context.maincolor() context(str)
+ context.NC() context.NR()
+ context.ML()
+ show(s,"ch",bodyfont)
+ show(s,"uc")
+ show(s,"zc")
+ show(s,"mc")
+ show(s,"pc")
+ show(s,"zm")
+ show(s,"mm")
+ show(s,"pm")
+ context.LL()
+ context.stoptabulate()
+end
+
+\stopluacode
+
+We can best demonstrate this with a few examples. As usual an English language
+example is trivial.
+
+\ctxlua{document.ShowSortSplit("abracadabra","en")}
+
+When we add an uppercase character we get a slightly different outcome:
+
+\ctxlua{document.ShowSortSplit("Abracadabra","en")}
+
+Some characters will be split, like \type {æ}:
+
+\ctxlua{document.ShowSortSplit("æsop","en")}
+
+It gets more complex when langiage specific demands kick in. Compare an English, German
+and Austrian split:
+
+\ctxlua{document.ShowSortSplit("Abräcàdábra","en")}
+\ctxlua{document.ShowSortSplit("Abräcàdábra","de")}
+\ctxlua{document.ShowSortSplit("Abräcàdábra","de-at")}
+
+The way a character gets replaced, like \type {ä} into \type {ae}, is defined in
+\type {sort-lan.lua} using \LUA\ tables. We will not explain all the obscure
+details here; most of the work is already done, so users are not bothered by
+these definitions. And new ones can often be made by copying and adapting an
+existing one.
+
+The sorting itself is specified by a sequence:
+
+\starttabulate[|TlCT{maincolor}|Tl|]
+\NC default \NC zc,pc,zm,pm,uc \NC \NR
+\NC before \NC mm,mc,uc \NC \NR
+\NC after \NC pm,mc,uc \NC \NR
+\NC first \NC pc,mm,uc \NC \NR
+\NC last \NC mc,mm,uc \NC \NR
+\stoptabulate
+
+The raw character is what we get after the (language specific) replacement has
+been applied and the unicodes are used when comparing. Lowercasing is done using
+the \UNICODE\ lowercase code, but one can define language specific ones too. The
+plus and minus variants can be used to force lowercase before or after uppercase.
+The mapping is based on an alphabet specification so this can differ per language
+and again we also provide plus and minus values that depend on case. When a
+character has no case we use shapes instead. For instance, the shape of \type
+{à} is \type {a}. Digits are treated special and currently get an offset so that
+they end up last in the sort order.
+
+\defineregister[jindex]
+
+\startbuffer
+ぱあ \jindex{ぱあ}
+ぱー \jindex{ぱー}
+ぱぁ \jindex{ぱぁ}
+\stopbuffer
+
+{\switchtobodyfont[ipaex]\startlines\typebuffer\stoplines}
+
+This three entry index\jindex{ぱあ}\jindex{ぱー}\jindex{ぱぁ} should be sorted in the order:
+{\switchtobodyfont[ipaex]\ruledhbox{ぱー}\enspace\ruledhbox{ぱぁ}\enspace\ruledhbox{ぱあ}}.
+
+{\mainlanguage[jp]\switchtobodyfont[ipaex]\placeregister[jindex][language=jp,n=1,method=default]}
+{\mainlanguage[jp]\switchtobodyfont[ipaex]\placeregister[jindex][language=jp,n=1,method=zm]}
+
+\ctxlua{document.ShowSortSplit("ぱあ","jp","ipaex")}
+\ctxlua{document.ShowSortSplit("ぱー","jp","ipaex")}
+\ctxlua{document.ShowSortSplit("ぱぁ","jp","ipaex")}
+
+{\em To be continued!}
+
+\stopsection
+
+% ぱー $\prec$ ぱぁ $\prec$ ぱあ
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/lua/lua-mkiv.tex b/doc/context/sources/general/manuals/lua/lua-mkiv.tex
new file mode 100644
index 000000000..40e885eac
--- /dev/null
+++ b/doc/context/sources/general/manuals/lua/lua-mkiv.tex
@@ -0,0 +1,139 @@
+% language=uk
+
+% author : Hans Hagen
+% copyright : PRAGMA ADE & ConTeXt Development Team
+% license : Creative Commons Attribution ShareAlike 4.0 International
+% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
+% origin : the ConTeXt distribution
+%
+% comment : Because this manual is distributed with TeX distributions it comes with a rather
+% liberal license. We try to adapt these documents to upgrades in the (sub)systems
+% that they describe. Using parts of the content otherwise can therefore conflict
+% with existing functionality and we cannot be held responsible for that. Many of
+% the manuals contain characteristic graphics and personal notes or examples that
+% make no sense when used out-of-context.
+
+\usemodule[art-01,abr-02]
+
+\setupbodyfont
+ [10pt]
+
+\definecolor
+ [maincolor]
+ [b=.4]
+
+\usesymbols
+ [cc]
+
+\setuptype
+ [color=maincolor]
+
+\setuptyping
+ [color=maincolor]
+
+\definefont
+ [TitlePageFont]
+ [file:lmmonolt10-bold.otf]
+
+\setuphead
+ [color=maincolor]
+
+\setupinteraction
+ [hidden]
+
+\startdocument
+ [metadata:author=Hans Hagen,
+ metadata:title={Lua, the context libraries},
+ author=Hans Hagen,
+ affiliation=PRAGMA ADE,
+ location=Hasselt NL,
+ title=Lua,
+ subtitle=the context libraries,
+ support=www.contextgarden.net,
+ website=www.pragma-ade.nl]
+
+\startMPpage
+
+ StartPage ;
+
+ numeric w ; w := bbwidth(Page) ;
+ numeric h ; h := bbheight(Page) ;
+
+ fill Page withcolor \MPcolor{maincolor} ;
+
+ draw textext.urt("\TitlePageFont \getvariable{document}{title}") xsized (0.8w) shifted (.1w,.2h) withcolor .80white ;
+ draw textext.top("\TitlePageFont \getvariable{document}{subtitle}") xsized (0.8w) shifted (.5w,.1h) withcolor .60white ;
+
+ StopPage ;
+
+\stopMPpage
+
+\startsubject[title=Contents]
+
+\placelist[section][alternative=a]
+
+\stopsubject
+
+\startsection[title=Introduction]
+
+Once we started the \LUATEX\ project it didn't take long for \CONTEXT\ to use
+the \LUA\ language extensively. And so, rather soon, a bunch of libraries
+evolved that provided all kind of helpers. Because \LUATEX\ can also act as
+a \LUA\ interpreter, and because we have \type {mtxrun} as script runner
+we can also use some of those libraries outside \CONTEXT. So, for me, a rather
+natural way to run a \LUA\ script is:
+
+\starttyping
+mtxrun --script myscript.lua <optional arguments>
+\stoptyping
+
+The advantage of this approach is that you operate in the same file domain as
+your \TEX\ runs as all file locators are preloaded as well. However, in some
+cases this is not possible, for instance when you run a stock \LUA\ or some
+embedded version. For this we provide an alternative mechanism.
+
+\stopsection
+
+\startsection[title=Making libraries]
+
+In the \CONTEXT\ distribution there is a script called \type {mtxlibs.lua} that
+can create a library for you that has the basic general purpose \CONTEXT\
+libraries on board, as well as whatever more you specify.
+
+\starttyping
+lua mtxlibs.lua --selfmerge myproject-a-libs.lua
+lua mtxlibs.lua --selfmerge myproject-b-libs.lua \
+ trac-lmx
+lua mtxlibs.lua --selfmerge myproject-c-libs.lua \
+ util-sql util-sql-imp-client util-sql-imp-library
+\stoptyping
+
+Here we create three libs. The first one has only the core libraries. You can
+read more about what they provide in the \type {cld-mkiv.pdf} manual. The second
+library includes code for creating web pages. The third variant preloads \SQL\
+support.
+
+You can best run this file in its own directory, in the \CONTEXT\ tree, so that
+it knows where to find the libraries needed. Of course you can put the result
+everywhere you want, preferably alongside your normal scripts. As we merge code,
+this is a rather good way to prevent compatibility issues. After all, some of
+the code might get improved.
+
+You can \type {require("mtxlibs")} directly in which case it will load the core
+libraries runtime. Of course this means that \LUA\ should be able to figure out
+where it can find them.
+
+\stopsection
+
+\startsubject[title={Colofon}]
+
+\starttabulate[|B|p|]
+\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR
+\NC version \NC \currentdate \NC \NR
+\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR
+\NC copyright \NC \symbol[cc][cc-by-sa-nc] \NC \NR
+\stoptabulate
+
+\stopsubject
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/luatex/luatex-contents.tex b/doc/context/sources/general/manuals/luatex/luatex-contents.tex
new file mode 100644
index 000000000..6d06b3ef0
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex-contents.tex
@@ -0,0 +1,20 @@
+\environment luatex-style
+\environment luatex-logos
+
+\startcomponent luatex-contents
+
+\starttitle[title=Contents]
+
+\start
+
+ \definecolor[maincolor][black]
+
+ \placelist
+ [chapter,section,subsection]
+ [criterium=text]
+
+\stop
+
+\stoptitle
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex b/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex
new file mode 100644
index 000000000..d55eef286
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex-enhancements.tex
@@ -0,0 +1,892 @@
+% language=uk
+
+\environment luatex-style
+\environment luatex-logos
+
+\startcomponent luatex-enhancements
+
+\startchapter[reference=enhancements,title={Basic \TEX\ enhancements}]
+
+\section{Introduction}
+
+From day one, \LUATEX\ has offered extra features compared to the superset of
+\PDFTEX\ and \ALEPH. This has not been limited to the possibility to execute
+\LUA\ code via \type {\directlua}, but \LUATEX\ also adds functionality via new
+\TEX|-|side primitives or extensions to existing ones.
+
+When \LUATEX\ starts up in \quote {iniluatex} mode (\type {luatex -ini}), it
+defines only the primitive commands known by \TEX82 and the one extra command
+\type {\directlua}. As is fitting, a \LUA\ function has to be called to add the
+extra primitives to the user environment. The simplest method to get access to
+all of the new primitive commands is by adding this line to the format generation
+file:
+
+\starttyping
+\directlua { tex.enableprimitives('',tex.extraprimitives()) }
+\stoptyping
+
+But be aware that the curly braces may not have the proper \type {\catcode}
+assigned to them at this early time (giving a \quote {Missing number} error), so
+it may be needed to put these assignments before the above line:
+
+\starttyping
+\catcode `\{=1
+\catcode `\}=2
+\stoptyping
+
+More fine|-|grained primitives control is possible and you can look up the
+details in \in {section} [luaprimitives]. For simplicity's sake, this manual
+assumes that you have executed the \type {\directlua} command as given above.
+
+The startup behaviour documented above is considered stable in the sense that
+there will not be backward|-|incompatible changes any more. We have promoted some
+rather generic \PDFTEX\ primitives to core \LUATEX\ ones, and the ones inherited
+frome \ALEPH\ (\OMEGA) are also promoted. Effectively this means that we now only
+have the \type {tex}, \type {etex} and \type {luatex} sets left.
+
+In \in {Chapter} [modifications] we discuss several primitives that are derived
+from \PDFTEX\ and \ALEPH\ (\OMEGA). Here we stick to real new ones. In the
+chapters on fonts and math we discuss a few more new ones.
+
+\section{Version information}
+
+\subsection {\type {\luatexbanner}, \type {\luatexversion} and \type {\luatexrevision}}
+
+There are three new primitives to test the version of \LUATEX:
+
+\starttabulate[|l|pl|pl|]
+\NC \bf primitive \NC \bf explanation \NC \bf value \NC \NR
+\NC \type {\luatexbanner} \NC the banner reported on the command line \NC \luatexbanner \NC \NR
+\NC \type {\luatexversion} \NC a combination of major and minor number \NC \the\luatexversion \NC \NR
+\NC \type {\luatexrevision} \NC the revision number, the current value is \NC \luatexrevision \NC \NR
+\stoptabulate
+
+The official \LUATEX\ version is defined as follows:
+
+\startitemize
+\startitem
+ The major version is the integer result of \type {\luatexversion} divided by
+ 100. The primitive is an \quote {internal variable}, so you may need to prefix
+ its use with \type {\the} depending on the context.
+\stopitem
+\startitem
+ The minor version is the two-digit result of \type {\luatexversion} modulo 100.
+\stopitem
+\startitem
+ The revision is the given by \type {\luatexrevision}. This primitive expands to
+ a positive integer.
+\stopitem
+\startitem
+ The full version number consists of the major version, minor version and
+ revision, separated by dots.
+\stopitem
+\stopitemize
+
+\subsection{\type {\formatname}}
+
+The \type {\formatname} syntax is identical to \type {\jobname}. In \INITEX, the
+expansion is empty. Otherwise, the expansion is the value that \type {\jobname} had
+during the \INITEX\ run that dumped the currently loaded format. You can use this
+token list to provide your own version info.
+
+\section{\UNICODE\ text support}
+
+\subsection {Extended ranges}
+
+Text input and output is now considered to be \UNICODE\ text, so input characters
+can use the full range of \UNICODE\ ($2^{20}+2^{16}-1 = \hbox{0x10FFFF}$). Later
+chapters will talk of characters and glyphs. Although these are not
+interchangeable, they are closely related. During typesetting, a character is
+always converted to a suitable graphic representation of that character in a
+specific font. However, while processing a list of to|-|be|-|typeset nodes, its
+contents may still be seen as a character. Inside \LUATEX\ there is no clear
+separation between the two concepts. Because the subtype of a glyph node can be
+changed in \LUA\ it is up to the user: subtypes larger than 255 indicate that
+font processing has happened.
+
+A few primitives are affected by this, all in a similar fashion: each of them has
+to accommodate for a larger range of acceptable numbers. For instance, \type
+{\char} now accepts values between~0 and $1{,}114{,}111$. This should not be a
+problem for well|-|behaved input files, but it could create incompatibilities for
+input that would have generated an error when processed by older \TEX|-|based
+engines. The affected commands with an altered initial (left of the equals sign)
+or secondary (right of the equals sign) value are: \type {\char}, \type
+{\lccode}, \type {\uccode}, \type {\catcode}, \type {\sfcode}, \type {\efcode},
+\type {\lpcode}, \type {\rpcode}, \type {\chardef}.
+
+As far as the core engine is concerned, all input and output to text files is
+\UTF-8 encoded. Input files can be pre|-|processed using the \type {reader}
+callback. This will be explained in a later chapter.
+
+Output in byte|-|sized chunks can be achieved by using characters just outside of
+the valid \UNICODE\ range, starting at the value $1{,}114{,}112$ (0x110000). When
+the time comes to print a character $c>=1{,}114{,}112$, \LUATEX\ will actually
+print the single byte corresponding to $c$ minus 1{,}114{,}112.
+
+Output to the terminal uses \type {^^} notation for the lower control range
+($c<32$), with the exception of \type {^^I}, \type {^^J} and \type {^^M}. These
+are considered \quote {safe} and therefore printed as|-|is. You can disable
+escaping with \type {texio.setescape(false)} in which case you get the normal
+characters on the console.
+
+Normalization of the \UNICODE\ input can be handled by a macro package during
+callback processing (this will be explained in \in {section} [iocallback]).
+
+\subsection{\type {\Uchar}}
+
+The expandable command \type {\Uchar} reads a number between~0 and $1{,}114{,}111$
+and expands to the associated \UNICODE\ character.
+
+\section{Extended tables}
+
+All traditional \TEX\ and \ETEX\ registers can be 16-bit numbers. The affected
+commands are:
+
+\startfourcolumns
+\starttyping
+\count
+\dimen
+\skip
+\muskip
+\marks
+\toks
+\countdef
+\dimendef
+\skipdef
+\muskipdef
+\toksdef
+\insert
+\box
+\unhbox
+\unvbox
+\copy
+\unhcopy
+\unvcopy
+\wd
+\ht
+\dp
+\setbox
+\vsplit
+\stoptyping
+\stopfourcolumns
+
+Because font memory management has been rewritten, character properties in fonts
+are no longer shared among fonts instances that originate from the same metric
+file.
+
+\section{Attributes}
+
+\subsection{Attribute registers}
+
+Attributes are a completely new concept in \LUATEX. Syntactically, they behave a
+lot like counters: attributes obey \TEX's nesting stack and can be used after
+\type {\the} etc.\ just like the normal \type {\count} registers.
+
+\startsyntax
+\attribute <16-bit number> <optional equals> <32-bit number>!crlf
+\attributedef <csname> <optional equals> <16-bit number>
+\stopsyntax
+
+Conceptually, an attribute is either \quote {set} or \quote {unset}. Unset
+attributes have a special negative value to indicate that they are unset, that
+value is the lowest legal value: \type {-"7FFFFFFF} in hexadecimal, a.k.a.
+$-2147483647$ in decimal. It follows that the value \type {-"7FFFFFFF} cannot be
+used as a legal attribute value, but you {\it can\/} assign \type {-"7FFFFFFF} to
+\quote {unset} an attribute. All attributes start out in this \quote {unset}
+state in \INITEX.
+
+Attributes can be used as extra counter values, but their usefulness comes mostly
+from the fact that the numbers and values of all \quote {set} attributes are
+attached to all nodes created in their scope. These can then be queried from any
+\LUA\ code that deals with node processing. Further information about how to use
+attributes for node list processing from \LUA\ is given in~\in {chapter}[nodes].
+
+Attributes are stored in a sorted (sparse) linked list that are shared when
+possible. This permits efficient testing and updating.
+
+\subsection{Box attributes}
+
+Nodes typically receive the list of attributes that is in effect when they are
+created. This moment can be quite asynchronous. For example: in paragraph
+building, the individual line boxes are created after the \type {\par} command has
+been processed, so they will receive the list of attributes that is in effect
+then, not the attributes that were in effect in, say, the first or third line of
+the paragraph.
+
+Similar situations happen in \LUATEX\ regularly. A few of the more obvious
+problematic cases are dealt with: the attributes for nodes that are created
+during hyphenation, kerning and ligaturing borrow their attributes from their
+surrounding glyphs, and it is possible to influence box attributes directly.
+
+When you assemble a box in a register, the attributes of the nodes contained in
+the box are unchanged when such a box is placed, unboxed, or copied. In this
+respect attributes act the same as characters that have been converted to
+references to glyphs in fonts. For instance, when you use attributes to implement
+color support, each node carries information about its eventual color. In that
+case, unless you implement mechanisms that deal with it, applying a color to
+already boxed material will have no effect. Keep in mind that this
+incompatibility is mostly due to the fact that separate specials and literals are
+a more unnatural approach to colors than attributes.
+
+It is possible to fine-tune the list of attributes that are applied to a \type
+{hbox}, \type {vbox} or \type {vtop} by the use of the keyword \type {attr}. An
+example:
+
+\starttyping
+\attribute2=5
+\setbox0=\hbox {Hello}
+\setbox2=\hbox attr1=12 attr2=-"7FFFFFFF{Hello}
+\stoptyping
+
+This will set the attribute list of box~2 to $1=12$, and the attributes of box~0
+will be $2=5$. As you can see, assigning the maximum negative value causes an
+attribute to be ignored.
+
+The \type {attr} keyword(s) should come before a \type {to} or \type {spread}, if
+that is also specified.
+
+\section{\LUA\ related primitives}
+
+\subsection{\type {\directlua}}
+
+In order to merge \LUA\ code with \TEX\ input, a few new primitives are needed.
+The primitive \type {\directlua} is used to execute \LUA\ code immediately. The
+syntax is
+
+\startsyntax
+\directlua <general text>!crlf
+\directlua <16-bit number> <general text>
+\stopsyntax
+
+The \syntax {<general text>} is expanded fully, and then fed into the \LUA\
+interpreter. After reading and expansion has been applied to the \syntax
+{<general text>}, the resulting token list is converted to a string as if it was
+displayed using \type {\the\toks}. On the \LUA\ side, each \type {\directlua}
+block is treated as a separate chunk. In such a chunk you can use the \type
+{local} directive to keep your variables from interfering with those used by the
+macro package.
+
+The conversion to and from a token list means that you normally can not use \LUA\
+line comments (starting with \type {--}) within the argument. As there typically
+will be only one \quote {line} the first line comment will run on until the end
+of the input. You will either need to use \TEX|-|style line comments (starting
+with \%), or change the \TEX\ category codes locally. Another possibility is to
+say:
+
+\starttyping
+\begingroup
+\endlinechar=10
+\directlua ...
+\endgroup
+\stoptyping
+
+Then \LUA\ line comments can be used, since \TEX\ does not replace line endings
+with spaces.
+
+Likewise, the \syntax {<16-bit number>} designates a name of a \LUA\ chunk and is
+taken from the \type {lua.name} array (see the documentation of the \type {lua}
+table further in this manual). When a chunk name starts with a \type {@} it will
+be displayed as a file name. This is a side effect of the way \LUA\ implements
+error handling.
+
+The \type {\directlua} command is expandable. Since it passes \LUA\ code to the
+\LUA\ interpreter its expansion from the \TEX\ viewpoint is usually empty.
+However, there are some \LUA\ functions that produce material to be read by \TEX,
+the so called print functions. The most simple use of these is \type
+{tex.print(<string> s)}. The characters of the string \type {s} will be placed on
+the \TEX\ input buffer, that is, \quote {before \TEX's eyes} to be read by \TEX\
+immediately. For example:
+
+\startbuffer
+\count10=20
+a\directlua{tex.print(tex.count[10]+5)}b
+\stopbuffer
+
+\typebuffer
+
+expands to
+
+\getbuffer
+
+Here is another example:
+
+\startbuffer
+$\pi = \directlua{tex.print(math.pi)}$
+\stopbuffer
+
+\typebuffer
+
+will result in
+
+\getbuffer
+
+Note that the expansion of \type {\directlua} is a sequence of characters, not of
+tokens, contrary to all \TEX\ commands. So formally speaking its expansion is
+null, but it places material on a pseudo-file to be immediately read by \TEX, as
+\ETEX's \type {\scantokens}. For a description of print functions look at \in
+{section} [sec:luaprint].
+
+Because the \syntax {<general text>} is a chunk, the normal \LUA\ error handling
+is triggered if there is a problem in the included code. The \LUA\ error messages
+should be clear enough, but the contextual information is still pretty bad.
+Often, you will only see the line number of the right brace at the end of the
+code.
+
+While on the subject of errors: some of the things you can do inside \LUA\ code
+can break up \LUATEX\ pretty bad. If you are not careful while working with the
+node list interface, you may even end up with assertion errors from within the
+\TEX\ portion of the executable.
+
+The behaviour documented in the above subsection is considered stable in the sense
+that there will not be backward-incompatible changes any more.
+
+\subsection{\type {\latelua}}
+
+Contrary to \type {\directlua}, \type {\latelua} stores \LUA\ code in a whatsit
+that will be processed at the time of shipping out. Its intended use is a cross
+between \PDF\ literals (often available as \type {\pdfliteral}) and the
+traditional \TEX\ extension \type {\write}. Within the \LUA\ code you can print
+\PDF\ statements directly to the \PDF\ file via \type {pdf.print}, or you can
+write to other output streams via \type {texio.write} or simply using \LUA\ \IO\
+routines.
+
+\startsyntax
+\latelua <general text>!crlf
+\latelua <16-bit number> <general text>
+\stopsyntax
+
+Expansion of macros in the final \type {<general text>} is delayed until just
+before the whatsit is executed (like in \type {\write}). With regard to \PDF\
+output stream \type {\latelua} behaves as \PDF\ page literals. The \syntax
+{name <general text>} and \syntax {<16-bit number>} behave in the same way as
+they do for \type {\directlua}
+
+\subsection{\type {\luaescapestring}}
+
+This primitive converts a \TEX\ token sequence so that it can be safely used as
+the contents of a \LUA\ string: embedded backslashes, double and single quotes,
+and newlines and carriage returns are escaped. This is done by prepending an
+extra token consisting of a backslash with category code~12, and for the line
+endings, converting them to \type {n} and \type {r} respectively. The token
+sequence is fully expanded.
+
+\startsyntax
+\luaescapestring <general text>
+\stopsyntax
+
+Most often, this command is not actually the best way to deal with the
+differences between the \TEX\ and \LUA. In very short bits of \LUA\
+code it is often not needed, and for longer stretches of \LUA\ code it
+is easier to keep the code in a separate file and load it using \LUA's
+\type {dofile}:
+
+\starttyping
+\directlua { dofile('mysetups.lua') }
+\stoptyping
+
+\subsection{\type {\luafunction}}
+
+The \type {\directlua} commands involves tokenization of its argument (after
+picking up an optional name or number specification). The tokenlist is then
+converted into a string and given to \LUA\ to turn into a function that is
+called. The overhead is rather small but when you use this primitive hundreds of
+thousands of times, it can become noticeable. For this reason there is a variant
+call available: \type {\luafunction}. This command is used as follows:
+
+\starttyping
+\directlua {
+ local t = lua.get_functions_table()
+ t[1] = function() tex.print("!") end
+ t[2] = function() tex.print("?") end
+}
+
+\luafunction1
+\luafunction2
+\stoptyping
+
+Of course the functions can also be defined in a separate file. There is no limit
+on the number of functions apart from normal \LUA\ limitations. Of course there
+is the limitation of no arguments but that would involve parsing and thereby give
+no gain. The function, when called in fact gets one argument, being the index, so
+in the following example the number \type {8} gets typeset.
+
+\starttyping
+\directlua {
+ local t = lua.get_functions_table()
+ t[8] = function(slot) tex.print(slot) end
+}
+\stoptyping
+
+\section {Alignments}
+
+\subsection{\tex {alignmark}}
+
+This primitive duplicates the functionality of \type {#} inside alignment
+preambles.
+
+\subsection{\tex {aligntab}}
+
+This primitive duplicates the functionality of \type {&} inside alignments and
+preambles.
+
+\section{Catcode tables}
+
+Catcode tables are a new feature that allows you to switch to a predefined
+catcode regime in a single statement. You can have a practically unlimited number
+of different tables. This subsystem is backward compatible: if you never use the
+following commands, your document will not notice any difference in behaviour
+compared to traditional \TEX. The contents of each catcode table is independent
+from any other catcode tables, and their contents is stored and retrieved from
+the format file.
+
+\subsection{\type {\catcodetable}}
+
+\startsyntax
+\catcodetable <15-bit number>
+\stopsyntax
+
+The primitive \type {\catcodetable} switches to a different catcode table. Such a
+table has to be previously created using one of the two primitives below, or it
+has to be zero. Table zero is initialized by \INITEX.
+
+\subsection{\type {\initcatcodetable}}
+
+\startsyntax
+\initcatcodetable <15-bit number>
+\stopsyntax
+
+The primitive \type {\initcatcodetable} creates a new table with catcodes identical
+to those defined by \INITEX:
+
+\starttabulate[|r|l|l|l|]
+\NC 0 \NC \tttf \letterbackslash \NC \NC \type {escape} \NC\NR
+\NC 5 \NC \tttf \letterhat\letterhat M \NC return \NC \type {car_ret} \NC\NR
+\NC 9 \NC \tttf \letterhat\letterhat @ \NC null \NC \type {ignore} \NC\NR
+\NC 10 \NC \tttf <space> \NC space \NC \type {spacer} \NC\NR
+\NC 11 \NC {\tttf a} \endash\ {\tttf z} \NC \NC \type {letter} \NC\NR
+\NC 11 \NC {\tttf A} \endash\ {\tttf Z} \NC \NC \type {letter} \NC\NR
+\NC 12 \NC everything else \NC \NC \type {other} \NC\NR
+\NC 14 \NC \tttf \letterpercent \NC \NC \type {comment} \NC\NR
+\NC 15 \NC \tttf \letterhat\letterhat ? \NC delete \NC \type {invalid_char} \NC\NR
+\stoptabulate
+
+The new catcode table is allocated globally: it will not go away after the
+current group has ended. If the supplied number is identical to the currently
+active table, an error is raised.
+
+\subsection{\type {\savecatcodetable}}
+
+\startsyntax
+\savecatcodetable <15-bit number>
+\stopsyntax
+
+\type {\savecatcodetable} copies the current set of catcodes to a new table with
+the requested number. The definitions in this new table are all treated as if
+they were made in the outermost level.
+
+The new table is allocated globally: it will not go away after the current group
+has ended. If the supplied number is the currently active table, an error is
+raised.
+
+\section{Suppressing errors}
+
+\subsection{\type {\suppressfontnotfounderror}}
+
+\startsyntax
+\suppressfontnotfounderror = 1
+\stopsyntax
+
+If this integer parameter is non|-|zero, then \LUATEX\ will not complain about
+font metrics that are not found. Instead it will silently skip the font
+assignment, making the requested csname for the font \type {\ifx} equal to \type
+{\nullfont}, so that it can be tested against that without bothering the user.
+
+\subsection{\type {\suppresslongerror}}
+
+\startsyntax
+\suppresslongerror = 1
+\stopsyntax
+
+If this integer parameter is non|-|zero, then \LUATEX\ will not complain about
+\type {\par} commands encountered in contexts where that is normally prohibited
+(most prominently in the arguments of non-long macros).
+
+\subsection{\type {\suppressifcsnameerror}}
+
+\startsyntax
+\suppressifcsnameerror = 1
+\stopsyntax
+
+If this integer parameter is non|-|zero, then \LUATEX\ will not complain about
+non-expandable commands appearing in the middle of a \type {\ifcsname} expansion.
+Instead, it will keep getting expanded tokens from the input until it encounters
+an \type {\endcsname} command. If the input expansion is unbalanced with respect
+to \type {\csname} \ldots \type {\endcsname} pairs, the \LUATEX\ process may hang
+indefinitely.
+
+\subsection{\type {\suppressoutererror}}
+
+\startsyntax
+\suppressoutererror = 1
+\stopsyntax
+
+If this new integer parameter is non|-|zero, then \LUATEX\ will not complain
+about \type {\outer} commands encountered in contexts where that is normally
+prohibited.
+
+\subsection{\type {\suppressmathparerror}}
+
+The following setting will permit \type {\par} tokens in a math formula:
+
+\startsyntax
+\suppressmathparerror = 1
+\stopsyntax
+
+So, the next code is valid then:
+
+\starttyping
+$ x + 1 =
+
+a $
+\stoptyping
+
+\section {Math}
+
+\subsection{Extensions}
+
+We will cover math in its own chapter because not only the font subsystem and
+spacing model have been enhanced (thereby introducing many new primitives) but
+also because some more control has been added to existing functionality.
+
+\subsection{\type {\matheqnogapstep}}
+
+By default \TEX\ will add one quad between the equation and the number. This is
+hard coded. A new primitive can control this:
+
+\startsyntax
+\matheqnogapstep = 1000
+\stopsyntax
+
+Because a math quad from the math text font is used instead of a dimension, we
+use a step to control the size. A value of zero will suppress the gap. The step
+is divided by 1000 which is the usual way to mimmick floating point factors in
+\TEX.
+
+\section{Fonts}
+
+\subsection{Font syntax}
+
+\LUATEX\ will accept a braced argument as a font name:
+
+\starttyping
+\font\myfont = {cmr10}
+\stoptyping
+
+This allows for embedded spaces, without the need for double quotes. Macro
+expansion takes place inside the argument.
+
+\subsection{\type {\fontid}}
+
+\startsyntax
+\fontid\font
+\stopsyntax
+
+This primitive expands into a number. It is not a register so there is no need to
+prefix with \type {\number} (and using \type {\the} gives an error). The currently
+used font id is \fontid\font. Here are some more:
+
+\starttabulate[|l|c|]
+\NC \type {\bf} \NC \bf \fontid\font \NC \NR
+\NC \type {\it} \NC \it \fontid\font \NC \NR
+\NC \type {\bi} \NC \bi \fontid\font \NC \NR
+\stoptabulate
+
+These numbers depend on the macro package used because each one has its own way
+of dealing with fonts. They can also differ per run, as they can depend on the
+order of loading fonts. For instance, when in \CONTEXT\ virtual math \UNICODE\
+fonts are used, we can easily get over a hundred ids in use. Not all ids have to
+be bound to a real font, after all it's just a number.
+
+\subsection{\type {\setfontid}}
+
+The primitive \type {\setfontid} can be used to enable a font with the given id
+(which of course needs to be a valid one).
+
+\subsection{\type {\noligs} and \type {\nokerns}}
+
+These primitives prohibit ligature and kerning insertion at the time when the
+initial node list is built by \LUATEX's main control loop. You can enable these
+primitives when you want to do node list processing of \quote {characters}, where
+\TEX's normal processing would get in the way.
+
+\startsyntax
+\noligs <integer>!crlf
+\nokerns <integer>
+\stopsyntax
+
+These primitives can also be implemented by overloading the ligature building and
+kerning functions, i.e.\ by assigning dummy functions to their associated
+callbacks. Keep in mind that when you define a font (using \LUA) you can also
+omit the kern and ligature tables, which has the same effect as the above.
+
+\subsection{\type{\nospaces}}
+
+This new primitive can be used to overrule the usual \type {\spaceskip}
+related heuristics when a space character is seen in a text flow. The
+value~\type{1} triggers no injection while \type{2} results in injection of
+a zero skip. Below we see the results for four characters separated by a
+space.
+
+\startlinecorrection
+\startcombination[3*2]
+ {\ruledhbox to 5cm{\vtop{\hsize 10mm\nospaces=0\relax x x x x \par}\hss}} {\type {0 / hsize 10mm}}
+ {\ruledhbox to 5cm{\vtop{\hsize 10mm\nospaces=1\relax x x x x \par}\hss}} {\type {1 / hsize 10mm}}
+ {\ruledhbox to 5cm{\vtop{\hsize 10mm\nospaces=2\relax x x x x \par}\hss}} {\type {2 / hsize 10mm}}
+ {\ruledhbox to 5cm{\vtop{\hsize 1mm\nospaces=0\relax x x x x \par}\hss}} {\type {0 / hsize 1mm}}
+ {\ruledhbox to 5cm{\vtop{\hsize 1mm\nospaces=1\relax x x x x \par}\hss}} {\type {1 / hsize 1mm}}
+ {\ruledhbox to 5cm{\vtop{\hsize 1mm\nospaces=2\relax x x x x \par}\hss}} {\type {2 / hsize 1mm}}
+\stopcombination
+\stoplinecorrection
+
+\section{Tokens, commands and strings}
+
+\subsection{\type {\scantextokens}}
+
+The syntax of \type {\scantextokens} is identical to \type {\scantokens}. This
+primitive is a slightly adapted version of \ETEX's \type {\scantokens}. The
+differences are:
+
+\startitemize
+\startitem
+ The last (and usually only) line does not have a \type {\endlinechar}
+ appended.
+\stopitem
+\startitem
+ \type {\scantextokens} never raises an EOF error, and it does not execute
+ \type {\everyeof} tokens.
+\stopitem
+\startitem
+ There are no \quote {\unknown\ while end of file \unknown} error tests
+ executed. This allows the expansion to end on a different grouping level or
+ while a conditional is still incomplete.
+\stopitem
+\stopitemize
+
+\subsection{\type {\toksapp}, \type {\tokspre}, \type {\etoksapp} and \type {\etokspre}}
+
+Instead of:
+
+\starttyping
+\toks0\expandafter{\the\toks0 foo}
+\stoptyping
+
+you can use:
+
+\starttyping
+\etoksapp0{foo}
+\stoptyping
+
+The \type {pre} variants prepend instead of append, and the \type {e} variants
+expand the passed general text.
+
+\subsection{\type {\csstring}, \type {\begincsname} and \type {\lastnamedcs}}
+
+These are somewhat special. The \type {\csstring} primitive is like
+\type {\string} but it omits the leading escape character. This can be
+somewhat more efficient that stripping it of afterwards.
+
+The \type {\begincsname} primitive is like \type {\csname} but doesn't create
+a relaxed equivalent when there is no such name. It is equivalent to
+
+\starttyping
+\ifcsname foo\endcsname
+ \csname foo\endcsname
+\fi
+\stoptyping
+
+The advantage is that it saves a lookup (don't expect much speedup) but more
+important is that it avoids using the \type {\if}.
+
+The \type {\lastnamedcs} is one that should be used with care. The above
+example could be written as:
+
+\starttyping
+\ifcsname foo\endcsname
+ \lastnamedcs
+\fi
+\stoptyping
+
+This is slightly more efficient than constructing the string twice (deep down in
+\LUATEX\ this also involves some \UTF8 juggling), but probably more relevant is
+that it saves a few tokens and can make code a bit more more readable.
+
+\subsection{\type {\clearmarks}}
+
+This primitive complements the \ETEX\ mark primitives and clears a mark class
+completely, resetting all three connected mark texts to empty. It is an
+immediate command.
+
+\startsyntax
+\clearmarks <16-bit number>
+\stopsyntax
+
+\subsection{\type{\letcharcode}}
+
+This primitive is still experimental but can be used to assign a meaning to an active
+character, as in:
+
+\starttyping
+\def\foo{bar} \letcharcode123\foo
+\stoptyping
+
+This can be a bit nicer that using the uppercase tricks (using the property of
+\type {\uppercase} that it treats active characters special).
+
+\section{Boxes, rules and leaders}
+
+\subsection{\type {\outputbox}}
+
+\startsyntax
+\outputbox = 65535
+\stopsyntax
+
+This new integer parameter allows you to alter the number of the box that will be
+used to store the page sent to the output routine. Its default value is 255, and
+the acceptable range is from 0 to 65535.
+
+\subsection{\type {\vpack}, \type {\hpack} and \type {\tpack}}
+
+These three primitives are like \type {\vbox}, \type {\hbox} and \type {\vtop}
+but don't apply the related callbacks.
+
+\subsection{\type {\vsplit}}
+
+The \type {\vsplit} primitive has to be followed by a specification of the
+required height. As alternative for the \type {to} keyword you can use \type
+{upto} to get a split of the given size but result has the natural dimensions
+then.
+
+\subsection{Images and Forms}
+
+These two concepts are now core concepts and no longer whatsits. They are in fact
+now implemented as rules with special properties. Normal rules have subtype~0,
+saved boxes have subtype~1 and images have subtype~2. This has the positive side
+effect that whenever we need to take content with dimensions into account, when we
+look at rule nodes, we automatically also deal with these two types.
+
+The syntax of the \type {\save...resource} is the same as in \PDFTEX\ but you
+should consider them to be backend specific. This means that a macro package
+should treat them as such and check for the current output mode if applicable.
+Here are the equivalents:
+
+\starttabulate[|l|l|]
+\NC \type {\saveboxresource} \EQ \type {\pdfxform} \NC \NR
+\NC \type {\saveimageresource} \EQ \type {\pdfximage} \NC \NR
+\NC \type {\useboxresource} \EQ \type {\pdfrefxform} \NC \NR
+\NC \type {\useimageresource} \EQ \type {\pdfrefximage} \NC \NR
+\NC \type {\lastsavedboxresourceindex} \EQ \type {\pdflastxform} \NC \NR
+\NC \type {\lastsavedimageresourceindex} \EQ \type {\pdflastximage} \NC \NR
+\NC \type {\lastsavedimageresourcepages} \EQ \type {\pdflastximagepages} \NC \NR
+\stoptabulate
+
+\LUATEX\ accepts optional dimension parameters for \type {\use...resource} in the
+same format as for rules. With images, these dimensions are then used instead of
+the ones given to \type {\useimageresource} but the original dimensions are not
+overwritten, so that a \type {\useimageresource} without dimensions still
+provides the image with dimensions defined by \type {\saveimageresource}. These
+optional parameters are not implemented for \type {\saveboxresource}.
+
+\starttyping
+\useimageresource width 20mm height 10mm depth 5mm \lastsavedimageresourceindex
+\useboxresource width 20mm height 10mm depth 5mm \lastsavedboxresourceindex
+\stoptyping
+
+The box resources are of course implemented in the backend and therefore we do
+support the \type {attr} and \type {resources} keys that accept a token list. New
+is the \type {type} key. When set to non|-|zero the \type {/Type} entry is
+omitted. A value of 1 or 3 still writes a \type {/BBox}, while 2 or 3 will write
+a \type {/Matrix}.
+
+\subsection{\type {\nohrule} and \type {\novrule}}
+
+Because introducing a new keyword can cause incompatibilities, two new primitives
+were introduced: \type {\nohrule} and \type {\novrule}. These can be used to
+reserve space. This is often more efficient than creating an empty box with fake
+dimensions).
+
+\subsection{\type {\gleaders}}
+
+This type of leaders is anchored to the origin of the box to be shipped out. So
+they are like normal \type {\leaders} in that they align nicely, except that the
+alignment is based on the {\it largest\/} enclosing box instead of the {\it
+smallest\/}. The \type {g} stresses this global nature.
+
+\section {Languages}
+
+\subsection{\type {\hyphenationmin}}
+
+This primitive can be used to set the minimal word length, so setting it to a value
+of~$5$ means that only words of 6 characters and more will be hyphenated, of course
+within the constraints of the \type {\lefthyphenmin} and \type {\righthyphenmin}
+values (as stored in the glyph node). This primitive accepts a number and stores
+the value with the language.
+
+\subsection{\type {\boundary}, \type {\noboundary}, \type {\protrusionboundary} and \type
+{\wordboundary}}
+
+The \type {\noboundary} commands used to inject a whatsit node but now injects a normal
+node with type \type {boundary} and subtype~0. In addition you can say:
+
+\starttyping
+x\boundary 123\relax y
+\stoptyping
+
+This has the same effect but the subtype is now~1 and the value~123 is stored.
+The traditional ligature builder still sees this as a cancel boundary directive
+but at the \LUA\ end you can implement different behaviour. The added benefit of
+passing this value is a side effect of the generalization. The subtypes~2 and~3
+are used to control protrusion and word boundaries in hyphenation.
+
+\section{Control and debugging}
+
+\subsection {Tracing}
+
+If \type {\tracingonline} is larger than~2, the node list display will also print
+the node number of the nodes.
+
+\subsection{\type {\outputmode} and \type {\draftmode}}
+
+The \type {\outputmode} variable tells \LUATEX\ what it has to produce:
+
+\starttabulate[|l|l|]
+\NC \type {0} \NC \DVI\ code \NC \NR
+\NC \type {1} \NC \PDF\ code \NC \NR
+\stoptabulate
+
+The value of the \type {\draftmode} counter signals the backend if it should
+output less. The \PDF\ backend accepts a value of~$1$, while the \DVI\ backend
+ignores the value.
+
+\section {Files}
+
+\subsection{File syntax}
+
+\LUATEX\ will accept a braced argument as a file name:
+
+\starttyping
+\input {plain}
+\openin 0 {plain}
+\stoptyping
+
+This allows for embedded spaces, without the need for double quotes. Macro
+expansion takes place inside the argument.
+
+\subsection{Writing to file}
+
+You can now open upto 127 files with \type {\openout}. When no file is open
+writes will go to the console and log. As a consequence a system command is
+no longer possible but one can use \type {os.execute} to do the same.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/luatex/luatex-fonts.tex b/doc/context/sources/general/manuals/luatex/luatex-fonts.tex
new file mode 100644
index 000000000..90412ea81
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex-fonts.tex
@@ -0,0 +1,719 @@
+% language=uk
+
+\environment luatex-style
+\environment luatex-logos
+
+\startcomponent luatex-fonts
+
+\startchapter[reference=fonts,title={Font structure}]
+
+\section {The font tables}
+
+All \TEX\ fonts are represented to \LUA\ code as tables, and internally as
+\CCODE~structures. All keys in the table below are saved in the internal font
+structure if they are present in the table returned by the \type {define_font}
+callback, or if they result from the normal \TFM|/|\VF\ reading routines if there
+is no \type {define_font} callback defined.
+
+The column \quote {\VF} means that this key will be created by the \type
+{font.read_vf()} routine, \quote {\TFM} means that the key will be created by the
+\type {font.read_tfm()} routine, and \quote{used} means whether or not the
+\LUATEX\ engine itself will do something with the key.
+
+The top|-|level keys in the table are as follows:
+
+\starttabulate[|Tl|c|c|c|l|p|]
+\NC \rmbf key \NC \bf vf \NC \bf tfm \NC \bf used \NC \bf value type \NC \bf description \NC \NR
+\NC name \NC yes \NC yes \NC yes \NC string \NC metric (file) name \NC \NR
+\NC area \NC no \NC yes \NC yes \NC string \NC (directory) location, typically empty \NC \NR
+\NC used \NC no \NC yes \NC yes \NC boolean\NC indicates usage (initial: false) \NC \NR
+\NC characters \NC yes \NC yes \NC yes \NC table \NC the defined glyphs of this font \NC \NR
+\NC checksum \NC yes \NC yes \NC no \NC number \NC default: 0 \NC \NR
+\NC designsize \NC no \NC yes \NC yes \NC number \NC expected size (default: 655360 == 10pt) \NC \NR
+\NC direction \NC no \NC yes \NC yes \NC number \NC default: 0 \NC \NR
+\NC encodingbytes \NC no \NC no \NC yes \NC number \NC default: depends on \type {format} \NC \NR
+\NC encodingname \NC no \NC no \NC yes \NC string \NC encoding name \NC \NR
+\NC fonts \NC yes \NC no \NC yes \NC table \NC locally used fonts \NC \NR
+\NC psname \NC no \NC no \NC yes \NC string \NC This is the \POSTSCRIPT\ fontname in the incoming font
+ source, and it's used as fontname identifier in the \PDF\
+ output. This has to be a valid string, e.g.\ no spaces
+ and such, as the backend will not do a cleanup. This gives
+ complete control to the loader. \NC \NR
+\NC fullname \NC no \NC no \NC yes \NC string \NC output font name, used as a fallback in the \PDF\ output
+ if the \type {psname} is not set \NC \NR
+\NC header \NC yes \NC no \NC no \NC string \NC header comments, if any \NC \NR
+\NC hyphenchar \NC no \NC no \NC yes \NC number \NC default: \TEX's \type {\hyphenchar} \NC \NR
+\NC parameters \NC no \NC yes \NC yes \NC hash \NC default: 7 parameters, all zero \NC \NR
+\NC size \NC no \NC yes \NC yes \NC number \NC loaded (at) size. (default: same as designsize) \NC \NR
+\NC skewchar \NC no \NC no \NC yes \NC number \NC default: \TEX's \type {\skewchar} \NC \NR
+\NC type \NC yes \NC no \NC yes \NC string \NC basic type of this font \NC \NR
+\NC format \NC no \NC no \NC yes \NC string \NC disk format type \NC \NR
+\NC embedding \NC no \NC no \NC yes \NC string \NC \PDF\ inclusion \NC \NR
+\NC filename \NC no \NC no \NC yes \NC string \NC the name of the font on disk \NC \NR
+\NC tounicode \NC no \NC yes \NC yes \NC number \NC When this is set to~1 \LUATEX\ assumes per|-|glyph
+ tounicode entries are present in the font. \NC \NR
+\NC stretch \NC no \NC no \NC yes \NC number \NC the \quote {stretch} value from \type
+ {\expandglyphsinfont} \NC \NR
+\NC shrink \NC no \NC no \NC yes \NC number \NC the \quote {shrink} value from \type
+ {\expandglyphsinfont} \NC \NR
+\NC step \NC no \NC no \NC yes \NC number \NC the \quote {step} value from \type
+ {\expandglyphsinfont} \NC \NR
+\NC auto_expand \NC no \NC no \NC yes \NC boolean\NC the \quote {autoexpand} keyword from \crlf
+ \type {\expandglyphsinfont} \NC \NR
+\NC expansion_factor \NC no \NC no \NC no \NC number \NC the actual expansion factor of an expanded font \NC \NR
+\NC attributes \NC no \NC no \NC yes \NC string \NC the \type {\pdffontattr} \NC \NR
+\NC cache \NC no \NC no \NC yes \NC string \NC This key controls caching of the \LUA\ table on the
+ \TEX\ end where \type {yes} means: use a reference to
+ the table that is passed to \LUATEX\ (this is the
+ default), and no \type {no} means: don't store the
+ table reference, don't cache any \LUA\ data for this
+ font while \type {renew} means: don't store the table
+ reference, but save a reference to the table that is
+ created at the first access to one of its fields in font.
+ Note: the saved reference is thread|-|local, so be
+ careful when you are using coroutines: an error will be
+ thrown if the table has been cached in one thread, but
+ you reference it from another thread. \NC \NR
+\NC nomath \NC no \NC no \NC yes \NC boolean\NC This key allows a minor speedup for text fonts. If it
+ is present and true, then \LUATEX\ will not check the
+ character entries for math|-|specific keys. \NC \NR
+\NC slant \NC no \NC no \NC yes \NC number \NC This has the same semantics as the \type {SlantFont}
+ operator in font map files. \NC \NR
+\NC extent \NC no \NC no \NC yes \NC number \NC This has the same semantics as the \type {ExtendFont}
+ operator in font map files. \NC \NR
+\stoptabulate
+
+The key \type {name} is always required. The keys \type {stretch}, \type
+{shrink}, \type {step} and optionally \type {auto_expand} only have meaning when
+used together: they can be used to replace a post|-|loading \type
+{\expandglyphsinfont} command. The \type {expansion_factor} is value that can be
+present inside a font in \type {font.fonts}. It is the actual expansion factor (a
+value between \type {-shrink} and \type {stretch}, with step \type {step}) of a
+font that was automatically generated by the font expansion algorithm. The key
+\type {attributes} can be used to set font attributes in the \PDF\ file. The key
+\type {used} is set by the engine when a font is actively in use, this makes sure
+that the font's definition is written to the output file (\DVI\ or \PDF). The
+\TFM\ reader sets it to false. The \type {direction} is a number signalling the
+\quote {normal} direction for this font. There are sixteen possibilities:
+
+\starttabulate[|Tc|Tc|Tc|Tc|]
+\NC \rmbf number \NC \rmbf meaning \NC \rmbf number \NC \rmbf meaning \NC\NR
+\NC 0 \NC LT \NC 8 \NC TT \NC\NR
+\NC 1 \NC LL \NC 9 \NC TL \NC\NR
+\NC 2 \NC LB \NC 10 \NC TB \NC\NR
+\NC 3 \NC LR \NC 11 \NC TR \NC\NR
+\NC 4 \NC RT \NC 12 \NC BT \NC\NR
+\NC 5 \NC RL \NC 13 \NC BL \NC\NR
+\NC 6 \NC RB \NC 14 \NC BB \NC\NR
+\NC 7 \NC RR \NC 15 \NC BR \NC\NR
+\stoptabulate
+
+These are \OMEGA|-|style direction abbreviations: the first character indicates
+the \quote {first} edge of the character glyphs (the edge that is seen first in
+the writing direction), the second the \quote {top} side. Keep in mind that
+\LUATEX\ has a bit different directional model so these values are not used for
+anything.
+
+The \type {parameters} is a hash with mixed key types. There are seven possible
+string keys, as well as a number of integer indices (these start from 8 up). The
+seven strings are actually used instead of the bottom seven indices, because that
+gives a nicer user interface.
+
+The names and their internal remapping are:
+
+\starttabulate[|lT|c|]
+\NC \rmbf name \NC \rmbf remapping \NC\NR
+\NC slant \NC 1 \NC\NR
+\NC space \NC 2 \NC\NR
+\NC space_stretch \NC 3 \NC\NR
+\NC space_shrink \NC 4 \NC\NR
+\NC x_height \NC 5 \NC\NR
+\NC quad \NC 6 \NC\NR
+\NC extra_space \NC 7 \NC\LR
+\stoptabulate
+
+The keys \type {type}, \type {format}, \type {embedding}, \type {fullname} and
+\type {filename} are used to embed \OPENTYPE\ fonts in the result \PDF.
+
+The \type {characters} table is a list of character hashes indexed by an integer
+number. The number is the \quote {internal code} \TEX\ knows this character by.
+
+Two very special string indexes can be used also: \type {left_boundary} is a
+virtual character whose ligatures and kerns are used to handle word boundary
+processing. \type {right_boundary} is similar but not actually used for anything
+(yet).
+
+Other index keys are ignored.
+
+Each character hash itself is a hash. For example, here is the character \quote
+{f} (decimal 102) in the font \type {cmr10 at 10pt}:
+
+\starttyping
+[102] = {
+ ['width'] = 200250,
+ ['height'] = 455111,
+ ['depth'] = 0,
+ ['italic'] = 50973,
+ ['kerns'] = {
+ [63] = 50973,
+ [93] = 50973,
+ [39] = 50973,
+ [33] = 50973,
+ [41] = 50973
+ },
+ ['ligatures'] = {
+ [102] = {
+ ['char'] = 11,
+ ['type'] = 0
+ },
+ [108] = {
+ ['char'] = 13,
+ ['type'] = 0
+ },
+ [105] = {
+ ['char'] = 12,
+ ['type'] = 0
+ }
+ }
+}
+\stoptyping
+
+The following top|-|level keys can be present inside a character hash:
+
+\starttabulate[|lT|c|c|c|l|p|]
+\NC \rmbf key \NC \bf vf \NC \bf tfm \NC \bf used \NC \bf type \NC \bf description \NC\NR
+\NC width \NC yes \NC yes \NC yes \NC number \NC character's width, in sp (default 0) \NC\NR
+\NC height \NC no \NC yes \NC yes \NC number \NC character's height, in sp (default 0) \NC\NR
+\NC depth \NC no \NC yes \NC yes \NC number \NC character's depth, in sp (default 0) \NC\NR
+\NC italic \NC no \NC yes \NC yes \NC number \NC character's italic correction, in sp (default zero) \NC\NR
+\NC top_accent \NC no \NC no \NC maybe \NC number \NC character's top accent alignment place, in sp (default zero) \NC\NR
+\NC bot_accent \NC no \NC no \NC maybe \NC number \NC character's bottom accent alignment place, in sp (default zero) \NC\NR
+\NC left_protruding \NC no \NC no \NC maybe \NC number \NC character's \type {\lpcode} \NC\NR
+\NC right_protruding \NC no \NC no \NC maybe \NC number \NC character's \type {\rpcode} \NC\NR
+\NC expansion_factor \NC no \NC no \NC maybe \NC number \NC character's \type {\efcode} \NC\NR
+\NC tounicode \NC no \NC no \NC maybe \NC string \NC character's \UNICODE\ equivalent(s), in \UTF|-|16BE hexadecimal format \NC\NR
+\NC next \NC no \NC yes \NC yes \NC number \NC the \quote {next larger} character index \NC\NR
+\NC extensible \NC no \NC yes \NC yes \NC table \NC the constituent parts of an extensible recipe \NC\NR
+\NC vert_variants \NC no \NC no \NC yes \NC table \NC constituent parts of a vertical variant set \NC \NR
+\NC horiz_variants \NC no \NC no \NC yes \NC table \NC constituent parts of a horizontal variant set \NC \NR
+\NC kerns \NC no \NC yes \NC yes \NC table \NC kerning information \NC\NR
+\NC ligatures \NC no \NC yes \NC yes \NC table \NC ligaturing information \NC\NR
+\NC commands \NC yes \NC no \NC yes \NC array \NC virtual font commands \NC\NR
+\NC name \NC no \NC no \NC no \NC string \NC the character (\POSTSCRIPT) name \NC\NR
+\NC index \NC no \NC no \NC yes \NC number \NC the (\OPENTYPE\ or \TRUETYPE) font glyph index \NC\NR
+\NC used \NC no \NC yes \NC yes \NC boolean \NC typeset already (default: false)? \NC\NR
+\NC mathkern \NC no \NC no \NC yes \NC table \NC math cut-in specifications \NC\NR
+\stoptabulate
+
+The values of \type {top_accent}, \type {bot_accent} and \type {mathkern} are
+used only for math accent and superscript placement, see the \at {math chapter}
+[math] in this manual for details.
+
+The values of \type {left_protruding} and \type {right_protruding} are used only
+when \type {\protrudechars} is non-zero.
+
+Whether or not \type {expansion_factor} is used depends on the font's global
+expansion settings, as well as on the value of \type {\adjustspacing}.
+
+The usage of \type {tounicode} is this: if this font specifies a \type
+{tounicode=1} at the top level, then \LUATEX\ will construct a \type {/ToUnicode}
+entry for the \PDF\ font (or font subset) based on the character|-|level \type
+{tounicode} strings, where they are available. If a character does not have a
+sensible \UNICODE\ equivalent, do not provide a string either (no empty strings).
+
+If the font level \type {tounicode} is not set, then \LUATEX\ will build up \type
+{/ToUnicode} based on the \TEX\ code points you used, and any character-level
+\type {tounicodes} will be ignored. The string format is exactly the format that
+is expected by Adobe \CMAP\ files (\UTF-16BE in hexadecimal encoding), minus the
+enclosing angle brackets. For instance the \type {tounicode} for a \type {fi}
+ligature would be \type {00660069}. When you pass a number the conversion will be
+done for you.
+
+The presence of \type {extensible} will overrule \type {next}, if that is also
+present. It in in turn can be overruled by \type {vert_variants}.
+
+The \type {extensible} table is very simple:
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf key \NC \bf type \NC \bf description \NC\NR
+\NC top \NC number \NC top character index \NC\NR
+\NC mid \NC number \NC middle character index \NC\NR
+\NC bot \NC number \NC bottom character index \NC\NR
+\NC rep \NC number \NC repeatable character index \NC\NR
+\stoptabulate
+
+The \type {horiz_variants} and \type {vert_variants} are arrays of components.
+Each of those components is itself a hash of up to five keys:
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf key \NC \bf type \NC \bf explanation \NC\NR
+\NC glyph \NC number \NC The character index. Note that this is an encoding number, not a name. \NC \NR
+\NC extender \NC number \NC One (1) if this part is repeatable, zero (0) otherwise. \NC \NR
+\NC start \NC number \NC The maximum overlap at the starting side (in scaled points). \NC \NR
+\NC end \NC number \NC The maximum overlap at the ending side (in scaled points). \NC \NR
+\NC advance \NC number \NC The total advance width of this item. It can be zero or missing,
+ then the natural size of the glyph for character \type {component}
+ is used. \NC \NR
+\stoptabulate
+
+The \type {kerns} table is a hash indexed by character index (and \quote
+{character index} is defined as either a non|-|negative integer or the string
+value \type {right_boundary}), with the values the kerning to be applied, in
+scaled points.
+
+The \type {ligatures} table is a hash indexed by character index (and \quote
+{character index} is defined as either a non|-|negative integer or the string
+value \type {right_boundary}), with the values being yet another small hash, with
+two fields:
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf key \NC \bf type \NC \bf description \NC \NR
+\NC type \NC number \NC the type of this ligature command, default 0 \NC \NR
+\NC char \NC number \NC the character index of the resultant ligature \NC \NR
+\stoptabulate
+
+The \type {char} field in a ligature is required.
+
+The \type {type} field inside a ligature is the numerical or string value of one
+of the eight possible ligature types supported by \TEX. When \TEX\ inserts a new
+ligature, it puts the new glyph in the middle of the left and right glyphs. The
+original left and right glyphs can optionally be retained, and when at least one
+of them is kept, it is also possible to move the new \quote {insertion point}
+forward one or two places. The glyph that ends up to the right of the insertion
+point will become the next \quote {left}.
+
+\starttabulate[|l|c|l|l|]
+\NC \bf textual (Knuth) \NC \bf number \NC \bf string \NC result \NC\NR
+\NC \type{l + r =: n} \NC 0 \NC \type{=:} \NC \type{|n} \NC\NR
+\NC \type{l + r =:| n} \NC 1 \NC \type{=:|} \NC \type{|nr} \NC\NR
+\NC \type{l + r |=: n} \NC 2 \NC \type{|=:} \NC \type{|ln} \NC\NR
+\NC \type{l + r |=:| n} \NC 3 \NC \type{|=:|} \NC \type{|lnr} \NC\NR
+\NC \type{l + r =:|> n} \NC 5 \NC \type{=:|>} \NC \type{n|r} \NC\NR
+\NC \type{l + r |=:> n} \NC 6 \NC \type{|=:>} \NC \type{l|n} \NC\NR
+\NC \type{l + r |=:|> n} \NC 7 \NC \type{|=:|>} \NC \type{l|nr} \NC\NR
+\NC \type{l + r |=:|>> n} \NC 11 \NC \type{|=:|>>} \NC \type{ln|r} \NC\NR
+\stoptabulate
+
+The default value is~0, and can be left out. That signifies a \quote {normal}
+ligature where the ligature replaces both original glyphs. In this table the~\type {|}
+indicates the final insertion point.
+
+The \type {commands} array is explained below.
+
+\section {Real fonts}
+
+Whether or not a \TEX\ font is a \quote {real} font that should be written to the
+\PDF\ document is decided by the \type {type} value in the top|-|level font
+structure. If the value is \type {real}, then this is a proper font, and the
+inclusion mechanism will attempt to add the needed font object definitions to the
+\PDF. Values for \type {type} are:
+
+\starttabulate[|Tl|p|]
+\NC \rmbf value \NC \rmbf description \NC\NR
+\NC real \NC this is a base font \NC\NR
+\NC virtual \NC this is a virtual font \NC\NR
+\stoptabulate
+
+The actions to be taken depend on a number of different variables:
+
+\startitemize[packed]
+\startitem
+ Whether the used font fits in an 8-bit encoding scheme or not.
+\stopitem
+\startitem
+ The type of the disk font file.
+\stopitem
+\startitem
+ The level of embedding requested.
+\stopitem
+\stopitemize
+
+A font that uses anything other than an 8-bit encoding vector has to be written
+to the \PDF\ in a different way.
+
+The rule is: if the font table has \type {encodingbytes} set to~2, then this is a
+wide font, in all other cases it isn't. The value~2 is the default for \OPENTYPE\
+and \TRUETYPE\ fonts loaded via \LUA. For \TYPEONE\ fonts, you have to set \type
+{encodingbytes} to~2 explicitly. For \PK\ bitmap fonts, wide font encoding is not
+supported at all.
+
+If no special care is needed, \LUATEX\ currently falls back to the
+mapfile|-|based solution used by \PDFTEX\ and \DVIPS. This behaviour might
+silently be removed in the future, in which case the related primitives and \LUA\
+functions will become no|-|ops.
+
+If a \quote {wide} font is used, the new subsystem kicks in, and some
+extra fields have to be present in the font structure. In this case, \LUATEX\
+does not use a map file at all.
+
+The extra fields are: \type {format}, \type {embedding}, \type {fullname}, \type
+{cidinfo} (as explained above), \type {filename}, and the \type {index} key in
+the separate characters.
+
+Values for \type {format} are:
+
+\starttabulate[|Tl|p|]
+\NC \rmbf value \NC \rmbf description \NC \NR
+\NC type1 \NC this is a \POSTSCRIPT\ \TYPEONE\ font \NC \NR
+\NC type3 \NC this is a bitmapped (\PK) font \NC \NR
+\NC truetype \NC this is a \TRUETYPE\ or \TRUETYPE|-|based \OPENTYPE\ font \NC \NR
+\NC opentype \NC this is a \POSTSCRIPT|-|based \OPENTYPE\ font \NC \NR
+\stoptabulate
+
+\type {type3} fonts are provided for backward compatibility only, and do not
+support the new wide encoding options.
+
+Values for \type {embedding} are:
+
+\starttabulate[|Tl|p|]
+\NC \rmbf value \NC \rmbf description \NC \NR
+\NC no \NC don't embed the font at all \NC \NR
+\NC subset \NC include and atttempt to subset the font \NC \NR
+\NC full \NC include this font in its entirety \NC \NR
+\stoptabulate
+
+The other fields are used as follows: The \type {fullname} will be the
+\POSTSCRIPT|/|\PDF\ font name. The \type {cidinfo} will be used as the character
+set (the CID \type {/Ordering} and \type {/Registry} keys). The \type {filename}
+points to the actual font file. If you include the full path in the \type
+{filename} or if the file is in the local directory, \LUATEX\ will run a little
+bit more efficient because it will not have to re|-|run the \type {find_xxx_file}
+callback in that case.
+
+Be careful: when mixing old and new fonts in one document, it is possible to
+create \POSTSCRIPT\ name clashes that can result in printing errors. When this
+happens, you have to change the \type {fullname} of the font.
+
+Typeset strings are written out in a wide format using 2~bytes per glyph, using
+the \type {index} key in the character information as value. The overall effect
+is like having an encoding based on numbers instead of traditional (\POSTSCRIPT)
+name|-|based reencoding. The way to get the correct \type {index} numbers for
+\TYPEONE\ fonts is by loading the font via \type {fontloader.open} and use the table
+indices as \type {index} fields.
+
+In order to make sure that cut and paste of the final document works okay you can
+best make sure that there is a \type {tounicode} vector enforced.
+
+\section[virtualfonts]{Virtual fonts}
+
+\subsection{The structure}
+
+You have to take the following steps if you want \LUATEX\ to treat the returned
+table from \type {define_font} as a virtual font:
+
+\startitemize[packed]
+\startitem
+ Set the top|-|level key \type {type} to \type {virtual}.
+\stopitem
+\startitem
+ Make sure there is at least one valid entry in \type {fonts} (see below).
+\stopitem
+\startitem
+ Give a \type {commands} array to every character (see below).
+\stopitem
+\stopitemize
+
+The presence of the toplevel \type {type} key with the specific value \type
+{virtual} will trigger handling of the rest of the special virtual font fields in
+the table, but the mere existence of 'type' is enough to prevent \LUATEX\ from
+looking for a virtual font on its own.
+
+Therefore, this also works \quote {in reverse}: if you are absolutely certain
+that a font is not a virtual font, assigning the value \type {base} or \type
+{real} to \type {type} will inhibit \LUATEX\ from looking for a virtual font
+file, thereby saving you a disk search.
+
+The \type {fonts} is another \LUA\ array. The values are one- or two|-|key
+hashes themselves, each entry indicating one of the base fonts in a virtual font.
+In case your font is referring to itself, you can use the \type {font.nextid()}
+function which returns the index of the next to be defined font which is probably
+the currently defined one.
+
+An example makes this easy to understand
+
+\starttyping
+fonts = {
+ { name = 'ptmr8a', size = 655360 },
+ { name = 'psyr', size = 600000 },
+ { id = 38 }
+}
+\stoptyping
+
+says that the first referenced font (index 1) in this virtual font is \type
+{ptrmr8a} loaded at 10pt, and the second is \type {psyr} loaded at a little over
+9pt. The third one is previously defined font that is known to \LUATEX\ as font id
+\quote {38}.
+
+The array index numbers are used by the character command definitions that are
+part of each character.
+
+The \type {commands} array is a hash where each item is another small array,
+with the first entry representing a command and the extra items being the
+parameters to that command. The allowed commands and their arguments are:
+
+\starttabulate[|Tl|l|l|p|]
+\NC \rmbf command name \NC \bf arguments \NC \bf type \NC \bf description \NC\NR
+\NC font \NC 1 \NC number \NC select a new font from the local \type {fonts} table\NC\NR
+\NC char \NC 1 \NC number \NC typeset this character number from the current font,
+ and move right by the character's width\NC\NR
+\NC node \NC 1 \NC node \NC output this node (list), and move right
+ by the width of this list\NC\NR
+\NC slot \NC 2 \NC number \NC a shortcut for the combination of a font and char command\NC\NR
+\NC push \NC 0 \NC \NC save current position\NC\NR
+\NC nop \NC 0 \NC \NC do nothing \NC\NR
+\NC pop \NC 0 \NC \NC pop position \NC\NR
+\NC rule \NC 2 \NC 2 numbers \NC output a rule $ht*wd$, and move right.\NC\NR
+\NC down \NC 1 \NC number \NC move down on the page\NC\NR
+\NC right \NC 1 \NC number \NC move right on the page\NC\NR
+\NC special \NC 1 \NC string \NC output a \type {\special} command\NC\NR
+\NC lua \NC 1 \NC string \NC execute a \LUA\ script (at \type {\latelua} time)\NC\NR
+\NC image \NC 1 \NC image \NC output an image (the argument can be either an \type
+ {<image>} variable or an \type {image_spec} table)\NC\NR
+\NC comment \NC any \NC any \NC the arguments of this command are ignored\NC\NR
+\stoptabulate
+
+When a font id is set to~0 then it will be replaced by the currently assigned
+font id. This prevents the need for hackery with future id's (normally one could
+use \type {font.nextid} but when more complex fonts are built in the meantime
+other instances could have been loaded.
+
+Here is a rather elaborate glyph commands example:
+
+\starttyping
+...
+commands = {
+ { 'push' }, -- remember where we are
+ { 'right', 5000 }, -- move right about 0.08pt
+ { 'font', 3 }, -- select the fonts[3] entry
+ { 'char', 97 }, -- place character 97 (ASCII 'a')
+ { 'pop' }, -- go all the way back
+ { 'down', -200000 }, -- move upwards by about 3pt
+ { 'special', 'pdf: 1 0 0 rg' } -- switch to red color
+ { 'rule', 500000, 20000 } -- draw a bar
+ { 'special','pdf: 0 g' } -- back to black
+}
+...
+\stoptyping
+
+The default value for \type {font} is always~1 at the start of the
+\type {commands} array. Therefore, if the virtual font is essentially only a
+re|-|encoding, then you do usually not have create an explicit \quote {font}
+command in the array.
+
+Rules inside of \type {commands} arrays are built up using only two dimensions:
+they do not have depth. For correct vertical placement, an extra \type {down}
+command may be needed.
+
+Regardless of the amount of movement you create within the \type {commands}, the
+output pointer will always move by exactly the width that was given in the \type
+{width} key of the character hash. Any movements that take place inside the \type
+{commands} array are ignored on the upper level.
+
+\subsection{Artificial fonts}
+
+Even in a \quote {real} font, there can be virtual characters. When \LUATEX\
+encounters a \type {commands} field inside a character when it becomes time to
+typeset the character, it will interpret the commands, just like for a true
+virtual character. In this case, if you have created no \quote {fonts} array,
+then the default (and only) \quote {base} font is taken to be the current font
+itself. In practice, this means that you can create virtual duplicates of
+existing characters which is useful if you want to create composite characters.
+
+Note: this feature does {\it not\/} work the other way around. There can not be
+\quote {real} characters in a virtual font! You cannot use this technique for
+font re-encoding either; you need a truly virtual font for that (because
+characters that are already present cannot be altered).
+
+\subsection{Example virtual font}
+
+Finally, here is a plain \TEX\ input file with a virtual font demonstration:
+
+\startbuffer
+\directlua {
+ callback.register('define_font',
+ function (name,size)
+ if name == 'cmr10-red' then
+ f = font.read_tfm('cmr10',size)
+ f.name = 'cmr10-red'
+ f.type = 'virtual'
+ f.fonts = {{ name = 'cmr10', size = size }}
+ for i,v in pairs(f.characters) do
+ if (string.char(i)):find('[tacohanshartmut]') then
+ v.commands = {
+ {'special','pdf: 1 0 0 rg'},
+ {'char',i},
+ {'special','pdf: 0 g'},
+ }
+ else
+ v.commands = {{'char',i}}
+ end
+ end
+ else
+ f = font.read_tfm(name,size)
+ end
+ return f
+ end
+ )
+}
+
+\font\myfont = cmr10-red at 10pt \myfont This is a line of text \par
+\font\myfontx= cmr10 at 10pt \myfontx Here is another line of text \par
+\stopbuffer
+
+\typebuffer
+
+\section{The \type {font} library}
+
+The font library provides the interface into the internals of the font system,
+and also it contains helper functions to load traditional \TEX\ font metrics
+formats. Other font loading functionality is provided by the \type {fontloader}
+library that will be discussed in the next section.
+
+\subsection{Loading a \TFM\ file}
+
+The behavior documented in this subsection is considered stable in the sense that
+there will not be backward-incompatible changes any more.
+
+\startfunctioncall
+<table> fnt =
+ font.read_tfm(<string> name, <number> s)
+\stopfunctioncall
+
+The number is a bit special:
+
+\startitemize
+\startitem
+ If it is positive, it specifies an \quote {at size} in scaled points.
+\stopitem
+\startitem
+ If it is negative, its absolute value represents a \quote {scaled}
+ setting relative to the designsize of the font.
+\stopitem
+\stopitemize
+
+The internal structure of the metrics font table that is returned is explained in
+\in {chapter} [fonts].
+
+\subsection{Loading a \VF\ file}
+
+The behavior documented in this subsection is considered stable in the sense that
+there will not be backward-incompatible changes any more.
+
+\startfunctioncall
+<table> vf_fnt =
+ font.read_vf(<string> name, <number> s)
+\stopfunctioncall
+
+The meaning of the number \type {s} and the format of the returned table are
+similar to the ones in the \type {read_tfm()} function.
+
+\subsection{The fonts array}
+
+The whole table of \TEX\ fonts is accessible from \LUA\ using a virtual array.
+
+\starttyping
+font.fonts[n] = { ... }
+<table> f = font.fonts[n]
+\stoptyping
+
+See \in {chapter} [fonts] for the structure of the tables. Because this is a
+virtual array, you cannot call \type {pairs} on it, but see below for the \type
+{font.each} iterator.
+
+The two metatable functions implementing the virtual array are:
+
+\startfunctioncall
+<table> f = font.getfont(<number> n)
+font.setfont(<number> n, <table> f)
+\stopfunctioncall
+
+Note that at the moment, each access to the \type {font.fonts} or call to \type
+{font.getfont} creates a \LUA\ table for the whole font. This process can be quite
+slow. In a later version of \LUATEX, this interface will change (it will start
+using userdata objects instead of actual tables).
+
+Also note the following: assignments can only be made to fonts that have already
+been defined in \TEX, but have not been accessed {\it at all\/} since that
+definition. This limits the usability of the write access to \type {font.fonts}
+quite a lot, a less stringent ruleset will likely be implemented later.
+
+\subsection{Checking a font's status}
+
+You can test for the status of a font by calling this function:
+
+\startfunctioncall
+<boolean> f =
+ font.frozen(<number> n)
+\stopfunctioncall
+
+The return value is one of \type {true} (unassignable), \type {false} (can be
+changed) or \type {nil} (not a valid font at all).
+
+\subsection{Defining a font directly}
+
+You can define your own font into \type {font.fonts} by calling this function:
+
+\startfunctioncall
+<number> i =
+ font.define(<table> f)
+\stopfunctioncall
+
+The return value is the internal id number of the defined font (the index into
+\type {font.fonts}). If the font creation fails, an error is raised. The table
+is a font structure, as explained in \in {chapter} [fonts].
+
+\subsection{Projected next font id}
+
+\startfunctioncall
+<number> i =
+ font.nextid()
+\stopfunctioncall
+
+This returns the font id number that would be returned by a \type {font.define}
+call if it was executed at this spot in the code flow. This is useful for virtual
+fonts that need to reference themselves.
+
+\subsection{Font id}
+
+\startfunctioncall
+<number> i =
+ font.id(<string> csname)
+\stopfunctioncall
+
+This returns the font id associated with \type {csname} string, or $-1$ if \type
+{csname} is not defined.
+
+\subsection{Currently active font}
+
+\startfunctioncall
+<number> i = font.current()
+font.current(<number> i)
+\stopfunctioncall
+
+This gets or sets the currently used font number.
+
+\subsection{Maximum font id}
+
+\startfunctioncall
+<number> i =
+ font.max()
+\stopfunctioncall
+
+This is the largest used index in \type {font.fonts}.
+
+\subsection{Iterating over all fonts}
+
+\startfunctioncall
+for i,v in font.each() do
+ ...
+end
+\stopfunctioncall
+
+This is an iterator over each of the defined \TEX\ fonts. The first returned
+value is the index in \type {font.fonts}, the second the font itself, as a \LUA\
+table. The indices are listed incrementally, but they do not always form an array
+of consecutive numbers: in some cases there can be holes in the sequence.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/luatex/luatex-introduction.tex b/doc/context/sources/general/manuals/luatex/luatex-introduction.tex
new file mode 100644
index 000000000..8ab8b4463
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex-introduction.tex
@@ -0,0 +1,121 @@
+% language=uk
+
+\environment luatex-style
+\environment luatex-logos
+
+\startcomponent luatex-introduction
+
+\startchapter[title=Introduction]
+
+This is the reference manual of \LUATEX. We don't claim it is complete and we
+assume that the reader knows about \TEX\ as described in \quotation {The \TEX\
+Book}, the \quotation {\ETEX\ manual}, the \quotation {\PDFTEX\ manual}, etc.
+Additional reference material is published in journals of user groups and
+\CONTEXT\ related documentation.
+
+It took about a decade to reach stable version 1.0, but for good reason.
+Successive versions brought new functionality, more control, some cleanup of
+internals and experimental features evolved into stable ones or were dropped.
+Already quite early \LUATEX\ could be used for production and it was used on a
+daily basis by the authors. Successive versions sometimes demanded a adaption to
+the \LUA\ interfacing, but the concepts were unchanged. The current version can
+be considered stable in functionality and there will be no fundamental changes.
+Of course we then can decide to move towards version 2.00 with different
+properties.
+
+Don't expect \LUATEX\ to behave the same as \PDFTEX ! Although the core
+functionality of that 8 bit engine was starting point, it has been combined with
+the directional support of \OMEGA\ (\ALEPH). But, \LUATEX\ can behave different
+due to its wide (32 bit) characters, many registers and large memory support.
+There is native \UTF\ input, support for large (more that 8 bit) fonts, and the
+math machinery is tuned for \OPENTYPE\ math. There is support for directional
+typesetting too. The log output can differ from other engines and will likely
+differ more as we move forward. When you run plain \TEX\ for sure \LUATEX\ runs
+slower than \PDFTEX\ but when you run for instance \CONTEXT\ \MKIV\ in many cases
+it runs faster, especially when you have a bit more complex documents or input.
+Anyway, 32 bit all||over combined with more features has a price, but on a modern
+machine this is no real problem.
+
+Testing is done with \CONTEXT, but \LUATEX\ should work fine with other macro
+packages too. For that purpose we provide generic font handlers that are mostly
+the same as used in \CONTEXT. Discussing specific implementations is beyond this
+manual. Even when we keep \LUATEX\ lean and mean, we already have enough to
+discuss here.
+
+\LUATEX\ consists of a number of interrelated but (still) distinguishable parts.
+The organization of the source code is adapted so that it can glue all these
+components together. We continue cleaning up side effects of the accumulated
+code in \TEX\ engines (especially code that is not needed any longer).
+
+\startitemize[packed]
+ \startitem
+ Most of \PDFTEX\ version 1.40.9, converted to \CCODE. Some experimental
+ features have been removed and some utility macros are not inherited as
+ their functionality can be done in \LUA. The number of backend interface
+ commands has been reduced to a few. The extensions are separated from the
+ core (which we keep close to the original \TEX\ core). Some mechanisms
+ like expansion and protrusion can behave different from the original due
+ to some cleanup and optimization. Some whatsit based functionality (image
+ support and reusable content) is now core functionality.
+ \stopitem
+ \startitem
+ The direction model and some other bits from \ALEPH\ RC4 (derived from
+ \OMEGA) is included. The related primitives are part of core \LUATEX\ but
+ at the node level directional support is no longer based on so called
+ whatsits but on real nodes. In fact, whatsits are now only used for
+ backend specific extensions.
+ \stopitem
+ \startitem
+ Neither \ALEPH's I/O translation processes, nor tcx files, nor \ENCTEX\
+ can be used, these encoding|-|related functions are superseded by a
+ \LUA|-|based solution (reader callbacks). In a similar fashion all file
+ \IO\ can be intercepted.
+ \stopitem
+ \startitem
+ We currently use \LUA\ 5.2.*. At some point we might decide to move to
+ 5.3.* but that is yet to be decided. There are few \LUA\ libraries that
+ we consider part of the core \LUA\ machinery, for instance \type {lpeg}.
+ There are additional \LUA\ libraries that interface to the internals of
+ \TEX.
+ \stopitem
+ \startitem
+ There are various \TEX\ extensions but only those that cannot be done
+ using the \LUA\ interfaces. The math machinery often has two code paths:
+ one traditional and the other more suitable for wide \OPENTYPE\ fonts.
+ \stopitem
+ \startitem
+ The fontloader uses parts of \FONTFORGE\ 2008.11.17 combined with
+ additional code specific for usage in a \TEX\ engine. We try to minimize
+ specific font support to what \TEX\ needs: character references and
+ dimensions and delegate everything else to \LUA. That way we keep \TEX\
+ open for extensions without touching the core.
+ \stopitem
+ \startitem
+ The \METAPOST\ library is integral part of \LUATEX. This gives \TEX\ some
+ graphical capabilities using a relative high speed graphical subsystem.
+ Again \LUA\ is used as glue between the frontend and backend. Further
+ development of \METAPOST\ is closely related to \LUATEX.
+ \stopitem
+\stopitemize
+
+The \TEXLIVE\ version is to be considered the current stable version. Any version
+between the yearly \TEXLIVE\ releases are to be considered beta. The beta
+releases are normally available via the \CONTEXT\ distribution channels (the
+garden and so called minimals).
+
+\blank[1*big]
+
+Hans Hagen, Harmut Henkel, \crlf
+Taco Hoekwater \& Luigi Scarso
+
+\blank[3*big]
+
+\starttabulate
+\NC Version \EQ \currentdate \NC \NR
+\NC \LUATEX \EQ Snapshot \number\luatexversion.\luatexrevision \NC \NR
+\NC \CONTEXT \EQ \contextversion \NC \NR
+\stoptabulate
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/luatex/luatex-languages.tex b/doc/context/sources/general/manuals/luatex/luatex-languages.tex
new file mode 100644
index 000000000..ad7b7b9d6
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex-languages.tex
@@ -0,0 +1,770 @@
+% language=uk
+
+\environment luatex-style
+\environment luatex-logos
+
+\startcomponent luatex-languages
+
+\startchapter[reference=languages,title={Languages, characters, fonts and glyphs}]
+
+\LUATEX's internal handling of the characters and glyphs that eventually become
+typeset is quite different from the way \TEX82 handles those same objects. The
+easiest way to explain the difference is to focus on unrestricted horizontal mode
+(i.e.\ paragraphs) and hyphenation first. Later on, it will be easy to deal
+with the differences that occur in horizontal and math modes.
+
+In \TEX82, the characters you type are converted into \type {char_node} records
+when they are encountered by the main control loop. \TEX\ attaches and processes
+the font information while creating those records, so that the resulting \quote
+{horizontal list} contains the final forms of ligatures and implicit kerning.
+This packaging is needed because we may want to get the effective width of for
+instance a horizontal box.
+
+When it becomes necessary to hyphenate words in a paragraph, \TEX\ converts (one
+word at time) the \type {char_node} records into a string by replacing ligatures
+with their components and ignoring the kerning. Then it runs the hyphenation
+algorithm on this string, and converts the hyphenated result back into a \quote
+{horizontal list} that is consecutively spliced back into the paragraph stream.
+Keep in mind that the paragraph may contain unboxed horizontal material, which
+then already contains ligatures and kerns and the words therein are part of the
+hyphenation process.
+
+Those \type {char_node} records are somewhat misnamed, as they are glyph
+positions in specific fonts, and therefore not really \quote {characters} in the
+linguistic sense. There is no language information inside the \type {char_node}
+records at all. Instead, language information is passed along using \type
+{language whatsit} records inside the horizontal list.
+
+In \LUATEX, the situation is quite different. The characters you type are always
+converted into \type {glyph_node} records with a special subtype to identify them
+as being intended as linguistic characters. \LUATEX\ stores the needed language
+information in those records, but does not do any font|-|related processing at
+the time of node creation. It only stores the index of the current font and a
+reference to a character in that font.
+
+When it becomes necessary to typeset a paragraph, \LUATEX\ first inserts all
+hyphenation points right into the whole node list. Next, it processes all the
+font information in the whole list (creating ligatures and adjusting kerning),
+and finally it adjusts all the subtype identifiers so that the records are \quote
+{glyph nodes} from now on.
+
+\section[charsandglyphs]{Characters and glyphs}
+
+\TEX82 (including \PDFTEX) differentiates between \type {char_node}s and \type
+{lig_node}s. The former are simple items that contained nothing but a \quote
+{character} and a \quote {font} field, and they lived in the same memory as
+tokens did. The latter also contained a list of components, and a subtype
+indicating whether this ligature was the result of a word boundary, and it was
+stored in the same place as other nodes like boxes and kerns and glues.
+
+In \LUATEX, these two types are merged into one, somewhat larger structure called
+a \type {glyph_node}. Besides having the old character, font, and component
+fields, and the new special fields like \quote {attr} (see~\in {section}
+[glyphnodes]), these nodes also contain:
+
+\startitemize
+
+\startitem A subtype, split into four main types:
+
+ \startitemize
+ \startitem
+ \type {character}, for characters to be hyphenated: the lowest bit
+ (bit 0) is set to 1.
+ \stopitem
+ \startitem
+ \type {glyph}, for specific font glyphs: the lowest bit (bit 0) is
+ not set.
+ \stopitem
+ \startitem
+ \type {ligature}, for ligatures (bit 1 is set)
+ \stopitem
+ \startitem
+ \type {ghost}, for \quote {ghost objects} (bit 2 is set)
+ \stopitem
+ \stopitemize
+
+ The latter two make further use of two extra fields (bits 3 and 4):
+
+ \startitemize
+ \startitem
+ \type {left}, for ligatures created from a left word boundary and for
+ ghosts created from \type {\leftghost}
+ \stopitem
+ \startitem
+ \type {right}, for ligatures created from a right word boundary and
+ for ghosts created from \type {\rightghost}
+ \stopitem
+ \stopitemize
+
+ For ligatures, both bits can be set at the same time (in case of a
+ single|-|glyph word).
+
+\stopitem
+
+\startitem
+ \type {glyph_node}s of type \quote {character} also contain language data,
+ split into four items that were current when the node was created: the
+ \type {\setlanguage} (15 bits), \type {\lefthyphenmin} (8 bits), \type
+ {\righthyphenmin} (8 bits), and \type {\uchyph} (1 bit).
+\stopitem
+
+\stopitemize
+
+Incidentally, \LUATEX\ allows 16383 separate languages, and words can be 256
+characters long. The language is stored with each character. You can set
+\type {\firstvalidlanguage} to for instance~1 and make thereby language~0
+an ignored hyphenation language.
+
+The new primitive \type {\hyphenationmin} can be used to signal the minimal length
+of a word. This value stored with the (current) language.
+
+Because the \type {\uchyph} value is saved in the actual nodes, its handling is
+subtly different from \TEX82: changes to \type {\uchyph} become effective
+immediately, not at the end of the current partial paragraph.
+
+Typeset boxes now always have their language information embedded in the nodes
+themselves, so there is no longer a possible dependency on the surrounding
+language settings. In \TEX82, a mid-paragraph statement like \type {\unhbox0} would
+process the box using the current paragraph language unless there was a
+\type {\setlanguage} issued inside the box. In \LUATEX, all language variables are
+already frozen.
+
+In traditional \TEX\ the process of hyphenation is driven by \type {lccode}s. In
+\LUATEX\ we made this dependency less strong. There are several strategies
+possible. When you do nothing, the currently used \type {lccode}s are used, when
+loading patterns, setting exceptions or hyphenating a list.
+
+When you set \type {\savinghyphcodes} to a value larger than zero the current set
+of \type {lccode}s will be saved with the language. In that case changing a \type
+{lccode} afterwards has no effect. However, you can adapt the set with:
+
+\starttyping
+\hjcode`a=`a
+\stoptyping
+
+This change is global which makes sense if you keep in mind that the moment that
+hyphenation happens is (normally) when the paragraph or a horizontal box is
+constructed. When \type {\savinghyphcodes} was zero when the language got
+initialized you start out with nothing, otherwise you already have a set.
+
+When a \type {\hjcode} is larger than $0$ but smaller than $32$ is indicates the
+to be used length. In the following example we map a character (\type {x}) onto
+another one in the patterns and tell the engine that \type {œ} counts as one
+character. Because traditionally zero itself is reserved for inhibiting
+hyphenation, a value of $32$ counts as zero.
+
+\starttyping
+% assuming french patterns:
+foobar % foo-bar
+
+\hjcode`x=`o
+
+fxxbar % fxx-bar
+
+\lefthyphenmin3
+
+œdipus % œdi-pus
+
+\lefthyphenmin4
+
+œdipus % œdipus
+
+\hjcode`œ=2
+
+œdipus % œdi-pus
+
+\hjcode`i=32
+\hjcode`d=32
+
+œdipus % œdipus
+\stoptyping
+
+Carrying all this information with each glyph would give too much overhead and
+also make the process of setting up thee codes more complex. A solution with
+\type {hjcode} sets was considered but rejected because in practice the current
+approach is sufficient and it would not be compatible anyway.
+
+Beware: the values are always saved in the format, independent of the setting
+of \type {\savinghyphcodes} at the moment the format is dumped.
+
+A boundary node normally would mark the end of a word which interferes with for
+instance discretionary injection. For this you can use the \type {\wordboundary}
+as trigger. Here are a few examples of usage:
+
+\startbuffer
+ discrete---discrete
+\stopbuffer
+\typebuffer \start \dontcomplain \hsize 1pt \getbuffer \par \stop
+\startbuffer
+ discrete\discretionary{}{}{---}discrete
+\stopbuffer
+\typebuffer \start \dontcomplain \hsize 1pt \getbuffer \par \stop
+\startbuffer
+ discrete\wordboundary\discretionary{}{}{---}discrete
+\stopbuffer
+\typebuffer \start \dontcomplain \hsize 1pt \getbuffer \par \stop
+\startbuffer
+ discrete\wordboundary\discretionary{}{}{---}\wordboundary discrete
+\stopbuffer
+\typebuffer \start \dontcomplain \hsize 1pt \getbuffer \par \stop
+\startbuffer
+ discrete\wordboundary\discretionary{---}{}{}\wordboundary discrete
+\stopbuffer
+\typebuffer \start \dontcomplain \hsize 1pt \getbuffer \par \stop
+
+We only accept an explicit hyphen when there is a preceding glyph and we skip a
+sequence of explicit hyphens as that normally indicates a \type {--} or \type
+{---} ligature in which case we can in a worse case usage get bad node lists
+later on due to messed up ligature building as these dashes are ligatures in base
+fonts. This is a side effect of the separating the hyphenation, ligaturing and
+kerning steps.
+
+The start and end of a characters is signalled by a glue, penalty, kern or boundary
+node. But by default also a hlist, vlist, rule, dir, whatsit, ins, and adjust node
+indicate a start or end. You can omit the last set from the test by setting
+\type {\hyphenationbounds} to a non|-|zero value:
+
+\starttabulate[|Tl|l|]
+\NC 0 \NC not strict \NC \NR
+\NC 1 \NC strict start \NC \NR
+\NC 2 \NC strict end \NC \NR
+\NC 3 \NC strict start and strict end \NC \NR
+\stoptabulate
+
+\section{The main control loop}
+
+In \LUATEX's main loop, almost all input characters that are to be typeset are
+converted into \type {glyph} node records with subtype \quote {character}, but
+there are a few exceptions.
+
+First, the \type {\accent} primitives creates nodes with subtype \quote {glyph}
+instead of \quote {character}: one for the actual accent and one for the
+accentee. The primary reason for this is that \type {\accent} in \TEX82 is
+explicitly dependent on the current font encoding, so it would not make much
+sense to attach a new meaning to the primitive's name, as that would invalidate
+many old documents and macro packages. \footnote {Of course, modern packages will
+not use the \type {\accent} primitive at all but try to map directly on composed
+characters.} A secondary reason is that in \TEX82, \type {\accent} prohibits
+hyphenation of the current word. Since in \LUATEX\ hyphenation only takes place
+on \quote {character} nodes, it is possible to achieve the same effect.
+
+This change of meaning did happen with \type {\char}, that now generates \quote
+{glyph} nodes with a character subtype. In traditional \TEX\ there was a strong
+relationship between the 8|-|bit input encoding, hyphenation and glyphs taken
+from a font. In \LUATEX\ we have \UTF\ input, and in most cases this maps
+directly to a character in a font, apart from glyph replacement in the font
+engine. If you want to access arbitrary glyphs in a font directly you can always
+use \LUA\ to do so, because fonts are available as \LUA\ table.
+
+Second, all the results of processing in math mode eventually become nodes with
+\quote {glyph} subtypes.
+
+Third, the \ALEPH|-|derived commands \type {\leftghost} and \type {\rightghost}
+create nodes of a third subtype: \quote {ghost}. These nodes are ignored
+completely by all further processing until the stage where inter|-|glyph kerning
+is added.
+
+Fourth, automatic discretionaries are handled differently. \TEX82 inserts an
+empty discretionary after sensing an input character that matches the \type
+{\hyphenchar} in the current font. This test is wrong in our opinion: whether or
+not hyphenation takes place should not depend on the current font, it is a
+language property. \footnote {When \TEX\ showed up we didn't have \UNICODE\ yet
+and being limited to eight bits meant that one sometimes had to compromise
+between supporting character input, glyph rendering, hyphenation.}
+
+In \LUATEX, it works like this: if \LUATEX\ senses a string of input characters
+that matches the value of the new integer parameter \type {\exhyphenchar}, it will
+insert an explicit discretionary after that series of nodes. Initex sets the \type
+{\exhyphenchar=`\-}. Incidentally, this is a global parameter instead of a
+language-specific one because it may be useful to change the value depending on
+the document structure instead of the text language.
+
+The insertion of discretionaries after a sequence of explicit hyphens happens at
+the same time as the other hyphenation processing, {\it not\/} inside the main
+control loop.
+
+The only use \LUATEX\ has for \type {\hyphenchar} is at the check whether a word
+should be considered for hyphenation at all. If the \type {\hyphenchar} of the
+font attached to the first character node in a word is negative, then hyphenation
+of that word is abandoned immediately. This behaviour is added for backward
+compatibility only, and the use of \type {\hyphenchar=-1} as a means of
+preventing hyphenation should not be used in new \LUATEX\ documents.
+
+Fifth, \type {\setlanguage} no longer creates whatsits. The meaning of \type
+{\setlanguage} is changed so that it is now an integer parameter like all others.
+That integer parameter is used in \type {\glyph_node} creation to add language
+information to the glyph nodes. In conjunction, the \type {\language} primitive is
+extended so that it always also updates the value of \type {\setlanguage}.
+
+Sixth, the \type {\noboundary} command (that prohibits word boundary processing
+where that would normally take place) now does create nodes. These nodes are
+needed because the exact place of the \type {\noboundary} command in the input
+stream has to be retained until after the ligature and font processing stages.
+
+Finally, there is no longer a \type {main_loop} label in the code. Remember that
+\TEX82 did quite a lot of processing while adding \type {char_nodes} to the
+horizontal list? For speed reasons, it handled that processing code outside of
+the \quote {main control} loop, and only the first character of any \quote {word}
+was handled by that \quote {main control} loop. In \LUATEX, there is no longer a
+need for that (all hard work is done later), and the (now very small) bits of
+character|-|handling code have been moved back inline. When \type
+{\tracingcommands} is on, this is visible because the full word is reported,
+instead of just the initial character.
+
+\section[patternsexceptions]{Loading patterns and exceptions}
+
+The hyphenation algorithm in \LUATEX\ is quite different from the one in \TEX82,
+although it uses essentially the same user input.
+
+After expansion, the argument for \type {\patterns} has to be proper \UTF8 with
+individual patterns separated by spaces, no \type {\char} or \type {\chardef}d
+commands are allowed. The current implementation quite strict and will reject all
+non|-|\UNICODE\ characters.
+
+Likewise, the expanded argument for \type {\hyphenation} also has to be proper
+\UTF8, but here a bit of extra syntax is provided:
+
+\startitemize[n]
+\startitem
+ Three sets of arguments in curly braces (\type {{}{}{}}) indicates a desired
+ complex discretionary, with arguments as in \type {\discretionary}'s command in
+ normal document input.
+\stopitem
+\startitem
+ A \type {-} indicates a desired simple discretionary, cf.\ \type {\-} and \type
+ {\discretionary{-}{}{}} in normal document input.
+\stopitem
+\startitem
+ Internal command names are ignored. This rule is provided especially for \type
+ {\discretionary}, but it also helps to deal with \type {\relax} commands that
+ may sneak in.
+\stopitem
+\startitem
+ An \type {=} indicates a (non|-|discretionary) hyphen in the document input.
+\stopitem
+\stopitemize
+
+The expanded argument is first converted back to a space-separated string while
+dropping the internal command names. This string is then converted into a
+dictionary by a routine that creates key|-|value pairs by converting the other
+listed items. It is important to note that the keys in an exception dictionary
+can always be generated from the values. Here are a few examples:
+
+\starttabulate[|l|l|l|]
+\NC \bf value \NC \bf implied key (input) \NC \bf effect \NC\NR
+\NC \type {ta-ble} \NC table \NC \type {ta\-ble} ($=$ \type {ta\discretionary{-}{}{}ble}) \NC\NR
+\NC \type {ba{k-}{}{c}ken} \NC backen \NC \type {ba\discretionary{k-}{}{c}ken} \NC\NR
+\stoptabulate
+
+The resultant patterns and exception dictionary will be stored under the language
+code that is the present value of \type {\language}.
+
+In the last line of the table, you see there is no \type {\discretionary} command
+in the value: the command is optional in the \TEX-based input syntax. The
+underlying reason for that is that it is conceivable that a whole dictionary of
+words is stored as a plain text file and loaded into \LUATEX\ using one of the
+functions in the \LUA\ \type {lang} library. This loading method is quite a bit
+faster than going through the \TEX\ language primitives, but some (most?) of that
+speed gain would be lost if it had to interpret command sequences while doing so.
+
+It is possible to specify extra hyphenation points in compound words by using
+\type {{-}{}{-}} for the explicit hyphen character (replace \type {-} by the
+actual explicit hyphen character if needed). For example, this matches the word
+\quote {multi|-|word|-|boundaries} and allows an extra break inbetween \quote
+{boun} and \quote {daries}:
+
+\starttyping
+\hyphenation{multi{-}{}{-}word{-}{}{-}boun-daries}
+\stoptyping
+
+The motivation behind the \ETEX\ extension \type {\savinghyphcodes} was that
+hyphenation heavily depended on font encodings. This is no longer true in
+\LUATEX, and the corresponding primitive is basically ignored. Because we now
+have \type {hjcode}, the case relate codes can be used exclusively for \type
+{\uppercase} and \type {\lowercase}.
+
+\section{Applying hyphenation}
+
+The internal structures \LUATEX\ uses for the insertion of discretionaries in
+words is very different from the ones in \TEX82, and that means there are some
+noticeable differences in handling as well.
+
+First and foremost, there is no \quote {compressed trie} involved in hyphenation.
+The algorithm still reads \PATGEN-generated pattern files, but \LUATEX\ uses a
+finite state hash to match the patterns against the word to be hyphenated. This
+algorithm is based on the \quote {libhnj} library used by \OPENOFFICE, which in
+turn is inspired by \TEX.
+
+There are a few differences between \LUATEX\ and \TEX82 that are a direct result
+of the implementation:
+
+\startitemize
+\startitem
+ \LUATEX\ happily hyphenates the full \UNICODE\ character range.
+\stopitem
+\startitem
+ Pattern and exception dictionary size is limited by the available memory
+ only, all allocations are done dynamically. The trie|-|related settings in
+ \type {texmf.cnf} are ignored.
+\stopitem
+\startitem
+ Because there is no \quote {trie preparation} stage, language patterns never
+ become frozen. This means that the primitive \type {\patterns} (and its \LUA\
+ counterpart \type {lang.patterns}) can be used at any time, not only in
+ ini\TEX.
+\stopitem
+\startitem
+ Only the string representation of \type {\patterns} and \type {\hyphenation} is
+ stored in the format file. At format load time, they are simply
+ re|-|evaluated. It follows that there is no real reason to preload languages
+ in the format file. In fact, it is usually not a good idea to do so. It is
+ much smarter to load patterns no sooner than the first time they are actually
+ needed.
+\stopitem
+\startitem
+ \LUATEX\ uses the language-specific variables \type {\prehyphenchar} and \type
+ {\posthyphenchar} in the creation of implicit discretionaries, instead of
+ \TEX82's \type {\hyphenchar}, and the values of the language|-|specific variables
+ \type {\preexhyphenchar} and \type {\postexhyphenchar} for explicit
+ discretionaries (instead of \TEX82's empty discretionary).
+\stopitem
+\startitem
+ The value of the two counters related to hyphenation, \type {\hyphenpenalty}
+ and \type {\exhyphenpenalty}, are now stored in the discretionary nodes. This
+ permits a local overload for explicit \type {\discretionary} commands. The
+ value current when the hyphenation pass is applied is used. When no callbacks
+ are used this is compatible with traditional \TEX. When you apply the \LUA\
+ \type {lang.hyphenate} function the current values are used.
+\stopitem
+\stopitemize
+
+Because we store penalties in the disc node the \type {\discretionary} command has
+been extended to accept an optional penalty specification, so you can do the
+following:
+
+\startbuffer
+\hsize1mm
+1:foo{\hyphenpenalty 10000\discretionary{}{}{}}bar\par
+2:foo\discretionary penalty 10000 {}{}{}bar\par
+3:foo\discretionary{}{}{}bar\par
+\stopbuffer
+
+\typebuffer
+
+This results in:
+
+\blank \start \getbuffer \stop \blank
+
+Inserted characters and ligatures inherit their attributes from the nearest glyph
+node item (usually the preceding one, but the following one for the items
+inserted at the left-hand side of a word).
+
+Word boundaries are no longer implied by font switches, but by language switches.
+One word can have two separate fonts and still be hyphenated correctly (but it
+can not have two different languages, the \type {\setlanguage} command forces a
+word boundary).
+
+All languages start out with \type {\prehyphenchar=`\-}, \type {\posthyphenchar=0},
+\type {\preexhyphenchar=0} and \type {\postexhyphenchar=0}. When you assign the
+values of one of these four parameters, you are actually changing the settings
+for the current \type {\language}, this behaviour is compatible with \type {\patterns}
+and \type {\hyphenation}.
+
+\LUATEX\ also hyphenates the first word in a paragraph. Words can be up to 256
+characters long (up from 64 in \TEX82). Longer words generate an error right now,
+but eventually either the limitation will be removed or perhaps it will become
+possible to silently ignore the excess characters (this is what happens in
+\TEX82, but there the behaviour cannot be controlled).
+
+If you are using the \LUA\ function \type {lang.hyphenate}, you should be aware
+that this function expects to receive a list of \quote {character} nodes. It will
+not operate properly in the presence of \quote {glyph}, \quote {ligature}, or
+\quote {ghost} nodes, nor does it know how to deal with kerning.
+
+The hyphenation exception dictionary is maintained as key|-|value hash, and that
+is also dynamic, so the \type {hyph_size} setting is not used either.
+
+\section{Applying ligatures and kerning}
+
+After all possible hyphenation points have been inserted in the list, \LUATEX\
+will process the list to convert the \quote {character} nodes into \quote {glyph}
+and \quote {ligature} nodes. This is actually done in two stages: first all
+ligatures are processed, then all kerning information is applied to the result
+list. But those two stages are somewhat dependent on each other: If the used font
+makes it possible to do so, the ligaturing stage adds virtual \quote {character}
+nodes to the word boundaries in the list. While doing so, it removes and
+interprets \type {\noboundary} nodes. The kerning stage deletes those word
+boundary items after it is done with them, and it does the same for \quote
+{ghost} nodes. Finally, at the end of the kerning stage, all remaining \quote
+{character} nodes are converted to \quote {glyph} nodes.
+
+This work separation is worth mentioning because, if you overrule from \LUA\ only
+one of the two callbacks related to font handling, then you have to make sure you
+perform the tasks normally done by \LUATEX\ itself in order to make sure that the
+other, non|-|overruled, routine continues to function properly.
+
+Work in this area is not yet complete, but most of the possible cases are handled
+by our rewritten ligaturing engine. At some point all of the possible inputs will
+become supported. \footnote {Not all of this makes sense because we nowadays have
+\OPENTYPE\ fonts and ligature building can happen in ,any different ways there.}
+
+For example, take the word \type {office}, hyphenated \type {of-fice}, using a
+\quote {normal} font with all the \type {f}-\type {f} and \type {f}-\type {i}
+type ligatures:
+
+\starttabulate[|l|l|]
+\NC Initial: \NC \type {{o}{f}{f}{i}{c}{e}} \NC\NR
+\NC After hyphenation: \NC \type {{o}{f}{{-},{},{}}{f}{i}{c}{e}} \NC\NR
+\NC First ligature stage: \NC \type {{o}{{f-},{f},{<ff>}}{i}{c}{e}} \NC\NR
+\NC Final result: \NC \type {{o}{{f-},{<fi>},{<ffi>}}{c}{e}} \NC\NR
+\stoptabulate
+
+That's bad enough, but let us assume that there is also a hyphenation point
+between the \type {f} and the \type {i}, to create \type {of-f-ice}. Then the
+final result should be:
+
+\starttyping
+{o}{{f-},
+ {{f-},
+ {i},
+ {<fi>}},
+ {{<ff>-},
+ {i},
+ {<ffi>}}}{c}{e}
+\stoptyping
+
+with discretionaries in the post-break text as well as in the replacement text of
+the top-level discretionary that resulted from the first hyphenation point.
+
+Here is that nested solution again, in a different representation:
+
+\starttabulate[|l|l|l|l|]
+\NC \NC pre \NC post \NC replace \NC \NR
+\NC topdisc \NC \type {f-}$^1$ \NC sub1 \NC sub2 \NC \NR
+\NC sub1 \NC \type {f-}$^2$ \NC \type {i}$^3$ \NC \type {<fi>}$^4$ \NC \NR
+\NC sub2 \NC \type {<ff>-}$^5$\NC \type {i}$^6$ \NC \type {<ffi>}$^7$ \NC \NR
+\stoptabulate
+
+When line breaking is choosing its breakpoints, the following fields will
+eventually be selected:
+
+\starttabulate[|l|l|l|]
+\NC \type {of-f-ice} \NC \type {f-}$^1$ \NC \NR
+\NC \NC \type {f-}$^2$ \NC \NR
+\NC \NC \type {i}$^3$ \NC \NR
+\NC \type {of-fice} \NC \type {f-}$^1$ \NC \NR
+\NC \NC \type {<fi>}$^4$ \NC \NR
+\NC \type {off-ice} \NC \type {<ff>-}$^5$ \NC \NR
+\NC \NC \type {i}$^6$ \NC \NR
+\NC \type {office} \NC \type {<ffi>}$^7$ \NC \NR
+\stoptabulate
+
+The current solution in \LUATEX\ is not able to handle nested discretionaries,
+but it is in fact smart enough to handle this fictional \type {of-f-ice} example.
+It does so by combining two sequential discretionary nodes as if they were a
+single object (where the second discretionary node is treated as an extension of
+the first node).
+
+One can observe that the \type {of-f-ice} and \type {off-ice} cases both end with
+the same actual post replacement list (\type {i}), and that this would be the
+case even if that \type {i} was the first item of a potential following ligature
+like \type {ic}. This allows \LUATEX\ to do away with one of the fields, and thus
+make the whole stuff fit into just two discretionary nodes.
+
+The mapping of the seven list fields to the six fields in this discretionary node
+pair is as follows:
+
+\starttabulate[|l|p|]
+\NC \bf field \NC \bf description \NC \NR
+\NC \type {disc1.pre} \NC \type {f-}$^1$ \NC \NR
+\NC \type {disc1.post} \NC \type {<fi>}$^4$ \NC \NR
+\NC \type {disc1.replace} \NC \type {<ffi>}$^7$ \NC \NR
+\NC \type {disc2.pre} \NC \type {f-}$^2$ \NC \NR
+\NC \type {disc2.post} \NC \type {i}$^{3{,}6}$\NC \NR
+\NC \type {disc2.replace} \NC \type {<ff>-}$^5$\NC \NR
+\stoptabulate
+
+What is actually generated after ligaturing has been applied is therefore:
+
+\starttyping
+{o}{{f-},
+ {<fi>},
+ {<ffi>}}
+ {{f-},
+ {i},
+ {<ff>-}}{c}{e}
+\stoptyping
+
+The two discretionaries have different subtypes from a discretionary appearing on
+its own: the first has subtype 4, and the second has subtype 5. The need for
+these special subtypes stems from the fact that not all of the fields appear in
+their \quote {normal} location. The second discretionary especially looks odd,
+with things like the \type {<ff>-} appearing in \type {disc2.replace}. The fact
+that some of the fields have different meanings (and different processing code
+internally) is what makes it necessary to have different subtypes: this enables
+\LUATEX\ to distinguish this sequence of two joined discretionary nodes from the
+case of two standalone discretionaries appearing in a row.
+
+Of course there is still that relationship with fonts: ligatures can be implemented by
+mapping a sequence of glyphs onto one glyph, but also by selective replacement and
+kerning. This means that the above examples are just representing the traditional
+approach.
+
+\section{Breaking paragraphs into lines}
+
+This code is still almost unchanged, but because of the above|-|mentioned changes
+with respect to discretionaries and ligatures, line breaking will potentially be
+different from traditional \TEX. The actual line breaking code is still based on
+the \TEX82 algorithms, and it does not expect there to be discretionaries inside
+of discretionaries.
+
+But that situation is now fairly common in \LUATEX, due to the changes to the
+ligaturing mechanism. And also, the \LUATEX\ discretionary nodes are implemented
+slightly different from the \TEX82 nodes: the \type {no_break} text is now
+embedded inside the disc node, where previously these nodes kept their place in
+the horizontal list. In traditional \TEX\ the discretionary node contains a
+counter indicating how many nodes to skip, but in \LUATEX\ we store the pre, post
+and replace text in the discretionary node.
+
+The combined effect of these two differences is that \LUATEX\ does not always use
+all of the potential breakpoints in a paragraph, especially when fonts with many
+ligatures are used. Of course kerning also complicates matters here.
+
+\section{The \type {lang} library}
+
+This library provides the interface to \LUATEX's structure
+representing a language, and the associated functions.
+
+\startfunctioncall
+<language> l = lang.new()
+<language> l = lang.new(<number> id)
+\stopfunctioncall
+
+This function creates a new userdata object. An object of type \type {<language>}
+is the first argument to most of the other functions in the \type {lang}
+library. These functions can also be used as if they were object methods, using
+the colon syntax.
+
+Without an argument, the next available internal id number will be assigned to
+this object. With argument, an object will be created that links to the internal
+language with that id number.
+
+\startfunctioncall
+<number> n = lang.id(<language> l)
+\stopfunctioncall
+
+returns the internal \type {\language} id number this object refers to.
+
+\startfunctioncall
+<string> n = lang.hyphenation(<language> l)
+lang.hyphenation(<language> l, <string> n)
+\stopfunctioncall
+
+Either returns the current hyphenation exceptions for this language, or adds new
+ones. The syntax of the string is explained in~\in {section}
+[patternsexceptions].
+
+\startfunctioncall
+lang.clear_hyphenation(<language> l)
+\stopfunctioncall
+
+Clears the exception dictionary (string) for this language.
+
+\startfunctioncall
+<string> n = lang.clean(<language> l, <string> o)
+<string> n = lang.clean(<string> o)
+\stopfunctioncall
+
+Creates a hyphenation key from the supplied hyphenation value. The syntax of the
+argument string is explained in~\in {section} [patternsexceptions]. This function
+is useful if you want to do something else based on the words in a dictionary
+file, like spell|-|checking.
+
+\startfunctioncall
+<string> n = lang.patterns(<language> l)
+lang.patterns(<language> l, <string> n)
+\stopfunctioncall
+
+Adds additional patterns for this language object, or returns the current set.
+The syntax of this string is explained in~\in {section} [patternsexceptions].
+
+\startfunctioncall
+lang.clear_patterns(<language> l)
+\stopfunctioncall
+
+Clears the pattern dictionary for this language.
+
+\startfunctioncall
+<number> n = lang.prehyphenchar(<language> l)
+lang.prehyphenchar(<language> l, <number> n)
+\stopfunctioncall
+
+Gets or sets the \quote {pre|-|break} hyphen character for implicit hyphenation
+in this language (initially the hyphen, decimal 45).
+
+\startfunctioncall
+<number> n = lang.posthyphenchar(<language> l)
+lang.posthyphenchar(<language> l, <number> n)
+\stopfunctioncall
+
+Gets or sets the \quote {post|-|break} hyphen character for implicit hyphenation
+in this language (initially null, decimal~0, indicating emptiness).
+
+\startfunctioncall
+<number> n = lang.preexhyphenchar(<language> l)
+lang.preexhyphenchar(<language> l, <number> n)
+\stopfunctioncall
+
+Gets or sets the \quote {pre|-|break} hyphen character for explicit hyphenation
+in this language (initially null, decimal~0, indicating emptiness).
+
+\startfunctioncall
+<number> n = lang.postexhyphenchar(<language> l)
+lang.postexhyphenchar(<language> l, <number> n)
+\stopfunctioncall
+
+Gets or sets the \quote {post|-|break} hyphen character for explicit hyphenation
+in this language (initially null, decimal~0, indicating emptiness).
+
+\startfunctioncall
+<boolean> success = lang.hyphenate(<node> head)
+<boolean> success = lang.hyphenate(<node> head, <node> tail)
+\stopfunctioncall
+
+Inserts hyphenation points (discretionary nodes) in a node list. If \type {tail}
+is given as argument, processing stops on that node. Currently, \type {success}
+is always true if \type {head} (and \type {tail}, if specified) are proper nodes,
+regardless of possible other errors.
+
+Hyphenation works only on \quote {characters}, a special subtype of all the glyph
+nodes with the node subtype having the value \type {1}. Glyph modes with
+different subtypes are not processed. See \in {section~} [charsandglyphs] for
+more details.
+
+The following two commands can be used to set or query hj codes:
+
+\startfunctioncall
+lang.sethjcode(<language> l, <number> char, <number> usedchar)
+<number> usedchar = lang.gethjcode(<language> l, <number> char)
+\stopfunctioncall
+
+When you set a hjcode the current sets get initialized unless the set was already
+initialized due to \type {\savinghyphcodes} being larger than zero.
+
+\stopchapter
+
+\stopcomponent
+
+% \parindent0pt \hsize=1.1cm
+% 12-34-56 \par
+% 12-34-\hbox{56} \par
+% 12-34-\vrule width 1em height 1.5ex \par
+% 12-\hbox{34}-56 \par
+% 12-\vrule width 1em height 1.5ex-56 \par
+% \hjcode`\1=`\1 \hjcode`\2=`\2 \hjcode`\3=`\3 \hjcode`\4=`\4 \vskip.5cm
+% 12-34-56 \par
+% 12-34-\hbox{56} \par
+% 12-34-\vrule width 1em height 1.5ex \par
+% 12-\hbox{34}-56 \par
+% 12-\vrule width 1em height 1.5ex-56 \par
+
diff --git a/doc/context/sources/general/manuals/luatex/luatex-logos.tex b/doc/context/sources/general/manuals/luatex/luatex-logos.tex
new file mode 100644
index 000000000..7406dd602
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex-logos.tex
@@ -0,0 +1,19 @@
+\startenvironment luatex-logos
+
+\logo[DFONT] {dfont}
+\logo[CFF] {cff}
+\logo[CMAP] {CMap}
+\logo[PATGEN] {patgen}
+\logo[MP] {MetaPost}
+\logo[METAPOST] {MetaPost}
+\logo[MPLIB] {MPlib}
+\logo[COCO] {coco}
+\logo[SUNOS] {SunOS}
+\logo[BSD] {bsd}
+\logo[SYSV] {sysv}
+\logo[DPI] {dpi}
+\logo[DLL] {dll}
+\logo[OPENOFFICE]{OpenOffice}
+\logo[OCP] {OCP}
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/luatex/luatex-lua.tex b/doc/context/sources/general/manuals/luatex/luatex-lua.tex
new file mode 100644
index 000000000..0960f8032
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex-lua.tex
@@ -0,0 +1,572 @@
+% language=uk
+
+\environment luatex-style
+\environment luatex-logos
+
+\startcomponent luatex-lua
+
+\startchapter[reference=lua,title={\LUA\ general}]
+
+\section[init]{Initialization}
+
+\subsection{\LUATEX\ as a \LUA\ interpreter}
+
+There are some situations that make \LUATEX\ behave like a standalone \LUA\
+interpreter:
+
+\startitemize[packed]
+\startitem
+ if a \type {--luaonly} option is given on the commandline, or
+\stopitem
+\startitem
+ if the executable is named \type {texlua} or \type {luatexlua}, or
+\stopitem
+\startitem
+ if the only non|-|option argument (file) on the commandline has the extension
+ \type {lua} or \type {luc}.
+\stopitem
+\stopitemize
+
+In this mode, it will set \LUA's \type {arg[0]} to the found script name, pushing
+preceding options in negative values and the rest of the command line in the
+positive values, just like the \LUA\ interpreter.
+
+\LUATEX\ will exit immediately after executing the specified \LUA\ script and is,
+in effect, a somewhat bulky stand alone \LUA\ interpreter with a bunch of extra
+preloaded libraries.
+
+\subsection{\LUATEX\ as a \LUA\ byte compiler}
+
+There are two situations that make \LUATEX\ behave like the \LUA\ byte compiler:
+
+\startitemize[packed]
+\startitem if a \type {--luaconly} option is given on the command line, or \stopitem
+\startitem if the executable is named \type {texluac} \stopitem
+\stopitemize
+
+In this mode, \LUATEX\ is exactly like \type {luac} from the stand alone \LUA\
+distribution, except that it does not have the \type {-l} switch, and that it
+accepts (but ignores) the \type {--luaconly} switch.
+
+\subsection{Other commandline processing}
+
+When the \LUATEX\ executable starts, it looks for the \type {--lua} command line
+option. If there is no \type {--lua} option, the command line is interpreted in a
+similar fashion as the other \TEX\ engines. Some options are accepted but have no
+consequence. The following command|-|line options are understood:
+
+\starttabulate[|lT|p|]
+\NC --credits \NC display credits and exit \NC \NR
+\NC --debug-format \NC enable format debugging \NC \NR
+\NC --draftmode \NC switch on draft mode i.e.\ generate no output in \PDF\ mode \NC \NR
+\NC --[no-]file-line-error \NC disable/enable \type {file:line:error} style messages \NC \NR
+\NC --[no-]file-line-error-style \NC aliases of \type {--[no-]file-line-error} \NC \NR
+\NC --fmt=FORMAT \NC load the format file \type {FORMAT} \NC\NR
+\NC --halt-on-error \NC stop processing at the first error\NC \NR
+\NC --help \NC display help and exit \NC\NR
+\NC --ini \NC be \type {iniluatex}, for dumping formats \NC\NR
+\NC --interaction=STRING \NC set interaction mode: \type {batchmode}, \type {nonstopmode}, \type {scrollmode} or \type {errorstopmode} \NC \NR
+\NC --jobname=STRING \NC set the job name to \type {STRING} \NC \NR
+\NC --kpathsea-debug=NUMBER \NC set path searching debugging flags according to the bits of \type {NUMBER} \NC \NR
+\NC --lua=FILE \NC load and execute a \LUA\ initialization script \NC\NR
+\NC --[no-]mktex=FMT \NC disable/enable \type {mktexFMT} generation with \type {FMT} is \type {tex} or \type {tfm} \NC \NR
+\NC --nosocket \NC disable the \LUA\ socket library \NC\NR
+\NC --output-comment=STRING \NC use \type {STRING} for \DVI\ file comment instead of date (no effect for \PDF) \NC \NR
+\NC --output-directory=DIR \NC use \type {DIR} as the directory to write files to \NC \NR
+\NC --output-format=FORMAT \NC use \type {FORMAT} for job output; \type {FORMAT} is \type {dvi} or \type {pdf} \NC \NR
+\NC --progname=STRING \NC set the program name to \type {STRING} \NC \NR
+\NC --recorder \NC enable filename recorder \NC \NR
+\NC --safer \NC disable easily exploitable \LUA\ commands \NC\NR
+\NC --[no-]shell-escape \NC disable/enable system calls \NC \NR
+\NC --shell-restricted \NC restrict system calls to a list of commands given in \type {texmf.cnf} \NC \NR
+\NC --synctex=NUMBER \NC enable \type {synctex} \NC \NR
+\NC --utc \NC use utc times when applicable \NC \NR
+\NC --version \NC display version and exit \NC \NR
+\stoptabulate
+
+Some of the traditional flags are just ignored: \type {--etex}, \type
+{--translate-file}, \type {--8bit}. \type {--[no-]parse-first-line}, \type
+{--default-translate-file}. Also, we no longer support write18 because \type
+{os.execute} can do the same.
+
+The value to use for \type {\jobname} is decided as follows:
+
+\startitemize
+\startitem
+ If \type {--jobname} is given on the command line, its argument will be the
+ value for \type {\jobname}, without any changes. The argument will not be
+ used for actual input so it need not exist. The \type {--jobname} switch only
+ controls the \type {\jobname} setting.
+\stopitem
+\startitem
+ Otherwise, \type {\jobname} will be the name of the first file that is read
+ from the file system, with any path components and the last extension (the
+ part following the last \type {.}) stripped off.
+\stopitem
+\startitem
+ An exception to the previous point: if the command line goes into interactive
+ mode (by starting with a command) and there are no files input via \type
+ {\everyjob} either, then the \type {\jobname} is set to \type {texput} as a
+ last resort.
+\stopitem
+\stopitemize
+
+The file names for output files that are generated automatically are created by
+attaching the proper extension (\type {log}, \type {pdf}, etc.) to the found
+\type {\jobname}. These files are created in the directory pointed to by \type
+{--output-directory}, or in the current directory, if that switch is not present.
+
+\blank
+
+Without the \type {--lua} option, command line processing works like it does in
+any other web2c-based typesetting engine, except that \LUATEX\ has a few extra
+switches.
+
+If the \type {--lua} option is present, \LUATEX\ will enter an alternative mode
+of command line processing in comparison to the standard web2c programs.
+
+In this mode, a small series of actions is taken in order. First, it will parse
+the command line as usual, but it will only interpret a small subset of the
+options immediately: \type {--safer}, \type {--nosocket}, \type
+{--[no-]shell-escape}, \type {--enable-write18}, \type {--disable-write18}, \type
+{--shell-restricted}, \type {--help}, \type {--version}, and \type {--credits}.
+
+Next \LUATEX\ searches for the requested \LUA\ initialization script. If it
+cannot be found using the actual name given on the command line, a second attempt
+is made by prepending the value of the environment variable \type {LUATEXDIR}, if
+that variable is defined in the environment.
+
+Then it checks the various safety switches. You can use those to disable some
+\LUA\ commands that can easily be abused by a malicious document. At the moment,
+\type {--safer} \type {nil}s the following functions:
+
+\starttabulate[|l|l|]
+\NC \bf library \NC \bf functions \NC \NR
+\NC \type {os} \NC \type {execute} \type {exec} \type {spawn} \type {setenv} \type {rename} \type {remove} \type {tmpdir} \NC \NR
+\NC \type {io} \NC \type {popen} \type {output} \type {tmpfile} \NC \NR
+\NC \type {lfs} \NC \type {rmdir} \type {mkdir} \type {chdir} \type {lock} \type {touch} \NC \NR
+\stoptabulate
+
+Furthermore, it disables loading of compiled \LUA\ libraries and it makes \type
+{io.open()} fail on files that are opened for anything besides reading.
+
+When \LUATEX\ starts it set the locale to a neutral value. If for some reason you
+use \type {os.locale}, you need to make sure you \type {nil} it afterwards
+because otherwise it can interfere with code that for instance generates dates.
+You can nil the locale with
+
+\starttyping
+os.setlocale(nil.nil)
+\stoptyping
+
+The \type {--nosocket} option makes the socket library unavailable, so that \LUA\
+cannot use networking.
+
+The switches \type {--[no-]shell-escape}, \type {--[enable|disable]-write18}, and
+\type {--shell-restricted} have the same effects as in \PDFTEX, and additionally
+make \type {io.popen()}, \type {os.execute}, \type {os.exec} and \type {os.spawn}
+adhere to the requested option.
+
+Next the initialization script is loaded and executed. From within the script,
+the entire command line is available in the \LUA\ table \type {arg}, beginning with
+\type {arg[0]}, containing the name of the executable. As consequence warnings
+about unrecognized options are suppressed.
+
+Command line processing happens very early on. So early, in fact, that none of
+\TEX's initializations have taken place yet. For that reason, the tables that
+deal with typesetting, like \type {tex}, \type {token}, \type {node} and
+\type {pdf}, are off|-|limits during the execution of the startup file (they
+are \type {nil}'d). Special care is taken that \type {texio.write} and \type
+{texio.write_nl} function properly, so that you can at least report your actions
+to the log file when (and if) it eventually becomes opened (note that \TEX\ does
+not even know its \type {\jobname} yet at this point). See \in {chapter} [libraries]
+for more information about the \LUATEX-specific \LUA\ extension tables.
+
+Everything you do in the \LUA\ initialization script will remain visible during
+the rest of the run, with the exception of the \TEX\ specific libraries like
+\type {tex}, \type {token}, \type {node} and \type {pdf} tables. These will be
+initialized to their documented state after the execution of the script. You
+should not store anything in variables or within tables with these four global
+names, as they will be overwritten completely.
+
+We recommend you use the startup file only for your own \TEX|-|independent
+initializations (if you need any), to parse the command line, set values in the
+\type {texconfig} table, and register the callbacks you need.
+
+\LUATEX\ allows some of the command line options to be overridden by reading
+values from the \type {texconfig} table at the end of script execution (see the
+description of the \type {texconfig} table later on in this document for more
+details on which ones exactly).
+
+Unless the \type {texconfig} table tells \LUATEX\ not to initialize \KPATHSEA\
+at all (set \type {texconfig.kpse_init} to \type {false} for that), \LUATEX\
+acts on some more command line options after the initialization script is
+finished: in order to initialize the built|-|in \KPATHSEA\ library properly,
+\LUATEX\ needs to know the correct program name to use, and for that it needs to
+check \type {--progname}, or \type {--ini} and \type {--fmt}, if \type
+{--progname} is missing.
+
+\section{\LUA\ behaviour}
+
+\LUA s \type {tostring} function (and \type {string.format} may return values in
+scientific notation, thereby confusing the \TEX\ end of things when it is used as
+the right|-|hand side of an assignment to a \type {\dimen} or \type {\count}.
+
+Loading dynamic \LUA\ libraries will fail if there are two \LUA\ libraries loaded
+at the same time (which will typically happen on \type {win32}, because there is
+one \LUA\ 5.2 inside \LUATEX, and another will likely be linked to the \DLL\ file
+of the module itself).
+
+\LUATEX\ is able to use the kpathsea library to find \type {require()}d modules.
+For this purpose, \type {package.searchers[2]} is replaced by a different loader
+function, that decides at runtime whether to use kpathsea or the built|-|in core
+\LUA\ function. It uses \KPATHSEA\ when that is already initialized at that point
+in time, otherwise it reverts to using the normal \type {package.path} loader.
+
+Initialization of \KPATHSEA\ can happen either implicitly (when \LUATEX\ starts
+up and the startup script has not set \type {texconfig.kpse_init} to false), or
+explicitly by calling the \LUA\ function \type {kpse.set_program_name()}.
+
+\LUATEX\ is able to use dynamically loadable \LUA\ libraries, unless
+\type {--safer} was given as an option on the command line. For this purpose,
+\type {package.searchers[3]} is replaced by a different loader function, that
+decides at runtime whether to use \KPATHSEA\ or the built|-|in core \LUA\
+function. It uses \KPATHSEA\ when that is already initialized at that point in
+time, otherwise it reverts to using the normal \type {package.cpath} loader.
+
+This functionality required an extension to kpathsea:
+
+\startnarrower
+There is a new kpathsea file format: \type {kpse_clua_format} that searches for
+files with extension \type {.dll} and \type {.so}. The \type {texmf.cnf} setting
+for this variable is \type {CLUAINPUTS}, and by default it has this value:
+
+\starttyping
+CLUAINPUTS=.:$SELFAUTOLOC/lib/{$progname,$engine,}/lua//
+\stoptyping
+
+This path is imperfect (it requires a \TDS\ subtree below the binaries
+directory), but the architecture has to be in the path somewhere, and the
+currently simplest way to do that is to search below the binaries directory only.
+Of course it no big deal to write an alternative loader and use that in a macro
+package.
+
+One level up (a \type {lib} directory parallel to \type {bin}) would have been
+nicer, but that is not doable because \TEXLIVE\ uses a \type {bin/<arch>}
+structure.
+\stopnarrower
+
+In keeping with the other \TEX|-|like programs in \TEXLIVE, the two \LUA\ functions
+\type {os.execute} and \type {io.popen}, as well as the two new functions \type
+{os.exec} and \type {os.spawn} that are explained below, take the value of \type
+{shell_escape} and|/|or \type {shell_escape_commands} in account. Whenever
+\LUATEX\ is run with the assumed intention to typeset a document (and by that we
+mean that it is called as \type {luatex}, as opposed to \type {texlua}, and that
+the command line option \type {--luaonly} was not given), it will only run the
+four functions above if the matching \type {texmf.cnf} variable(s) or their \type
+{texconfig} (see \in {section} [texconfig]) counterparts allow execution of the
+requested system command. In \quote {script interpreter} runs of \LUATEX, these
+settings have no effect, and all four functions function as normal.
+
+The \type {f:read("*line")} and \type {f:lines()} functions from the io library
+have been adjusted so that they are line|-|ending neutral: any of \type {LF},
+\type {CR} or \type {CR+LF} are acceptable line endings.
+
+\type {luafilesystem} has been extended: there are two extra boolean functions
+(\type {lfs.isdir(filename)} and \type {lfs.isfile(filename)}) and one extra
+string field in its attributes table (\type {permissions}). There is an
+additional function \type {lfs.shortname()} which takes a file name and returns
+its short name on \type {win32} platforms. On other platforms, it just returns
+the given argument. The file name is not tested for existence. Finally, for
+non|-|\type {win32} platforms only, there is the new function \type
+{lfs.readlink()} hat takes an existing symbolic link as argument and returns its
+content. It returns an error on \type {win32}.
+
+The \type {string} library has an extra function: \type {string.explode(s[,m])}.
+This function returns an array containing the string argument \type {s} split
+into sub-strings based on the value of the string argument \type {m}. The second
+argument is a string that is either empty (this splits the string into
+characters), a single character (this splits on each occurrence of that
+character, possibly introducing empty strings), or a single character followed by
+the plus sign \type {+} (this special version does not create empty sub-strings).
+The default value for \type {m} is \quote {\type { +}} (multiple spaces). Note:
+\type {m} is not hidden by surrounding braces as it would be if this function was
+written in \TEX\ macros.
+
+The \type {string} library also has six extra iterators that return strings
+piecemeal:
+
+\startitemize
+\startitem
+ \type {string.utfvalues(s)}: an integer value in the \UNICODE\ range
+\stopitem
+\startitem
+ \type {string.utfcharacters(s)}: a string with a single \UTF-8 token in it
+\stopitem
+\startitem
+ \type {string.characters(s)} \NC a string containing one byte
+\stopitem
+\startitem
+ \type {string.characterpairs(s)} two strings each containing one byte or an
+ empty second string if the string length was odd
+\stopitem
+\startitem
+ \type {string.bytes(s)} a single byte value
+\stopitem
+\startitem
+ \type {string.bytepairs(s)} two byte values or nil instead of a number as
+ its second return value if the string length was odd
+\stopitem
+\stopitemize
+
+The \type {string.characterpairs()} and \type {string.bytepairs()} iterators
+are useful especially in the conversion of \UTF16 encoded data into \UTF8.
+
+There is also a two|-|argument form of \type {string.dump()}. The second argument
+is a boolean which, if true, strips the symbols from the dumped data. This
+matches an extension made in \type {luajit}.
+
+The \type {string} library functions \type {len}, \type {lower}, \type {sub}
+etc.\ are not \UNICODE|-|aware. For strings in the \UTF8 encoding, i.e., strings
+containing characters above code point 127, the corresponding functions from the
+\type {slnunicode} library can be used, e.g., \type {unicode.utf8.len}, \type
+{unicode.utf8.lower} etc.\ The exceptions are \type {unicode.utf8.find}, that
+always returns byte positions in a string, and \type {unicode.utf8.match} and
+\type {unicode.utf8.gmatch}. While the latter two functions in general {\it
+are} \UNICODE|-|aware, they fall|-|back to non|-|\UNICODE|-|aware behavior when
+using the empty capture \type {()} but other captures work as expected. For the
+interpretation of character classes in \type {unicode.utf8} functions refer to
+the library sources at \hyphenatedurl {http://luaforge.net/projects/sln}. Version
+5.3 of \LUA\ will provide some native \UTF8 support.
+
+\blank
+
+The \type {os} library has a few extra functions and variables:
+
+\startitemize
+
+\startitem
+ \type {os.selfdir} is a variable that holds the directory path of the
+ actual executable. For example: \type {\directlua {tex.sprint(os.selfdir)}}.
+\stopitem
+
+\startitem
+ \type {os.exec(commandline)} is a variation on \type {os.execute}. Here
+ \type {commandline} can be either a single string or a single table.
+
+ If the argument is a table \LUATEX\ first checks if there is a value at
+ integer index zero. If there is, this is the command to be executed.
+ Otherwise, it will use the value at integer index one. If neither are
+ present, nothing at all happens.
+
+ The set of consecutive values starting at integer~1 in the table are the
+ arguments that are passed on to the command (the value at index~1 becomes
+ \type {arg[0]}). The command is searched for in the execution path, so there
+ is normally no need to pass on a fully qualified path name.
+
+ If the argument is a string, then it is automatically converted into a table
+ by splitting on whitespace. In this case, it is impossible for the command
+ and first argument to differ from each other.
+
+ In the string argument format, whitespace can be protected by putting (part
+ of) an argument inside single or double quotes. One layer of quotes is
+ interpreted by \LUATEX, and all occurrences of \type {\"}, \type {\'} or \type
+ {\\} within the quoted text are unescaped. In the table format, there is no
+ string handling taking place.
+
+ This function normally does not return control back to the \LUA\ script: the
+ command will replace the current process. However, it will return the two
+ values \type {nil} and \type {error} if there was a problem while
+ attempting to execute the command.
+
+ On \MSWINDOWS, the current process is actually kept in memory until after the
+ execution of the command has finished. This prevents crashes in situations
+ where \TEXLUA\ scripts are run inside integrated \TEX\ environments.
+
+ The original reason for this command is that it cleans out the current
+ process before starting the new one, making it especially useful for use in
+ \TEXLUA.
+\stopitem
+
+\startitem
+ \type {os.spawn(commandline)} is a returning version of \type {os.exec},
+ with otherwise identical calling conventions.
+
+ If the command ran ok, then the return value is the exit status of the
+ command. Otherwise, it will return the two values \type {nil} and \type
+ {error}.
+\stopitem
+
+\startitem
+ \type {os.setenv(key,value)} sets a variable in the environment. Passing
+ \type {nil} instead of a value string will remove the variable.
+\stopitem
+
+\startitem
+ \type {os.env} is a hash table containing a dump of the variables and
+ values in the process environment at the start of the run. It is writeable,
+ but the actual environment is {\em not\/} updated automatically.
+\stopitem
+
+\startitem
+ \type {os.gettimeofday()} returns the current \quote {\UNIX\ time}, but as a
+ float. This function is not available on the \SUNOS\ platforms, so do not use
+ this function for portable documents.
+\stopitem
+
+\startitem
+ \type {os.times()}returns the current process times according to \ the
+ \UNIX\ C library function \quote {times}. This function is not available on
+ the \MSWINDOWS\ and \SUNOS\ platforms, so do not use this function for
+ portable documents.
+\stopitem
+
+\startitem
+ \type {os.tmpdir()} creates a directory in the \quote {current directory}
+ with the name \type {luatex.XXXXXX} where the \type {X}-es are replaced by a
+ unique string. The function also returns this string, so you can \type
+ {lfs.chdir()} into it, or \type {nil} if it failed to create the directory.
+ The user is responsible for cleaning up at the end of the run, it does not
+ happen automatically.
+\stopitem
+
+\startitem
+ \type {os.type} is a string that gives a global indication of the class of
+ operating system. The possible values are currently \type {windows}, \type
+ {unix}, and \type {msdos} (you are unlikely to find this value \quote {in the
+ wild}).
+\stopitem
+
+\startitem
+ \type {os.name} is a string that gives a more precise indication of the
+ operating system. These possible values are not yet fixed, and for \type
+ {os.type} values \type {windows} and \type {msdos}, the \type {os.name}
+ values are simply \type {windows} and \type {msdos}
+
+ The list for the type \type {unix} is more precise: \type {linux}, \type
+ {freebsd}, \type {kfreebsd}, \type {cygwin}, \type {openbsd}, \type
+ {solaris}, \type {sunos} (pre-solaris), \type {hpux}, \type {irix}, \type
+ {macosx}, \type {gnu} (hurd), \type {bsd} (unknown, but \BSD|-|like), \type
+ {sysv} (unknown, but \SYSV|-|like), \type {generic} (unknown).
+\stopitem
+
+\startitem
+ \type {os.uname()} returns a table with specific operating system
+ information acquired at runtime. The keys in the returned table are all
+ string valued, and their names are: \type {sysname}, \type {machine}, \type
+ {release}, \type {version}, and \type {nodename}.
+\stopitem
+
+\stopitemize
+
+In stock \LUA, many things depend on the current locale. In \LUATEX, we can't do
+that, because it makes documents unportable. While \LUATEX\ is running if
+forces the following locale settings:
+
+\starttyping
+LC_CTYPE=C
+LC_COLLATE=C
+LC_NUMERIC=C
+\stoptyping
+
+\section {\LUA\ modules}
+
+Some modules that are normally external to \LUA\ are statically linked in with
+\LUATEX, because they offer useful functionality:
+
+\startitemize
+
+\startitem
+ \type {slnunicode}, from the \type {selene} libraries, \hyphenatedurl
+ {http://luaforge.net/projects/sln}. This library has been slightly extended
+ so that the \type {unicode.utf8.*} functions also accept the first 256 values
+ of plane~18. This is the range \LUATEX\ uses for raw binary output, as
+ explained above.
+\stopitem
+
+\startitem
+ \type {luazip}, from the kepler project, \hyphenatedurl
+ {http://www.keplerproject.org/luazip/}.
+\stopitem
+
+\startitem
+ \type {luafilesystem}, also from the kepler project, \hyphenatedurl
+ {http://www.keplerproject.org/luafilesystem/}.
+\stopitem
+
+\startitem
+ \type {lpeg}, by Roberto Ierusalimschy, \hyphenatedurl
+ {http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html}. This library is not
+ \UNICODE|-|aware, but interprets strings on a byte|-|per|-|byte basis. This
+ mainly means that \type {lpeg.S} cannot be used with \UTF8 characters encoded
+ in more than two bytes, and thus \type {lpeg.S} will look for one of those
+ two bytes when matching, not the combination of the two. The same is true for
+ \type {lpeg.R}, although the latter will display an error message if used
+ with multibyte characters. Therefore \type {lpeg.R('aä')} results in the
+ message \type {bad argument #1 to 'R' (range must have two characters)},
+ since to \type {lpeg}, \type {ä} is two 'characters' (bytes), so \type {aä}
+ totals three. In practice this is no real issue.
+\stopitem
+
+\startitem
+ \type {lzlib}, by Tiago Dionizio, \hyphenatedurl
+ {http://luaforge.net/projects/lzlib/}.
+\stopitem
+
+\startitem
+ \type {md5}, by Roberto Ierusalimschy \hyphenatedurl
+ {http://www.inf.puc-rio.br/~roberto/md5/md5-5/md5.html}.
+\stopitem
+
+\startitem
+ \type {luasocket}, by Diego Nehab \hyphenatedurl
+ {http://w3.impa.br/~diego/software/luasocket/}. The \type {.lua} support
+ modules from \type {luasocket} are also preloaded inside the executable,
+ there are no external file dependencies.
+\stopitem
+
+\stopitemize
+
+At some point (this also depends on distributions) \LUATEX\ might have these
+libraries loaded on demand. For this reason you can best use \type {require} to
+make sure they are loaded.
+
+\section{Testing}
+
+For development reasons you can influence the used startup date and time. This can
+be done in two ways.
+
+\startitemize[n]
+
+\startitem
+ By setting the environmment variable \type {SOURCE_DATE_EPOCH}. This will
+ influence the \TEX\ parameters \type {time} and \type {date}, the random seed,
+ the \PDF\ timestamp and the \PDF\ id that is derived from the time as well. This
+ variable is consulted when the \KPSE\ library is enabled. Resolving is
+ delegated to this library.
+\stopitem
+
+\startitem
+ By setting the \type {start_time} variable in the \type {texconfig} table; as
+ with other variables we use the internal name there. For compatibility
+ reasons we also honour a \type {SOURCE_DATE_EPOCH} entry. It should be noted
+ that there are no such variables in other engines and this method is only
+ relevant in case the while setup happens in \LUA.
+\stopitem
+
+\stopitemize
+
+When Universal Time is needed, you can pass the flag \type {utc} to the engine. This
+property also works when the date and time are set by \LUATEX\ itself. It has a
+complementary entry \type {use_utc_time} in the \type {texconfig} table.
+
+{\em To some extend a cleaner solution would be to have a flag that disables all
+variable data in one go (like filenames and so) but we just follow the method
+implemented in \PDFTEX\ where primitives are used to influence other properties.}
+
+{\em In \CONTEXT\ we provide the command line argument \type {--nodates} that
+does bit more disabling of dates.}
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/luatex/luatex-math.tex b/doc/context/sources/general/manuals/luatex/luatex-math.tex
new file mode 100644
index 000000000..cb8d198b1
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex-math.tex
@@ -0,0 +1,1049 @@
+% language=uk
+
+\environment luatex-style
+\environment luatex-logos
+
+\startcomponent luatex-math
+
+\startchapter[reference=math,title={Math}]
+
+The handling of mathematics in \LUATEX\ differs quite a bit from how \TEX82 (and
+therefore \PDFTEX) handles math. First, \LUATEX\ adds primitives and extends some
+others so that \UNICODE\ input can be used easily. Second, all of \TEX82's
+internal special values (for example for operator spacing) have been made
+accessible and changeable via control sequences. Third, there are extensions that
+make it easier to use \OPENTYPE\ math fonts. And finally, there are some
+extensions that have been proposed or considered in the past that are now added
+to the engine.
+
+\section{The current math style}
+
+It is possible to discover the math style that will be used for a formula in an
+expandable fashion (while the math list is still being read). To make this
+possible, \LUATEX\ adds the new primitive: \type {\mathstyle}. This is a \quote
+{convert command} like e.g. \type {\romannumeral}: its value can only be read,
+not set.
+
+\subsection{\type {\mathstyle}}
+
+The returned value is between 0 and 7 (in math mode), or $-1$ (all other modes).
+For easy testing, the eight math style commands have been altered so that the can
+be used as numeric values, so you can write code like this:
+
+\starttyping
+\ifnum\mathstyle=\textstyle
+ \message{normal text style}
+\else \ifnum\mathstyle=\crampedtextstyle
+ \message{cramped text style}
+\fi \fi
+\stoptyping
+
+\subsection{\type {\Ustack}}
+
+There are a few math commands in \TEX\ where the style that will be used is not
+known straight from the start. These commands (\type {\over}, \type {\atop},
+\type {\overwithdelims}, \type {\atopwithdelims}) would therefore normally return
+wrong values for \type {\mathstyle}. To fix this, \LUATEX\ introduces a special
+prefix command: \type {\Ustack}:
+
+\starttyping
+$\Ustack {a \over b}$
+\stoptyping
+
+The \type {\Ustack} command will scan the next brace and start a new math group
+with the correct (numerator) math style.
+
+\section{Unicode math characters}
+
+Character handling is now extended up to the full \UNICODE\ range (the \type {\U}
+prefix), which is compatible with \XETEX.
+
+The math primitives from \TEX\ are kept as they are, except for the ones that
+convert from input to math commands: \type {mathcode}, and \type {delcode}. These
+two now allow for a 21-bit character argument on the left hand side of the equals
+sign.
+
+Some of the new \LUATEX\ primitives read more than one separate value. This is
+shown in the tables below by a plus sign in the second column.
+
+The input for such primitives would look like this:
+
+\starttyping
+\def\overbrace{\Umathaccent 0 1 "23DE }
+\stoptyping
+
+The altered \TEX82 primitives are:
+
+\starttabulate[|l|l|r|c|l|r|]
+\NC \bf primitive \NC \bf min \NC \bf max \NC \kern 2em \NC \bf min \NC \bf max \NC \NR
+\NC \type {\mathcode} \NC 0 \NC 10FFFF \NC = \NC 0 \NC 8000 \NC \NR
+\NC \type {\delcode} \NC 0 \NC 10FFFF \NC = \NC 0 \NC FFFFFF \NC \NR
+\stoptabulate
+
+The unaltered ones are:
+
+\starttabulate[|l|l|r|]
+\NC \bf primitive \NC \bf min \NC \bf max \NC \NR
+\NC \type {\mathchardef} \NC 0 \NC 8000 \NC \NR
+\NC \type {\mathchar} \NC 0 \NC 7FFF \NC \NR
+\NC \type {\mathaccent} \NC 0 \NC 7FFF \NC \NR
+\NC \type {\delimiter} \NC 0 \NC 7FFFFFF \NC \NR
+\NC \type {\radical} \NC 0 \NC 7FFFFFF \NC \NR
+\stoptabulate
+
+For practical reasons \type {\mathchardef} will silently accept values larger
+that \type {0x8000} and interpret it as \type {\Umathcharnumdef}. This is needed
+to satisfy older macro packages.
+
+The following new primitives are compatible with \XETEX:
+
+% somewhat fuzzy:
+
+\starttabulate[|l|l|r|c|l|r|]
+\NC \bf primitive \NC \bf min \NC \bf max \NC \kern 2em \NC \bf min \NC \bf max \NC \NR
+\NC \type {\Umathchardef} \NC 0+0+0 \NC 7+FF+10FFFF\rlap{\high{1}} \NC \NC \NC \NC \NR
+\NC \type {\Umathcharnumdef}\rlap{\high{5}} \NC -80000000 \NC 7FFFFFFF\rlap{\high{3}} \NC \NC \NC \NC \NR
+\NC \type {\Umathcode} \NC 0 \NC 10FFFF \NC = \NC 0+0+0 \NC 7+FF+10FFFF\rlap{\high{1}} \NC \NR
+\NC \type {\Udelcode} \NC 0 \NC 10FFFF \NC = \NC 0+0 \NC FF+10FFFF\rlap{\high{2}} \NC \NR
+\NC \type {\Umathchar} \NC 0+0+0 \NC 7+FF+10FFFF \NC \NC \NC \NC \NR
+\NC \type {\Umathaccent} \NC 0+0+0 \NC 7+FF+10FFFF\rlap{\high{2,4}} \NC \NC \NC \NC \NR
+\NC \type {\Udelimiter} \NC 0+0+0 \NC 7+FF+10FFFF\rlap{\high{2}} \NC \NC \NC \NC \NR
+\NC \type {\Uradical} \NC 0+0 \NC FF+10FFFF\rlap{\high{2}} \NC \NC \NC \NC \NR
+\NC \type {\Umathcharnum} \NC -80000000 \NC 7FFFFFFF\rlap{\high{3}} \NC \NC \NC \NC \NR
+\NC \type {\Umathcodenum} \NC 0 \NC 10FFFF \NC = \NC -80000000 \NC 7FFFFFFF\rlap{\high{3}} \NC \NR
+\NC \type {\Udelcodenum} \NC 0 \NC 10FFFF \NC = \NC -80000000 \NC 7FFFFFFF\rlap{\high{3}} \NC \NR
+\stoptabulate
+
+Specifications typically look like:
+
+\starttyping
+\Umathchardef\xx="1"0"456
+\Umathcode 123="1"0"789
+\stoptyping
+
+Note 1: The new primitives that deal with delimiter|-|style objects do not set up a
+\quote {large family}. Selecting a suitable size for display purposes is expected
+to be dealt with by the font via the \type {\Umathoperatorsize} parameter (more
+information can be found in a following section).
+
+Note 2: For these three primitives, all information is packed into a single
+signed integer. For the first two (\type {\Umathcharnum} and \type
+{\Umathcodenum}), the lowest 21 bits are the character code, the 3 bits above
+that represent the math class, and the family data is kept in the topmost bits
+(This means that the values for math families 128--255 are actually negative).
+For \type {\Udelcodenum} there is no math class. The math family information is
+stored in the bits directly on top of the character code. Using these three
+commands is not as natural as using the two- and three|-|value commands, so
+unless you know exactly what you are doing and absolutely require the speedup
+resulting from the faster input scanning, it is better to use the verbose
+commands instead.
+
+Note 3: The \type {\Umathaccent} command accepts optional keywords to control
+various details regarding math accents. See \in {section} [mathacc] below for
+details.
+
+New primitives that exist in \LUATEX\ only (all of these will be explained
+in following sections):
+
+\starttabulate[|l|l|l|l|]
+\NC \bf primitive \NC \bf value range (in hex) \NC \NR
+\NC \type {\Uroot} \NC 0+0--FF+10FFFF$^2$ \NC \NR
+\NC \type {\Uoverdelimiter} \NC 0+0--FF+10FFFF$^2$ \NC \NR
+\NC \type {\Uunderdelimiter} \NC 0+0--FF+10FFFF$^2$ \NC \NR
+\NC \type {\Udelimiterover} \NC 0+0--FF+10FFFF$^2$ \NC \NR
+\NC \type {\Udelimiterunder} \NC 0+0--FF+10FFFF$^2$ \NC \NR
+\stoptabulate
+
+\section{Cramped math styles}
+
+\LUATEX\ has four new primitives to set the cramped math styles directly:
+
+\starttyping
+\crampeddisplaystyle
+\crampedtextstyle
+\crampedscriptstyle
+\crampedscriptscriptstyle
+\stoptyping
+
+These additional commands are not all that valuable on their own, but they come
+in handy as arguments to the math parameter settings that will be added shortly.
+
+In Eijkhouts \quotation {\TEX\ by Topic} the rules for handling styles in scripts
+are described as follows:
+
+\startitemize
+\startitem
+ In any style superscripts and subscripts are taken from the next smaller style.
+ Exception: in display style they are taken in script style.
+\stopitem
+\startitem
+ Subscripts are always in the cramped variant of the style; superscripts are only
+ cramped if the original style was cramped.
+\stopitem
+\startitem
+ In an \type {..\over..} formula in any style the numerator and denominator are
+ taken from the next smaller style.
+\stopitem
+\startitem
+ The denominator is always in cramped style; the numerator is only in cramped
+ style if the original style was cramped.
+\stopitem
+\startitem
+ Formulas under a \type {\sqrt} or \type {\overline} are in cramped style.
+\stopitem
+\stopitemize
+
+In \LUATEX\ one can set the styles in more detail which means that you sometimes
+have to set both normal and cramped styles to get the effect you want. If we
+force styles in the script using \type {\scriptstyle} and \type {\crampedscriptstyle}
+we get this:
+
+\startbuffer[demo]
+\starttabulate
+\NC default \NC $b_{x=xx}^{x=xx}$ \NC \NR
+\NC script \NC $b_{\scriptstyle x=xx}^{\scriptstyle x=xx}$ \NC \NR
+\NC crampedscript \NC $b_{\crampedscriptstyle x=xx}^{\crampedscriptstyle x=xx}$ \NC \NR
+\stoptabulate
+\stopbuffer
+
+\getbuffer[demo]
+
+Now we set the following parameters
+
+\startbuffer[setup]
+\Umathordrelspacing\scriptstyle=30mu
+\Umathordordspacing\scriptstyle=30mu
+\stopbuffer
+
+\typebuffer[setup]
+
+This gives:
+
+\start\getbuffer[setup,demo]\stop
+
+But, as this is not what is expected (visually) we should say:
+
+\startbuffer[setup]
+\Umathordrelspacing\scriptstyle=30mu
+\Umathordordspacing\scriptstyle=30mu
+\Umathordrelspacing\crampedscriptstyle=30mu
+\Umathordordspacing\crampedscriptstyle=30mu
+\stopbuffer
+
+\typebuffer[setup]
+
+Now we get:
+
+\start\getbuffer[setup,demo]\stop
+
+\section{Math parameter settings}
+
+In \LUATEX, the font dimension parameters that \TEX\ used in math typesetting are
+now accessible via primitive commands. In fact, refactoring of the math engine
+has resulted in many more parameters than were accessible before.
+
+\starttabulate
+\NC \bf primitive name \NC \bf description \NC \NR
+\NC \type {\Umathquad} \NC the width of 18 mu's \NC \NR
+\NC \type {\Umathaxis} \NC height of the vertical center axis of
+ the math formula above the baseline \NC \NR
+\NC \type {\Umathoperatorsize} \NC minimum size of large operators in display mode \NC \NR
+\NC \type {\Umathoverbarkern} \NC vertical clearance above the rule \NC \NR
+\NC \type {\Umathoverbarrule} \NC the width of the rule \NC \NR
+\NC \type {\Umathoverbarvgap} \NC vertical clearance below the rule \NC \NR
+\NC \type {\Umathunderbarkern} \NC vertical clearance below the rule \NC \NR
+\NC \type {\Umathunderbarrule} \NC the width of the rule \NC \NR
+\NC \type {\Umathunderbarvgap} \NC vertical clearance above the rule \NC \NR
+\NC \type {\Umathradicalkern} \NC vertical clearance above the rule \NC \NR
+\NC \type {\Umathradicalrule} \NC the width of the rule \NC \NR
+\NC \type {\Umathradicalvgap} \NC vertical clearance below the rule \NC \NR
+\NC \type {\Umathradicaldegreebefore}\NC the forward kern that takes place before placement of
+ the radical degree \NC \NR
+\NC \type {\Umathradicaldegreeafter} \NC the backward kern that takes place after placement of
+ the radical degree \NC \NR
+\NC \type {\Umathradicaldegreeraise} \NC this is the percentage of the total height and depth of
+ the radical sign that the degree is raised by; it is
+ expressed in \type {percents}, so 60\% is expressed as the
+ integer $60$ \NC \NR
+\NC \type {\Umathstackvgap} \NC vertical clearance between the two
+ elements in a \type {\atop} stack \NC \NR
+\NC \type {\Umathstacknumup} \NC numerator shift upward in \type {\atop} stack \NC \NR
+\NC \type {\Umathstackdenomdown} \NC denominator shift downward in \type {\atop} stack \NC \NR
+\NC \type {\Umathfractionrule} \NC the width of the rule in a \type {\over} \NC \NR
+\NC \type {\Umathfractionnumvgap} \NC vertical clearance between the numerator and the rule \NC \NR
+\NC \type {\Umathfractionnumup} \NC numerator shift upward in \type {\over} \NC \NR
+\NC \type {\Umathfractiondenomvgap} \NC vertical clearance between the denominator and the rule \NC \NR
+\NC \type {\Umathfractiondenomdown} \NC denominator shift downward in \type {\over} \NC \NR
+\NC \type {\Umathfractiondelsize} \NC minimum delimiter size for \type {\...withdelims} \NC \NR
+\NC \type {\Umathlimitabovevgap} \NC vertical clearance for limits above operators \NC \NR
+\NC \type {\Umathlimitabovebgap} \NC vertical baseline clearance for limits above operators \NC \NR
+\NC \type {\Umathlimitabovekern} \NC space reserved at the top of the limit \NC \NR
+\NC \type {\Umathlimitbelowvgap} \NC vertical clearance for limits below operators \NC \NR
+\NC \type {\Umathlimitbelowbgap} \NC vertical baseline clearance for limits below operators \NC \NR
+\NC \type {\Umathlimitbelowkern} \NC space reserved at the bottom of the limit \NC \NR
+\NC \type {\Umathoverdelimitervgap} \NC vertical clearance for limits above delimiters \NC \NR
+\NC \type {\Umathoverdelimiterbgap} \NC vertical baseline clearance for limits above delimiters \NC \NR
+\NC \type {\Umathunderdelimitervgap} \NC vertical clearance for limits below delimiters \NC \NR
+\NC \type {\Umathunderdelimiterbgap} \NC vertical baseline clearance for limits below delimiters \NC \NR
+\NC \type {\Umathsubshiftdrop} \NC subscript drop for boxes and subformulas \NC \NR
+\NC \type {\Umathsubshiftdown} \NC subscript drop for characters \NC \NR
+\NC \type {\Umathsupshiftdrop} \NC superscript drop (raise, actually) for boxes and subformulas \NC \NR
+\NC \type {\Umathsupshiftup} \NC superscript raise for characters \NC \NR
+\NC \type {\Umathsubsupshiftdown} \NC subscript drop in the presence of a superscript \NC \NR
+\NC \type {\Umathsubtopmax} \NC the top of standalone subscripts cannot be higher than this
+ above the baseline \NC \NR
+\NC \type {\Umathsupbottommin} \NC the bottom of standalone superscripts cannot be less than
+ this above the baseline \NC \NR
+\NC \type {\Umathsupsubbottommax} \NC the bottom of the superscript of a combined super- and subscript
+ be at least as high as this above the baseline \NC \NR
+\NC \type {\Umathsubsupvgap} \NC vertical clearance between super- and subscript \NC \NR
+\NC \type {\Umathspaceafterscript} \NC additional space added after a super- or subscript \NC \NR
+\NC \type {\Umathconnectoroverlapmin}\NC minimum overlap between parts in an extensible recipe \NC \NR
+\stoptabulate
+
+Each of the parameters in this section can be set by a command like this:
+
+\starttyping
+\Umathquad\displaystyle=1em
+\stoptyping
+
+they obey grouping, and you can use \type {\the\Umathquad\displaystyle} if
+needed.
+
+\section{Skips around display math}
+
+The injection of \type {\abovedisplayskip} and \type {\belowdisplayskip} is not
+symmetrical. An above one is always inserted, also when zero, but the below is
+only inserted when larger than zero. Especially the later mkes it sometimes hard
+to fully control spacing. Therefore \LUATEX\ comes with a new directive: \type
+{\mathdisplayskipmode}. The following values apply:
+
+\starttabulate
+\NC 0 \NC normal \TEX\ behaviour: always above, only below when larger than zero \NC \NR
+\NC 1 \NC always \NC \NR
+\NC 2 \NC only when not zero \NC \NR
+\NC 3 \NC never, not even when not zero \NC \NR
+\stoptabulate
+
+\section{Font-based Math Parameters}
+
+While it is nice to have these math parameters available for tweaking, it would
+be tedious to have to set each of them by hand. For this reason, \LUATEX\
+initializes a bunch of these parameters whenever you assign a font identifier to
+a math family based on either the traditional math font dimensions in the font
+(for assignments to math family~2 and~3 using \TFM|-|based fonts like \type
+{cmsy} and \type {cmex}), or based on the named values in a potential \type
+{MathConstants} table when the font is loaded via Lua. If there is a \type
+{MathConstants} table, this takes precedence over font dimensions, and in that
+case no attention is paid to which family is being assigned to: the \type
+{MathConstants} tables in the last assigned family sets all parameters.
+
+In the table below, the one|-|letter style abbreviations and symbolic tfm font
+dimension names match those using in the \TeX book. Assignments to \type
+{\textfont} set the values for the cramped and uncramped display and text styles,
+\type {\scriptfont} sets the script styles, and \type {\scriptscriptfont} sets
+the scriptscript styles, so we have eight parameters for three font sizes. In the
+\TFM\ case, assignments only happen in family~2 and family~3 (and of course only
+for the parameters for which there are font dimensions).
+
+Besides the parameters below, \LUATEX\ also looks at the \quote {space} font
+dimension parameter. For math fonts, this should be set to zero.
+
+\start
+
+\switchtobodyfont[8pt]
+
+\starttabulate[|l|l|l|p|]
+\NC \bf variable \NC \bf style \NC \bf default value opentype \NC \bf default value tfm \NC \NR
+\NC \type {\Umathaxis} \NC -- \NC AxisHeight \NC axis_height \NC \NR
+\NC \type {\Umathoperatorsize} \NC D, D' \NC DisplayOperatorMinHeight \NC $^6$ \NC \NR
+\NC \type {\Umathfractiondelsize} \NC D, D' \NC FractionDelimiterDisplayStyleSize$^9$ \NC delim1 \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC FractionDelimiterSize$^9$ \NC delim2 \NC \NR
+\NC \type {\Umathfractiondenomdown} \NC D, D' \NC FractionDenominatorDisplayStyleShiftDown \NC denom1 \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC FractionDenominatorShiftDown \NC denom2 \NC \NR
+\NC \type {\Umathfractiondenomvgap} \NC D, D' \NC FractionDenominatorDisplayStyleGapMin \NC 3*default_rule_thickness \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC FractionDenominatorGapMin \NC default_rule_thickness \NC \NR
+\NC \type {\Umathfractionnumup} \NC D, D' \NC FractionNumeratorDisplayStyleShiftUp \NC num1 \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC FractionNumeratorShiftUp \NC num2 \NC \NR
+\NC \type {\Umathfractionnumvgap} \NC D, D' \NC FractionNumeratorDisplayStyleGapMin \NC 3*default_rule_thickness \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC FractionNumeratorGapMin \NC default_rule_thickness \NC \NR
+\NC \type {\Umathfractionrule} \NC -- \NC FractionRuleThickness \NC default_rule_thickness \NC \NR
+\NC \type {\Umathskewedfractionhgap} \NC -- \NC SkewedFractionHorizontalGap \NC math_quad/2 \NC \NR
+\NC \type {\Umathskewedfractionvgap} \NC -- \NC SkewedFractionVerticalGap \NC math_x_height \NC \NR
+\NC \type {\Umathlimitabovebgap} \NC -- \NC UpperLimitBaselineRiseMin \NC big_op_spacing3 \NC \NR
+\NC \type {\Umathlimitabovekern} \NC -- \NC 0$^1$ \NC big_op_spacing5 \NC \NR
+\NC \type {\Umathlimitabovevgap} \NC -- \NC UpperLimitGapMin \NC big_op_spacing1 \NC \NR
+\NC \type {\Umathlimitbelowbgap} \NC -- \NC LowerLimitBaselineDropMin \NC big_op_spacing4 \NC \NR
+\NC \type {\Umathlimitbelowkern} \NC -- \NC 0$^1$ \NC big_op_spacing5 \NC \NR
+\NC \type {\Umathlimitbelowvgap} \NC -- \NC LowerLimitGapMin \NC big_op_spacing2 \NC \NR
+\NC \type {\Umathoverdelimitervgap} \NC -- \NC StretchStackGapBelowMin \NC big_op_spacing1 \NC \NR
+\NC \type {\Umathoverdelimiterbgap} \NC -- \NC StretchStackTopShiftUp \NC big_op_spacing3 \NC \NR
+\NC \type {\Umathunderdelimitervgap} \NC-- \NC StretchStackGapAboveMin \NC big_op_spacing2 \NC \NR
+\NC \type {\Umathunderdelimiterbgap} \NC-- \NC StretchStackBottomShiftDown \NC big_op_spacing4 \NC \NR
+\NC \type {\Umathoverbarkern} \NC -- \NC OverbarExtraAscender \NC default_rule_thickness \NC \NR
+\NC \type {\Umathoverbarrule} \NC -- \NC OverbarRuleThickness \NC default_rule_thickness \NC \NR
+\NC \type {\Umathoverbarvgap} \NC -- \NC OverbarVerticalGap \NC 3*default_rule_thickness \NC \NR
+\NC \type {\Umathquad} \NC -- \NC <font_size(f)>$^1$ \NC math_quad \NC \NR
+\NC \type {\Umathradicalkern} \NC -- \NC RadicalExtraAscender \NC default_rule_thickness \NC \NR
+\NC \type {\Umathradicalrule} \NC -- \NC RadicalRuleThickness \NC <not set>$^2$ \NC \NR
+\NC \type {\Umathradicalvgap} \NC D, D' \NC RadicalDisplayStyleVerticalGap \NC (default_rule_thickness+\crlf
+ (abs(math_x_height)/4))$^3$ \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC RadicalVerticalGap \NC (default_rule_thickness+\crlf
+ (abs(default_rule_thickness)/4))$^3$ \NC \NR
+\NC \type {\Umathradicaldegreebefore} \NC -- \NC RadicalKernBeforeDegree \NC <not set>$^2$ \NC \NR
+\NC \type {\Umathradicaldegreeafter} \NC -- \NC RadicalKernAfterDegree \NC <not set>$^2$ \NC \NR
+\NC \type {\Umathradicaldegreeraise} \NC -- \NC RadicalDegreeBottomRaisePercent \NC <not set>$^{2,7}$ \NC \NR
+\NC \type {\Umathspaceafterscript} \NC -- \NC SpaceAfterScript \NC script_space$^4$ \NC \NR
+\NC \type {\Umathstackdenomdown} \NC D, D' \NC StackBottomDisplayStyleShiftDown \NC denom1 \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC StackBottomShiftDown \NC denom2 \NC \NR
+\NC \type {\Umathstacknumup} \NC D, D' \NC StackTopDisplayStyleShiftUp \NC num1 \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC StackTopShiftUp \NC num3 \NC \NR
+\NC \type {\Umathstackvgap} \NC D, D' \NC StackDisplayStyleGapMin \NC 7*default_rule_thickness \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC StackGapMin \NC 3*default_rule_thickness \NC \NR
+\NC \type {\Umathsubshiftdown} \NC -- \NC SubscriptShiftDown \NC sub1 \NC \NR
+\NC \type {\Umathsubshiftdrop} \NC -- \NC SubscriptBaselineDropMin \NC sub_drop \NC \NR
+\NC \type {\Umathsubsupshiftdown} \NC -- \NC SubscriptShiftDownWithSuperscript$^8$ \NC \NC \NR
+\NC \NC \NC \quad\ or SubscriptShiftDown \NC sub2 \NC \NR
+\NC \type {\Umathsubtopmax} \NC -- \NC SubscriptTopMax \NC (abs(math_x_height * 4) / 5) \NC \NR
+\NC \type {\Umathsubsupvgap} \NC -- \NC SubSuperscriptGapMin \NC 4*default_rule_thickness \NC \NR
+\NC \type {\Umathsupbottommin} \NC -- \NC SuperscriptBottomMin \NC (abs(math_x_height) / 4) \NC \NR
+\NC \type {\Umathsupshiftdrop} \NC -- \NC SuperscriptBaselineDropMax \NC sup_drop \NC \NR
+\NC \type {\Umathsupshiftup} \NC D \NC SuperscriptShiftUp \NC sup1 \NC \NR
+\NC \NC T, S, SS, \NC SuperscriptShiftUp \NC sup2 \NC \NR
+\NC \NC D', T', S', SS' \NC SuperscriptShiftUpCramped \NC sup3 \NC \NR
+\NC \type {\Umathsupsubbottommax} \NC -- \NC SuperscriptBottomMaxWithSubscript \NC (abs(math_x_height * 4) / 5) \NC \NR
+\NC \type {\Umathunderbarkern} \NC -- \NC UnderbarExtraDescender \NC default_rule_thickness \NC \NR
+\NC \type {\Umathunderbarrule} \NC -- \NC UnderbarRuleThickness \NC default_rule_thickness \NC \NR
+\NC \type {\Umathunderbarvgap} \NC -- \NC UnderbarVerticalGap \NC 3*default_rule_thickness \NC \NR
+\NC \type {\Umathconnectoroverlapmin} \NC -- \NC MinConnectorOverlap \NC 0$^5$ \NC \NR
+\stoptabulate
+
+\stop
+
+Note 1: \OPENTYPE\ fonts set \type {\Umathlimitabovekern} and \type
+{\Umathlimitbelowkern} to zero and set \type {\Umathquad} to the font size of the
+used font, because these are not supported in the \type {MATH} table,
+
+Note 2: Traditional \TFM\ fonts do not set \type {\Umathradicalrule} because
+\TEX82\ uses the height of the radical instead. When this parameter is indeed not
+set when \LUATEX\ has to typeset a radical, a backward compatibility mode will
+kick in that assumes that an oldstyle \TEX\ font is used. Also, they do not set
+\type {\Umathradicaldegreebefore}, \type {\Umathradicaldegreeafter}, and \type
+{\Umathradicaldegreeraise}. These are then automatically initialized to
+$5/18$quad, $-10/18$quad, and 60.
+
+Note 3: If \TFM\ fonts are used, then the \type {\Umathradicalvgap} is not set
+until the first time \LUATEX\ has to typeset a formula because this needs
+parameters from both family~2 and family~3. This provides a partial backward
+compatibility with \TEX82, but that compatibility is only partial: once the \type
+{\Umathradicalvgap} is set, it will not be recalculated any more.
+
+Note 4: When \TFM\ fonts are used a similar situation arises with respect to
+\type {\Umathspaceafterscript}: it is not set until the first time \LUATEX\ has
+to typeset a formula. This provides some backward compatibility with \TEX82. But
+once the \type {\Umathspaceafterscript} is set, \type {\scriptspace} will never
+be looked at again.
+
+Note 5: Traditional \TFM\ fonts set \type {\Umathconnectoroverlapmin} to zero
+because \TEX82\ always stacks extensibles without any overlap.
+
+Note 6: The \type {\Umathoperatorsize} is only used in \type {\displaystyle}, and
+is only set in \OPENTYPE\ fonts. In \TFM\ font mode, it is artificially set to
+one scaled point more than the initial attempt's size, so that always the \quote
+{first next} will be tried, just like in \TEX82.
+
+Note 7: The \type {\Umathradicaldegreeraise} is a special case because it is the
+only parameter that is expressed in a percentage instead of as a number of scaled
+points.
+
+Note 8: \type {SubscriptShiftDownWithSuperscript} does not actually exist in the
+\quote {standard} \OPENTYPE\ math font Cambria, but it is useful enough to be
+added.
+
+Note 9: \type {FractionDelimiterDisplayStyleSize} and \type
+{FractionDelimiterSize} do not actually exist in the \quote {standard} \OPENTYPE\
+math font Cambria, but were useful enough to be added.
+
+\section{Math spacing setting}
+
+Besides the parameters mentioned in the previous sections, there are also 64 new
+primitives to control the math spacing table (as explained in Chapter~18 of the
+\TEX book). The primitive names are a simple matter of combining two math atom
+types, but for completeness' sake, here is the whole list:
+
+\starttwocolumns
+\starttyping
+\Umathordordspacing
+\Umathordopspacing
+\Umathordbinspacing
+\Umathordrelspacing
+\Umathordopenspacing
+\Umathordclosespacing
+\Umathordpunctspacing
+\Umathordinnerspacing
+\Umathopordspacing
+\Umathopopspacing
+\Umathopbinspacing
+\Umathoprelspacing
+\Umathopopenspacing
+\Umathopclosespacing
+\Umathoppunctspacing
+\Umathopinnerspacing
+\Umathbinordspacing
+\Umathbinopspacing
+\Umathbinbinspacing
+\Umathbinrelspacing
+\Umathbinopenspacing
+\Umathbinclosespacing
+\Umathbinpunctspacing
+\Umathbininnerspacing
+\Umathrelordspacing
+\Umathrelopspacing
+\Umathrelbinspacing
+\Umathrelrelspacing
+\Umathrelopenspacing
+\Umathrelclosespacing
+\Umathrelpunctspacing
+\Umathrelinnerspacing
+\Umathopenordspacing
+\Umathopenopspacing
+\Umathopenbinspacing
+\Umathopenrelspacing
+\Umathopenopenspacing
+\Umathopenclosespacing
+\Umathopenpunctspacing
+\Umathopeninnerspacing
+\Umathcloseordspacing
+\Umathcloseopspacing
+\Umathclosebinspacing
+\Umathcloserelspacing
+\Umathcloseopenspacing
+\Umathcloseclosespacing
+\Umathclosepunctspacing
+\Umathcloseinnerspacing
+\Umathpunctordspacing
+\Umathpunctopspacing
+\Umathpunctbinspacing
+\Umathpunctrelspacing
+\Umathpunctopenspacing
+\Umathpunctclosespacing
+\Umathpunctpunctspacing
+\Umathpunctinnerspacing
+\Umathinnerordspacing
+\Umathinneropspacing
+\Umathinnerbinspacing
+\Umathinnerrelspacing
+\Umathinneropenspacing
+\Umathinnerclosespacing
+\Umathinnerpunctspacing
+\Umathinnerinnerspacing
+\stoptyping
+\stoptwocolumns
+
+These parameters are of type \type {\muskip}, so setting a parameter can be done
+like this:
+
+\starttyping
+\Umathopordspacing\displaystyle=4mu plus 2mu
+\stoptyping
+
+They are all initialized by \type {initex} to the values mentioned in the table
+in Chapter~18 of the \TEX book.
+
+Note 1: for ease of use as well as for backward compatibility, \type
+{\thinmuskip}, \type {\medmuskip} and \type {\thickmuskip} are treated
+especially. In their case a pointer to the corresponding internal parameter is
+saved, not the actual \type {\muskip} value. This means that any later changes to
+one of these three parameters will be taken into account.
+
+Note 2: Careful readers will realise that there are also primitives for the items
+marked \type {*} in the \TEX book. These will not actually be used as those
+combinations of atoms cannot actually happen, but it seemed better not to break
+orthogonality. They are initialized to zero.
+
+\section[mathacc]{Math accent handling}
+
+\LUATEX\ supports both top accents and bottom accents in math mode, and math
+accents stretch automatically (if this is supported by the font the accent comes
+from, of course). Bottom and combined accents as well as fixed-width math accents
+are controlled by optional keywords following \type {\Umathaccent}.
+
+The keyword \type {bottom} after \type {\Umathaccent} signals that a bottom accent
+is needed, and the keyword \type {both} signals that both a top and a bottom
+accent are needed (in this case two accents need to be specified, of course).
+
+Then the set of three integers defining the accent is read. This set of integers
+can be prefixed by the \type {fixed} keyword to indicate that a non-stretching
+variant is requested (in case of both accents, this step is repeated).
+
+A simple example:
+
+\starttyping
+\Umathaccent both fixed 0 0 "20D7 fixed 0 0 "20D7 {example}
+\stoptyping
+
+If a math top accent has to be placed and the accentee is a character and has a
+non-zero \type {top_accent} value, then this value will be used to place the
+accent instead of the \type {\skewchar} kern used by \TEX82.
+
+The \type {top_accent} value represents a vertical line somewhere in the
+accentee. The accent will be shifted horizontally such that its own \type
+{top_accent} line coincides with the one from the accentee. If the \type
+{top_accent} value of the accent is zero, then half the width of the accent
+followed by its italic correction is used instead.
+
+The vertical placement of a top accent depends on the \type {x_height} of the
+font of the accentee (as explained in the \TEX book), but if value that turns out
+to be zero and the font had a \type {MathConstants} table, then \type
+{AccentBaseHeight} is used instead.
+
+The vertical placement of a bottom accent is straight below the accentee, no
+correction takes place.
+
+Possible locations are \type {top}, \type {bottom}, \type {both} and \type
+{center}. When no location is given \type {top} is assumed. An additional
+parameter \type {fraction} can be specified followed by a number; a value of for
+instance 1200 means that the criterium is 1.2 times the width of the nuclues. The
+fraction only applies to the stepwise selected shapes and is mostly meant for the
+\type {overlay} location. It also works for the other locations but then it
+concerns the width.
+
+\section{Math root extension}
+
+The new primitive \type {\Uroot} allows the construction of a radical noad
+including a degree field. Its syntax is an extension of \type {\Uradical}:
+
+\starttyping
+\Uradical <fam integer> <char integer> <radicand>
+\Uroot <fam integer> <char integer> <degree> <radicand>
+\stoptyping
+
+The placement of the degree is controlled by the math parameters \type
+{\Umathradicaldegreebefore}, \type {\Umathradicaldegreeafter}, and \type
+{\Umathradicaldegreeraise}. The degree will be typeset in \type
+{\scriptscriptstyle}.
+
+\section{Math kerning in super- and subscripts}
+
+The character fields in a \LUA|-|loaded \OPENTYPE\ math font can have a \quote
+{mathkern} table. The format of this table is the same as the \quote {mathkern}
+table that is returned by the \type {fontloader} library, except that all height
+and kern values have to be specified in actual scaled points.
+
+When a super- or subscript has to be placed next to a math item, \LUATEX\ checks
+whether the super- or subscript and the nucleus are both simple character items.
+If they are, and if the fonts of both character items are \OPENTYPE\ fonts (as
+opposed to legacy \TEX\ fonts), then \LUATEX\ will use the \OPENTYPE\ math
+algorithm for deciding on the horizontal placement of the super- or subscript.
+
+This works as follows:
+
+\startitemize
+ \startitem
+ The vertical position of the script is calculated.
+ \stopitem
+ \startitem
+ The default horizontal position is flat next to the base character.
+ \stopitem
+ \startitem
+ For superscripts, the italic correction of the base character is added.
+ \stopitem
+ \startitem
+ For a superscript, two vertical values are calculated: the bottom of the
+ script (after shifting up), and the top of the base. For a subscript, the two
+ values are the top of the (shifted down) script, and the bottom of the base.
+ \stopitem
+ \startitem
+ For each of these two locations:
+ \startitemize
+ \startitem
+ find the math kern value at this height for the base (for a subscript
+ placement, this is the bottom_right corner, for a superscript
+ placement the top_right corner)
+ \stopitem
+ \startitem
+ find the math kern value at this height for the script (for a
+ subscript placement, this is the top_left corner, for a superscript
+ placement the bottom_left corner)
+ \stopitem
+ \startitem
+ add the found values together to get a preliminary result.
+ \stopitem
+ \stopitemize
+ \stopitem
+ \startitem
+ The horizontal kern to be applied is the smallest of the two results from
+ previous step.
+ \stopitem
+\stopitemize
+
+The math kern value at a specific height is the kern value that is specified by the
+next higher height and kern pair, or the highest one in the character (if there is no
+value high enough in the character), or simply zero (if the character has no math kern
+pairs at all).
+
+\section{Scripts on horizontally extensible items like arrows}
+
+The primitives \type {\Uunderdelimiter} and \type {\Uoverdelimiter} allow the
+placement of a subscript or superscript on an automatically extensible item and
+\type {\Udelimiterunder} and \type {\Udelimiterover} allow the placement of an
+automatically extensible item as a subscript or superscript on a nucleus. The
+input:
+
+% these produce radical noads .. in fact the code base has the numbers wrong for
+% quite a while, so no one seems to use this
+
+\startbuffer
+$\Uoverdelimiter 0 "2194 {\hbox{\strut overdelimiter}}$
+$\Uunderdelimiter 0 "2194 {\hbox{\strut underdelimiter}}$
+$\Udelimiterover 0 "2194 {\hbox{\strut delimiterover}}$
+$\Udelimiterunder 0 "2194 {\hbox{\strut delimiterunder}}$
+\stopbuffer
+
+\typebuffer will render this:
+
+\blank \startnarrower \getbuffer \stopnarrower \blank
+
+The vertical placements are controlled by \type {\Umathunderdelimiterbgap}, \type
+{\Umathunderdelimitervgap}, \type {\Umathoverdelimiterbgap}, and \type
+{\Umathoverdelimitervgap} in a similar way as limit placements on large operators.
+The superscript in \type {\Uoverdelimiter} is typeset in a suitable scripted style,
+the subscript in \type {\Uunderdelimiter} is cramped as well.
+
+These primitives accepts an option \type {width} specification. When used the
+also optional keywords \type {left}, \type {middle} and \type {right} will
+determine what happens when a requested size can't be met (which can happen when
+we step to successive larger variants).
+
+An extra primitive \type {\Uhextensible} is available that can be used like this:
+
+\startbuffer
+$\Uhextensible width 10cm 0 "2194$
+\stopbuffer
+
+\typebuffer This will render this:
+
+\blank \startnarrower \getbuffer \stopnarrower \blank
+
+Here you can also pass options, like:
+
+\startbuffer
+$\Uhextensible width 1pt middle 0 "2194$
+\stopbuffer
+
+\typebuffer This gives:
+
+\blank \startnarrower \getbuffer \stopnarrower \blank
+
+\LUATEX\ internally uses a structure that supports \OPENTYPE\ \quote
+{MathVariants} as well as \TFM\ \quote {extensible recipes}. In most cases where
+font metrics are involved we have a different code path for traditional fonts end
+\OPENTYPE\ fonts.
+
+\section {Extracting values}
+
+You can extract the components of a math character. Say that we have defined:
+
+\starttyping
+\Umathcode 1 2 3 4
+\stoptyping
+
+then
+
+\starttyping
+[\Umathcharclass1] [\Umathcharfam1] [\Umathcharslot1]
+\stoptyping
+
+will return:
+
+\starttyping
+[2] [3] [4]
+\stoptyping
+
+These commands are provides as convenience. Before they came available you could
+do the following:
+
+\starttyping
+\def\Umathcharclass{\directlua{tex.print(tex.getmathcode(token.scan_int())[1])}}
+\def\Umathcharfam {\directlua{tex.print(tex.getmathcode(token.scan_int())[2])}}
+\def\Umathcharslot {\directlua{tex.print(tex.getmathcode(token.scan_int())[3])}}
+\stoptyping
+
+\section{fractions}
+
+The \type {\abovewithdelims} command accepts a keyword \type {exact}. When issued
+the extra space relative to the rule thickness is not added. One can of course
+use the \type {\Umathfraction..gap} commands to influence the spacing. Also the
+rule is still positioned around the math axis.
+
+\starttyping
+$$ { {a} \abovewithdelims() exact 4pt {b} }$$
+\stoptyping
+
+The math parameter table contains some parameters that specify a horizontal and
+vertical gap for skewed fractions. Of course some guessing is needed in order to
+implement something that uses them. And so we now provide a primitive similar to the
+other fraction related ones but with a few options so that one can influence the
+rendering. Of course a user can also mess around a bit with the parameters
+\type {\Umathskewedfractionhgap} and \type {\Umathskewedfractionvgap}.
+
+The syntax used here is:
+
+\starttyping
+{ {1} \Uskewed / <options> {2} }
+{ {1} \Uskewedwithdelims / () <options> {2} }
+\stoptyping
+
+where the options can be \type {noaxis} and \type {exact}. By default we add half
+the axis to the shifts and by default we zero the width of the middle character.
+For Latin Modern The result looks as follows:
+
+\def\ShowA#1#2#3{$x + { {#1} \Uskewed / #3 {#2} } + x$}
+\def\ShowB#1#2#3{$x + { {#1} \Uskewedwithdelims / () #3 {#2} } + x$}
+
+\start
+ \switchtobodyfont[modern]
+ \starttabulate[||||||]
+ \NC \NC
+ \ShowA{a}{b}{} \NC
+ \ShowA{1}{2}{} \NC
+ \ShowB{a}{b}{} \NC
+ \ShowB{1}{2}{} \NC
+ \NR
+ \NC \type{exact} \NC
+ \ShowA{a}{b}{exact} \NC
+ \ShowA{1}{2}{exact} \NC
+ \ShowB{a}{b}{exact} \NC
+ \ShowB{1}{2}{exact} \NC
+ \NR
+ \NC \type{noaxis} \NC
+ \ShowA{a}{b}{noaxis} \NC
+ \ShowA{1}{2}{noaxis} \NC
+ \ShowB{a}{b}{noaxis} \NC
+ \ShowB{1}{2}{noaxis} \NC
+ \NR
+ \NC \type{exact noaxis} \NC
+ \ShowA{a}{b}{exact noaxis} \NC
+ \ShowA{1}{2}{exact noaxis} \NC
+ \ShowB{a}{b}{exact noaxis} \NC
+ \ShowB{1}{2}{exact noaxis} \NC
+ \NR
+ \stoptabulate
+\stop
+
+\section {Other Math changes}
+
+\subsection {Verbose versions of single-character math commands}
+
+\LUATEX\ defines six new primitives that have the same function as
+\type {^}, \type {_}, \type {$}, and \type {$$}: %$
+
+\starttabulate[|l|l|l|l|]
+\NC \bf primitive \NC \bf explanation \NC \NR
+\NC \type {\Usuperscript} \NC Duplicates the functionality of \type {^} \NC \NR
+\NC \type {\Usubscript} \NC Duplicates the functionality of \type {_} \NC \NR
+\NC \type {\Ustartmath} \NC Duplicates the functionality of \type {$}, % $
+ when used in non-math mode. \NC \NR
+\NC \type {\Ustopmath} \NC Duplicates the functionality of \type {$}, % $
+ when used in inline math mode. \NC \NR
+\NC \type {\Ustartdisplaymath} \NC Duplicates the functionality of \type {$$}, % $$
+ when used in non-math mode. \NC \NR
+\NC \type {\Ustopdisplaymath} \NC Duplicates the functionality of \type {$$}, % $$
+ when used in display math mode. \NC \NR
+\stoptabulate
+
+The \type {\Ustopmath} and \type {\Ustopdisplaymath} primitives check if the current
+math mode is the correct one (inline vs.\ displayed), but you can freely intermix
+the four mathon|/|mathoff commands with explicit dollar sign(s).
+
+\subsection{Allowed math commands in non-math modes}
+
+The commands \type {\mathchar}, and \type {\Umathchar} and control sequences that
+are the result of \type {\mathchardef} or \type {\Umathchardef} are also
+acceptable in the horizontal and vertical modes. In those cases, the \type
+{\textfont} from the requested math family is used.
+
+\section{Math surrounding skips}
+
+Inline math is surrounded by (optional) \type {\mathsurround} spacing but that is fixed
+dimension. There is now an additional parameter \type {\mathsurroundskip}. When set to a
+non|-|zero value (or zero with some stretch or shrink) this parameter will replace
+\type {\mathsurround}. By using an additional parameter instead of changing the nature
+of \type {\mathsurround}, we can remain compatible.
+
+% \section{Math todo}
+%
+% The following items are still todo.
+%
+% \startitemize
+% \startitem
+% Pre-scripts.
+% \stopitem
+% \startitem
+% Multi-story stacks.
+% \stopitem
+% \startitem
+% Flattened accents for high characters (maybe).
+% \stopitem
+% \startitem
+% Better control over the spacing around displays and handling of equation numbers.
+% \stopitem
+% \startitem
+% Support for multi|-|line displays using \MATHML\ style alignment points.
+% \stopitem
+% \stopitemize
+
+\subsection {Delimiters: \type{\Uleft}, \type {\Umiddle} and \type {\Uright}}
+
+Normally you will force delimiters to certain sizes by putting an empty box or
+rule next to it. The resulting delimiter will either be a character from the
+stepwise size range or an extensible. The latter can be quite differently
+positioned that the characters as it depends on the fit as well as the fact if
+the used characters in the font have depth or height. Commands like (plain \TEX
+s) \type {\big} need use this feature. In \LUATEX\ we provide a bit more control
+by three variants that supporting optional parameters \type {height}, \type
+{depth} and \type {axis}. The following example uses this:
+
+\startbuffer
+\Uleft height 30pt depth 10pt \Udelimiter "0 "0 "000028
+\quad x\quad
+\Umiddle height 40pt depth 15pt \Udelimiter "0 "0 "002016
+\quad x\quad
+\Uright height 30pt depth 10pt \Udelimiter "0 "0 "000029
+\quad \quad \quad
+\Uleft height 30pt depth 10pt axis \Udelimiter "0 "0 "000028
+\quad x\quad
+\Umiddle height 40pt depth 15pt axis \Udelimiter "0 "0 "002016
+\quad x\quad
+\Uright height 30pt depth 10pt axis \Udelimiter "0 "0 "000029
+\stopbuffer
+
+\typebuffer
+
+\startlinecorrection
+\ruledhbox{\mathematics{\getbuffer}}
+\stoplinecorrection
+
+The keyword \type {exact} can be used as directive that the real dimensions
+should be applied when the criteria can't be met which can happen when we're
+still stepping through the successively larger variants. When no dimensions are
+given the \type {noaxis} command can be used to prevent shifting over the axis.
+
+You can influence the final class with the keyword \type {class} which will
+influence the spacing.
+
+\subsection{Fixed scripts}
+
+We have three parameters that are used for this fixed anchoring:
+
+\starttabulate[|l|l|]
+\NC $d$ \NC \type {\Umathsubshiftdown} \NC \NR
+\NC $u$ \NC \type {\Umathsupshiftup} \NC \NR
+\NC $s$ \NC \type {\Umathsubsupshiftdown} \NC \NR
+\stoptabulate
+
+When we set \type {\mathscriptsmode} to a value other than zero these are used
+for calculating fixed positions. This is something that is needed for instance
+for chemistry. You can manipulate the mentioned variables to achive different
+effects.
+
+\def\SampleMath#1%
+ {$\mathscriptsmode#1\mathupright CH_2 + CH^+_2 + CH^2_2$}
+
+\starttabulate[|c|c|c|l|]
+\NC \bf mode \NC \bf down \NC \bf up \NC \NC \NR
+\NC 0 \NC dynamic \NC dynamic \NC \SampleMath{0} \NC \NR
+\NC 1 \NC $d$ \NC $u$ \NC \SampleMath{1} \NC \NR
+\NC 2 \NC $s$ \NC $u$ \NC \SampleMath{2} \NC \NR
+\NC 3 \NC $s$ \NC $u + s - d$ \NC \SampleMath{3} \NC \NR
+\NC 4 \NC $d + (s-d)/2$ \NC $u + (s-d)/2$ \NC \SampleMath{4} \NC \NR
+\NC 5 \NC $d$ \NC $u + s - d$ \NC \SampleMath{5} \NC \NR
+\stoptabulate
+
+The value of this parameter obeys grouping but applies to the whole current
+formula.
+
+% if needed we can put the value in stylenodes but maybe more should go there
+
+\subsection {Tracing}
+
+Because there are quite some math related parameters and values, it is possible
+to limit tracing. Only when \type {tracingassigns} and|/|or \type
+{tracingrestores} are set to~2 or more they will be traced.
+
+\subsection {Math options}
+
+The logic in the math engine is rather complex and there are often no universal
+solutions (read: what works out well for one font, fails for another). Therefore
+some variations in the implementation will be driven by options for which a new
+primitive \type {\mathoption} has been introduced (so that we don't end up with
+many new commands). The approach of options also permits us to see what effect a
+specific solution has.
+
+\subsubsection {\type {\mathoption noitaliccompensation}}
+
+This option compensates placement for characters with a built|-|in italic
+correction.
+
+\startbuffer
+{\showboxes\int}\quad
+{\showboxes\int_{|}^{|}}\quad
+{\showboxes\int\limits_{|}^{|}}
+\stopbuffer
+
+\typebuffer
+
+Gives (with computer modern that has such italics):
+
+\startlinecorrection[blank]
+ \switchtobodyfont[modern]
+ \startcombination[nx=2,ny=2,distance=5em]
+ {\mathoption noitaliccompensation 0\relax \mathematics{\getbuffer}}
+ {\nohyphens\type{0:inline}}
+ {\mathoption noitaliccompensation 0\relax \mathematics{\displaymath\getbuffer}}
+ {\nohyphens\type{0:display}}
+ {\mathoption noitaliccompensation 1\relax \mathematics{\getbuffer}}
+ {\nohyphens\type{1:inline}}
+ {\mathoption noitaliccompensation 1\relax \mathematics{\displaymath\getbuffer}}
+ {\nohyphens\type{1:display}}
+ \stopcombination
+\stoplinecorrection
+
+\subsubsection {\type {\mathoption nocharitalic}}
+
+When two characters follow each other italic correction can interfere. The
+following example shows what this option does:
+
+\startbuffer
+\catcode"1D443=11
+\catcode"1D444=11
+\catcode"1D445=11
+P( PP PQR
+\stopbuffer
+
+\typebuffer
+
+Gives (with computer modern that has such italics):
+
+\startlinecorrection[blank]
+ \switchtobodyfont[modern]
+ \startcombination[nx=2,ny=2,distance=5em]
+ {\mathoption nocharitalic 0\relax \mathematics{\getbuffer}}
+ {\nohyphens\type{0:inline}}
+ {\mathoption nocharitalic 0\relax \mathematics{\displaymath\getbuffer}}
+ {\nohyphens\type{0:display}}
+ {\mathoption nocharitalic 1\relax \mathematics{\getbuffer}}
+ {\nohyphens\type{1:inline}}
+ {\mathoption nocharitalic 1\relax \mathematics{\displaymath\getbuffer}}
+ {\nohyphens\type{1:display}}
+ \stopcombination
+\stoplinecorrection
+
+\subsubsection {\type {\mathoption useoldfractionscaling}}
+
+This option has been introduced as solution for tracker item 604 for fuzzy cases
+around either or not present fraction related settings for new fonts.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/luatex/luatex-modifications.tex b/doc/context/sources/general/manuals/luatex/luatex-modifications.tex
new file mode 100644
index 000000000..549cfe377
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex-modifications.tex
@@ -0,0 +1,1220 @@
+% language=uk
+
+\environment luatex-style
+\environment luatex-logos
+
+\startcomponent luatex-modifications
+
+\startchapter[reference=modifications,title={Modifications}]
+
+\startsection[title=The merged engines]
+
+\startsubsection[title=The need for change]
+
+The first version of \LUATEX\ only had a few extra primitives and it was largely
+the same as \PDFTEX. Then we merged substantial parts of \ALEPH\ into the code
+and got more primitives. When we got more stable the decision was made to clean
+up the rather hybrid nature of the program. This means that some primitives have
+been promoted to core primitives, often with a different name, and that others
+were removed. This made it possible to start cleaning up the code base. In \in
+{chapter} [enhancements] we discussed some new primitives, here we will cover
+most of the adapted ones.
+
+Besides the expected changes caused by new functionality, there are a number of
+not|-|so|-|expected changes. These are sometimes a side|-|effect of a new
+(conflicting) feature, or, more often than not, a change neccessary to clean up
+the internal interfaces. These will also be mentioned.
+
+\stopsubsection
+
+\startsubsection[title=Changes from \TEX\ 3.1415926]
+
+Of course it all starts with traditional \TEX. Even if we started with \PDFTEX,
+most still comes from the original. But we divert a bit.
+
+\startitemize
+
+\startitem
+ The current code base is written in \CCODE, not \PASCAL. We use \CWEB\ when
+ possible. As a consequence instead of one large file plus change files, we
+ now have multiple files organized in categories like \type {tex}, \type
+ {pdf}, \type {lang}, \type {font}, \type {lua}, etc. There are some artefacts
+ of the conversion to \CCODE, but in due time we will clean up the source code
+ and make sure that the documentation is done right. Many files are in the
+ \CWEB\ format, but others, like those interfacing to \LUA, are \CCODE\ files.
+ Of course we want to stay as close as possible to the original so that the
+ documentation of the fundamentals behind \TEX\ by Don Knuth still applies.
+\stopitem
+
+\startitem
+ See \in {chapter} [languages] for many small changes related to paragraph
+ building, language handling and hyphenation. The most important change is
+ that adding a brace group in the middle of a word (like in \type {of{}fice})
+ does not prevent ligature creation.
+\stopitem
+
+\startitem
+ There is no pool file, all strings are embedded during compilation.
+\stopitem
+
+\startitem
+ The specifier \type {plus 1 fillll} does not generate an error. The extra
+ \quote{l} is simply typeset.
+\stopitem
+
+\startitem
+ The upper limit to \type {\endlinechar} and \type {\newlinechar} is 127.
+\stopitem
+
+\startitem
+ Magnification (\type {\mag}) is only supported in \DVI\ output mode. You can
+ set this parameter and it even works with \type {true} units till you switch
+ to \PDF\ output mode. When you use \PDF\ output you can best not touch the
+ \type {\mag} variable. This fuzzy behaviour is not much different from using
+ \PDF\ backend related functionality while eventually \DVI\ output is
+ required.
+
+ After the output mode has been frozen (normally that happens when the first
+ page is shipped out) or when \PDF\ output is enabled, the \type {true}
+ specification is ignored. When you preload a plain format adapted to
+ \LUATEX\ it can be that the \type {\mag} parameter already has been set.
+\stopitemize
+
+\stopsubsection
+
+\startsubsection[title=Changes from \ETEX\ 2.2]
+
+Being the de factor standard extension of course we provide the \ETEX\
+functionality, but with a few small adaptations.
+
+\startitemize
+
+\startitem
+ The \ETEX\ functionality is always present and enabled so the prepended
+ asterisk or \type {-etex} switch for \INITEX\ is not needed.
+\stopitem
+
+\startitem
+ The \TEXXET\ extension is not present, so the primitives \type
+ {\TeXXeTstate}, \type {\beginR}, \type {\beginL}, \type {\endR} and \type
+ {\endL} are missing. Instead we use the \OMEGA\ approach to directionality.
+\stopitem
+
+\startitem
+ Some of the tracing information that is output by \ETEX's \type
+ {\tracingassigns} and \type {\tracingrestores} is not there.
+\stopitem
+
+\startitem
+ Register management in \LUATEX\ uses the \ALEPH\ model, so the maximum value
+ is 65535 and the implementation uses a flat array instead of the mixed
+ flat|\&|sparse model from \ETEX.
+\stopitem
+
+\startitem
+ When kpathsea is used to find files, \LUATEX\ uses the \type {ofm} file
+ format to search for font metrics. In turn, this means that \LUATEX\ looks at
+ the \type {OFMFONTS} configuration variable (like \OMEGA\ and \ALEPH) instead
+ of \type {TFMFONTS} (like \TEX\ and \PDFTEX). Likewise for virtual fonts
+ (\LUATEX\ uses the variable \type {OVFFONTS} instead of \type {VFFONTS}).
+\stopitem
+
+\stopitemize
+
+\stopsubsection
+
+\startsubsection[title=Changes from \PDFTEX\ 1.40]
+
+Because we want to produce \PDF\ the most natural starting point was the popular
+\PDFTEX\ program. We inherit the stable features, dropped most of the
+experimental code and promoted some functionality to core \LUATEX\ functionality
+which in turn triggered renaming primitives.
+
+For compatibility reasons we still refer to \type {\pdf...} commands but \LUATEX\
+has a different backend interface. Instead of these primitives there are three
+interfacing primitives: \type {\pdfextension}, \type {\pdfvariable} and
+\type {\pdffeedback} that take keywords and optional further arguments. This way
+we can extend the features when needed but don't need to adapt the core engine.
+The front- and backend are decoupled as much as possible.
+
+\startitemize
+
+\startitem
+ The (experimental) support for snap nodes has been removed, because it is
+ much more natural to build this functionality on top of node processing and
+ attributes. The associated primitives that are now gone are: \type
+ {\pdfsnaprefpoint}, \type {\pdfsnapy}, and \type {\pdfsnapycomp}.
+\stopitem
+
+\startitem
+ The (experimental) support for specialized spacing around nodes has also been
+ removed. The associated primitives that are now gone are: \type
+ {\pdfadjustinterwordglue}, \type {\pdfprependkern}, and \type
+ {\pdfappendkern}, as well as the five supporting primitives \type
+ {\knbscode}, \type {\stbscode}, \type {\shbscode}, \type {\knbccode}, and
+ \type {\knaccode}.
+\stopitem
+
+\startitem
+ A number of \quote {\PDFTEX\ primitives} have been removed as they can be
+ implemented using \LUA:
+
+ \start \raggedright
+ \type {\pdfelapsedtime}, \type {\pdfescapehex}, \type {\pdfescapename}, \type
+ {\pdfescapestring}, \type {\pdffiledump}, \type {\pdffilemoddate}, \type
+ {\pdffilesize}, \type {\pdfforcepagebox}, \type {\pdflastmatch}, \type
+ {\pdfmatch}, \type {\pdfmdfivesum}, \type {\pdfmovechars}, \type
+ {\pdfoptionalwaysusepdfpagebox}, \type {\pdfoptionpdfinclusionerrorlevel},
+ \type {\pdfresettimer}, \type {\pdfshellescape}, \type {\pdfstrcmp} and \type
+ {\pdfunescapehex}
+ \par \stop
+\stopitem
+
+\startitem
+ The version related primitives \type {\pdftexbanner}, \type {\pdftexversion}
+ and \type {\pdftexrevision} are no longer present as there is no longer a
+ relationship with \PDFTEX\ development.
+\stopitem
+
+\startitem
+ The experimental snapper mechanism has been removed and therefore also the
+ primitives:
+
+ \start \raggedright
+ \type {\pdfignoreddimen}, \type {\pdffirstlineheight}, \type
+ {\pdfeachlineheight}, \type {\pdfeachlinedepth} and \type
+ {\pdflastlinedepth}
+ \par \stop
+\stopitem
+
+\startitem
+ The experimental primitives \type {\primitive}, \type {\ifprimitive}, \type
+ {\ifabsnum} and \type {\ifabsdim} are promoted to core primitives. The \type
+ {\pdf*} prefixed originals are not available.
+\stopitem
+
+\startitem
+ The \PNG\ transparency fix from 1.40.6 is not applied as high|-|level support
+ is pending. Because \LUATEX\ has a different subsystem for managing images,
+ more diversion from its ancestor happened in the meantime.
+\stopitem
+
+\startitem
+ Two extra token lists are provides, \type {\pdfxformresources} and \type
+ {\pdfxformattr}, as an alternative to \type {\pdfxform} keywords.
+\stopitem
+
+\startitem
+ The current version of \LUATEX\ no longer replaces and|/|or merges fonts in
+ embedded \PDF\ files with fonts of the enveloping \PDF\ document. This
+ regression may be temporary, depending on how the rewritten font backend will
+ look like.
+\stopitem
+
+\startitem
+ The primitives \type {\pdfpagewidth} and \type {\pdfpageheight} have been removed
+ because \type {\pagewidth} and \type {\pageheight} have that purpose.
+\stopitem
+
+\startitem
+ The primitives \type {\pdfnormaldeviate}, \type {\pdfuniformdeviate}, \type
+ {\pdfsetrandomseed} and \type {\pdfrandomseed} have been promoted to core
+ primitives without \type {pdf} prefix so the original commands are no longer
+ recognized.
+\stopitem
+
+\startitem
+ The primitives \type {\ifincsname}, \type {\expanded} and \type {\quitvmode}
+ are now core primitives.
+\stopitem
+
+\startitem
+ As the hz and protrusion mechanism are part of the core the related
+ primitives \type {\lpcode}, \type {\rpcode}, \type {\efcode}, \type
+ {\leftmarginkern}, \type {\rightmarginkern} are promoted to core primitives. The
+ two commands \type {\protrudechars} and \type {\adjustspacing} replace their
+ prefixed with \type {\pdf} originals.
+\stopitem
+
+\startitem
+ The hz optimization code has been partially redone so that we no longer need
+ to create extra font instances. The front- and backend have been decoupled
+ and more efficient (\PDF) code is generated.
+\stopitem
+
+\startitem
+ When \type {\adjustspacing} has value~2, hz optimization will be applied to
+ glyphs and kerns. When the value is~3, only glyphs will be treated. A value
+ smaller than~2 disables this feature.
+\stopitem
+
+\startitem
+ The \type {\tagcode} primitive is promoted to core primitive.
+\stopitem
+
+\startitem
+ The \type {\letterspacefont} feature is now part of the core but will not be
+ changed (improved). We just provide it for legacy use.
+\stopitem
+
+\startitem
+ The \type {\pdfnoligatures} primitive is now \type {\ignoreligaturesinfont}.
+\stopitem
+
+\startitem
+ The \type {\pdfcopyfont} primitive is now \type {\copyfont}.
+\stopitem
+
+\startitem
+ The \type {\pdffontexpand} primitive is now \type {\expandglyphsinfont}.
+\stopitem
+
+\startitem
+ Because position tracking is also available in \DVI\ mode the \type
+ {\savepos}, \type {\lastxpos} and \type {\lastypos} commands now replace
+ their \type {pdf} prefixed originals.
+\stopitem
+
+\startitem
+ The introspective primitives \type {\pdflastximagecolordepth} and \type
+ {\pdfximagebbox} have been removed. One can use external applications to
+ determine these properties or use the built|-|in \type {img} library.
+\stopitem
+
+\startitem
+ The initializers \type {\pdfoutput} has been replaced by \type {\outputmode} and
+ \type {\pdfdraftmode} is now \type {\draftmode}.
+\stopitem
+
+\startitem
+ The pixel multiplier dimension \type {\pdfpxdimen} lots its prefix and is now calles
+ \type {\pxdimen}.
+\stopitem
+
+\startitem
+ An extra \type {\pdfimageaddfilename} option has been added that can be used to block
+ writing the filename to the \PDF\ file.
+\stopitem
+
+\startitem
+ The primitive \type {\pdftracingfonts} is now \type {\tracingfonts} as it
+ doesn't relate to the backend.
+\stopitem
+
+\startitem
+ The experimental primitive \type {\pdfinsertht} is kept as \type {\insertht}.
+\stopitem
+
+\startitem
+ The promotion of primitives to core primitives as well as the separation of
+ font- and backend means that the initialization namespace \type {pdftex} is
+ gone.
+\stopitem
+
+\stopitemize
+
+One change involves the so called xforms and ximages. In \PDFTEX\ these are
+implemented as so called whatsits. But contrary to other whatsits they have
+dimensions that need to be taken into account when for instance calculating
+optimal line breaks. In \LUATEX\ these are now promoted to normal nodes, which
+simplifies code that needs those dimensions.
+
+Another reason for promotion is that these are useful concepts. Backends can
+provide the ability to use content that has been rendered in several places,
+and images are also common. For that reason we also changed the names:
+
+\starttabulate[|l|l|]
+\NC \bf new name \NC \bf old name \NC \NR
+\NC \type {\saveboxresource} \NC \type {\pdfxform} \NC \NR
+\NC \type {\saveimageresource} \NC \type {\pdfximage} \NC \NR
+\NC \type {\useboxresource} \NC \type {\pdfrefxform} \NC \NR
+\NC \type {\useimageresource} \NC \type {\pdfrefximage} \NC \NR
+\NC \type {\lastsavedboxresourceindex} \NC \type {\pdflastxform} \NC \NR
+\NC \type {\lastsavedimageresourceindex} \NC \type {\pdflastximage} \NC \NR
+\NC \type {\lastsavedimageresourcepages} \NC \type {\pdflastximagepages} \NC \NR
+\stoptabulate
+
+There are a few \type {\pdffeedback} features that relate to this but these are
+typical backend specific ones. The index that gets returned is to be considered
+as \quote {just a number} and although it still has the same meaning (object
+related) as before, you should not depend on that.
+
+The protrusion detection mechanism is enhanced a bit to enable a bit more complex
+situations. When protrusion characters are identified some nodes are skipped:
+
+\startitemize[packed]
+\startitem zero glue \stopitem
+\startitem penalties \stopitem
+\startitem empty discretionaries \stopitem
+\startitem normal zero kerns \stopitem
+\startitem rules with zero dimensions \stopitem
+\startitem math nodes with a surround of zero \stopitem
+\startitem dir nodes \stopitem
+\startitem empty horizontal lists \stopitem
+\startitem local par nodes \stopitem
+\startitem inserts, marks and adjusts \stopitem
+\startitem boundaries \stopitem
+\startitem whatsits \stopitem
+\stopitemize
+
+Because this can not be enough, you can also use a protrusion boundary node to
+make the next node being ignored. When the value is~1 or~3, the next node will be
+ignored in the test when locating a left boundary condition. When the value is~2
+or~3, the previous node will be ignored when locating a right boundary condition
+(the search goes from right to left). This permits protrusion combined with for
+instance content moved into the margin:
+
+\starttyping
+\protrusionboundary1\llap{!\quad}«Who needs protrusion?»
+\stoptyping
+
+\stopsubsection
+
+\startsubsection[title=Changes from \ALEPH\ RC4]
+
+Because we wanted proper directional typesetting the \ALEPH\ mechanisms looked
+most attractive. These are rather close to the ones provided by \OMEGA, so what
+we say next applies to both these programs.
+
+\startitemize
+
+\startitem
+ The extended 16-bit math primitives (\type {\omathcode} etc.) have been
+ removed.
+\stopitem
+
+\startitem
+ The \OCP\ processing has been removed completely and as a consequence, the
+ following primitives have been removed:
+
+ \start \raggedright
+ \type {\ocp}, \type {\externalocp}, \type {\ocplist}, \type {\pushocplist},
+ \type {\popocplist}, \type {\clearocplists}, \type {\addbeforeocplist}, \type
+ {\addafterocplist}, \type {\removebeforeocplist}, \type {\removeafterocplist}
+ and \type {\ocptracelevel}
+ \par \stop
+\stopitem
+
+\startitem
+ \LUATEX\ only understands 4~of the 16~direction specifiers of \ALEPH: \type
+ {TLT} (latin), \type {TRT} (arabic), \type {RTT} (cjk), \type {LTL}
+ (mongolian). All other direction specifiers generate an error.
+\stopitem
+
+\startitem
+ The input translations from \ALEPH\ are not implemented, the related
+ primitives are not available:
+
+ \start \raggedright
+ \type {\DefaultInputMode}, \type {\noDefaultInputMode}, \type {\noInputMode},
+ \type {\InputMode}, \type {\DefaultOutputMode}, \type {\noDefaultOutputMode},
+ \type {\noOutputMode}, \type {\OutputMode}, \type {\DefaultInputTranslation},
+ \type {\noDefaultInputTranslation}, \type {\noInputTranslation}, \type
+ {\InputTranslation}, \type {\DefaultOutputTranslation}, \type
+ {\noDefaultOutputTranslation}, \type {\noOutputTranslation} and \type
+ {\OutputTranslation}
+ \par \stop
+\stopitem
+
+\startitem
+ Several bugs have been fixed an confusing implementation details have been sorted
+ out.
+\stopitem
+
+\startitem
+ The scanner for direction specifications now allows an optional space after
+ the direction is completely parsed.
+\stopitem
+
+\startitem
+ The \type {^^} notation has been extended: after \type {^^^^} four hexadecimal
+ characters are expected and after \type {^^^^^^} six hexadecimal characters
+ have to be given. The original \TEX\ interpretation is still valid for the
+ \type {^^} case but the four and six variants do no backtracking, i.e.\ when
+ they are not followed by the right number of hexadecimal digits they issue an
+ error message. Because \type{^^^} is a normal \TEX\ case, we don't support the
+ odd number of \type {^^^^^} either.
+\stopitem
+
+\startitem
+ Glues {\it immediately after} direction change commands are not legal
+ breakpoints.
+\stopitem
+
+\startitem
+ Several mechanisms that need to be right|-|to|-|left aware have been
+ improved. For instance placement of formula numbers.
+\stopitem
+
+\startitem
+ The page dimension related primitives \type {\pagewidth} and \type
+ {\pageheight} have been promoted to core primitives. The \type {\hoffset} and
+ \type {\voffset} primitives have been fixed.
+\stopitem
+
+\startitem
+ The primitives \type {\charwd}, \type {\charht}, \type {\chardp} and \type
+ {\charit} have been removed as we have the \ETEX\ variants \type
+ {\fontchar*}.
+\stopitem
+
+\startitem
+ The two dimension registers \type {\pagerightoffset} and \type
+ {\pagebottomoffset} are now core primitives.
+\stopitem
+
+\startitem
+ The direction related primitives \type {\pagedir}, \type {\bodydir}, \type
+ {\pardir}, \type {\textdir}, \type {\mathdir} and \type {\boxdir} are now
+ core primitives.
+\stopitem
+
+\startitem
+ The promotion of primitives to core primitives as well as the removed of all
+ others means that the initialization namespace \type {aleph} is gone.
+\stopitem
+
+\stopitemize
+
+The above let's itself summarize as: we took the 32 bit aspects and much of the
+directional mechanisms.
+
+\stopsubsection
+
+\startsubsection[title=Changes from standard \WEBC]
+
+The compilation framework is \WEBC\ and we keep using that but without the
+\PASCAL\ to \CCODE\ step. This framework also provides some common features that
+deal with reading bytes from files and locating files in \TDS. This is what we do
+different:
+
+\startitemize
+
+\startitem
+ There is no mltex support.
+\stopitem
+
+\startitem
+ There is no enctex support.
+\stopitem
+
+\startitem
+ The following encoding related command line switches are silently ignored,
+ even in non|-|\LUA\ mode: \type {-8bit}, \type {-translate-file}, \type
+ {-mltex}, \type {-enc} and \type {-etex}.
+\stopitem
+
+\startitem
+ The \type {\openout} whatsits are not written to the log file.
+\stopitem
+
+\startitem
+ Some of the so|-|called \WEBC\ extensions are hard to set up in non|-|\KPSE\
+ mode because \type {texmf.cnf} is not read: \type {shell-escape} is off (but
+ that is not a problem because of \LUA's \type {os.execute}), and the paranoia
+ checks on \type {openin} and \type {openout} do not happen. However, it is
+ easy for a \LUA\ script to do this itself by overloading \type {io.open}.
+\stopitem
+
+\startitem
+ The \quote{E} option does not do anything useful.
+\stopitem
+
+\stopitemize
+
+\stopsubsection
+
+\stopsection
+
+\startsection[reference=backendprimitives,title=The backend primitives \type {\pdf*}]
+
+In a previous section we mentioned that some \PDFTEX\ primitives were removed and
+others promoted to core \LUATEX\ primitives. That is only part of the story. In
+order to separate the backend specific primitives in de code these commands are
+now replaced by only a few. In traditional \TEX\ we only had the \DVI\ backend
+but now we have two: \DVI\ and \PDF. Additional functionality is implemented as
+\quote {extensions} in \TEX speak. By separating more strickly we are able to
+keep the core (fontend) clean and stable. If for some reason an extra backend
+option is needed, it can be implemented without touching the core. The three
+\PDF\ backend related primitives are
+
+\starttyping
+\pdfextension command [specification]
+\pdfvariable name
+\pdffeedback name
+\stoptyping
+
+An extension triggers further parsing, depending on the command given. A variable is
+a (kind of) register and can be read and written, while a feedback is reporting
+something (as it comes from the backend it's normally a sequence of tokens).
+
+In order for \LUATEX\ to be more than just \TEX\ you need to enable primitives. That
+has already be the case right from the start. If you want the traditional \PDFTEX\
+primitives (for as far their functionality is still around) you now can do this:
+
+\starttyping
+\protected\def\pdfliteral {\pdfextension literal}
+\protected\def\pdfcolorstack {\pdfextension colorstack}
+\protected\def\pdfsetmatrix {\pdfextension setmatrix}
+\protected\def\pdfsave {\pdfextension save\relax}
+\protected\def\pdfrestore {\pdfextension restore\relax}
+\protected\def\pdfobj {\pdfextension obj }
+\protected\def\pdfrefobj {\pdfextension refobj }
+\protected\def\pdfannot {\pdfextension annot }
+\protected\def\pdfstartlink {\pdfextension startlink }
+\protected\def\pdfendlink {\pdfextension endlink\relax}
+\protected\def\pdfoutline {\pdfextension outline }
+\protected\def\pdfdest {\pdfextension dest }
+\protected\def\pdfthread {\pdfextension thread }
+\protected\def\pdfstartthread {\pdfextension startthread }
+\protected\def\pdfendthread {\pdfextension endthread\relax}
+\protected\def\pdfinfo {\pdfextension info }
+\protected\def\pdfcatalog {\pdfextension catalog }
+\protected\def\pdfnames {\pdfextension names }
+\protected\def\pdfincludechars {\pdfextension includechars }
+\protected\def\pdffontattr {\pdfextension fontattr }
+\protected\def\pdfmapfile {\pdfextension mapfile }
+\protected\def\pdfmapline {\pdfextension mapline }
+\protected\def\pdftrailer {\pdfextension trailer }
+\protected\def\pdfglyphtounicode {\pdfextension glyphtounicode }
+\stoptyping
+
+The introspective primitives can be defined as:
+
+\starttyping
+\def\pdftexversion {\numexpr\pdffeedback version\relax}
+\def\pdftexrevision {\pdffeedback revision}
+\def\pdflastlink {\numexpr\pdffeedback lastlink\relax}
+\def\pdfretval {\numexpr\pdffeedback retval\relax}
+\def\pdflastobj {\numexpr\pdffeedback lastobj\relax}
+\def\pdflastannot {\numexpr\pdffeedback lastannot\relax}
+\def\pdfxformname {\numexpr\pdffeedback xformname\relax}
+\def\pdfcreationdate {\pdffeedback creationdate}
+\def\pdffontname {\numexpr\pdffeedback fontname\relax}
+\def\pdffontobjnum {\numexpr\pdffeedback fontobjnum\relax}
+\def\pdffontsize {\dimexpr\pdffeedback fontsize\relax}
+\def\pdfpageref {\numexpr\pdffeedback pageref\relax}
+\def\pdfcolorstackinit {\pdffeedback colorstackinit}
+\stoptyping
+
+The configuration related registers have become:
+
+\starttyping
+\edef\pdfcompresslevel {\pdfvariable compresslevel}
+\edef\pdfobjcompresslevel {\pdfvariable objcompresslevel}
+\edef\pdfdecimaldigits {\pdfvariable decimaldigits}
+\edef\pdfgamma {\pdfvariable gamma}
+\edef\pdfimageresolution {\pdfvariable imageresolution}
+\edef\pdfimageapplygamma {\pdfvariable imageapplygamma}
+\edef\pdfimagegamma {\pdfvariable imagegamma}
+\edef\pdfimagehicolor {\pdfvariable imagehicolor}
+\edef\pdfimageaddfilename {\pdfvariable imageaddfilename}
+\edef\pdfpkresolution {\pdfvariable pkresolution}
+\edef\pdfpkfixeddpi {\pdfvariable pkfixeddpi}
+\edef\pdfinclusioncopyfonts {\pdfvariable inclusioncopyfonts}
+\edef\pdfinclusionerrorlevel {\pdfvariable inclusionerrorlevel}
+\edef\pdfignoreunknownimages {\pdfvariable ignoreunknownimages}
+\edef\pdfgentounicode {\pdfvariable gentounicode}
+\edef\pdfpagebox {\pdfvariable pagebox}
+\edef\pdfminorversion {\pdfvariable minorversion}
+\edef\pdfuniqueresname {\pdfvariable uniqueresname}
+
+\edef\pdfhorigin {\pdfvariable horigin}
+\edef\pdfvorigin {\pdfvariable vorigin}
+\edef\pdflinkmargin {\pdfvariable linkmargin}
+\edef\pdfdestmargin {\pdfvariable destmargin}
+\edef\pdfthreadmargin {\pdfvariable threadmargin}
+\edef\pdfxformmargin {\pdfvariable xformmargin}
+
+\edef\pdfpagesattr {\pdfvariable pagesattr}
+\edef\pdfpageattr {\pdfvariable pageattr}
+\edef\pdfpageresources {\pdfvariable pageresources}
+\edef\pdfxformattr {\pdfvariable xformattr}
+\edef\pdfxformresources {\pdfvariable xformresources}
+\edef\pdfpkmode {\pdfvariable pkmode}
+
+\edef\pdfsuppressoptionalinfo {\pdfvariable suppressoptionalinfo }
+\edef\pdftrailerid {\pdfvariable trailerid }
+\stoptyping
+
+The variables are internal ones, so they are anonymous. When you ask for the
+meaning of a few previously defined ones:
+
+\starttyping
+\meaning\pdfhorigin
+\meaning\pdfcompresslevel
+\meaning\pdfpageattr
+\stoptyping
+
+you will get:
+
+\starttyping
+macro:->[internal backend dimension]
+macro:->[internal backend integer]
+macro:->[internal backend tokenlist]
+\stoptyping
+
+The \type {\edef} can also be an \type {\def} but it's a bit more efficient
+to expand the lookup related register beforehand. After that you can adapt
+the defaults; these are:
+
+\starttyping
+\pdfcompresslevel 9
+\pdfobjcompresslevel 1 % used: (0,9)
+\pdfdecimaldigits 4 % used: (3,6)
+\pdfgamma 1000
+\pdfimageresolution 71
+\pdfimageapplygamma 0
+\pdfimagegamma 2200
+\pdfimagehicolor 1
+\pdfimageaddfilename 1
+\pdfpkresolution 72
+\pdfpkfixeddpi 0
+\pdfinclusioncopyfonts 0
+\pdfinclusionerrorlevel 0
+\pdfignoreunknownimages 0
+\pdfgentounicode 0
+\pdfpagebox 0
+\pdfminorversion 4
+\pdfuniqueresname 0
+
+\pdfhorigin 1in
+\pdfvorigin 1in
+\pdflinkmargin 0pt
+\pdfdestmargin 0pt
+\pdfthreadmargin 0pt
+\pdfxformmargin 0pt
+\stoptyping
+
+If you also want some backward compatibility, you can add:
+
+\starttyping
+\let\pdfpagewidth \pagewidth
+\let\pdfpageheight \pageheight
+
+\let\pdfadjustspacing \adjustspacing
+\let\pdfprotrudechars \protrudechars
+\let\pdfnoligatures \ignoreligaturesinfont
+\let\pdffontexpand \expandglyphsinfont
+\let\pdfcopyfont \copyfont
+
+\let\pdfxform \saveboxresource
+\let\pdflastxform \lastsavedboxresourceindex
+\let\pdfrefxform \useboxresource
+
+\let\pdfximage \saveimageresource
+\let\pdflastximage \lastsavedimageresourceindex
+\let\pdflastximagepages\lastsavedimageresourcepages
+\let\pdfrefximage \useimageresource
+
+\let\pdfsavepos \savepos
+\let\pdflastxpos \lastxpos
+\let\pdflastypos \lastypos
+
+\let\pdfoutput \outputmode
+\let\pdfdraftmode \draftmode
+
+\let\pdfpxdimen \pxdimen
+
+\let\pdfinsertht \insertht
+
+\let\pdfnormaldeviate \normaldeviate
+\let\pdfuniformdeviate \uniformdeviate
+\let\pdfsetrandomseed \setrandomseed
+\let\pdfrandomseed \randomseed
+
+\let\pdfprimitive \primitive
+\let\ifpdfprimitive \ifprimitive
+
+\let\ifpdfabsnum \ifabsnum
+\let\ifpdfabsdim \ifabsdim
+\stoptyping
+
+And even:
+
+\starttyping
+\newdimen\pdfeachlineheight
+\newdimen\pdfeachlinedepth
+\newdimen\pdflastlinedepth
+\newdimen\pdffirstlineheight
+\newdimen\pdfignoreddimen
+\stoptyping
+
+The backend is derived from \PDFTEX\ so the same syntax applies. However, the
+\type {outline} command accepts a \type {objnum} followed by a number. No
+checking takes place so when this is used it had better be a valid (flushed)
+object.
+
+In order to be (more or less) compatible with \PDFTEX\ we also support the
+option to suppress some info:
+
+\starttyping
+\pdfvariable suppressoptionalinfo \numexpr
+ 0
+ + 1 % PTEX.FullBanner
+ + 2 % PTEX.FileName
+ + 4 % PTEX.PageNumber
+ + 8 % PTEX.InfoDict
+ + 16 % Creator
+ + 32 % CreationDate
+ + 64 % ModDate
+ + 128 % Producer
+ + 256 % Trapped
+ + 512 % ID
+\relax
+\stoptyping
+
+In addition you can overload the trailer id, but we don't do any checking on
+validity, so you have to pass a valid array. The following is like the ones
+normally generated by the engine:
+
+\starttyping
+\pdfvariable trailerid {[
+ <FA052949448907805BA83C1E78896398>
+ <FA052949448907805BA83C1E78896398>
+]}
+\stoptyping
+
+So, you even need to include the brackets!
+
+Although we started from a merge of \PDFTEX\ and \ALEPH, by now the code base as
+well as functionality has diverted from those parents. Here we show the options
+that can be passed to the extensions.
+
+\starttexsyntax
+\pdfextension literal
+ [ direct | page ] { tokens }
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension dest
+ num integer | name { tokens }!crlf
+ [ fitbh | fitbv | fitb | fith| fitv | fit |
+ fitr <rule spec> | xyz [ zoom <integer> ]
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension annot
+ reserveobjnum | useobjnum <integer>
+ { tokens }
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension save
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension restore
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension setmatrix
+ { tokens }
+\stoptexsyntax
+
+\starttexsyntax
+[ \immediate ] \pdfextension obj
+ reserveobjnum
+\stoptexsyntax
+
+\starttexsyntax
+[ \immediate ] \pdfextension obj
+ [ useobjnum <integer> ]
+ [ uncompressed ]
+ [ stream [ attr { tokens } ] ]
+ [ file ]
+ { tokens }
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension refobj
+ <integer>
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension colorstack
+ <integer>
+ set { tokens } | push { tokens } | pop | current
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension startlink
+ [ attr { tokens } ]
+ user { tokens } | goto | thread
+ [ file { tokens } ]
+ [ page <integer> { tokens } | name { tokens } | num integer ]
+ [ newwindow | nonewwindow ]
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension endlink
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension startthread
+ num <integer> | name { tokens }
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension endthread
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension thread
+ num <integer> | name { tokens }
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension outline
+ [ attr { tokens } ]
+ [ useobjnum <integer> ]
+ [ count <integer> ]
+ { tokens }
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension glyphtounicode
+ { tokens }
+ { tokens }
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension catalog
+ { tokens }
+ [ openaction
+ user { tokens } | goto | thread
+ [ file { tokens } ]
+ [ page <integer> { tokens } | name { tokens } | num <integer> ]
+ [ newwindow | nonewwindow ] ]
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension fontattr
+ <integer>
+ {tokens}
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension mapfile
+ {tokens}
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension mapline
+ {tokens}
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension includechars
+ {tokens}
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension info
+ {tokens}
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension names
+ {tokens}
+\stoptexsyntax
+
+\starttexsyntax
+\pdfextension trailer
+ {tokens}
+\stoptexsyntax
+
+\stopsection
+
+\startsection[title=Directions]
+
+The directional model in \LUATEX\ is inherited from \OMEGA|/|\ALEPH\ but we tried
+to improve it a bit. At some point we played with recovery of modes but that was
+disabled later on when we found that it interfered with nested directions. That
+itself had as side effect that the node list was no longer balanced with respect
+to directional nodes which in turn can give side effects when a series of dir
+changes happens without grouping.
+
+The current (0.97 onward) approach is that we again make the list balanced but
+try to avoid some side effects. What happens is quite intuitive if we forget
+about spaces (turned into glue) but even there what happens makes sense if you
+look at it in detail. However that logic makes in|-|group switching kind of
+useless when no proper nested grouping is used: switching from right to left
+several times nested, results in spacing ending up after each other due to nested
+mirroring. Of course a sane macro package will manage this for the user but here
+we are discussing the low level dir injection.
+
+This is what happens:
+
+\starttyping
+\textdir TRT nur {\textdir TLT run \textdir TRT NUR} nur
+\stoptyping
+
+This becomes stepwise:
+
+\startnarrower
+\starttyping
+injected: [+TRT]nur {[+TLT]run [+TRT]NUR} nur
+balanced: [+TRT]nur {[+TLT]run [-TLT][+TRT]NUR[-TRT]} nur[-TRT]
+result : run {RUNrun } run
+\stoptyping
+\stopnarrower
+
+And this:
+
+\starttyping
+\textdir TRT nur {nur \textdir TLT run \textdir TRT NUR} nur
+\stoptyping
+
+becomes:
+
+\startnarrower
+\starttyping
+injected: [+TRT]nur {nur [+TLT]run [+TRT]NUR} nur
+balanced: [+TRT]nur {nur [+TLT]run [-TLT][+TRT]NUR[-TRT]} nur[-TRT]
+result : run {run RUNrun } run
+\stoptyping
+\stopnarrower
+
+Now, in the following examples watch where we put the braces:
+
+\startbuffer
+\textdir TRT nur {{\textdir TLT run} {\textdir TRT NUR}} nur
+\stopbuffer
+
+\typebuffer
+
+This becomes:
+
+\startnarrower
+\getbuffer
+\stopnarrower
+
+Compare this to:
+
+\startbuffer
+\textdir TRT nur {{\textdir TLT run }{\textdir TRT NUR}} nur
+\stopbuffer
+
+\typebuffer
+
+Which renders as:
+
+\startnarrower
+\getbuffer
+\stopnarrower
+
+So how do we deal with the next?
+
+\startbuffer
+\def\ltr{\textdir TLT\relax}
+\def\rtl{\textdir TRT\relax}
+
+run {\rtl nur {\ltr run \rtl NUR \ltr run \rtl NUR} nur}
+run {\ltr run {\rtl nur \ltr RUN \rtl nur \ltr RUN} run}
+\stopbuffer
+
+\typebuffer
+
+It gets typeset as:
+
+\startnarrower
+\startlines
+\getbuffer
+\stoplines
+\stopnarrower
+
+We could define the two helpers to look back, pick up a skip, remove it and
+inject it after the dir node. But that way we loose the subtype information that
+for some applications can be handy to be kept as|-|is. This is why we now have a
+variant of \type {\textdir} which injects the balanced node before the skip.
+Instead of the previous definition we can use:
+
+\startbuffer[def]
+\def\ltr{\linedir TLT\relax}
+\def\rtl{\linedir TRT\relax}
+\stopbuffer
+
+\typebuffer[def]
+
+and this time:
+
+\startbuffer[txt]
+run {\rtl nur {\ltr run \rtl NUR \ltr run \rtl NUR} nur}
+run {\ltr run {\rtl nur \ltr RUN \rtl nur \ltr RUN} run}
+\stopbuffer
+
+\typebuffer[txt]
+
+comes out as a properly spaced:
+
+\startnarrower
+\startlines
+\getbuffer[def,txt]
+\stoplines
+\stopnarrower
+
+Anything more complex that this, like combination of skips and penalties, or
+kerns, should be handled in the input or macro package because there is no way we
+can predict the expected behaviour. In fact, the \type {\linedir} is just a
+convenience extra which could also have been implemented using node list parsing.
+
+Another adaptation to the \ALEPH\ directional model is control over shapes driven
+by \type {\hangindent} and \type {\parshape}. This is controlled by a new parameter
+\type {\shapemode}:
+
+\starttabulate[|cTB|c|]
+\NC \NC \bf \type {\hangindent} \NC \bf \type {\parshape} \NC \NR
+\NC 0 \NC normal \NC normal \NC \NR
+\NC 1 \NC mirrored \NC normal \NC \NR
+\NC 2 \NC normal \NC mirrored \NC \NR
+\NC 3 \NC mirrored \NC mirrored \NC \NR
+\stoptabulate
+
+The value is reset to zero (like \type {\hangindent} and \type {\parshape})
+after the paragraph is done with. You can use negative values to preven t
+this.
+
+In \in {figure} [fig:shapemode] a few examples are given.
+
+\startplacefigure[reference=fig:shapemode,title={The effect of \type {shapemode}.}]
+ \startcombination[2*3]
+ {\ruledvbox \bgroup \setuptolerance[verytolerant]
+ \hsize .45\textwidth \switchtobodyfont[6pt]
+ \pardir TLT \textdir TLT
+ \hangindent 40pt \hangafter -3
+ \leftskip10pt \input tufte \par
+ \egroup} {TLT: hangindent}
+ {\ruledvbox \bgroup \setuptolerance[verytolerant]
+ \hsize .45\textwidth \switchtobodyfont[6pt]
+ \pardir TLT \textdir TLT
+ \parshape 4 0pt .8\hsize 10pt .8\hsize 20pt .8\hsize 0pt \hsize
+ \input tufte \par
+ \egroup} {TLT: parshape}
+ {\ruledvbox \bgroup \setuptolerance[verytolerant]
+ \hsize .45\textwidth \switchtobodyfont[6pt]
+ \pardir TRT \textdir TRT
+ \hangindent 40pt \hangafter -3
+ \leftskip10pt \input tufte \par
+ \egroup} {TRT: hangindent mode 0}
+ {\ruledvbox \bgroup \setuptolerance[verytolerant]
+ \hsize .45\textwidth \switchtobodyfont[6pt]
+ \pardir TRT \textdir TRT
+ \parshape 4 0pt .8\hsize 10pt .8\hsize 20pt .8\hsize 0pt \hsize
+ \input tufte \par
+ \egroup} {TRT: parshape mode 0}
+ {\ruledvbox \bgroup \setuptolerance[verytolerant]
+ \hsize .45\textwidth \switchtobodyfont[6pt]
+ \shapemode=3
+ \pardir TRT \textdir TRT
+ \hangindent 40pt \hangafter -3
+ \leftskip10pt \input tufte \par
+ \egroup} {TRT: hangindent mode 1 & 3}
+ {\ruledvbox \bgroup \setuptolerance[verytolerant]
+ \hsize .45\textwidth \switchtobodyfont[6pt]
+ \shapemode=3
+ \pardir TRT \textdir TRT
+ \parshape 4 0pt .8\hsize 10pt .8\hsize 20pt .8\hsize 0pt \hsize
+ \input tufte \par
+ \egroup} {TRT: parshape mode 2 & 3}
+ \stopcombination
+\stopplacefigure
+
+\stopsection
+
+\startsection[title=Implementation notes]
+
+\startsubsection[title=Memory allocation]
+
+The single internal memory heap that traditional \TEX\ used for tokens and nodes
+is split into two separate arrays. Each of these will grow dynamically when
+needed.
+
+The \type {texmf.cnf} settings related to main memory are no longer used (these
+are: \type {main_memory}, \type {mem_bot}, \type {extra_mem_top} and \type
+{extra_mem_bot}). \quote {Out of main memory} errors can still occur, but the
+limiting factor is now the amount of RAM in your system, not a predefined limit.
+
+Also, the memory (de)allocation routines for nodes are completely rewritten. The
+relevant code now lives in the C file \type {texnode.c}, and basically uses a
+dozen or so \quote {avail} lists instead of a doubly|-|linked model. An extra
+function layer is added so that the code can ask for nodes by type instead of
+directly requisitioning a certain amount of memory words.
+
+Because of the split into two arrays and the resulting differences in the data
+structures, some of the macros have been duplicated. For instance, there are now
+\type {vlink} and \type {vinfo} as well as \type {token_link} and \type
+{token_info}. All access to the variable memory array is now hidden behind a
+macro called \type {vmem}. We mention this because using the \TEX book as
+reference is still quite valid but not for memory related details. Another
+significate detail is that we have double linked node lists and that some nodes
+carry more data.
+
+The implementation of the growth of two arrays (via reallocation) introduces a
+potential pitfall: the memory arrays should never be used as the left hand side
+of a statement that can modify the array in question. Details like this are
+of no concern to users.
+
+The input line buffer and pool size are now also reallocated when needed, and the
+\type {texmf.cnf} settings \type {buf_size} and \type {pool_size} are silently
+ignored.
+
+\stopsubsection
+
+\startsubsection[title=Sparse arrays]
+
+The \type {\mathcode}, \type {\delcode}, \type {\catcode}, \type {\sfcode}, \type
+{\lccode} and \type {\uccode} (and the new \type {\hjcode}) tables are now sparse
+arrays that are implemented in~\CCODE. They are no longer part of the \TEX\
+\quote {equivalence table} and because each had 1.1 million entries with a few
+memory words each, this makes a major difference in memory usage.
+
+The \type {\catcode}, \type {\sfcode}, \type {\lccode}, \type {\uccode} and \type
+{\hjcode} assignments do not yet show up when using the \ETEX\ tracing routines
+\type {\tracingassigns} and \type {\tracingrestores}.
+
+A side|-|effect of the current implementation is that \type {\global} is now more
+expensive in terms of processing than non|-|global assignments.
+
+The glyph ids within a font are also managed by means of a sparse array as glyph
+ids can go up to index $2^{21}-1$.
+
+\stopsubsection
+
+\startsubsection[title=Simple single-character csnames]
+
+Single|-|character commands are no longer treated specially in the internals,
+they are stored in the hash just like the multiletter csnames.
+
+The code that displays control sequences explicitly checks if the length is one
+when it has to decide whether or not to add a trailing space.
+
+Active characters are internally implemented as a special type of multi|-|letter
+control sequences that uses a prefix that is otherwise impossible to obtain.
+
+\stopsubsection
+
+\startsubsection[title=Compressed format]
+
+The format is passed through \type {zlib}, allowing it to shrink to roughly half
+of the size it would have had in uncompressed form. This takes a bit more \CPU\
+cycles but much less disk \IO, so it should still be faster.
+
+\stopsubsection
+
+\startsubsection[title=Binary file reading]
+
+All of the internal code is changed in such a way that if one of the \type
+{read_xxx_file} callbacks is not set, then the file is read by a \CCODE\ function
+using basically the same convention as the callback: a single read into a buffer
+big enough to hold the entire file contents. While this uses more memory than the
+previous code (that mostly used \type {getc} calls), it can be quite a bit faster
+(depending on your \IO\ subsystem).
+
+\stopsubsection
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex
new file mode 100644
index 000000000..8d32ab287
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex
@@ -0,0 +1,1915 @@
+% language=uk
+
+\environment luatex-style
+\environment luatex-logos
+
+\startcomponent luatex-nodes
+
+\startchapter[reference=nodes,title={Nodes}]
+
+\section{\LUA\ node representation}
+
+\TEX's nodes are represented in \LUA\ as userdata object with a variable set of
+fields. In the following syntax tables, such the type of such a userdata object
+is represented as \syntax {<node>}.
+
+The current return value of \type {node.types()} is:
+\startluacode
+ for id, name in table.sortedhash(node.types()) do
+ context.type(name)
+ context(" (%s), ",id)
+ end
+ context.removeunwantedspaces()
+ context.removepunctuation()
+\stopluacode
+. % period
+
+The \type {\lastnodetype} primitive is \ETEX\ compliant. The valid range is still
+$[-1,15]$ and glyph nodes (formerly known as char nodes) have number~0 while
+ligature nodes are mapped to~7. That way macro packages can use the same symbolic
+names as in traditional \ETEX. Keep in mind that these \ETEX\ node numbers are
+different from the real internal ones and that there are more \ETEX\ node types
+than~15.
+
+You can ask for a list of fields with the \type {node.fields} (which takes an id)
+and for valid subtypes with \type {node.subtypes} (which takes a string because
+eventually we might support more used enumerations).
+
+\subsection{Attributes}
+
+The newly introduced attribute registers are non|-|trivial, because the value
+that is attached to a node is essentially a sparse array of key|-|value pairs. It
+is generally easiest to deal with attribute lists and attributes by using the
+dedicated functions in the \type {node} library, but for completeness, here is
+the low|-|level interface.
+
+\subsubsection{attribute_list nodes}
+
+An \type {attribute_list} item is used as a head pointer for a list of attribute
+items. It has only one user-visible field:
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC next \NC node \NC pointer to the first attribute \NC \NR
+\stoptabulate
+
+\subsubsection{attribute nodes}
+
+A normal node's attribute field will point to an item of type \type
+{attribute_list}, and the \type {next} field in that item will point to the first
+defined \quote {attribute} item, whose \type {next} will point to the second
+\quote {attribute} item, etc.
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC next \NC node \NC pointer to the next attribute \NC \NR
+\NC number \NC number \NC the attribute type id \NC \NR
+\NC value \NC number \NC the attribute value \NC \NR
+\stoptabulate
+
+As mentioned it's better to use the official helpers rather than edit these
+fields directly. For instance the \type {prev} field is used for other purposes
+and there is no double linked list.
+
+\subsection{Main text nodes}
+
+These are the nodes that comprise actual typesetting commands. A few fields are
+present in all nodes regardless of their type, these are:
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC next \NC node \NC the next node in a list, or nil \NC \NR
+\NC id \NC number \NC the node's type (\type {id}) number \NC \NR
+\NC subtype \NC number \NC the node \type {subtype} identifier \NC \NR
+\stoptabulate
+
+The \type {subtype} is sometimes just a stub entry. Not all nodes actually use
+the \type {subtype}, but this way you can be sure that all nodes accept it as a
+valid field name, and that is often handy in node list traversal. In the
+following tables \type {next} and \type {id} are not explicitly mentioned.
+
+Besides these three fields, almost all nodes also have an \type {attr} field, and
+there is a also a field called \type {prev}. That last field is always present,
+but only initialized on explicit request: when the function \type {node.slide()}
+is called, it will set up the \type {prev} fields to be a backwards pointer in
+the argument node list. By now most of \TEX's node processing makes sure that the
+\type {prev} nodes are valid but there can be exceptions, especially when the
+internal magic uses a leading \type {temp} nodes to temporarily store a state.
+
+\subsubsection{hlist nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{list} \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC width \NC number \NC the width of the box \NC \NR
+\NC height \NC number \NC the height of the box \NC \NR
+\NC depth \NC number \NC the depth of the box \NC \NR
+\NC shift \NC number \NC a displacement perpendicular to the character progression direction \NC \NR
+\NC glue_order \NC number \NC a number in the range $[0,4]$, indicating the glue order \NC \NR
+\NC glue_set \NC number \NC the calculated glue ratio \NC \NR
+\NC glue_sign \NC number \NC 0 = \type {normal}, 1 = \type {stretching}, 2 = \type {shrinking} \NC \NR
+\NC head/list \NC node \NC the first node of the body of this list \NC \NR
+\NC dir \NC string \NC the direction of this box, see~\in[dirnodes] \NC \NR
+\stoptabulate
+
+A warning: never assign a node list to the \type {head} field unless you are sure
+its internal link structure is correct, otherwise an error may result.
+
+Note: the field name \type {head} and \type {list} are both valid. Sometimes it
+makes more sense to refer to a list by \type {head}, sometimes \type {list} makes
+more sense.
+
+\subsubsection{vlist nodes}
+
+This node is similar to \type {hlist}, except that \quote {shift} is a displacement
+perpendicular to the line progression direction, and \quote {subtype} only has
+the values 0, 4, and~5.
+
+\subsubsection{rule nodes}
+
+Contrary to traditional \TEX, \LUATEX\ has more subtypes because we also use
+rules to store reuseable objects and images. User nodes are invisible and can be
+intercepted by a callback.
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{rule} \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC width \NC number \NC the width of the rule where the special value $-1073741824$ is used for \quote {running} glue dimensions \NC \NR
+\NC height \NC number \NC the height of the rule (can be negative) \NC \NR
+\NC depth \NC number \NC the depth of the rule (can be negative) \NC \NR
+\NC dir \NC string \NC the direction of this rule, see~\in[dirnodes] \NC \NR
+\NC index \NC number \NC an optional index that can be referred to \NC \NR
+\stoptabulate
+
+\subsubsection{ins nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC the insertion class \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC cost \NC number \NC the penalty associated with this insert \NC \NR
+\NC height \NC number \NC height of the insert \NC \NR
+\NC depth \NC number \NC depth of the insert \NC \NR
+\NC head/list \NC node \NC the first node of the body of this insert \NC \NR
+\stoptabulate
+
+There is a set of extra fields that concern the associated glue: \type {width},
+\type {stretch}, \type {stretch_order}, \type {shrink} and \type {shrink_order}.
+These are all numbers.
+
+A warning: never assign a node list to the \type {head} field unless you are sure
+its internal link structure is correct, otherwise an error may be result. You can use
+\type {list} instead (often in functions you want to use local variable swith similar
+names and both names are equally sensible).
+
+\subsubsection{mark nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC unused \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC class \NC number \NC the mark class \NC \NR
+\NC mark \NC table \NC a table representing a token list \NC \NR
+\stoptabulate
+
+\subsubsection{adjust nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{adjust} \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC head/list \NC node \NC adjusted material \NC \NR
+\stoptabulate
+
+A warning: never assign a node list to the \type {head} field unless you are sure
+its internal link structure is correct, otherwise an error may be result.
+
+\subsubsection{disc nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{disc} \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC pre \NC node \NC pointer to the pre|-|break text \NC \NR
+\NC post \NC node \NC pointer to the post|-|break text \NC \NR
+\NC replace \NC node \NC pointer to the no|-|break text \NC \NR
+\NC penalty \NC number \NC the penalty associated with the break, normally \type {\hyphenpenalty} or \type {\exhyphenpenalty} \NC \NR
+\stoptabulate
+
+The subtype numbers~4 and~5 belong to the \quote {of-f-ice} explanation given
+elsewhere.
+
+These disc nodes are kind of special as at some point they also keep information
+about breakpoints and nested ligatures. The \type {pre}, \type {post} and \type
+{replace} fields at the \LUA\ end are in fact indirectly accessed and have a
+\type {prev} pointer that is not \type {nil}. This means that when you mess
+around with the head of these (three) lists, you also need to reassign them
+because that will restore the proper \type {prev} pointer, so:
+
+\starttyping
+pre = d.pre
+-- change the list starting with pre
+d.pre = pre
+\stoptyping
+
+Otherwise you can end up with an invalid internal perception of reality and
+\LUATEX\ might even decide to crash on you. It also means that running forward
+over for instance \type {pre} is ok but backward you need to stop at \type {pre}.
+And you definitely must not mess with the node that \type {prev} points to, if
+only because it is not really an node but part of the disc data structure (so
+freeing it again might crash \LUATEX).
+
+\subsubsection{math nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{math} \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC surround \NC number \NC width of the \type {\mathsurround} kern \NC \NR
+\stoptabulate
+
+There is a set of extra fields that concern the associated glue: \type {width},
+\type {stretch}, \type {stretch_order}, \type {shrink} and \type {shrink_order}.
+These are all numbers.
+
+\subsubsection{glue nodes}
+
+Skips are about the only type of data objects in traditional \TEX\ that are not a
+simple value. The structure that represents the glue components of a skip is
+called a \type {glue_spec}, and it has the following accessible fields:
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf key \NC \bf type \NC \bf explanation \NC \NR
+\NC width \NC number \NC the horizontal or vertical displacement \NC \NR
+\NC stretch \NC number \NC extra (positive) displacement or stretch amount \NC \NR
+\NC stretch_order \NC number \NC factor applied to stretch amount \NC \NR
+\NC shrink \NC number \NC extra (negative) displacement or shrink amount\NC \NR
+\NC shrink_order \NC number \NC factor applied to shrink amount \NC \NR
+\stoptabulate
+
+The effective width of some glue subtypes depends on the stretch or shrink needed
+to make the encapsulating box fit its dimensions. For instance, in a paragraph
+lines normally have glue representing spaces and these stretch of shrink to make
+the content fit in the available space. The \type {effective_glue} function that
+takes a glue node and a parent (hlist or vlist) returns the effective width of
+that glue item.
+
+A gluespec node is a special kind of node that is used for storing a set of glue
+values in registers. Originally they were also used to store properties of glue
+nodes (using a system of reference counts) but we now keep these properties in
+the glue nodes themselves, which gives a cleaner interface to \LUA.
+
+The indirect spec approach was in fact an optimization in the original \TEX\
+code. First of all it can save quite some memory because all these spaces that
+become glue now share the same specification (only the reference count is
+incremented), and zero testing is also a bit faster because only the pointer has
+to be checked (this is no longer true for engines that implement for instance
+protrusion where we really need to ensure that zero is zero when we test for
+bounds). Another side effect is that glue specifications are read|-|only, so in
+the end copies need to be made when they are used from \LUA\ (each assignment to
+a field can result in a new copy). So in the end the advantages of sharing are
+not that high (and nowadays memory is less an issue, also given that a glue node
+is only a few memory words larger than a spec).
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{glue} \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC leader \NC node \NC pointer to a box or rule for leaders \NC \NR
+\stoptabulate
+
+In addition there are the \type {width}, \type {stretch} \type {stretch_order},
+\type {shrink}, and \type {shrink_order} fields. Note that we use the key \type
+{width} in both horizontal and vertical glue. This suits the \TEX\ internals well
+so we decided to stick to that naming.
+
+A regular word space also results in a \type {spaceskip} subtype (this used to be
+a \type {userskip} with subtype zero).
+
+\subsubsection{kern nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{kern} \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC kern \NC number \NC fixed horizontal or vertical advance \NC \NR
+\stoptabulate
+
+\subsubsection{penalty nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC not used \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC penalty \NC number \NC the penalty value \NC \NR
+\stoptabulate
+
+\subsubsection[glyphnodes]{glyph nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \rmbf type \NC \rmbf explanation \NC \NR
+\NC subtype \NC number \NC bitfield \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC char \NC number \NC the chatacter index in the font \NC \NR
+\NC font \NC number \NC the font identifier \NC \NR
+\NC lang \NC number \NC the language identifier \NC \NR
+\NC left \NC number \NC the frozen \type {\lefthyphenmnin} value \NC \NR
+\NC right \NC number \NC the frozen \type {\righthyphenmnin} value \NC \NR
+\NC uchyph \NC boolean \NC the frozen \type {\uchyph} value \NC \NR
+\NC components \NC node \NC pointer to ligature components \NC \NR
+\NC xoffset \NC number \NC a virtual displacement in horizontal direction \NC \NR
+\NC yoffset \NC number \NC a virtual displacement in vertical direction \NC \NR
+\NC xadvance \NC number \NC an additional advance after the glyph (experimental) \NC \NR
+\NC width \NC number \NC the (original) width of the character \NC \NR
+\NC height \NC number \NC the (original) height of the character\NC \NR
+\NC depth \NC number \NC the (original) depth of the character\NC \NR
+\NC expansion_factor \NC number \NC the to be applied expansion_factor \NC \NR
+\stoptabulate
+
+The \type {width}, \type {height} and \type {depth} values are read|-|only. The
+\type {expansion_factor} is assigned in the parbuilder and used in the backend.
+
+A warning: never assign a node list to the components field unless you are sure
+its internal link structure is correct, otherwise an error may be result. Valid
+bits for the \type {subtype} field are:
+
+\starttabulate[|c|l|]
+\NC \rmbf bit \NC \bf meaning \NC \NR
+\NC 0 \NC character \NC \NR
+\NC 1 \NC ligature \NC \NR
+\NC 2 \NC ghost \NC \NR
+\NC 3 \NC left \NC \NR
+\NC 4 \NC right \NC \NR
+\stoptabulate
+
+See \in {section} [charsandglyphs] for a detailed description of the \type
+{subtype} field.
+
+The \type {expansion_factor} has been introduced as part of the separation
+between font- and backend. It is the result of extensive experiments with a more
+efficient implementation of expansion. Early versions of \LUATEX\ already
+replaced multiple instances of fonts in the backend by scaling but contrary to
+\PDFTEX\ in \LUATEX\ we now also got rid of font copies in the frontend and
+replaced them by expansion factors that travel with glyph nodes. Apart from a
+cleaner approach this is also a step towards a better separation between front-
+and backend.
+
+The \type {is_char} function checks if a node is a glyph node with a subtype still
+less than 256. This function can be used to determine if applying font logic to a
+glyph node makes sense. The value \type {nil} gets returned when the node is not
+a glyph, a character number is returned if the node is still tagged as character
+and \type {false} gets returned otherwise. When nil is returned, the id is also
+returned. The \type {is_glyph} variant doesn't check for a subtype being less
+than 256, so it returns either the character value or nil plus the id. These
+helpers are not always faster than separate calls but they sometimes permit
+making more readable tests.
+
+\subsubsection{boundary nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{boundary} \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC value \NC number \NC values 0--255 are reserved \NC \NR
+\stoptabulate
+
+This node relates to the \type {\noboundary}, \type {\boundary}, \type
+{\protrusionboundary} and \type {\wordboundary} primitives.
+
+\subsubsection{local_par nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC pen_inter \NC number \NC local interline penalty (from \type {\localinterlinepenalty}) \NC \NR
+\NC pen_broken \NC number \NC local broken penalty (from \type {\localbrokenpenalty}) \NC \NR
+\NC dir \NC string \NC the direction of this par. see~\in [dirnodes] \NC \NR
+\NC box_left \NC node \NC the \type {\localleftbox} \NC \NR
+\NC box_left_width \NC number \NC width of the \type {\localleftbox} \NC \NR
+\NC box_right \NC node \NC the \type {\localrightbox} \NC \NR
+\NC box_right_width \NC number \NC width of the \type {\localrightbox} \NC \NR
+\stoptabulate
+
+A warning: never assign a node list to the \type {box_left} or \type {box_right}
+field unless you are sure its internal link structure is correct, otherwise an
+error may be result.
+
+\subsubsection[dirnodes]{dir nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC dir \NC string \NC the direction (but see below) \NC \NR
+\NC level \NC number \NC nesting level of this direction whatsit \NC \NR
+\stoptabulate
+
+A note on \type {dir} strings. Direction specifiers are three|-|letter
+combinations of \type {T}, \type {B}, \type {R}, and \type {L}.
+
+These are built up out of three separate items:
+
+\startitemize[packed]
+\startitem
+ the first is the direction of the \quote{top} of paragraphs.
+\stopitem
+\startitem
+ the second is the direction of the \quote{start} of lines.
+\stopitem
+\startitem
+ the third is the direction of the \quote{top} of glyphs.
+\stopitem
+\stopitemize
+
+However, only four combinations are accepted: \type {TLT}, \type {TRT}, \type
+{RTT}, and \type {LTL}.
+
+Inside actual \type {dir} whatsit nodes, the representation of \type {dir} is not
+a three-letter but a four|-|letter combination. The first character in this case
+is always either \type {+} or \type {-}, indicating whether the value is pushed
+or popped from the direction stack.
+
+\subsubsection{margin_kern nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{margin_kern} \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC width \NC number \NC the advance of the kern \NC \NR
+\NC glyph \NC node \NC the glyph to be used \NC \NR
+\stoptabulate
+
+\subsection{Math nodes}
+
+These are the so||called \quote {noad}s and the nodes that are specifically
+associated with math processing. Most of these nodes contain subnodes so that the
+list of possible fields is actually quite small. First, the subnodes:
+
+\subsubsection{Math kernel subnodes}
+
+Many object fields in math mode are either simple characters in a specific family
+or math lists or node lists. There are four associated subnodes that represent
+these cases (in the following node descriptions these are indicated by the word
+\type {<kernel>}).
+
+The \type {next} and \type {prev} fields for these subnodes are unused.
+
+\subsubsubsection{math_char and math_text_char subnodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC char \NC number \NC the character index \NC \NR
+\NC fam \NC number \NC the family number \NC \NR
+\stoptabulate
+
+The \type {math_char} is the simplest subnode field, it contains the character
+and family for a single glyph object. The \type {math_text_char} is a special
+case that you will not normally encounter, it arises temporarily during math list
+conversion (its sole function is to suppress a following italic correction).
+
+\subsubsubsection{sub_box and sub_mlist subnodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC head/list \NC node \NC list of nodes \NC \NR
+\stoptabulate
+
+These two subnode types are used for subsidiary list items. For \type {sub_box},
+the \type {head} points to a \quote {normal} vbox or hbox. For \type {sub_mlist},
+the \type {head} points to a math list that is yet to be converted.
+
+A warning: never assign a node list to the \type {head} field unless you are sure
+its internal link structure is correct, otherwise an error may be result.
+
+\subsubsection{Math delimiter subnode}
+
+There is a fifth subnode type that is used exclusively for delimiter fields. As
+before, the \type {next} and \type {prev} fields are unused.
+
+\subsubsubsection{delim subnodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC small_char \NC number \NC character index of base character \NC \NR
+\NC small_fam \NC number \NC family number of base character \NC \NR
+\NC large_char \NC number \NC character index of next larger character \NC \NR
+\NC large_fam \NC number \NC family number of next larger character \NC \NR
+\stoptabulate
+
+The fields \type {large_char} and \type {large_fam} can be zero, in that case the
+font that is sed for the \type {small_fam} is expected to provide the large
+version as an extension to the \type {small_char}.
+
+\subsubsection{Math core nodes}
+
+First, there are the objects (the \TEX book calls then \quote {atoms}) that are
+associated with the simple math objects: ord, op, bin, rel, open, close, punct,
+inner, over, under, vcent. These all have the same fields, and they are combined
+into a single node type with separate subtypes for differentiation.
+
+\subsubsubsection{simple nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{noad} \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC nucleus \NC kernel node \NC base \NC \NR
+\NC sub \NC kernel node \NC subscript \NC \NR
+\NC sup \NC kernel node \NC superscript \NC \NR
+\stoptabulate
+
+\subsubsubsection{accent nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{accent} \NC \NR
+\NC nucleus \NC kernel node \NC base \NC \NR
+\NC sub \NC kernel node \NC subscript \NC \NR
+\NC sup \NC kernel node \NC superscript \NC \NR
+\NC accent \NC kernel node \NC top accent \NC \NR
+\NC bot_accent \NC kernel node \NC bottom accent \NC \NR
+\stoptabulate
+
+\subsubsubsection{style nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC style \NC string \NC contains the style \NC \NR
+\stoptabulate
+
+There are eight possibilities for the string value: one of \quote {display},
+\quote {text}, \quote {script}, or \quote {scriptscript}. Each of these can have
+a trailing \type {'} to signify \quote {cramped} styles.
+
+\subsubsubsection{choice nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC display \NC node \NC list of display size alternatives \NC \NR
+\NC text \NC node \NC list of text size alternatives \NC \NR
+\NC script \NC node \NC list of scriptsize alternatives \NC \NR
+\NC scriptscript \NC node \NC list of scriptscriptsize alternatives \NC \NR
+\stoptabulate
+
+A warning: never assign a node list to the display, text, script, or
+scriptscript field unless you are sure its internal link structure is
+correct, otherwise an error may be result.
+
+\subsubsubsection{radical nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{radical} \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC nucleus \NC kernel node \NC base \NC \NR
+\NC sub \NC kernel node \NC subscript \NC \NR
+\NC sup \NC kernel node \NC superscript \NC \NR
+\NC left \NC delimiter node \NC \NC \NR
+\NC degree \NC kernel node \NC only set by \type {\Uroot} \NC \NR
+\stoptabulate
+
+A warning: never assign a node list to the nucleus, sub, sup, left, or degree
+field unless you are sure its internal link structure is correct, otherwise an
+error may be result.
+
+\subsubsubsection{fraction nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC width \NC number \NC (optional) width of the fraction \NC \NR
+\NC num \NC kernel node \NC numerator \NC \NR
+\NC denom \NC kernel node \NC denominator \NC \NR
+\NC left \NC delimiter node \NC left side symbol \NC \NR
+\NC right \NC delimiter node \NC right side symbol\NC \NR
+\stoptabulate
+
+A warning: never assign a node list to the num, or denom field unless you are
+sure its internal link structure is correct, otherwise an error may be result.
+
+\subsubsubsection{fence nodes}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC subtype \NC number \NC \showsubtypes{fence} \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC delim \NC delimiter node \NC delimiter specification \NC \NR
+\stoptabulate
+
+\subsection{whatsit nodes}
+
+Whatsit nodes come in many subtypes that you can ask for by running
+\type {node.whatsits()}:
+\startluacode
+ for id, name in table.sortedpairs(node.whatsits()) do
+ context.type(name)
+ context(" (%s), ",id)
+ end
+ context.removeunwantedspaces()
+ context.removepunctuation()
+\stopluacode
+. % period
+
+\subsubsection{front|-|end whatsits}
+
+\subsubsubsection{open whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC stream \NC number \NC \TEX's stream id number \NC \NR
+\NC name \NC string \NC file name \NC \NR
+\NC ext \NC string \NC file extension \NC \NR
+\NC area \NC string \NC file area (this may become obsolete) \NC \NR
+\stoptabulate
+
+\subsubsubsection{write whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC stream \NC number \NC \TEX's stream id number \NC \NR
+\NC data \NC table \NC a table representing the token list to be written \NC \NR
+\stoptabulate
+
+\subsubsubsection{close whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC stream \NC number \NC \TEX's stream id number \NC \NR
+\stoptabulate
+
+\subsubsubsection{user_defined whatsits}
+
+User|-|defined whatsit nodes can only be created and handled from \LUA\ code. In
+effect, they are an extension to the extension mechanism. The \LUATEX\ engine
+will simply step over such whatsits without ever looking at the contents.
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC user_id \NC number \NC id number \NC \NR
+\NC type \NC number \NC type of the value \NC \NR
+\NC value \NC number \NC a \LUA\ number \NC \NR
+\NC \NC node \NC a node list \NC \NR
+\NC \NC string \NC a \LUA\ string \NC \NR
+\NC \NC table \NC a \LUA\ table \NC \NR
+\stoptabulate
+
+The \type {type} can have one of six distinct values. The number is the \ASCII\
+value if the first character if the type name (so you can use string.byte("l")
+instead of \type {108}).
+
+\starttabulate[|lT|lT|p|]
+\NC \rmbf value \NC \bf meaning \NC \bf explanation \NC \NR
+\NC 97 \NC a \NC list of attributes (a node list) \NC \NR
+\NC 100 \NC d \NC a \LUA\ number \NC \NR
+\NC 108 \NC l \NC a \LUA\ value (table, number, boolean, etc) \NC \NR
+\NC 110 \NC n \NC a node list \NC \NR
+\NC 115 \NC s \NC a \LUA\ string \NC \NR
+\NC 116 \NC t \NC a \LUA\ token list in \LUA\ table form (a list of triplets) \NC \NR
+\stoptabulate
+
+\subsubsubsection{save_pos whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\stoptabulate
+
+\subsubsubsection{late_lua whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC data \NC string \NC data to execute \NC \NR
+\NC string \NC string \NC data to execute \NC \NR
+\NC name \NC string \NC the name to use for \LUA\ error reporting \NC \NR
+\stoptabulate
+
+The difference between \type {data} and \type {string} is that on assignment, the
+\type {data} field is converted to a token list, cf. use as \type {\latelua}. The
+\type {string} version is treated as a literal string.
+
+\subsubsection{\DVI\ backend whatsits}
+
+\subsubsection{special whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC data \NC string \NC the \type {\special} information \NC \NR
+\stoptabulate
+
+\subsubsection{\PDF\ backend whatsits}
+
+\subsubsubsection{pdf_literal whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC mode \NC number \NC the \quote {mode} setting of this literal \NC \NR
+\NC data \NC string \NC the \type {\pdfliteral} information \NC \NR
+\stoptabulate
+
+Possible mode values are:
+
+\starttabulate[|lT|p|]
+\NC \rmbf value \NC \rmbf \PDFTEX\ keyword \NC \NR
+\NC 0 \NC setorigin \NC \NR
+\NC 1 \NC page \NC \NR
+\NC 2 \NC direct \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_refobj whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC objnum \NC number \NC the referenced \PDF\ object number \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_annot whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC width \NC number \NC the width (not used in calculations) \NC \NR
+\NC height \NC number \NC the height (not used in calculations) \NC \NR
+\NC depth \NC number \NC the depth (not used in calculations) \NC \NR
+\NC objnum \NC number \NC the referenced \PDF\ object number \NC \NR
+\NC data \NC string \NC the annotation data \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_start_link whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC width \NC number \NC the width (not used in calculations) \NC \NR
+\NC height \NC number \NC the height (not used in calculations) \NC \NR
+\NC depth \NC number \NC the depth (not used in calculations) \NC \NR
+\NC objnum \NC number \NC the referenced \PDF\ object number \NC \NR
+\NC link_attr \NC table \NC the link attribute token list \NC \NR
+\NC action \NC node \NC the action to perform \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_end_link whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_dest whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC width \NC number \NC the width (not used in calculations) \NC \NR
+\NC height \NC number \NC the height (not used in calculations) \NC \NR
+\NC depth \NC number \NC the depth (not used in calculations) \NC \NR
+\NC named_id \NC number \NC is the \type {dest_id} a string value? \NC \NR
+\NC dest_id \NC number \NC the destination id \NC \NR
+\NC \NC string \NC the destination name \NC \NR
+\NC dest_type \NC number \NC type of destination \NC \NR
+\NC xyz_zoom \NC number \NC the zoom factor (times 1000) \NC \NR
+\NC objnum \NC number \NC the \PDF\ object number \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_action whatsits}
+
+These are a special kind of item that only appears inside \PDF\ start link
+objects.
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC action_type \NC number \NC the kind of action involved \NC \NR
+\NC action_id \NC number or string \NC token list reference or string \NC \NR
+\NC named_id \NC number \NC the index of the destination \NC \NR
+\NC file \NC string \NC the target filename \NC \NR
+\NC new_window \NC number \NC the window state of the target \NC \NR
+\NC data \NC string \NC the name of the destination \NC \NR
+\stoptabulate
+
+Valid action types are:
+
+\starttabulate[|lT|lT|]
+\NC 0 \NC page \NC \NR
+\NC 1 \NC goto \NC \NR
+\NC 2 \NC thread \NC \NR
+\NC 3 \NC user \NC \NR
+\stoptabulate
+
+Valid window types are:
+
+\starttabulate[|lT|lT|]
+\NC 0 \NC notset \NC \NR
+\NC 1 \NC new \NC \NR
+\NC 2 \NC nonew \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_thread whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC width \NC number \NC the width (not used in calculations) \NC \NR
+\NC height \NC number \NC the height (not used in calculations) \NC \NR
+\NC depth \NC number \NC the depth (not used in calculations) \NC \NR
+\NC named_id \NC number \NC is \type {tread_id} a string value? \NC \NR
+\NC tread_id \NC number \NC the thread id \NC \NR
+\NC \NC string \NC the thread name \NC \NR
+\NC thread_attr \NC number \NC extra thread information \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_start_thread whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC width \NC number \NC the width (not used in calculations) \NC \NR
+\NC height \NC number \NC the height (not used in calculations) \NC \NR
+\NC depth \NC number \NC the depth (not used in calculations) \NC \NR
+\NC named_id \NC number \NC is \type {tread_id} a string value? \NC \NR
+\NC tread_id \NC number \NC the thread id \NC \NR
+\NC \NC string \NC the thread name \NC \NR
+\NC thread_attr \NC number \NC extra thread information \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_end_thread whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_colorstack whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC stack \NC number \NC colorstack id number \NC \NR
+\NC command \NC number \NC command to execute \NC \NR
+\NC data \NC string \NC data \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_setmatrix whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\NC data \NC string \NC data \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_save whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\stoptabulate
+
+\subsubsubsection{pdf_restore whatsits}
+
+\starttabulate[|lT|l|p|]
+\NC \rmbf field \NC \bf type \NC \bf explanation \NC \NR
+\NC attr \NC node \NC list of attributes \NC \NR
+\stoptabulate
+
+\section{The \type {node} library}
+
+The \type {node} library contains functions that facilitate dealing with (lists
+of) nodes and their values. They allow you to create, alter, copy, delete, and
+insert \LUATEX\ node objects, the core objects within the typesetter.
+
+\LUATEX\ nodes are represented in \LUA\ as userdata with the metadata type
+\type {luatex.node}. The various parts within a node can be accessed using
+named fields.
+
+Each node has at least the three fields \type {next}, \type {id}, and \type
+{subtype}:
+
+\startitemize[intro]
+
+\startitem
+ The \type {next} field returns the userdata object for the next node in a
+ linked list of nodes, or \type {nil}, if there is no next node.
+\stopitem
+
+\startitem
+ The \type {id} indicates \TEX's \quote{node type}. The field \type {id} has a
+ numeric value for efficiency reasons, but some of the library functions also
+ accept a string value instead of \type {id}.
+\stopitem
+
+\startitem
+ The \type {subtype} is another number. It often gives further information
+ about a node of a particular \type {id}, but it is most important when
+ dealing with \quote {whatsits}, because they are differentiated solely based
+ on their \type {subtype}.
+\stopitem
+
+\stopitemize
+
+The other available fields depend on the \type {id} (and for \quote {whatsits},
+the \type {subtype}) of the node. Further details on the various fields and their
+meanings are given in~\in{chapter}[nodes].
+
+Support for \type {unset} (alignment) nodes is partial: they can be queried and
+modified from \LUA\ code, but not created.
+
+Nodes can be compared to each other, but: you are actually comparing indices into
+the node memory. This means that equality tests can only be trusted under very
+limited conditions. It will not work correctly in any situation where one of the
+two nodes has been freed and|/|or reallocated: in that case, there will be false
+positives.
+
+At the moment, memory management of nodes should still be done explicitly by the
+user. Nodes are not \quote {seen} by the \LUA\ garbage collector, so you have to
+call the node freeing functions yourself when you are no longer in need of a node
+(list). Nodes form linked lists without reference counting, so you have to be
+careful that when control returns back to \LUATEX\ itself, you have not deleted
+nodes that are still referenced from a \type {next} pointer elsewhere, and that
+you did not create nodes that are referenced more than once.
+
+There are statistics available with regards to the allocated node memory, which
+can be handy for tracing.
+
+\subsection{Node handling functions}
+
+\subsubsection{\type {node.is_node}}
+
+\startfunctioncall
+<boolean> t =
+ node.is_node(<any> item)
+\stopfunctioncall
+
+This function returns true if the argument is a userdata object of
+type \type {<node>}.
+
+\subsubsection{\type {node.types}}
+
+\startfunctioncall
+<table> t =
+ node.types()
+\stopfunctioncall
+
+This function returns an array that maps node id numbers to node type strings,
+providing an overview of the possible top|-|level \type {id} types.
+
+\subsubsection{\type {node.whatsits}}
+
+\startfunctioncall
+<table> t =
+ node.whatsits()
+\stopfunctioncall
+
+\TEX's \quote{whatsits} all have the same \type {id}. The various subtypes are
+defined by their \type {subtype} fields. The function is much like \type
+{node.types}, except that it provides an array of \type {subtype} mappings.
+
+\subsubsection{\type {node.id}}
+
+\startfunctioncall
+<number> id =
+ node.id(<string> type)
+\stopfunctioncall
+
+This converts a single type name to its internal numeric representation.
+
+\subsubsection{\type {node.subtype}}
+
+\startfunctioncall
+<number> subtype =
+ node.subtype(<string> type)
+\stopfunctioncall
+
+This converts a single whatsit name to its internal numeric representation (\type
+{subtype}).
+
+\subsubsection{\type {node.type}}
+
+\startfunctioncall
+<string> type =
+ node.type(<any> n)
+\stopfunctioncall
+
+In the argument is a number, then this function converts an internal numeric
+representation to an external string representation. Otherwise, it will return
+the string \type {node} if the object represents a node, and \type {nil}
+otherwise.
+
+\subsubsection{\type {node.fields}}
+
+\startfunctioncall
+<table> t =
+ node.fields(<number> id)
+<table> t =
+ node.fields(<number> id, <number> subtype)
+\stopfunctioncall
+
+This function returns an array of valid field names for a particular type of
+node. If you want to get the valid fields for a \quote {whatsit}, you have to
+supply the second argument also. In other cases, any given second argument will
+be silently ignored.
+
+This function accepts string \type {id} and \type {subtype} values as well.
+
+\subsubsection{\type {node.has_field}}
+
+\startfunctioncall
+<boolean> t =
+ node.has_field(<node> n, <string> field)
+\stopfunctioncall
+
+This function returns a boolean that is only true if \type {n} is
+actually a node, and it has the field.
+
+\subsubsection{\type {node.new}}
+
+\startfunctioncall
+<node> n =
+ node.new(<number> id)
+<node> n =
+ node.new(<number> id, <number> subtype)
+\stopfunctioncall
+
+Creates a new node. All of the new node's fields are initialized to either zero
+or \type {nil} except for \type {id} and \type {subtype} (if supplied). If you
+want to create a new whatsit, then the second argument is required, otherwise it
+need not be present. As with all node functions, this function creates a node on
+the \TEX\ level.
+
+This function accepts string \type {id} and \type {subtype} values as well.
+
+\subsubsection{\type {node.free} and \type {node.flush_node}}
+
+\startfunctioncall
+<node> next =
+ node.free(<node> n)
+flush_node(<node> n)
+\stopfunctioncall
+
+Removes the node \type {n} from \TEX's memory. Be careful: no checks are done on
+whether this node is still pointed to from a register or some \type {next} field:
+it is up to you to make sure that the internal data structures remain correct.
+
+The \type {free} function returns the next field of the freed node, while the
+\type {flush_node} alternative returns nothing.
+
+\subsubsection{\type {node.flush_list}}
+
+\startfunctioncall
+node.flush_list(<node> n)
+\stopfunctioncall
+
+Removes the node list \type {n} and the complete node list following \type {n}
+from \TEX's memory. Be careful: no checks are done on whether any of these nodes
+is still pointed to from a register or some \type {next} field: it is up to you
+to make sure that the internal data structures remain correct.
+
+\subsubsection{\type {node.copy}}
+
+\startfunctioncall
+<node> m =
+ node.copy(<node> n)
+\stopfunctioncall
+
+Creates a deep copy of node \type {n}, including all nested lists as in the case
+of a hlist or vlist node. Only the \type {next} field is not copied.
+
+\subsubsection{\type {node.copy_list}}
+
+\startfunctioncall
+<node> m =
+ node.copy_list(<node> n)
+<node> m =
+ node.copy_list(<node> n, <node> m)
+\stopfunctioncall
+
+Creates a deep copy of the node list that starts at \type {n}. If \type {m} is
+also given, the copy stops just before node \type {m}.
+
+Note that you cannot copy attribute lists this way, specialized functions for
+dealing with attribute lists will be provided later but are not there yet.
+However, there is normally no need to copy attribute lists as when you do
+assignments to the \type {attr} field or make changes to specific attributes, the
+needed copying and freeing takes place automatically.
+
+\subsubsection{\type {node.next}}
+
+\startfunctioncall
+<node> m =
+ node.next(<node> n)
+\stopfunctioncall
+
+Returns the node following this node, or \type {nil} if there is no such node.
+
+\subsubsection{\type {node.prev}}
+
+\startfunctioncall
+<node> m =
+ node.prev(<node> n)
+\stopfunctioncall
+
+Returns the node preceding this node, or \type {nil} if there is no such node.
+
+\subsubsection{\type {node.current_attr}}
+
+\startfunctioncall
+<node> m =
+ node.current_attr()
+\stopfunctioncall
+
+Returns the currently active list of attributes, if there is one.
+
+The intended usage of \type {current_attr} is as follows:
+
+\starttyping
+local x1 = node.new("glyph")
+x1.attr = node.current_attr()
+local x2 = node.new("glyph")
+x2.attr = node.current_attr()
+\stoptyping
+
+or:
+
+\starttyping
+local x1 = node.new("glyph")
+local x2 = node.new("glyph")
+local ca = node.current_attr()
+x1.attr = ca
+x2.attr = ca
+\stoptyping
+
+The attribute lists are ref counted and the assignment takes care of incrementing
+the refcount. You cannot expect the value \type {ca} to be valid any more when
+you assign attributes (using \type {tex.setattribute}) or when control has been
+passed back to \TEX.
+
+Note: this function is somewhat experimental, and it returns the {\it actual}
+attribute list, not a copy thereof. Therefore, changing any of the attributes in
+the list will change these values for all nodes that have the current attribute
+list assigned to them.
+
+\subsubsection{\type {node.hpack}}
+
+\startfunctioncall
+<node> h, <number> b =
+ node.hpack(<node> n)
+<node> h, <number> b =
+ node.hpack(<node> n, <number> w, <string> info)
+<node> h, <number> b =
+ node.hpack(<node> n, <number> w, <string> info, <string> dir)
+\stopfunctioncall
+
+This function creates a new hlist by packaging the list that begins at node \type
+{n} into a horizontal box. With only a single argument, this box is created using
+the natural width of its components. In the three argument form, \type {info}
+must be either \type {additional} or \type {exactly}, and \type {w} is the
+additional (\type {\hbox spread}) or exact (\type {\hbox to}) width to be used. The
+second return value is the badness of the generated box.
+
+Caveat: at this moment, there can be unexpected side|-|effects to this function,
+like updating some of the \type {\marks} and \type {\inserts}. Also note that the
+content of \type {h} is the original node list \type {n}: if you call \type
+{node.free(h)} you will also free the node list itself, unless you explicitly set
+the \type {list} field to \type {nil} beforehand. And in a similar way, calling
+\type {node.free(n)} will invalidate \type {h} as well!
+
+\subsubsection{\type {node.vpack}}
+
+\startfunctioncall
+<node> h, <number> b =
+ node.vpack(<node> n)
+<node> h, <number> b =
+ node.vpack(<node> n, <number> w, <string> info)
+<node> h, <number> b =
+ node.vpack(<node> n, <number> w, <string> info, <string> dir)
+\stopfunctioncall
+
+This function creates a new vlist by packaging the list that begins at node \type
+{n} into a vertical box. With only a single argument, this box is created using
+the natural height of its components. In the three argument form, \type {info}
+must be either \type {additional} or \type {exactly}, and \type {w} is the
+additional (\type {\vbox spread}) or exact (\type {\vbox to}) height to be used.
+
+The second return value is the badness of the generated box.
+
+See the description of \type {node.hpack()} for a few memory allocation caveats.
+
+\subsubsection{\type {node.dimensions}}
+
+\startfunctioncall
+<number> w, <number> h, <number> d =
+ node.dimensions(<node> n)
+<number> w, <number> h, <number> d =
+ node.dimensions(<node> n, <string> dir)
+<number> w, <number> h, <number> d =
+ node.dimensions(<node> n, <node> t)
+<number> w, <number> h, <number> d =
+ node.dimensions(<node> n, <node> t, <string> dir)
+\stopfunctioncall
+
+This function calculates the natural in|-|line dimensions of the node list starting
+at node \type {n} and terminating just before node \type {t} (or the end of the
+list, if there is no second argument). The return values are scaled points. An
+alternative format that starts with glue parameters as the first three arguments
+is also possible:
+
+\startfunctioncall
+<number> w, <number> h, <number> d =
+ node.dimensions(<number> glue_set, <number> glue_sign, <number> glue_order,
+ <node> n)
+<number> w, <number> h, <number> d =
+ node.dimensions(<number> glue_set, <number> glue_sign, <number> glue_order,
+ <node> n, <string> dir)
+<number> w, <number> h, <number> d =
+ node.dimensions(<number> glue_set, <number> glue_sign, <number> glue_order,
+ <node> n, <node> t)
+<number> w, <number> h, <number> d =
+ node.dimensions(<number> glue_set, <number> glue_sign, <number> glue_order,
+ <node> n, <node> t, <string> dir)
+\stopfunctioncall
+
+This calling method takes glue settings into account and is especially useful for
+finding the actual width of a sublist of nodes that are already boxed, for
+example in code like this, which prints the width of the space in between the
+\type {a} and \type {b} as it would be if \type {\box0} was used as-is:
+
+\starttyping
+\setbox0 = \hbox to 20pt {a b}
+
+\directlua{print (node.dimensions(
+ tex.box[0].glue_set,
+ tex.box[0].glue_sign,
+ tex.box[0].glue_order,
+ tex.box[0].head.next,
+ node.tail(tex.box[0].head)
+)) }
+\stoptyping
+
+You need to keep in mind that this is one of the few places in \TEX\ where floats
+are used, which means that you can get small differences in rounding when you
+compare the width repported by \type {hpack} with \type {dimensions}.
+
+\subsubsection{\type {node.mlist_to_hlist}}
+
+\startfunctioncall
+<node> h =
+ node.mlist_to_hlist(<node> n, <string> display_type, <boolean> penalties)
+\stopfunctioncall
+
+This runs the internal mlist to hlist conversion, converting the math list in
+\type {n} into the horizontal list \type {h}. The interface is exactly the same
+as for the callback \type {mlist_to_hlist}.
+
+\subsubsection{\type {node.slide}}
+
+\startfunctioncall
+<node> m =
+ node.slide(<node> n)
+\stopfunctioncall
+
+Returns the last node of the node list that starts at \type {n}. As a
+side|-|effect, it also creates a reverse chain of \type {prev} pointers between
+nodes.
+
+\subsubsection{\type {node.tail}}
+
+\startfunctioncall
+<node> m =
+ node.tail(<node> n)
+\stopfunctioncall
+
+Returns the last node of the node list that starts at \type {n}.
+
+\subsubsection{\type {node.length}}
+
+\startfunctioncall
+<number> i =
+ node.length(<node> n)
+<number> i =
+ node.length(<node> n, <node> m)
+\stopfunctioncall
+
+Returns the number of nodes contained in the node list that starts at \type {n}.
+If \type {m} is also supplied it stops at \type {m} instead of at the end of the
+list. The node \type {m} is not counted.
+
+\subsubsection{\type {node.count}}
+
+\startfunctioncall
+<number> i =
+ node.count(<number> id, <node> n)
+<number> i =
+ node.count(<number> id, <node> n, <node> m)
+\stopfunctioncall
+
+Returns the number of nodes contained in the node list that starts at \type {n}
+that have a matching \type {id} field. If \type {m} is also supplied, counting
+stops at \type {m} instead of at the end of the list. The node \type {m} is not
+counted.
+
+This function also accept string \type {id}'s.
+
+\subsubsection{\type {node.traverse}}
+
+\startfunctioncall
+<node> t =
+ node.traverse(<node> n)
+\stopfunctioncall
+
+This is a \LUA\ iterator that loops over the node list that starts at \type {n}.
+Typically code looks like this:
+
+\starttyping
+for n in node.traverse(head) do
+ ...
+end
+\stoptyping
+
+is functionally equivalent to:
+
+\starttyping
+do
+ local n
+ local function f (head,var)
+ local t
+ if var == nil then
+ t = head
+ else
+ t = var.next
+ end
+ return t
+ end
+ while true do
+ n = f (head, n)
+ if n == nil then break end
+ ...
+ end
+end
+\stoptyping
+
+It should be clear from the definition of the function \type {f} that even though
+it is possible to add or remove nodes from the node list while traversing, you
+have to take great care to make sure all the \type {next} (and \type {prev})
+pointers remain valid.
+
+If the above is unclear to you, see the section \quote {For Statement} in the
+\LUA\ Reference Manual.
+
+\subsubsection{\type {node.traverse_id}}
+
+\startfunctioncall
+<node> t =
+ node.traverse_id(<number> id, <node> n)
+\stopfunctioncall
+
+This is an iterator that loops over all the nodes in the list that starts at
+\type {n} that have a matching \type {id} field.
+
+See the previous section for details. The change is in the local function \type
+{f}, which now does an extra while loop checking against the upvalue \type {id}:
+
+\starttyping
+ local function f(head,var)
+ local t
+ if var == nil then
+ t = head
+ else
+ t = var.next
+ end
+ while not t.id == id do
+ t = t.next
+ end
+ return t
+ end
+\stoptyping
+
+\subsubsection{\type {node.traverse_char}}
+
+This iterators loops over the glyph nodes in a list. Only nodes with a subtype
+less than 256 are seen.
+
+\startfunctioncall
+<node> n =
+ node.traverse_char(<node> n)
+\stopfunctioncall
+
+\subsubsection{\type {node.has_glyph}}
+
+This function returns the first glyph or disc node in the given list:
+
+\startfunctioncall
+<node> n =
+ node.has_glyph(<node> n)
+\stopfunctioncall
+
+\subsubsection{\type {node.end_of_math}}
+
+\startfunctioncall
+<node> t =
+ node.end_of_math(<node> start)
+\stopfunctioncall
+
+Looks for and returns the next \type {math_node} following the \type {start}. If
+the given node is a math endnode this helper return that node, else it follows
+the list and return the next math endnote. If no such node is found nil is
+returned.
+
+\subsubsection{\type {node.remove}}
+
+\startfunctioncall
+<node> head, current =
+ node.remove(<node> head, <node> current)
+\stopfunctioncall
+
+This function removes the node \type {current} from the list following \type
+{head}. It is your responsibility to make sure it is really part of that list.
+The return values are the new \type {head} and \type {current} nodes. The
+returned \type {current} is the node following the \type {current} in the calling
+argument, and is only passed back as a convenience (or \type {nil}, if there is
+no such node). The returned \type {head} is more important, because if the
+function is called with \type {current} equal to \type {head}, it will be
+changed.
+
+\subsubsection{\type {node.insert_before}}
+
+\startfunctioncall
+<node> head, new =
+ node.insert_before(<node> head, <node> current, <node> new)
+\stopfunctioncall
+
+This function inserts the node \type {new} before \type {current} into the list
+following \type {head}. It is your responsibility to make sure that \type
+{current} is really part of that list. The return values are the (potentially
+mutated) \type {head} and the node \type {new}, set up to be part of the list
+(with correct \type {next} field). If \type {head} is initially \type {nil}, it
+will become \type {new}.
+
+\subsubsection{\type {node.insert_after}}
+
+\startfunctioncall
+<node> head, new =
+ node.insert_after(<node> head, <node> current, <node> new)
+\stopfunctioncall
+
+This function inserts the node \type {new} after \type {current} into the list
+following \type {head}. It is your responsibility to make sure that \type
+{current} is really part of that list. The return values are the \type {head} and
+the node \type {new}, set up to be part of the list (with correct \type {next}
+field). If \type {head} is initially \type {nil}, it will become \type {new}.
+
+\subsubsection{\type {node.first_glyph}}
+
+\startfunctioncall
+<node> n =
+ node.first_glyph(<node> n)
+<node> n =
+ node.first_glyph(<node> n, <node> m)
+\stopfunctioncall
+
+Returns the first node in the list starting at \type {n} that is a glyph node
+with a subtype indicating it is a glyph, or \type {nil}. If \type {m} is given,
+processing stops at (but including) that node, otherwise processing stops at the
+end of the list.
+
+\subsubsection{\type {node.ligaturing}}
+
+\startfunctioncall
+<node> h, <node> t, <boolean> success =
+ node.ligaturing(<node> n)
+<node> h, <node> t, <boolean> success =
+ node.ligaturing(<node> n, <node> m)
+\stopfunctioncall
+
+Apply \TEX-style ligaturing to the specified nodelist. The tail node \type {m} is
+optional. The two returned nodes \type {h} and \type {t} are the new head and
+tail (both \type {n} and \type {m} can change into a new ligature).
+
+\subsubsection{\type {node.kerning}}
+
+\startfunctioncall
+<node> h, <node> t, <boolean> success =
+ node.kerning(<node> n)
+<node> h, <node> t, <boolean> success =
+ node.kerning(<node> n, <node> m)
+\stopfunctioncall
+
+Apply \TEX|-|style kerning to the specified node list. The tail node \type {m} is
+optional. The two returned nodes \type {h} and \type {t} are the head and tail
+(either one of these can be an inserted kern node, because special kernings with
+word boundaries are possible).
+
+\subsubsection{\type {node.unprotect_glyphs}}
+
+\startfunctioncall
+node.unprotect_glyphs(<node> n)
+\stopfunctioncall
+
+Subtracts 256 from all glyph node subtypes. This and the next function are
+helpers to convert from \type {characters} to \type {glyphs} during node
+processing.
+
+\subsubsection{\type {node.protect_glyphs} and \type {node.protect_glyph}}
+
+\startfunctioncall
+node.protect_glyphs(<node> n)
+\stopfunctioncall
+
+Adds 256 to all glyph node subtypes in the node list starting at \type {n},
+except that if the value is 1, it adds only 255. The special handling of 1 means
+that \type {characters} will become \type {glyphs} after subtraction of 256. A
+single character can be marked by the singular call.
+
+\subsubsection{\type {node.last_node}}
+
+\startfunctioncall
+<node> n =
+ node.last_node()
+\stopfunctioncall
+
+This function pops the last node from \TEX's \quote{current list}. It returns
+that node, or \type {nil} if the current list is empty.
+
+\subsubsection{\type {node.write}}
+
+\startfunctioncall
+node.write(<node> n)
+\stopfunctioncall
+
+This is an experimental function that will append a node list to \TEX's \quote
+{current list} The node list is not deep|-|copied! There is no error checking
+either!
+
+\subsubsection{\type {node.protrusion_skippable}}
+
+\startfunctioncall
+<boolean> skippable =
+ node.protrusion_skippable(<node> n)
+\stopfunctioncall
+
+Returns \type {true} if, for the purpose of line boundary discovery when
+character protrusion is active, this node can be skipped.
+
+\subsection{Glue handling}
+
+\subsubsection{\type {node.setglue}}
+
+You can set the properties of a glue in one go. If you pass no values, the glue
+will become a zero glue.
+
+\startfunctioncall
+node.setglue(<node> n)
+node.setglue(<node> n,width,stretch,shrink,stretch_order,shrink_order)
+\stopfunctioncall
+
+When you pass values, only arguments that are numbers
+are assigned so
+
+\starttyping
+node.setglue(n,655360,false,65536)
+\stoptyping
+
+will only adapt the width and shrink.
+
+\subsubsection{\type {node.getglue}}
+
+The next call will return 5 values (or northing when no glue is passed).
+
+\startfunctioncall
+<integer> width, <integer> stretch, <integer> shrink, <integer> stretch_order,
+ <integer> shrink_order = node.getglue(<node> n)
+\stopfunctioncall
+
+\subsubsection{\type {node.is_zero_glue}}
+
+This function returns \type {true} when the width, stretch and shrink properties
+are zero.
+
+\startfunctioncall
+<boolean> isglue =
+ node.is_zero_glue(<node> n)
+\stopfunctioncall
+
+\subsection{Attribute handling}
+
+Attributes appear as linked list of userdata objects in the \type {attr} field of
+individual nodes. They can be handled individually, but it is much safer and more
+efficient to use the dedicated functions associated with them.
+
+\subsubsection{\type {node.has_attribute}}
+
+\startfunctioncall
+<number> v =
+ node.has_attribute(<node> n, <number> id)
+<number> v =
+ node.has_attribute(<node> n, <number> id, <number> val)
+\stopfunctioncall
+
+Tests if a node has the attribute with number \type {id} set. If \type {val} is
+also supplied, also tests if the value matches \type {val}. It returns the value,
+or, if no match is found, \type {nil}.
+
+\subsubsection{\type {node.get_attribute}}
+
+\startfunctioncall
+<number> v =
+ node.get_attribute(<node> n, <number> id)
+\stopfunctioncall
+
+Tests if a node has an attribute with number \type {id} set. It returns the
+value, or, if no match is found, \type {nil}.
+
+\subsubsection{\type {node.find_attribute}}
+
+\startfunctioncall
+<number> v, <node> n =
+ node.find_attribute(<node> n, <number> id)
+\stopfunctioncall
+
+Finds the first node that has attribute with number \type {id} set. It returns
+the value and the node if there is a match and otherwise nothing.
+
+\subsubsection{\type {node.set_attribute}}
+
+\startfunctioncall
+node.set_attribute(<node> n, <number> id, <number> val)
+\stopfunctioncall
+
+Sets the attribute with number \type {id} to the value \type {val}. Duplicate
+assignments are ignored. {\em [needs explanation]}
+
+\subsubsection{\type {node.unset_attribute}}
+
+\startfunctioncall
+<number> v =
+ node.unset_attribute(<node> n, <number> id)
+<number> v =
+ node.unset_attribute(<node> n, <number> id, <number> val)
+\stopfunctioncall
+
+Unsets the attribute with number \type {id}. If \type {val} is also supplied, it
+will only perform this operation if the value matches \type {val}. Missing
+attributes or attribute|-|value pairs are ignored.
+
+If the attribute was actually deleted, returns its old value. Otherwise, returns
+\type {nil}.
+
+\subsubsection{\type {node.slide}}
+
+This helper makes sure that the node lists is double linked and returns the found
+tail node.
+
+\startfunctioncall
+<node> tail =
+ node.slide(<node> n)
+\stopfunctioncall
+
+\subsubsection{\type {node.check_discretionary} and \type {node.check_discretionaries}}
+
+When you fool around with disc nodes you need to be aware of the fact that they
+have a special internal data structure. As long as you reassign the fields when
+you have extended the lists it's ok because then the tail pointers get updated,
+but when you add to list without reassigning you might end up in troubles when
+the linebreak routien kicks in. You can call this function to check the list for
+issues with disc nodes.
+
+\startfunctioncall
+node.check_discretionary(<node> n)
+node.check_discretionaries(<node> head)
+\stopfunctioncall
+
+The plural variant runs over all disc nodes in a list, the singular variant
+checks one node only (it also checks if the node is a disc node).
+
+\subsubsection{\type {node.family_font}}
+
+When you pass it a proper family identifier the next helper will return the font
+currently associated with it. You can normally also access the font with the normal
+font field or getter because it will resolve the family automatically for noads.
+
+\startfunctioncall
+<integer> id =
+ node.family_font(<integer> fam)
+\stopfunctioncall
+
+\section{Two access models}
+
+Deep down in \TEX\ a node has a number which is an numeric entry in a memory
+table. In fact, this model, where \TEX\ manages memory is real fast and one of
+the reasons why plugging in callbacks that operate on nodes is quite fast too.
+Each node gets a number that is in fact an index in the memory table and that
+number often gets reported when you print node related information.
+
+There are two access models, a robust one using a so called user data object that
+provides a virtual interface to the internal nodes, and a more direct access which
+uses the node numbers directly. The first model provide key based access while
+the second always accesses fields via functions:
+
+\starttyping
+nodeobject.char
+getfield(nodenumber,"char")
+\stoptyping
+
+If you use the direct model, even if you know that you deal with numbers, you
+should not depend on that property but treat it an abstraction just like
+traditional nodes. In fact, the fact that we use a simple basic datatype has the
+penalty that less checking can be done, but less checking is also the reason why
+it's somewhat faster. An important aspect is that one cannot mix both methods,
+but you can cast both models. So, multiplying a node number makes no sense.
+
+So our advice is: use the indexed (table) approach when possible and investigate
+the direct one when speed might be an real issue. For that reason we also provide
+the \type {get*} and \type {set*} functions in the top level node namespace.
+There is a limited set of getters. When implementing this direct approach the
+regular index by key variant was also optimized, so direct access only makes
+sense when we're accessing nodes millions of times (which happens in some font
+processing for instance).
+
+We're talking mostly of getters because setters are less important. Documents
+have not that many content related nodes and setting many thousands of properties
+is hardly a burden contrary to millions of consultations.
+
+Normally you will access nodes like this:
+
+\starttyping
+local next = current.next
+if next then
+ -- do something
+end
+\stoptyping
+
+Here \type {next} is not a real field, but a virtual one. Accessing it results in
+a metatable method being called. In practice it boils down to looking up the node
+type and based on the node type checking for the field name. In a worst case you
+have a node type that sits at the end of the lookup list and a field that is last
+in the lookup chain. However, in successive versions of \LUATEX\ these lookups
+have been optimized and the most frequently accessed nodes and fields have a
+higher priority.
+
+Because in practice the \type {next} accessor results in a function call, there
+is some overhead involved. The next code does the same and performs a tiny bit
+faster (but not that much because it is still a function call but one that knows
+what to look up).
+
+\starttyping
+local next = node.next(current)
+if next then
+ -- do something
+end
+\stoptyping
+
+If performance matters you can use an function instead:
+
+\starttabulate[|T|p|]
+\NC getnext \NC parsing nodelist always involves this one \NC \NR
+\NC getprev \NC used less but is logical companion to \type {getnext} \NC \NR
+\NC getboth \NC returns the next and prev pointer of a node \NC \NR
+\NC getid \NC consulted a lot \NC \NR
+\NC getsubtype \NC consulted less but also a topper \NC \NR
+\NC getfont \NC used a lot in \OPENTYPE\ handling (glyph nodes are consulted a lot) \NC \NR
+\NC getchar \NC idem and also in other places \NC \NR
+\NC getdisc \NC returns the \type {pre}, \type {post} and \type {replace} fields and
+ optionally when true is passed also the tail fields. \NC \NR
+\NC getlist \NC we often parse nested lists so this is a convenient one too
+ (only works for hlist and vlist!) \NC \NR
+\NC getleader \NC comparable to list, seldom used in \TEX\ (but needs frequent consulting
+ like lists; leaders could have been made a dedicated node type) \NC \NR
+\NC getfield \NC generic getter, sufficient for the rest (other field names are
+ often shared so a specific getter makes no sense then) \NC \NR
+\NC getbox \NC gets the given box (a list node) \NC \NR
+\stoptabulate
+
+The direct variants also have setters, where the discretionary setter takes three
+(optional) arguments plus an optional fourth indicating the subtype. An additional
+setter is \type {setlink} which will link two nodes.
+
+It doesn't make sense to add getters for all fields, also because some are not
+unique to one node type. Profiling demonstrated that these fields can get
+accesses way more times than other fields. Even in complex documents, many node
+and fields types never get seen, or seen only a few times. Most functions in the
+\type {node} namespace have a companion in \type {node.direct}, but of course not
+the ones that don't deal with nodes themselves. The following table summarized
+this:
+
+% \startcolumns[balance=yes]
+
+\def\yes{$+$} \def\nop{$-$}
+
+\starttabulate[|T|c|c|]
+\HL
+\NC \bf function \NC \bf node \NC \bf direct \NC \NR
+\HL
+\NC \type {check_discretionaries}\NC \yes \NC \yes \NC \NR
+\NC \type {copy_list} \NC \yes \NC \yes \NC \NR
+\NC \type {copy} \NC \yes \NC \yes \NC \NR
+\NC \type {count} \NC \yes \NC \yes \NC \NR
+\NC \type {current_attr} \NC \yes \NC \yes \NC \NR
+\NC \type {dimensions} \NC \yes \NC \yes \NC \NR
+%NC \type {do_ligature_n} \NC \yes \NC \yes \NC \NR % was never documented and experimental
+\NC \type {effective_glue} \NC \yes \NC \yes \NC \NR
+\NC \type {end_of_math} \NC \yes \NC \yes \NC \NR
+\NC \type {family_font} \NC \yes \NC \nop \NC \NR
+\NC \type {fields} \NC \yes \NC \nop \NC \NR
+\NC \type {find_attribute} \NC \yes \NC \yes \NC \NR
+\NC \type {first_glyph} \NC \yes \NC \yes \NC \NR
+\NC \type {flush_list} \NC \yes \NC \yes \NC \NR
+\NC \type {flush_node} \NC \yes \NC \yes \NC \NR
+\NC \type {free} \NC \yes \NC \yes \NC \NR
+\NC \type {get_attribute} \NC \yes \NC \yes \NC \NR
+\NC \type {getboth} \NC \yes \NC \yes \NC \NR
+\NC \type {getbox} \NC \nop \NC \yes \NC \NR
+\NC \type {getchar} \NC \yes \NC \yes \NC \NR
+\NC \type {getdisc} \NC \yes \NC \yes \NC \NR
+\NC \type {getfield} \NC \yes \NC \yes \NC \NR
+\NC \type {getfont} \NC \yes \NC \yes \NC \NR
+\NC \type {getglue} \NC \yes \NC \yes \NC \NR
+\NC \type {getid} \NC \yes \NC \yes \NC \NR
+\NC \type {getleader} \NC \yes \NC \yes \NC \NR
+\NC \type {getlist} \NC \yes \NC \yes \NC \NR
+\NC \type {getnext} \NC \yes \NC \yes \NC \NR
+\NC \type {getprev} \NC \yes \NC \yes \NC \NR
+\NC \type {getsubtype} \NC \yes \NC \yes \NC \NR
+\NC \type {has_attribute} \NC \yes \NC \yes \NC \NR
+\NC \type {has_field} \NC \yes \NC \yes \NC \NR
+\NC \type {has_glyph} \NC \yes \NC \yes \NC \NR
+\NC \type {hpack} \NC \yes \NC \yes \NC \NR
+\NC \type {id} \NC \yes \NC \nop \NC \NR
+\NC \type {insert_after} \NC \yes \NC \yes \NC \NR
+\NC \type {insert_before} \NC \yes \NC \yes \NC \NR
+\NC \type {is_char} \NC \yes \NC \yes \NC \NR
+\NC \type {is_direct} \NC \nop \NC \yes \NC \NR
+\NC \type {is_glue_zero} \NC \yes \NC \yes \NC \NR
+\NC \type {is_glyph} \NC \yes \NC \yes \NC \NR
+\NC \type {is_node} \NC \yes \NC \yes \NC \NR
+\NC \type {kerning} \NC \yes \NC \yes \NC \NR
+\NC \type {last_node} \NC \yes \NC \yes \NC \NR
+\NC \type {length} \NC \yes \NC \yes \NC \NR
+\NC \type {ligaturing} \NC \yes \NC \yes \NC \NR
+\NC \type {mlist_to_hlist} \NC \yes \NC \nop \NC \NR
+\NC \type {new} \NC \yes \NC \yes \NC \NR
+\NC \type {next} \NC \yes \NC \nop \NC \NR
+\NC \type {prev} \NC \yes \NC \nop \NC \NR
+\NC \type {protect_glyphs} \NC \yes \NC \yes \NC \NR
+\NC \type {protect_glyph} \NC \yes \NC \yes \NC \NR
+\NC \type {protrusion_skippable} \NC \yes \NC \yes \NC \NR
+\NC \type {remove} \NC \yes \NC \yes \NC \NR
+\NC \type {set_attribute} \NC \yes \NC \yes \NC \NR
+\NC \type {setboth} \NC \yes \NC \yes \NC \NR
+\NC \type {setbox} \NC \nop \NC \yes \NC \NR
+\NC \type {setbox} \NC \yes \NC \yes \NC \NR
+\NC \type {setchar} \NC \yes \NC \yes \NC \NR
+\NC \type {setdisc} \NC \yes \NC \yes \NC \NR
+\NC \type {setfield} \NC \yes \NC \yes \NC \NR
+\NC \type {setglue} \NC \yes \NC \yes \NC \NR
+\NC \type {setlink} \NC \yes \NC \yes \NC \NR
+\NC \type {setnext} \NC \yes \NC \yes \NC \NR
+\NC \type {setprev} \NC \yes \NC \yes \NC \NR
+\NC \type {slide} \NC \yes \NC \yes \NC \NR
+\NC \type {subtypes} \NC \yes \NC \nop \NC \NR
+\NC \type {subtype} \NC \yes \NC \nop \NC \NR
+\NC \type {tail} \NC \yes \NC \yes \NC \NR
+\NC \type {todirect} \NC \yes \NC \yes \NC \NR
+\NC \type {tonode} \NC \yes \NC \yes \NC \NR
+\NC \type {tostring} \NC \yes \NC \yes \NC \NR
+\NC \type {traverse_char} \NC \yes \NC \yes \NC \NR
+\NC \type {traverse_id} \NC \yes \NC \yes \NC \NR
+\NC \type {traverse} \NC \yes \NC \yes \NC \NR
+\NC \type {types} \NC \yes \NC \nop \NC \NR
+\NC \type {type} \NC \yes \NC \nop \NC \NR
+\NC \type {unprotect_glyphs} \NC \yes \NC \yes \NC \NR
+\NC \type {unset_attribute} \NC \yes \NC \yes \NC \NR
+\NC \type {usedlist} \NC \yes \NC \yes \NC \NR
+\NC \type {vpack} \NC \yes \NC \yes \NC \NR
+\NC \type {whatsitsubtypes} \NC \yes \NC \nop \NC \NR
+\NC \type {whatsits} \NC \yes \NC \nop \NC \NR
+\NC \type {write} \NC \yes \NC \yes \NC \NR
+\stoptabulate
+
+% \stopcolumns
+
+The \type {node.next} and \type {node.prev} functions will stay but for
+consistency there are variants called \type {getnext} and \type {getprev}. We had
+to use \type {get} because \type {node.id} and \type {node.subtype} are already
+taken for providing meta information about nodes. Note: The getters do only basic
+checking for valid keys. You should just stick to the keys mentioned in the
+sections that describe node properties.
+
+Some nodes have indirect references. For instance a math character refers to a
+family instead of a font. In that case we provide a virtual font field as
+accessor. So, \type {getfont} and \type {.font} can be used on them. The same is
+true for the \type {width}, \type {height} and \type {depth} of glue nodes. These
+actually access the spec node properties, and here we can set as well as get the
+values.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/luatex/luatex-style.tex b/doc/context/sources/general/manuals/luatex/luatex-style.tex
new file mode 100644
index 000000000..c07dc3b76
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex-style.tex
@@ -0,0 +1,362 @@
+\startenvironment luatex-style
+
+% todo: use \useMPlibrary[lua]
+
+\usemodule[abr-02]
+
+\setuplayout
+ [height=middle,
+ width=middle,
+ backspace=2cm,
+ topspace=10mm,
+ bottomspace=10mm,
+ header=10mm,
+ footer=10mm,
+ footerdistance=10mm,
+ headerdistance=10mm]
+
+\setuppagenumbering
+ [alternative=doublesided]
+
+\setuptolerance
+ [stretch,tolerant]
+
+\setuptype
+ [lines=hyphenated]
+
+\setuptyping
+ [lines=hyphenated]
+
+\setupitemize
+ [each]
+ [packed]
+
+\setupwhitespace
+ [medium]
+
+\startluacode
+ local skipped = table.tohash { 'id', 'subtype', 'next', 'prev' }
+
+ function document.functions.showfields(s)
+ local t = string.split(s,',')
+ local f = node.fields(t[1],t[2])
+ if f then
+ local d = false
+ for i=1,#f do
+ local fi = f[i]
+ if skipped[fi] then
+ -- okay
+ elseif d then
+ context(', {\tttf %s}', fi)
+ else
+ context('{\tttf %s}', fi)
+ d = true
+ end
+ end
+ end
+ end
+
+ function document.functions.showid(s)
+ local t = string.split(s,',')
+ context('{tttf %s}',node.id(t[1]))
+ if t[2] then
+ context(', {tttf %s}',node.subtype(t[2]))
+ end
+ end
+
+ function document.functions.showsubtypes(s)
+ local s = node.subtypes(s)
+ local d = false
+ for k, v in table.sortedhash(s) do
+ if d then
+ context(', %s = {\\tttf %s}',k,v)
+ else
+ context('%s = {\\tttf %s}',k,v)
+ d = true
+ end
+ end
+ end
+\stopluacode
+
+\unexpanded\def\showfields #1{\ctxlua{document.functions.showfields("#1")}}
+\unexpanded\def\showid #1{\ctxlua{document.functions.showid("#1")}}
+\unexpanded\def\showsubtypes#1{\ctxlua{document.functions.showsubtypes("#1")}}
+
+\definecolor[blue] [b=.5]
+\definecolor[red] [r=.5]
+\definecolor[green] [g=.5]
+\definecolor[maincolor] [b=.5]
+\definecolor[keptcolor] [b=.5]
+\definecolor[othercolor][r=.5,g=.5]
+
+\setupbodyfont[modern] % we need this in examples so we predefine
+
+% \doifmodeelse {atpragma} {
+%
+% % \setupbodyfont
+% % [lucidaot,10pt]
+%
+% \setupbodyfont
+% [dejavu,10pt]
+%
+% \setuphead [chapter] [style=\bfd]
+% \setuphead [section] [style=\bfb]
+% \setuphead [subsection] [style=\bfa]
+% \setuphead [subsubsection][style=\bf]
+%
+% } {
+%
+% \definetypeface[mainfacenormal] [ss][sans] [iwona] [default]
+% \definetypeface[mainfacenormal] [rm][serif][palatino] [default]
+% \definetypeface[mainfacenormal] [tt][mono] [modern] [default][rscale=1.1]
+% \definetypeface[mainfacenormal] [mm][math] [iwona] [default]
+%
+% \definetypeface[mainfacemedium] [ss][sans] [iwona-medium][default]
+% \definetypeface[mainfacemedium] [rm][serif][palatino] [default]
+% \definetypeface[mainfacemedium] [tt][mono] [modern] [default][rscale=1.1]
+% \definetypeface[mainfacemedium] [mm][math] [iwona-medium][default]
+%
+% \setupbodyfont
+% [mainfacenormal,10pt]
+%
+% \setuphead [chapter] [style=\mainfacemedium\bfd]
+% \setuphead [section] [style=\mainfacemedium\bfb]
+% \setuphead [subsection] [style=\mainfacemedium\bfa]
+% \setuphead [subsubsection][style=\mainfacemedium\bf]
+%
+% }
+
+\writestatus{luatex manual}{we assume that dejavu math is available}
+
+\setupbodyfont % assumes dejavu-math
+ [dejavu,10pt]
+
+\setuphead [chapter] [align={flushleft,broad},style=\bfd]
+\setuphead [section] [align={flushleft,broad},style=\bfb]
+\setuphead [subsection] [align={flushleft,broad},style=\bfa]
+\setuphead [subsubsection][align={flushleft,broad},style=\bf]
+
+\setuphead [chapter] [color=maincolor]
+\setuphead [section] [color=maincolor]
+\setuphead [subsection] [color=maincolor]
+\setuphead [subsubsection][color=maincolor]
+
+\definehead
+ [remark]
+ [subsubsubject]
+
+\setupheadertexts
+ []
+
+\definemixedcolumns
+ [twocolumns]
+ [n=2,
+ balance=yes,
+ before=\blank,
+ after=\blank]
+
+\definemixedcolumns
+ [threecolumns]
+ [twocolumns]
+ [n=3]
+
+\definemixedcolumns
+ [fourcolumns]
+ [threecolumns]
+ [n=4]
+
+% if we do this we also need to do it in table cells
+%
+% \setuptyping
+% [color=maincolor]
+%
+% \setuptype
+% [color=maincolor]
+
+\definetyping
+ [functioncall]
+
+\startMPdefinitions
+
+ color luaplanetcolor ; luaplanetcolor := \MPcolor{maincolor} ;
+ color luaholecolor ; luaholecolor := white ;
+ numeric luaextraangle ; luaextraangle := 0 ;
+ numeric luaorbitfactor ; luaorbitfactor := .25 ;
+
+ vardef lualogo = image (
+
+ % Graphic design by A. Nakonechnyj. Copyright (c) 1998, All rights reserved.
+
+ save d, r, p ; numeric d, r, p ;
+
+ d := sqrt(2)/4 ; r := 1/4 ; p := r/8 ;
+
+ fill fullcircle scaled 1
+ withcolor luaplanetcolor ;
+ draw fullcircle rotated 40.5 scaled (1+r)
+ dashed evenly scaled p
+ withpen pencircle scaled (p/2)
+ withcolor (luaorbitfactor * luaholecolor) ;
+ fill fullcircle scaled r shifted (d+1/8,d+1/8)
+ rotated - luaextraangle
+ withcolor luaplanetcolor ;
+ fill fullcircle scaled r shifted (d-1/8,d-1/8)
+ withcolor luaholecolor ;
+ luaorbitfactor := .25 ;
+ ) enddef ;
+
+\stopMPdefinitions
+
+\startuseMPgraphic{luapage}
+ StartPage ;
+
+ fill Page withcolor \MPcolor{othercolor} ;
+
+ luaorbitfactor := 1 ;
+ picture p ; p := lualogo xsized (3PaperWidth/5) ;
+ draw p shifted center Page shifted (0,-.5ypart center ulcorner p) ;
+
+ StopPage ;
+\stopuseMPgraphic
+
+% \starttexdefinition luaextraangle
+% % we can also just access the last page and so in mp directly
+% \ctxlua {
+% context(\lastpage == 0 and 0 or \realfolio*360/\lastpage)
+% }
+% \stoptexdefinition
+
+\startuseMPgraphic{luanumber}
+ % luaextraangle := \luaextraangle;
+ luaextraangle := if (LastPageNumber == 0) : 0 else : (RealPageNumber / LastPageNumber) * 360 fi;
+ luaorbitfactor := 0.25 ;
+ picture p ; p := lualogo ;
+ setbounds p to boundingbox fullcircle ;
+ draw p ysized 1cm ;
+\stopuseMPgraphic
+
+\definelayer
+ [page]
+ [width=\paperwidth,
+ height=\paperheight]
+
+\setupbackgrounds
+ [leftpage]
+ [background=page]
+
+\setupbackgrounds
+ [rightpage]
+ [background=page]
+
+\startsetups pagenumber:right
+ \setlayerframed
+ [page]
+ [preset=rightbottom,offset=1cm]
+ [frame=off,height=1cm,offset=overlay]
+ {\useMPgraphic{luanumber}}
+ \setlayerframed
+ [page]
+ [preset=rightbottom,offset=1cm,x=1.5cm]
+ [frame=off,height=1cm,width=1cm,offset=overlay]
+ {\pagenumber}
+ \setlayerframed
+ [page]
+ [preset=rightbottom,offset=1cm,x=2.5cm]
+ [frame=off,height=1cm,offset=overlay]
+ {\getmarking[chapter]}
+\stopsetups
+
+\startsetups pagenumber:left
+ \setlayerframed
+ [page]
+ [preset=leftbottom,offset=1cm,x=2.5cm]
+ [frame=off,height=1cm,offset=overlay]
+ {\getmarking[chapter]}
+ \setlayerframed
+ [page]
+ [preset=leftbottom,offset=1cm,x=1.5cm]
+ [frame=off,height=1cm,width=1cm,offset=overlay]
+ {\pagenumber}
+ \setlayerframed
+ [page]
+ [preset=leftbottom,offset=1cm]
+ [frame=off,height=1cm,offset=overlay]
+ {\useMPgraphic{luanumber}}
+\stopsetups
+
+\unexpanded\def\nonterminal#1>{\mathematics{\langle\hbox{\rm #1}\rangle}}
+
+% taco's brainwave -) .. todo: create a typing variant so that we can avoid the !crlf
+
+\newcatcodetable\syntaxcodetable
+
+\unexpanded\def\makesyntaxcodetable
+ {\begingroup
+ \catcode`\<=13 \catcode`\|=12
+ \catcode`\!= 0 \catcode`\\=12
+ \savecatcodetable\syntaxcodetable
+ \endgroup}
+
+\makesyntaxcodetable
+
+\unexpanded\def\startsyntax {\begingroup\catcodetable\syntaxcodetable \dostartsyntax}
+\unexpanded\def\syntax {\begingroup\catcodetable\syntaxcodetable \dosyntax}
+ \let\stopsyntax \relax
+
+\unexpanded\def\syntaxenvbody#1%
+ {\par
+ \tt
+ \startnarrower
+ \maincolor #1
+ \stopnarrower
+ \par}
+
+\unexpanded\def\syntaxbody#1%
+ {\begingroup
+ \maincolor \tt #1%
+ \endgroup}
+
+\bgroup \catcodetable\syntaxcodetable
+
+!gdef!dostartsyntax#1\stopsyntax{!let<!nonterminal!syntaxenvbody{#1}!endgroup}
+!gdef!dosyntax #1{!let<!nonterminal!syntaxbody{#1}!endgroup}
+
+!egroup
+
+\definetyping
+ [texsyntax]
+ [color=maincolor]
+
+% end of wave
+
+\setupinteraction
+ [state=start,
+ focus=standard,
+ style=,
+ color=,
+ contrastcolor=]
+
+\placebookmarks
+ [chapter,section,subsection]
+
+\setuplist
+ [chapter,section,subsection,subsubsection]
+ [interaction=all,
+ width=3em]
+
+\setuplist
+ [chapter]
+ [style=bold,
+ color=keptcolor]
+
+\setuplist
+ [subsection,subsubsection]
+ [margin=3em,
+ width=5em]
+
+% Hans doesn't like the bookmarks opening by default so we comment this:
+%
+% \setupinteractionscreen
+% [option=bookmark]
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/luatex/luatex-titlepage.tex b/doc/context/sources/general/manuals/luatex/luatex-titlepage.tex
new file mode 100644
index 000000000..8ab56f85d
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex-titlepage.tex
@@ -0,0 +1,70 @@
+\environment luatex-style
+\environment luatex-logos
+
+\startcomponent luatex-titlepage
+
+\startstandardmakeup
+
+ \switchtobodyfont
+ [mainfacemedium]
+
+ \definedfont[Bold*default at \the\dimexpr.08\paperheight\relax] \setupinterlinespace
+
+ \setlayer
+ [page]
+ {\useMPgraphic{luapage}}
+
+ \setlayerframed
+ [page]
+ [preset=middletop,
+ voffset=.05\paperheight]
+ [align=middle,
+ foregroundcolor=blue,
+ frame=off]
+ {Lua\TeX\\Reference}
+
+ \definedfont[Bold*default at 18pt] \setupinterlinespace
+
+ \setlayerframed
+ [page]
+ [preset=rightbottom,
+ offset=.01\paperheight]
+ [align=flushright,
+ foregroundcolor=blue,
+ frame=off]
+ {\doifsomething{\documentvariable{status}}{\documentvariable{status}\par}
+ \currentdate[month,space,year]\par
+ Version \documentvariable{version}}
+
+\stopstandardmakeup
+
+\startstandardmakeup
+
+ \start
+ \raggedleft
+ \definedfont[Bold*default at 48pt]
+ \setupinterlinespace
+ \blue Lua\TeX \endgraf Reference \endgraf Manual \endgraf
+ \stop
+
+ \vfill
+
+ \definedfont[Bold*default at 12pt]
+
+ \starttabulate[|l|l|]
+ \NC copyright \EQ Lua\TeX\ development team \NC \NR
+ \NC more info \EQ www.luatex.org \NC \NR
+ \NC version \EQ \currentdate \doifsomething{\documentvariable{snapshot}}{(snapshot \documentvariable{snapshot})} \NC \NR
+ \stoptabulate
+
+\stopstandardmakeup
+
+\setupbackgrounds
+ [leftpage]
+ [setups=pagenumber:left]
+
+\setupbackgrounds
+ [rightpage]
+ [setups=pagenumber:right]
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/luatex/luatex.tex b/doc/context/sources/general/manuals/luatex/luatex.tex
new file mode 100644
index 000000000..cd67f07f2
--- /dev/null
+++ b/doc/context/sources/general/manuals/luatex/luatex.tex
@@ -0,0 +1,40 @@
+% macros=mkvi
+
+% \tex vs \type vs \syntax vs. \luatex
+% \em \it \/
+
+% "context --nodates --nocompression luatex" can be used for comparison
+% runs, not that we do it
+
+\environment luatex-style
+\environment luatex-logos
+
+\dontcomplain
+
+\startdocument
+ [version=0.98.0,
+ status=Pre-release]
+
+\component luatex-titlepage
+
+\startfrontmatter
+ \component luatex-contents
+ \component luatex-introduction
+\stopfrontmatter
+
+\startbodymatter
+ \component luatex-enhancements
+ \component luatex-modifications
+ \component luatex-lua
+ \component luatex-languages
+ \component luatex-fonts
+ \component luatex-math
+ \component luatex-nodes
+ \component luatex-callbacks
+ \component luatex-tex
+ \component luatex-graphics
+ \component luatex-fontloader
+ \component luatex-backend
+\stopbodymatter
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/manuals-explaining-contents.tex b/doc/context/sources/general/manuals/manuals-explaining-contents.tex
new file mode 100644
index 000000000..3e1fadabc
--- /dev/null
+++ b/doc/context/sources/general/manuals/manuals-explaining-contents.tex
@@ -0,0 +1,11 @@
+% language=uk
+
+\startcomponent manuals-explaining-contents
+
+ \starttitle[title=Contents][color=darkgray]
+
+ \placelist[chapter][criterium=text]
+
+ \stoptitle
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/manuals-explaining-cover.tex b/doc/context/sources/general/manuals/manuals-explaining-cover.tex
new file mode 100644
index 000000000..8b4f3e891
--- /dev/null
+++ b/doc/context/sources/general/manuals/manuals-explaining-cover.tex
@@ -0,0 +1,199 @@
+% language=uk
+
+% Please try to be original and don't just copy this cover page as I don't want
+% confusion and be associated with (or responsibility for the look of) similar
+% looking documents.
+
+\startenvironment manuals-explaining-cover
+
+\startsetups document:abstract
+ \framed [
+ foregroundstyle=bold,
+ foregroundcolor=white,
+ width=7.5cm,
+ align={normal,tolerant},
+ frame=off,
+ strut=no,
+ ] {
+ \getbuffer[abstract]
+ }
+\stopsetups
+
+\startMPinclusions
+
+ def DrawCoverPage (expr what) =
+
+ numeric variant ; variant := 1 ;
+
+ StartCover ;
+
+ save width, height, size, anchor, offset, colors ;
+
+ numeric width, height, size ; pair anchor, offset ; string colors[] ;
+
+ colors[1] := "\documentvariable{cover:color:1}" ;
+ colors[2] := "\documentvariable{cover:color:2}" ;
+ colors[3] := "\documentvariable{cover:color:3}" ;
+ colors[4] := "\documentvariable{cover:color:4}" ;
+ colors[5] := "\documentvariable{cover:color:5}" ;
+
+ fill CoverPage enlarged PaperBleed withcolor colors[5] ;
+
+ fill Spine bottomenlarged -.5PaperHeight withcolor colors[3] ;
+ fill Spine topenlarged -.5PaperHeight withcolor colors[2] ;
+
+ width := FrontPageWidth ;
+ height := FrontPageHeight ;
+ size := 4 * width / 3 ;
+ offset := (-1cm,1cm) ;
+ anchor := .5[lrcorner CoverPage,urcorner CoverPage] ;
+
+ fill anchored.llft(lltriangle scaled size, urcorner FrontPage) withcolor colors[1] ;
+ fill anchored.urt (urtriangle scaled size, llcorner FrontPage) withcolor colors[2] ;
+ fill anchored.lrt (lrtriangle scaled size, ulcorner FrontPage) withcolor colors[3] ;
+ fill anchored.ulft(ultriangle scaled size, lrcorner FrontPage) withcolor colors[4] ;
+
+ fill anchored.lrt (lrtriangle scaled size, ulcorner BackPage) withcolor colors[1] ;
+ fill anchored.llft(lltriangle scaled size, urcorner BackPage) withcolor colors[3] ;
+ fill anchored.ulft(ultriangle scaled size, lrcorner BackPage) withcolor colors[2] ;
+ fill anchored.urt (urtriangle scaled size, llcorner BackPage) withcolor colors[4] ;
+
+ draw thetextext.llft(
+ textext("\bf \documentvariable{title}\hskip-.1em")
+ rotated 45 ysized .350height,
+ anchor shifted (6*offset+offset)
+ ) withcolor white ;
+ draw thetextext.llft(
+ textext("\bf \documentvariable{subtitle}")
+ rotated 45 ysized .275height,
+ anchor shifted (5*offset+offset)
+ ) withcolor white ;
+ draw thetextext.llft(
+ textext("\bf \documentvariable{author}")
+ rotated 45 ysized .200height,
+ anchor shifted (2*offset+offset)
+ ) withcolor white ;
+ draw thetextext.llft(
+ textext("\bf \documentvariable{affiliation}")
+ rotated 45 ysized .200height,
+ anchor shifted (1*offset+offset)
+ ) withcolor white ;
+
+ % for the moment
+
+ if (what = "back") or (what = "cover") :
+
+ draw
+ thetextext.top(
+ textext("\bf \documentvariable{comment}")
+ xsized 4cm,
+ lrcorner Page shifted (-3cm,1cm)
+ ) withcolor white ;
+
+ fi ;
+
+ % till here
+
+ width := BackPageWidth ;
+
+ if (what = "back") or (what = "cover") :
+
+ draw thetextext(
+ textext("\bf\setups[document:abstract]")
+ xsized .65width rotated 45,
+ center BackPage
+ ) withcolor white ;
+
+ fi ;
+
+ if what = "cover" :
+
+ draw thetextext.bot(
+ textext("\bf \documentvariable{title}\hskip-.1em")
+ rotated 90 xsized .8SpineWidth,
+ .5[ulcorner Spine,urcorner Spine] shifted (0,-1cm)
+ ) withcolor white ;
+
+ draw thetextext.top(
+ textext("\bf \documentvariable{author}")
+ rotated 90 xsized .8SpineWidth,
+ .5[llcorner Spine,lrcorner Spine] shifted (0,1cm)
+ ) withcolor white ;
+
+ fi ;
+
+ StopCover ;
+
+ if what = "front" :
+ clip currentpicture to FrontPage ;
+ elseif what = "back" :
+ clip currentpicture to BackPage ;
+ else :
+ drawboundary CoverPage ;
+ fi ;
+
+ enddef ;
+
+\stopMPinclusions
+
+\startsetups document:start
+
+ % \startcovermatter[front]
+
+ \setupbackgrounds[page][background=]
+
+ \doifmodeelse {simple} {
+
+ \startMPpage
+ DrawCoverPage("front") ;
+ \stopMPpage
+
+ } {
+
+ \startMPpage
+ DrawCoverPage("cover") ;
+ \stopMPpage
+
+ }
+
+ \page[dummy]
+
+ \setupbackgrounds[page][background=page]
+
+ \resetuserpagenumber
+
+ % \stopcovermatter
+
+\stopsetups
+
+\startsetups document:stop
+
+ \doifmodeelse {simple} {
+
+ % \startcovermatter[back]
+
+ \page
+
+ \setuppagenumbering[page=]
+
+ \setupbackgrounds[page][background=]
+
+ \page[empty,left]
+
+ \setupmakeup[doublesided=no,page=no]
+
+ \startMPpage
+ DrawCoverPage("back") ;
+ \stopMPpage
+
+ % \stopcovermatter
+
+ } {
+
+ % not needed as it's part of the cover page
+
+ }
+
+\stopsetups
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/manuals-explaining-environment.tex b/doc/context/sources/general/manuals/manuals-explaining-environment.tex
new file mode 100644
index 000000000..f896c219b
--- /dev/null
+++ b/doc/context/sources/general/manuals/manuals-explaining-environment.tex
@@ -0,0 +1,325 @@
+\startenvironment manuals-explaining-environment
+
+\usemodule[abr-01]
+\usemodule[visual]
+\usemodule[simulate]
+\usemodule[chart]
+\usemodule[nodechart]
+
+% done
+
+\dontcomplain
+
+\definepapersize
+ [book]
+ [width=18cm,
+ height=24cm]
+
+\setuppapersize
+ [book]
+
+\startmode[oversized]
+
+ \setuppapersize
+ [book]
+ [oversized]
+
+ \setuplayout
+ [marking=on]
+
+\stopmode
+
+\setuplayout
+ [location=middle,
+ topspace=1.5cm,
+ bottomspace=2cm,
+ backspace=2cm,
+ cutspace=2cm,
+ header=0cm,
+ footer=0cm,
+ margindistance=.25cm,
+ margin=1.25cm,
+ width=middle,
+ height=middle]
+
+\setuplayout
+ [style=\ss]
+
+\usetypescript
+ [dejavu-condensed]
+
+\setupbodyfont
+ [ipaex,9pt]
+
+\setupbodyfont
+ [dejavu,9pt]
+
+\definetyping
+ [narrowtyping]
+ [typing]
+ [bodyfont=dejavu-condensed]
+
+% This is way too ugly for a manual:
+%
+% \setuptyping
+% [indentnext=no]
+%
+% \setupindenting
+% [medium,yes]
+
+\setupwhitespace
+ [big]
+
+\defineoverlay
+ [page]
+ [\useMPgraphic{page}]
+
+\setupbackgrounds
+ [page]
+ [background=page]
+
+\setuphead
+ [chapter,section,subsection]
+ [color=\namedstructureuservariable{chapter}{color}]
+
+\setuphead
+ [chapter]
+ [style=\bfc]
+
+\setuphead
+ [section]
+ [style=\bfb]
+
+\setuphead
+ [subsection]
+ [style=\bf,
+ before=\blank,
+ after=\blank]
+
+\startsetups document:chapter:inside
+ \definecolor[maincolor][1.0(\namedheadparameter{chapter}{color})] % this expands the color
+ \definecolor[halfcolor][0.5(maincolor,white)]
+\stopsetups
+
+\setuphead
+ [chapter]
+ [insidesection=\directsetup{document:chapter:inside}]
+
+\setuppagenumbering
+ [alternative=doublesided,
+ location=]
+
+\setuplist
+ [aligntitle=yes]
+
+\setuplist
+ [chapter]
+ [pagenumber=no,
+ style=bold,
+ before={\blank\startcolor[\structurelistuservariable{color}]},
+ after={\placelist[section]\stopcolor}]
+
+\setuplist
+ [chapter,section]
+ [width=3em]
+
+\startuseMPgraphic{page}
+
+ StartPage ;
+
+ linecap := butt ;
+
+ if OnRightPage :
+
+ path p ; p := (
+ urcorner Page shifted (-2cm,0) --
+ urcorner Page --
+ urcorner Page shifted (0,-2cm) -- cycle
+ ) shifted (-2.5mm,-2.5mm) ;
+
+ else :
+
+ path p ; p := (
+ ulcorner Page shifted (2cm,0) --
+ ulcorner Page --
+ ulcorner Page shifted (0,-2cm) -- cycle
+ ) shifted (2.5mm,-2.5mm) ;
+
+ fi ;
+
+ fill p
+ withpen pencircle scaled 1mm
+ withcolor "maincolor" ;
+
+ draw thetextext("\bf\userpagenumber",
+ if OnRightPage : urcorner p shifted (-5mm,-5mm) else : ulcorner p shifted (5mm,-5mm) fi)
+ withcolor white ;
+
+ if OnRightPage :
+
+ path p ; p := (
+ lrcorner Page shifted (-5cm,0) --
+ lrcorner Page
+ ) shifted (-5mm,10mm)
+
+ else :
+
+ path p ; p := (
+ llcorner Page shifted (5cm,0) --
+ llcorner Page
+ ) shifted (5mm,10mm) ;
+
+ fi ;
+
+ draw p
+ withpen pencircle scaled 1mm
+ withcolor "maincolor" ;
+
+ draw if OnRightPage :
+ thetextext.lft("\bf\getspecificstructuretitle{chapter}",lrcorner Page shifted (-5mm,5mm))
+ else :
+ thetextext.rt ("\bf\getspecificstructuretitle{chapter}",llcorner Page shifted ( 5mm,5mm))
+ fi withcolor "\namedstructureuservariable{chapter}{color}" ;
+
+ StopPage ;
+\stopuseMPgraphic
+
+\definecolor[orange] [r=1,g=.6,b=.1]
+
+\definecolor[middlegray] [s=.75]
+\definecolor[darkgray] [s=.25]
+\definecolor[darkred] [r=.5]
+\definecolor[darkgreen] [g=.5]
+\definecolor[darkblue] [b=.5]
+
+\definecolor[darkyellow] [.5(red,green)]
+\definecolor[darkmagenta][.5(red,blue)]
+\definecolor[darkcyan] [.5(green,blue)]
+
+\definecolor[darkorange] [.5(orange)]
+
+\definecolor[maincolor] [darkgray]
+
+\definecolor [mix-1] [r=1,g=.75,b=.25] \definecolor [darkmix-1][.5(mix-1)]
+\definecolor [mix-2] [r=1,g=.25,b=.75] \definecolor [darkmix-2][.5(mix-2)]
+\definecolor [mix-3] [r=.75,g=1,b=.25] \definecolor [darkmix-3][.5(mix-3)]
+\definecolor [mix-4] [r=.75,g=.25,b=1] \definecolor [darkmix-4][.5(mix-4)]
+\definecolor [mix-5] [r=.25,g=1,b=.75] \definecolor [darkmix-5][.5(mix-5)]
+\definecolor [mix-6] [r=.25,g=.75,b=1] \definecolor [darkmix-6][.5(mix-6)]
+
+% \blackrule[height=1cm,width=10cm,color=mix-1] \blackrule[height=1cm,width=10cm,color=darkmix-1]
+% \blackrule[height=1cm,width=10cm,color=mix-2] \blackrule[height=1cm,width=10cm,color=darkmix-2]
+% \blackrule[height=1cm,width=10cm,color=mix-3] \blackrule[height=1cm,width=10cm,color=darkmix-3]
+% \blackrule[height=1cm,width=10cm,color=mix-4] \blackrule[height=1cm,width=10cm,color=darkmix-4]
+% \blackrule[height=1cm,width=10cm,color=mix-5] \blackrule[height=1cm,width=10cm,color=darkmix-5]
+% \blackrule[height=1cm,width=10cm,color=mix-6] \blackrule[height=1cm,width=10cm,color=darkmix-6]
+
+% modules
+
+\setupsorting
+ [logo]
+ [style=]
+
+\setupFLOWchart
+ [width=6em,
+ height=3em,
+ offset=-2em, % maybe default : todo: hoffset and voffset
+ dx=2em,
+ dy=2em]
+
+\setupFLOWlines
+ [color=maincolor]
+
+\setupFLOWshapes
+ [rulecolor=maincolor]
+
+% tables
+
+\setuptabulate
+ [rulethickness=.5mm,
+ rulecolor=maincolor]
+
+% special commands
+
+\startuniqueMPgraphic{reference}{color}
+ fill
+ .5[llcorner OverlayBox,ulcorner OverlayBox] --
+ .5[ulcorner OverlayBox,urcorner OverlayBox] --
+ .5[urcorner OverlayBox,lrcorner OverlayBox] --
+ .5[lrcorner OverlayBox,llcorner OverlayBox] -- cycle
+ withcolor \MPvar{color} ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{reference}{color}
+ path p ; p := OverlayBox enlarged -1mm ;
+ filldraw
+ ulcorner p --
+ urcorner p --
+ lrcorner p --
+ .5[lrcorner p,llcorner p] shifted (0,-1ExHeight) --
+ llcorner p -- cycle
+ withpen pencircle scaled 1mm
+ withcolor \MPvar{color} ;
+ setbounds currentpicture to OverlayBox enlarged 1ExHeight ;
+\stopuniqueMPgraphic
+
+\defineoverlay
+ [reference]
+ [\uniqueMPgraphic{reference}{color=maincolor,}]
+
+\definecolor
+ [maincolor]
+ [red]
+
+\definemargindata
+ [appendixdata]
+ %[inner]
+ [outer]
+ [stack=yes]
+
+\definemarginframed
+ [appendixdata]
+ [width=3.5em,
+ height=\lineheight, % we know what goes in there
+ align=middle,
+ offset=overlay,
+ foregroundcolor=white,
+ background=reference]
+
+% todo:
+%
+% \appendixdata[reference=bla]{}
+%
+% whole data
+
+% interaction
+
+\setupinteraction
+ [state=start,
+ click=no,
+ color=,
+ contrastcolor=,
+ style=]
+
+% whatever
+
+\definestartstop
+ [notabene]
+ [before=\blank,
+ after=\blank,
+ style=\em]
+
+\setuphyphenation
+ [method=default]
+
+
+\startbuffer[underconstruction]
+\startnotabene
+ This document is still under construction. The functionality discussed here
+ will stay and more might show up. Of course there are errors, and they're all
+ mine. The text is not checked for spelling errors. Feel free to let me know
+ what should get added.
+\stopnotabene
+\stopbuffer
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/manuals-xml-environment.tex b/doc/context/sources/general/manuals/manuals-xml-environment.tex
new file mode 100644
index 000000000..5a5d9a92d
--- /dev/null
+++ b/doc/context/sources/general/manuals/manuals-xml-environment.tex
@@ -0,0 +1,385 @@
+% language=uk
+%
+% author : Hans Hagen, PRAGMA ADE, NL
+% license : Creative Commons, Attribution-NonCommercial-ShareAlike 3.0 Unported
+
+\usemodule[abr-01]
+
+\startmode[booklet]
+
+ \setuppapersize [A4][oversized]
+
+\stopmode
+
+% \setuppapersize[A4][doubleoversized,landscape]
+% \setuparranging[2UP]
+% \setuppagenumbering[alternative={singlesided,doublesided}]
+
+\setuplayout
+ [location=middle,
+ marking=on]
+
+% \logo [EXAMPLE] {eXaMpLe}
+
+\setuptabulate
+ [rulethickness=1pt,
+ rulecolor=darkgreen]
+
+\setuptables
+ [rulethickness=1pt,
+ rulecolor=darkgreen]
+
+% \usesymbols
+% [cc]
+
+\setuplayout
+ [width=middle,
+ topspace=2cm,
+ top=1cm,
+ cutspace=1.5cm, % 2.0cm
+ backspace=3.5cm,
+ header=1cm,
+ footer=1.5cm,
+ bottom=1cm,
+ leftmargin=2.5cm,
+ rightmargin=1cm,
+ margindistance=.5cm,
+ height=middle]
+
+\definelayout
+ [titlepage]
+ [topspace=2cm,
+ backspace=1.5cm,
+ bottomspace=1.5cm]
+
+\startmode[screen]
+
+ \setuppapersize
+ [S6][S6]
+
+ \setuplayout
+ [topspace=1cm,
+ bottomspace=1.5cm,
+ top=1cm,
+ header=0cm,
+ footer=.5cm,
+ bottom=1cm]
+
+ \setupinteraction
+ [state=start,
+ color=,
+ contrastcolor=,
+ style=,
+ menu=on]
+
+ \setupinteractionmenu
+ [bottom]
+ [left=\hfill,
+ middle=\hskip.25cm,
+ background=color,
+ backgroundcolor=darkgray,
+ color=lightgray,
+ contrastcolor=lightgray,
+ style=\bfb\setstrut\strut,
+ offset=2pt,
+ height=fit,
+ frame=off]
+
+ \startinteractionmenu[bottom]
+ \startbut [PreviousJump] GoBack \stopbut
+ \startbut [previouspage] Previous \stopbut
+ \startbut [nextpage] Next \stopbut
+ \startbut [CloseDocument] Exit \stopbut
+ \stopinteractionmenu
+
+\stopmode
+
+\setupbodyfont[dejavu,11pt]
+
+\definecolor [cyan] [g=.4,b=.4]
+\definecolor [magenta] [r=.4,b=.4]
+\definecolor [yellow] [r=.4,g=.4]
+\definecolor [red] [r=.4]
+\definecolor [green] [g=.4]
+\definecolor [blue] [b=.4]
+\definecolor [gray] [s=.4]
+
+\definecolor [lightgray] [s=.8]
+
+\definecolor [FillColor] [gray]
+
+\definecolor [NumberColor] [red]
+\definecolor [BannerColor] [green]
+\definecolor [AspectColor] [blue]
+
+% *rgb *rgy *rby *gby *rgc *rbc *gbc rgm rbm gbm
+% *cmy cmr cyr myr cmg cyr myg cmb cyb myb
+
+\definepalet[steps] [NumberColor=red, BannerColor=green, AspectColor=blue]
+\definepalet[mathml] [NumberColor=cyan, BannerColor=magenta,AspectColor=yellow]
+\definepalet[chemml] [NumberColor=red, BannerColor=green, AspectColor=yellow]
+\definepalet[physml] [NumberColor=red, BannerColor=blue, AspectColor=yellow]
+\definepalet[figures][NumberColor=green,BannerColor=blue, AspectColor=yellow]
+\definepalet[charts] [NumberColor=red, BannerColor=green, AspectColor=cyan]
+\definepalet[examns] [NumberColor=red, BannerColor=green, AspectColor=cyan]
+\definepalet[general][NumberColor=red, BannerColor=blue, AspectColor=cyan]
+\definepalet[tables] [NumberColor=green,BannerColor=blue, AspectColor=cyan]
+
+\setupindenting
+ [medium]
+
+\indenting
+ [yes]
+
+\defineoverlay
+ [nextpage]
+ [\overlaybutton{nextpage}]
+
+\startusableMPgraphic{cover}
+ path p, q ; color maincolor[], fillcolor ; numeric r, w, h ;
+ numeric cellwidth, cellspread, linewidth ;
+ maincolor[0] := \MPcolor{BannerColor} ;
+ maincolor[1] := \MPcolor{AspectColor} ;
+ maincolor[2] := \MPcolor{NumberColor} ;
+ fillcolor := \MPcolor{FillColor} ;
+ cellwidth := 75pt ;
+ cellspread := 50pt ;
+ linewidth := 1/10pt ;
+ w := OverlayWidth + cellwidth ;
+ h := OverlayHeight + cellwidth ;
+ q := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
+ fill unitsquare xyscaled (w,h) withcolor fillcolor ;
+ set_grid (w,h,cellwidth-cellspread,cellwidth-cellspread) ;
+ forever :
+ if new_on_grid(uniformdeviate w, uniformdeviate h) :
+ draw image (
+ p := unitsquare ;
+ r := floor(uniformdeviate 3) ;
+ fill p enlarged linewidth withcolor fillcolor ;
+ fill p withcolor maincolor[r] ;
+ draw
+ if r = 0 :
+ urcorner p -- .5[llcorner p,ulcorner p] -- lrcorner p
+ elseif r = 1 :
+ ulcorner p -- .5[lrcorner p,urcorner p] -- llcorner p
+ else :
+ urcorner p -- llcorner p
+ fi
+ withpen pencircle scaled linewidth withcolor fillcolor ;
+ )
+ scaled (cellwidth randomized cellspread)
+ shifted (dx,dy) ;
+ fi ;
+ exitif grid_full ;
+ endfor ;
+ % currentpicture := currentpicture shifted -(cellwidth,cellwidth) ;
+ % clip currentpicture to q ;
+\stopusableMPgraphic
+
+\defineoverlay
+ [cover]
+ [\useMPgraphic{cover}]
+
+\setupbackgrounds
+ [page]
+ [offset=3mm]
+
+\defineoverlay
+ [page]
+ [\reuseMPgraphic{page}]
+
+\startreusableMPgraphic{page}
+ StartPage ;
+ path p ; p :=
+ ulcorner Page --
+ llcorner Page --
+ llcorner Page shifted (BackSpace-LeftMarginDistance,0) --
+ ulcorner Page shifted (BackSpace-LeftMarginDistance,0) -- cycle ;
+ fill
+ (p enlarged PageOffset) rightenlarged -PageOffset
+ withcolor \MPcolor{FillColor} ;
+ picture t ; t := textext("\bfb \lightgray \ConTeXt\ XML") rotated 90 ;
+ setbounds t to boundingbox t enlarged ExHeight ;
+ t := image ( label.llft(t,urcorner Page )) ;
+ fill boundingbox t topenlarged PageOffset rightenlarged PageOffset withcolor \MPcolor{FillColor} ;
+ draw t ;
+ StopPage ;
+ setbounds currentpicture to boundingbox currentpicture enlarged PageOffset ;
+\stopreusableMPgraphic
+
+\setuphead
+ [section]
+ [command=\texdefinition{document:head:section},
+ color=lightgray,
+ style=\bfb,
+ before={\blank[2*big]},
+ after={\blank[2*big]},]
+
+\starttexdefinition document:head:section #1#2
+ \hbox {
+ \hskip-\marginwidth
+ \hskip-\margindistance
+ \framed [
+ width=.5\textwidth,
+ offset=2pt,
+ frame=off,
+ background=color,
+ backgroundcolor=AspectColor
+ ] {
+ \hskip.25cm
+ #2
+ \hfill
+ }
+ }
+\stoptexdefinition
+
+\setupheadertexts
+ []
+
+\setupbottom
+ [margin]
+ [color=lightgray,
+ style=\bfb]
+
+\setuptyping
+ [color=green]
+
+\setuptype
+ [color=green]
+
+\doifmodeelse {booklet} {
+
+ \setupbottomtexts
+ [margin]
+ [\setup{document:pagenumber}] []
+ [\setup{document:pagenumber}] []
+
+} {
+
+ \setupbottomtexts
+ [margin]
+ [\setup{document:pagenumber}] []
+
+}
+
+\setvariables
+ [document]
+ [title=No Title,
+ author=No Author]
+
+\startmode[atpragma]
+
+ \setvariables
+ [document]
+ [line:1=Con\TeX t XML,
+ line:2=Pragma ADE / Hasselt NL,
+ line:3=MkIV]
+
+\stopmode
+
+\startsetups document:pagenumber
+ \hbox to \marginwidth {
+ \framed [
+ width=.25\textwidth,
+ offset=2pt,
+ frame=off,
+ background=color,
+ backgroundcolor=NumberColor
+ ] {
+ \hskip.25cm
+ \documentvariable{title}
+ \hfill
+ \pagenumber
+ \hskip.25cm
+ }
+ }
+\stopsetups
+
+\startsetups document:start
+
+ \doifsomething {\documentvariable{palet}} {
+ \setuppalet[\documentvariable{palet}]
+ }
+
+ \setupbackgrounds
+ [page]
+ [background={cover,nextpage}]
+
+ \setuplayout
+ [titlepage]
+
+ \startstandardmakeup[bottomstate=stop]
+ \raggedcenter
+ \lightgray
+ \start
+ \definedfont[SansBold at 100pt]
+ \setupinterlinespace
+ \WORD{\documentvariable{title}}
+ \par
+ \stop
+ \vfilll
+ \doifsomething {\documentvariable{line:1}} {
+ \dontleavehmode\hbox{\definedfont[SansBold at 50pt]\setstrut\strut\documentvariable{line:1}}
+ }
+ \doifsomething {\documentvariable{line:2}} {
+ \vskip25pt
+ \dontleavehmode\hbox{\definedfont[SansBold at 25pt]\setstrut\strut\documentvariable{line:2}}
+ }
+ \doifsomething {\documentvariable{line:3}} {
+ \vskip25pt
+ \dontleavehmode\hbox{\definedfont[SansBold at 25pt]\setstrut\strut\documentvariable{line:3}}
+ }
+ \stopstandardmakeup
+
+ \setuplayout
+
+ \setupbackgrounds
+ [page]
+ [background={page,banner}]
+
+\stopsetups
+
+\startsetups document:stop
+
+ \definecolor[AspectColor][green]
+
+ \startsubject[title=Colofon]
+
+ This manual is part of the \CONTEXT\ distribution, and is authored and maintained by \space
+ \documentvariable{author}. \CONTEXT\ is developed at \PRAGMA, Hasselt, The Netherlands.\space
+ This manual is produced on \currentdate.
+
+ \stopsubject
+
+\stopsetups
+
+% \usemodule[set-11]
+
+% \setupframedtexts
+% [setuptext]
+% [rulethickness=1pt,
+% framecolor=green,
+% background=color,
+% backgroundcolor=lightgray]
+
+% titles:
+
+% Description
+% Structure
+% Usage
+% XML example
+% \TeX\ example
+% Configuring
+% Documentation
+
+\continueifinputfile{s-man-10.mkiv}
+
+\startdocument[title=Title,author=Author,palet=steps]
+
+ \startsection[title=Test]
+
+ \input knuth
+
+ \stopsection
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/math/math-framing-001.tex b/doc/context/sources/general/manuals/math/math-framing-001.tex
new file mode 100644
index 000000000..5081b8ad2
--- /dev/null
+++ b/doc/context/sources/general/manuals/math/math-framing-001.tex
@@ -0,0 +1,113 @@
+\setuplayout[topspace=5mm,bottomspace=5mm,height=middle,header=1cm,footer=0cm]
+
+\starttext
+
+\startbuffer[sample]
+ \enabletrackers[formulas.framed] \showboxes
+ \startformula
+ e = mc^2
+ \stopformula
+ \par
+ \startformula
+ e = mc^2
+ \stopformula
+ \startformula
+ e = mc^2
+ \stopformula
+ \startformula
+ e \dorecurse{12} { = mc^2 }
+ \stopformula
+ \startplaceformula
+ \startformula
+ e = mc^2
+ \stopformula
+ \stopplaceformula
+ \startplaceformula
+ \startformula
+ e \dorecurse{12} { = mc^2 }
+ \stopformula
+ \stopplaceformula
+\stopbuffer
+
+\startbuffer[setup-b]
+\setupformula
+ [option=frame]
+\stopbuffer
+
+\startbuffer[setup-d]
+\setupformulaframed
+ [frame=on,
+ %toffset=10pt,
+ %boffset=10pt,
+ foregroundcolor=white,
+ background=color,
+ backgroundcolor=gray]
+\stopbuffer
+
+\startbuffer[setup-c]
+\setupformula
+ [frame=number]
+\stopbuffer
+
+\startbuffer[all]
+\start
+ \typebuffer[setup-a]
+ \getbuffer[setup-a]
+ \getbuffer[sample]
+ \typebuffer[setup-b]
+ \typebuffer[setup-d]
+ \getbuffer[setup-b]
+ \getbuffer[setup-d]
+ \getbuffer[sample]
+ \typebuffer[setup-c]
+ \getbuffer[setup-c]
+ \getbuffer[sample]
+ \page
+\stop
+\stopbuffer
+
+\startbuffer
+ \startbuffer[setup-a]
+ \setupformula
+ [align=flushleft]
+ \stopbuffer
+ \getbuffer[all]
+ \startbuffer[setup-a]
+ \setupformula
+ [align=flushleft,location=left]
+ \stopbuffer
+ \getbuffer[all]
+
+ \startbuffer[setup-a]
+ \setupformula
+ [align=middle]
+ \stopbuffer
+ \getbuffer[all]
+ \startbuffer[setup-a]
+ \setupformula
+ [align=middle,location=left]
+ \stopbuffer
+ \getbuffer[all]
+
+ \startbuffer[setup-a]
+ \setupformula
+ [align=flushright]
+ \stopbuffer
+ \getbuffer[all]
+ \startbuffer[setup-a]
+ \setupformula
+ [align=flushright,location=left]
+ \stopbuffer
+ \getbuffer[all]
+\stopbuffer
+
+\getbuffer
+
+\startbuffer[setup-b]
+\setupformula
+ [option={tight,frame}]
+\stopbuffer
+
+\getbuffer
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/math/math-mkiv.tex b/doc/context/sources/general/manuals/math/math-mkiv.tex
new file mode 100644
index 000000000..c20f12049
--- /dev/null
+++ b/doc/context/sources/general/manuals/math/math-mkiv.tex
@@ -0,0 +1,58 @@
+% language=uk
+
+% author : Hans Hagen
+% copyright : PRAGMA ADE & ConTeXt Development Team
+% license : Creative Commons Attribution ShareAlike 4.0 International
+% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
+% origin : the ConTeXt distribution
+%
+% comment : Because this manual is distributed with TeX distributions it comes with a rather
+% liberal license. We try to adapt these documents to upgrades in the (sub)systems
+% that they describe. Using parts of the content otherwise can therefore conflict
+% with existing functionality and we cannot be held responsible for that. Many of
+% the manuals contain characteristic graphics and personal notes or examples that
+% make no sense when used out-of-context.
+
+\environment math-layout
+
+\startproduct math-mkiv
+
+\startdocument
+
+\component math-titlepage
+
+\startfrontmatter
+ \component math-contents
+ \component math-introduction
+\stopfrontmatter
+
+\startbodymatter
+ \component math-spacing
+ \component math-framing
+ \component math-numbering
+ \component math-combining
+\stopbodymatter
+
+\stopdocument
+
+\stopproduct
+
+% when we compare these tables with the one that the ff loader produces we notice
+% some differences: this is because (deduced from source) that ff does some kind
+% of interpolation for missing heights for the last kern (for n=2 adding 100 and
+% for adding 1 the max height) ... this is probably a side effect if missing specs
+% here we don't do that
+% \enabledirectives[fontgoodies.mathkerning]
+
+% \startTEXpage[offset=2mm]
+% \startcombination[4*2]
+% {\hbox to 50pt{\hss\showboxes\switchtobodyfont [modern]$V_i^i = W_i^i$\hss}} {\infofont modern}
+% {\hbox to 50pt{\hss\showboxes\switchtobodyfont [cambria]$V_i^i = W_i^i$\hss}} {\infofont cambria}
+% {\hbox to 50pt{\hss\showboxes\switchtobodyfont[lucidaot]$V_i^i = W_i^i$\hss}} {\infofont lucida}
+% {\hbox to 50pt{\hss\showboxes\switchtobodyfont [dejavu]$V_i^i = W_i^i$\hss}} {\infofont dejavu}
+% {\hbox to 50pt{\hss\showboxes\switchtobodyfont [pagella]$V_i^i = W_i^i$\hss}} {\infofont pagella}
+% {\hbox to 50pt{\hss\showboxes\switchtobodyfont [termes]$V_i^i = W_i^i$\hss}} {\infofont termes}
+% {\hbox to 50pt{\hss\showboxes\switchtobodyfont [bonum]$V_i^i = W_i^i$\hss}} {\infofont bonum}
+% {\hbox to 50pt{\hss\showboxes\switchtobodyfont [schola]$V_i^i = W_i^i$\hss}} {\infofont schola}
+% \stopcombination
+% \stopTEXpage
diff --git a/doc/context/sources/general/manuals/math/math-spacing-001.tex b/doc/context/sources/general/manuals/math/math-spacing-001.tex
new file mode 100644
index 000000000..a0ccda449
--- /dev/null
+++ b/doc/context/sources/general/manuals/math/math-spacing-001.tex
@@ -0,0 +1,73 @@
+\doifmodeelse {with-struts} {
+ \def\Line{\dontleavehmode{\showstruts\dorecurse{18}{x \strut x }}}
+} {
+ \def\Line{\dontleavehmode{\showstruts\dorecurse{18}{x x }}}
+}
+
+\setuplayout
+ [width=middle,
+ height=middle,
+ backspace=1mm,
+ topspace=1cm]
+
+\setupbodyfont
+ [17.3pt]
+
+\starttext
+
+\Line
+
+\startformula
+ x
+\stopformula
+
+\Line
+
+\startformula
+ y
+\stopformula
+
+\Line
+
+\startformula
+ \strut x
+\stopformula
+
+\Line
+
+\startformula \startalign
+ \NC c - a = \NC b \NR
+ \NC d + c - b = \NC a \NR
+\stopalign \stopformula
+
+\Line
+
+\startformula \startalign
+ \NC c - a = \NC b \NR
+ \NC d + c - b = \NC a \NR
+\stopalign \stopformula
+
+\Line
+
+\startformula
+\mframed
+ [offset=1mm,loffset=3mm,roffset=3mm] {
+ a + b = c
+ }
+\stopformula
+
+\Line
+
+\startformula
+\mframed
+ [offset=1mm,loffset=3mm,roffset=3mm] {
+ \startalign
+ \NC c - a = \NC b \NR
+ \NC d + c - b = \NC a \NR
+ \stopalign
+ }
+\stopformula
+
+\Line
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/mcommon.tex b/doc/context/sources/general/manuals/mcommon.tex
new file mode 100644
index 000000000..94b5f9bf5
--- /dev/null
+++ b/doc/context/sources/general/manuals/mcommon.tex
@@ -0,0 +1,210 @@
+% content=tex
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\startenvironment mcommon
+
+% modules
+
+\usemodule[abr-02]
+
+% layout
+
+% \startmode[screen]
+% \setuppapersize[S6][S6]
+% \setupinteractionscreen[options=max]
+% \stopmode
+
+\setuplayout
+ [topspace=15mm,
+ header=15mm,
+ headerdistance=0mm,
+ footer=0cm,
+ width=middle,
+ height=middle]
+
+\setupinteraction
+ [state=start,
+ color=,
+ contrastcolor=,
+ style=]
+
+% fonts
+
+\definetypeface [mainface] [rm] [serif] [pagella] [default]
+\definetypeface [mainface] [ss] [sans] [heros] [default] % [rscale=1.1]
+\definetypeface [mainface] [tt] [mono] [heros] [default] % [rscale=1.1]
+\definetypeface [mainface] [mm] [math] [pagella] [default]
+
+\setupbodyfont[mainface,12pt]
+
+\definefont [BigFont] [SansBold*default at 60pt]
+\definefont [MedFont] [SansBold*default at 30pt]
+
+% colors (historically)
+
+\definecolor [NopColor] [r=.6,g=.4,b=.5]
+\definecolor [AltColor] [r=.4,g=.6,b=.5]
+\definecolor [TheColor] [r=.4,g=.5,b=.6]
+\definecolor [TmpColor] [r=.6,g=.5,b=.4]
+
+\definecolor [NopColor] [r=.40,g=.20,b=.20]
+\definecolor [AltColor] [r=.20,g=.40,b=.20]
+\definecolor [TheColor] [r=.20,g=.20,b=.40]
+\definecolor [TmpColor] [r=.40,g=.40,b=.20]
+
+\definecolor [red] [NopColor]
+\definecolor [green] [AltColor]
+\definecolor [blue] [TheColor]
+\definecolor [yellow][TmpColor]
+
+% spacing
+
+\setupwhitespace
+ [big]
+
+\setuptolerance
+ [verytolerant,stretch]
+
+% verbatim
+
+\setuptype
+ [color=AltColor]
+
+\setuptyping
+ [color=AltColor]
+
+% structure
+
+\setupitemize
+ [each]
+ [color=TheColor]
+
+\definedescription
+ [switch]
+ [headstyle=type,
+ headcolor=TheColor,
+ location=serried,
+ width=broad]
+
+\defineenumeration
+ [topic]
+ [location=serried,
+ width=broad,
+ headstyle=,
+ headcolor=TheColor,
+ text=,
+ left={[},
+ right={]}]
+
+\setuphead
+ [section]
+ [style=\bfb,
+ color=TheColor]
+
+\setuplist
+ [section]
+ [alternative=c,
+ color=TheColor,
+ textcolor=black,
+ pagecolor=black]
+
+% whatever
+
+\setupsystem
+ [random=medium]
+
+\setupfloats
+ [ntop=100]
+
+\setupinteraction
+ [style=,
+ color=NopColor,
+ contrastcolor=NopColor]
+
+% tables and frames
+
+\setuptabulate
+ [rulethickness=.5pt,
+ rulecolor=AltColor]
+
+\setuptables
+ [rulethickness=.5pt,
+ rulecolor=AltColor]
+
+\setupframedtexts
+ [rulethickness=.5pt,
+ framecolor=TheColor,
+ width=\textwidth]
+
+% quick reference things
+
+\usemodule[set-11] \loadsetups
+
+\setupframedtexts
+ [setuptext]
+ [rulethickness=.5pt,
+ framecolor=AltColor]
+
+% titlepage
+
+\startsetups titlepage
+ \defineoverlay
+ [logo]
+ [\useMPgraphic{titlepage}{width=\overlaywidth,height=\overlayheight}]
+ \setupbackgrounds
+ [page]
+ [background=logo]
+ \startstandardmakeup
+ \dontcomplain
+ \BigFont
+ \setupinterlinespace
+ \vfill
+ \setupalign[left]
+ \let\\=\par
+ \dontleavehmode
+ \rotate
+ [rotation=90]
+ {\color
+ [lightgray]
+ {\getvariable{document}{title}}}
+ \par
+ \stopstandardmakeup
+ \setupbackgrounds
+ [page]
+ [background=]
+\stopsetups
+
+\startsetups colofon
+ \blank[2*big]
+ \testpage[3]
+ \startpacked
+ \getvariable{document}{author}\par
+ \getvariable{document}{affiliation}\par
+ \getvariable{document}{location}\par
+ \stoppacked
+\stopsetups
+
+\setupdocument
+ [title=No Title,
+ before=\setups{titlepage},
+ after=\setups{colofon}]
+
+% urls
+
+\useurl[gpl-simple] [http://creativecommons.org/licenses/GPL/2.0/]
+\useurl[gpl-legal] [http://creativecommons.org/licenses/GPL/2.0/legalcode]
+\useurl[bysa-simple][http://creativecommons.org/licenses/by-sa/4.0/]
+\useurl[bysa-legal] [http://creativecommons.org/licenses/by-sa/4.0/legalcode]
+
+\useurl[garden] [http://contextgarden.net]
+\useurl[install] [http://wiki.contextgarden.net/ConTeXt_Standalone]
+\useurl[texlive] [http://www.tug.org/texlive/]
+\useurl[group] [http://group.contextgarden.net]
+\useurl[list] [http://www.ntg.nl/mailman/listinfo/ntg-context]
+\useurl[development][http://www.ntg.nl/mailman/listinfo/dev-context]
+\useurl[announce] [http://www.ntg.nl/mailman/listinfo/ann-context]
+\useurl[collector] [http://tracker.luatex.org]
+\useurl[pragma] [http://www.pragma-ade.com]
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/readme/mreadme.tex b/doc/context/sources/general/manuals/readme/mreadme.tex
new file mode 100644
index 000000000..32c1684d9
--- /dev/null
+++ b/doc/context/sources/general/manuals/readme/mreadme.tex
@@ -0,0 +1,390 @@
+% interface=en engine=luatex language=uk
+
+% author : Hans Hagen
+% copyright : PRAGMA ADE & ConTeXt Development Team
+% license : Creative Commons Attribution ShareAlike 4.0 International
+% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
+% origin : the ConTeXt distribution
+%
+% comment : Because this manual is distributed with TeX distributions it comes with a rather
+% liberal license. We try to adapt these documents to upgrades in the (sub)systems
+% that they describe. Using parts of the content otherwise can therefore conflict
+% with existing functionality and we cannot be held responsible for that. Many of
+% the manuals contain characteristic graphics and personal notes or examples that
+% make no sense when used out-of-context.
+
+\environment mcommon
+
+% copied from cont-log: readme_logo
+
+\startuseMPgraphic{titlepage}{width,height}
+ numeric width ; width = \MPvar{width} ;
+ numeric height ; height = \MPvar{height} ;
+ numeric delta ; delta := width/10 ;
+ numeric circle ; circle := 2.5delta ;
+ color c ; c := (.2,.4,.6) ;
+ path p, q, r ;
+ p := unitsquare xscaled width yscaled height ;
+ z1 = (delta,height-2delta) ;
+ z2 = (width-delta,height-delta) ;
+ z3 = (width/2-delta,2delta+circle) ;
+ z4 = (x3,delta+circle/2) ;
+ q := z1 { dir -15 } .. z2 & z2 { dir -105 } .. z3 & z3 { dir 135 } .. z1 & cycle ;
+ r := fullcircle xscaled circle yscaled (.85circle) rotated 15 shifted z4 ;
+ pickup pencircle scaled (delta/1.5) ;
+ fill p withcolor .50c ;
+ fill q withcolor .75c ;
+ fill r withcolor .75c ;
+ draw p withcolor c ;
+ draw q withcolor c ;
+ pickup pencircle scaled (delta/2) ;
+ draw r withcolor c ;
+ setbounds currentpicture to p ;
+\stopuseMPgraphic
+
+\startdocument
+ [title={Read Me First},
+ author={Hans Hagen},
+ affiliation={PRAGMA ADE},
+ location={Hasselt NL}]
+
+\startsubject[title={Introduction}]
+
+What licence suits best for a \TEX\ like system is a matter of taste. Personally
+we dislike any licence that needs more than a few pages of dense legal code to
+get the message across. A \TEX\ related system like \CONTEXT\ is a hybrid of
+programs, scripts and|/|or macro code as well as documentation and sample code,
+including graphics. \TEX\ related systems also have a long standing tradition of
+providing support structures for users. In order to make support feasible, a
+\TEX\ based system like \CONTEXT\ assumes a certain logic and structure in the
+way the related files are named and organized in a tree structure. Even a small
+change in one of the elements may let such a system behave differently than
+manuals suggest. Swap a font, change some style defaults, leave out some pieces,
+and users may end up in confusion. A licence does not give a user any guarantees!
+
+In order to satisfy those responsible for distributing \CONTEXT, we need to
+choose a licence that makes them feel comfortable. Unfortunately we don't feel
+that comfortable with a licence that does not provide the guarantees that a
+system will not be adapted in such ways that the advertised behaviour changes. On
+the other hand, it is the responsibility of those distributing and extending the
+system to make sure that this does not happen. However, users should not
+automatically assume that what they get shipped is the same as the original,
+which is why we stress that support (from our side) will only be given on
+unaltered systems.
+
+First of all, what is \CONTEXT ? It's just a bunch of macros, written in \TEX\
+and \METAPOST, meant for typesetting documents. The macros are accompanied by
+some scripts, written in \PERL\ (mainly the older scripts) \RUBY\ (also older
+ones) and \LUA\ (the current fashion). The \CONTEXT\ distribution comes with a
+few fonts, files that help manage resources (e.g.\ map files needed for \MKII),
+as well as patterns (based on official ones, so this is a derived work).
+
+The \CONTEXT\ distribution is packaged in a zip file organized in the \TDS\
+structure.
+
+\starttabulate[|lT|p|]
+\NC \type {cont-tmf.zip} \NC the main distribution that has all relevant files \NC \NR
+\NC \type {cont-tst.7z} \NC a bunch of test files that can also serve as examples \NC \NR
+\NC \type {cont-mpd.zip} \NC a \METAPOST\ to \PDF\ converter (not needed in \CONTEXT) \NC \NR
+\NC \type {cont-ppc.zip} \NC a macro package for typesetting chemistry (not needed in \CONTEXT) \NC \NR
+\NC \type {cont-sci.zip} \NC configuration files for using \CONTEXT\ in the \SCITE\ editor \NC \NR
+\stoptabulate
+
+There are two flavours of \CONTEXT: \MKII\ and \MKIV. The first one is frozen and
+will not be extended. It runs on top of \PDFTEX\ or \XETEX. The \MKIV\ version is
+actively developed and runs on top of \LUATEX\ (an engine that is developed
+alongside \CONTEXT\ but that can also be used for other macro packages).
+
+The documentation can be downloaded from our website or the Wiki. Some manuals
+ship with source code. We might ship more source code but only when the source is
+stable and clean and can serve as an example.
+
+That said, what licence does apply? We need to distinguish between things that
+resemble a program on the one hand and documentation on the other hand. We
+(currently) use a different licence for either of them.
+
+\stopsubject
+
+\startsubject[title={The Code}]
+
+The program code (i.e. anything not under the \type {/doc} subtree) is
+distributed under the
+
+\startnarrower
+\goto{Creative Commons GNU GPL}[url(gpl-simple)]
+\stopnarrower
+
+For practical purposes distributers may also choose the \LATEX\ project licence,
+which is considered to be a bit more \TEX\ friendly. (BSD alike licences also
+apply well for \CONTEXT.)
+
+In practice, users may forget about the legal part, if only because I haven't
+even read (and understood) it completely myself, so let's stick to what Creative
+Commons makes of it:
+
+\startcolor[blue]
+The GNU General Public License is a Free Software license. Like any Free Software
+license, it grants to you the four following freedoms:
+
+\startitemize
+ \startitem
+ The freedom to run the program for any purpose.
+ \stopitem
+ \startitem
+ The freedom to study how the program works and adapt it to your needs.
+ \stopitem
+ \startitem
+ The freedom to redistribute copies so you can help your neighbour.
+ \stopitem
+ \startitem
+ The freedom to improve the program and release your improvements to the
+ public, so that the whole community benefits.
+ \stopitem
+\stopitemize
+
+You may exercise the freedoms specified here provided that you comply with the
+express conditions of this license. The principal conditions are:
+
+You must conspicuously and appropriately publish on each copy distributed an
+appropriate copyright notice and disclaimer of warranty and keep intact all the
+notices that refer to this License and to the absence of any warranty; and give
+any other recipients of the Program a copy of the GNU General Public License
+along with the Program. Any translation of the GNU General Public License must be
+accompanied by the GNU General Public License.
+
+If you modify your copy or copies of the program or any portion of it, or develop
+a program based upon it, you may distribute the resulting work provided you do so
+under the GNU General Public License. Any translation of the GNU General Public
+License must be accompanied by the GNU General Public License.
+
+If you copy or distribute the program, you must accompany it with the complete
+corresponding machine-readable source code or with a written offer, valid for at
+least three years, to furnish the complete corresponding machine-readable source
+code.
+
+Any of these conditions can be waived if you get permission from the copyright
+holder.
+
+Your fair use and other rights are in no way affected by the above.
+\stopcolor
+
+Many source filed mention the \quotation {\CONTEXT\ Development Team} as
+copyright holder. This is because over time users submit patches and whenever
+something happens to the main author, those involved in development can take
+over without the need to bother about derived work. In the end the \CONTEXT\
+group is the place to get more information.
+
+\stopsubject
+
+\startsubject[title={Recommendations}]
+
+Here are a few recommendations in case you want to distribute, extend of embed
+\CONTEXT\ in applications:
+
+\startitemize
+
+\startitem
+ You can best leave the code base untouched. Most of \CONTEXT\ provides hooks
+ and it's relatively easy to overload code. Leave the lower level system code
+ untouched: changes may backfire when you update. Asking for more hooks is the
+ best way to go.
+\stopitem
+
+\startitem
+ Put your own code in the right subpaths, i.e.\ modules approved by the
+ development team under \type {.../third}, and styles and whatever else under
+ \type {.../user}. This way your code will not interfere with existing code
+ and updating will give less problems. Keep in mind that \TEX\ systems have
+ their own way and order in locating files, and the load order often matters.
+\stopitem
+
+\startitem
+ Don't copy styles and change a few lines, but load the base one and
+ built|/|patch on top of that. In the end you may benefit from improvements to
+ the base style.
+\stopitem
+
+\startitem
+ Be original. The whole idea behind \CONTEXT\ is that you can write your own
+ styles. On the \CONTEXT\ mailing list as well as on the Wiki there are enough
+ advanced users to help you make a start.
+\stopitem
+
+\startitem
+ Don't hesitate to submit bugs reports and ask for extensions. It may even be
+ that what you want is already present but yet undocumented.
+\stopitem
+
+\startitem
+ If things don't work as expected, check to what extend your system matches
+ the (more or less) standard. We provide so called minimal \CONTEXT\ trees
+ that can serve as a reference. Because \CONTEXT\ evolves, make sure your
+ system is up to date. The \CONTEXT\ garden provides ways to install and
+ update the standard distribution.
+\stopitem
+
+\startitem
+ The scripts can best be called using \type {mtxrun}. This lessens dependencies
+ on the location in the tree and ensures upward compatibility. It also prevents
+ clashes with similar scripts.
+\stopitem
+
+\startitem
+ Some scripts depend on each other. Don't mess around with the existing
+ functionality and names of the scripts and then feed them back into the
+ standard distributions.
+\stopitem
+
+\stopitemize
+
+\stopsubject
+
+\startsubject[title={Documents}]
+
+The documentation is provided under another Creative Commons licence:
+
+\startnarrower
+ \goto{Attribution ShareAlike}[url(bysa-simple)]
+\stopnarrower
+
+The manuals that are distributed with \CONTEXT\ comes with a rather liberal
+license. However, we try to adapt these documents to upgrades in the (sub)systems
+that they describe and derived work can therefore conflict with existing
+functionality and we cannot be held responsible for that. Many of the manuals
+contain characteristic graphics and personal notes or examples that make no sense
+when used out|-|of|-|context.
+
+The mentioned license says:
+
+\startcolor[blue]
+You are free:
+
+\startitemize
+ \startitem to copy, distribute, display, and perform the work \stopitem
+ \startitem to make derivative works \stopitem
+\stopitemize
+
+{\sc Attribution:} You must attribute the work in the manner specified by the
+author or licensor.
+
+{\sc Share Alike:} If you alter, transform, or build upon this work, you may
+distribute the resulting work only under a license identical to this one.
+
+\startitemize
+ \startitem
+ For any reuse or distribution, you must make clear to others the license
+ terms of this work.
+ \stopitem
+ \startitem
+ Any of these conditions can be waived if you get permission from the
+ copyright holder.
+ \stopitem
+\stopitemize
+
+Your fair use and other rights are in no way affected by the above.
+\stopcolor
+
+If you distribute \CONTEXT\ and related software on electronic media as part of
+\TEX\ distributions (either or not for money), you may also distribute the
+manuals and their sources in electronic form, preferable as provided by the
+maintainers of \CONTEXT.
+
+Keep in mind that logos and cover designs are not meant to be copied. We provide
+the source code for some manuals, but we don't always provide all graphics and
+other resources. For instance, in some manuals we use commercial fonts and you
+have to buy those yourself.
+
+We provide the typeset manuals at our website. Those are the official ones. We
+appreciate it if you do not to distribute manuals compiled on your own system as
+substitutes. The manuals are a showcase for what \CONTEXT\ provides. Help us to
+assure the quality.
+
+\stopsubject
+
+\startsubject[title={More information}]
+
+We're not going to fill \mathematics{n}~pages with legal stuff, so if you want to
+know more, you have to consult the web for the legalities mentioned. Here are a
+few starting points:
+
+\startlines
+\goto{\url[gpl-simple]}[url(gpl-simple)]
+\goto{\url[gpl-legal]}[url(gpl-legal)]
+\stoplines
+
+\startlines
+\goto{\url[bysa-simple]}[url(bysa-simple)]
+\goto{\url[bysa-legal]}[url(bysa-legal)]
+\stoplines
+
+\CONTEXT\ itself can be fetched from the main site or the garden:
+
+\startlines
+\goto{\url[pragma]}[url(pragma)]
+\goto{\url[install]}[url(install)]
+\stoplines
+
+These always ship the latest versions. Alternatively you can install the whole
+\TEX\ distribution, which is a yearly snapshot:
+
+\startlines
+\goto{\url[texlive]}[url(texlive)]
+\stoplines
+
+A starting point for support can be found at:
+
+\startlines
+\goto{\url[list]}[url(list)]
+\goto{\url[garden]}[url(garden)]
+\stoplines
+
+And of course there is the \CONTEXT\ group:
+
+\startlines
+\goto{\url[group]}[url(group)]
+\stoplines
+
+Bugs and feature requests can be registered at the collector:
+
+\startlines
+\goto{\url[collector]}[url(collector)]
+\stoplines
+
+Releases are announced at:
+
+\startlines
+\goto{\url[announce]}[url(announce)]
+\stoplines
+
+The developers can be met at:
+
+\startlines
+\goto{\url[development]}[url(development)]
+\stoplines
+
+\stopsubject
+
+\startsubject[title={Disclaimer}]
+
+To play safe we include a disclaimer here, taken from the BSD style licence. For
+some reason such a text is always in unreadable capitals, so \unknown
+
+\start \txx \blue
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR \quotation {AS IS} AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\stop
+
+\unknown\ and don't bother discussing licence issues and related things with us
+for the mere sake of discussing licence stuff.
+
+\stopsubject
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/spacing/spacing-contents.tex b/doc/context/sources/general/manuals/spacing/spacing-contents.tex
new file mode 100644
index 000000000..d7c709e2e
--- /dev/null
+++ b/doc/context/sources/general/manuals/spacing/spacing-contents.tex
@@ -0,0 +1,9 @@
+\startcomponent spacing-contents
+
+\starttitle[title=Contents]
+
+\placelist[chapter,section]
+
+\stoptitle
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/spacing/spacing-introduction.tex b/doc/context/sources/general/manuals/spacing/spacing-introduction.tex
new file mode 100644
index 000000000..d4d385c5e
--- /dev/null
+++ b/doc/context/sources/general/manuals/spacing/spacing-introduction.tex
@@ -0,0 +1,19 @@
+\environment spacing-style
+
+\startcomponent spacing-introduction
+
+\startchapter[title=Introduction]
+
+ In this document I will collext some remarks about spacing (related) commands
+ but it will happen stepwise. Feel free to contribute.
+
+ \blank
+
+ \startlines
+ Hans Hagen
+ Hasselt NL
+ \stoplines
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/spacing/spacing-linecorrection.tex b/doc/context/sources/general/manuals/spacing/spacing-linecorrection.tex
new file mode 100644
index 000000000..c16afbf0a
--- /dev/null
+++ b/doc/context/sources/general/manuals/spacing/spacing-linecorrection.tex
@@ -0,0 +1,108 @@
+% language=uk
+
+\environment spacing-style
+
+\startcomponent spacing-linecorrection
+
+\startchapter[title=Line correction]
+
+\startbuffer[linecorrection]
+\typebuffer
+\blank
+\enabletrackers[linecorrection.boxes]
+\getbuffer
+\disabletrackers[linecorrection.boxes]
+\blank
+\stopbuffer
+
+We really do out best to make the spacing look as good as possible
+(or at least consistent) but sometimes \TEX\ needs a bit of help.
+An example of a helper is the following:
+
+\startbuffer
+\startlinecorrection
+ \input ward
+\stoplinecorrection
+\stopbuffer
+
+\getbuffer[linecorrection]
+
+When we use the same command with some left and/or right margins set, we get
+this:
+
+\startbuffer
+\startnarrower
+ \startlinecorrection
+ \input ward
+ \stoplinecorrection
+\stopnarrower
+\stopbuffer
+
+\getbuffer[linecorrection]
+
+Here we do obey the margins inside the correction box but the box itself is still
+as wide as the current width. A typical case where this happens is:
+
+\startbuffer
+\startitemize
+ \startitem an item:
+ \startlinecorrection
+ \input ward
+ \stoplinecorrection
+ \stopitem
+\stopitemize
+\stopbuffer
+
+\getbuffer[linecorrection]
+
+Here is a variant:
+
+\startbuffer
+\startitemize
+ \startitem a local linecorrection:
+ \startlocallinecorrection
+ \input ward
+ \stoplocallinecorrection
+ \stopitem
+\stopitemize
+\stopbuffer
+
+\getbuffer[linecorrection]
+
+Both types of correction wrap their content in a box and make sure that the
+spacing around it is visually as good as possible. The local variant uses a box
+fitting the available width taking margins into account and but resetting them
+inside the box. The normal variant applies the margins inside the box. Which one
+you use depends on the situation and content.
+
+You can pass an optional argument that indicates the amount of spacing to be
+added before and after the correction.
+
+\startbuffer
+\startlinecorrection[3*line]
+ \input ward
+\stoplinecorrection
+\stopbuffer
+
+\getbuffer[linecorrection]
+
+Normally you don't need this correction. It is mainly used for correcting spacing
+around boxed material, like \type {\framed}:
+
+\startbuffer
+before
+\startlinecorrection
+ \framed{something inbetween}
+\stoplinecorrection
+after
+\stopbuffer
+
+\getbuffer[linecorrection]
+
+Because in this document we have set the whitespace this also gets added around
+the box. So, in case your spacing around some special content looks bad, consider
+using these commands.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/spacing/spacing-mkiv.tex b/doc/context/sources/general/manuals/spacing/spacing-mkiv.tex
new file mode 100644
index 000000000..4261a3884
--- /dev/null
+++ b/doc/context/sources/general/manuals/spacing/spacing-mkiv.tex
@@ -0,0 +1,16 @@
+\environment spacing-style
+
+\startdocument
+
+ \component spacing-titlepage
+
+ \startfrontmatter
+ \component spacing-contents
+ \component spacing-introduction
+ \stopfrontmatter
+
+ \startbodymatter
+ \component spacing-linecorrection
+ \stopbodymatter
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/spacing/spacing-style.tex b/doc/context/sources/general/manuals/spacing/spacing-style.tex
new file mode 100644
index 000000000..cf0bae7bf
--- /dev/null
+++ b/doc/context/sources/general/manuals/spacing/spacing-style.tex
@@ -0,0 +1,55 @@
+\startenvironment spacing-style
+
+\setupbodyfont
+ [pagella]
+
+\setuplayout
+ [width=middle,
+ height=middle,
+ topspace=15mm,
+ header=15mm,
+ footer=0pt,
+ bottomspace=20mm]
+
+\setuppagenumbering
+ [alternative=doublesided]
+
+\setupwhitespace
+ [big]
+
+\definecolor
+ [blackcolor]
+ [r=0,b=0,g=0]
+
+\definecolor
+ [whitecolor]
+ [r=1,b=1,g=1]
+
+\definecolor
+ [maincolor]
+ [.25(blackcolor,green)]
+
+\definecolor
+ [extracolor]
+ [.25(whitecolor,green)]
+
+% \blackrule[color=maincolor,width=10cm,,height=10cm]
+% \blackrule[color=extracolor,width=10cm,,height=10cm]
+
+\setuptyping
+ [color=maincolor]
+
+\setuptype
+ [color=maincolor]
+
+\setuphead
+ [chapter]
+ [style=\bfd,
+ color=maincolor]
+
+\setuphead
+ [section]
+ [style=\bfc,
+ color=maincolor]
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/spacing/spacing-titlepage.tex b/doc/context/sources/general/manuals/spacing/spacing-titlepage.tex
new file mode 100644
index 000000000..1f21d769a
--- /dev/null
+++ b/doc/context/sources/general/manuals/spacing/spacing-titlepage.tex
@@ -0,0 +1,37 @@
+\environment spacing-style
+
+\startcomponent spacing-titlepage
+
+% This titlepage demonstrates once again how well designed the computer modern monospaced
+% font is, especially when we look at the consistent grayness.
+
+\startMPpage
+
+ fill Page enlarged 4mm withcolor \MPcolor{maincolor} ;
+
+ draw image (
+ for i=1 upto 20 :
+ draw bottomboundary Page shifted (0,100*log(i)) ;
+ endfor ;
+ )
+ xysized (PaperWidth-6mm,PaperHeight-6mm)
+ shifted (3mm,3mm)
+ withcolor \MPcolor{extracolor}
+ withpen pencircle scaled 1mm ;
+
+ numeric a ; a := log(1)*PaperHeight/(log(20)) ;
+ numeric b ; b := log(2)*PaperHeight/(log(20)) ;
+
+ picture p ; p := textext.lrt("\ttbf Spacing in Con\TeX t") xsized(.9PaperWidth) ;
+
+ draw p
+ shifted (.05PaperWidth,(b+a)/2 - ypart center p)
+ withcolor \MPcolor{extracolor} ;
+
+ setbounds currentpicture to Page ;
+
+\stopMPpage
+
+\page[right] \setuppagenumber[number=1]
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/sql/sql-mkiv.tex b/doc/context/sources/general/manuals/sql/sql-mkiv.tex
new file mode 100644
index 000000000..ec2c999aa
--- /dev/null
+++ b/doc/context/sources/general/manuals/sql/sql-mkiv.tex
@@ -0,0 +1,492 @@
+% language=uk
+
+% author : Hans Hagen
+% copyright : PRAGMA ADE & ConTeXt Development Team
+% license : Creative Commons Attribution ShareAlike 4.0 International
+% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
+% origin : the ConTeXt distribution
+%
+% comment : Because this manual is distributed with TeX distributions it comes with a rather
+% liberal license. We try to adapt these documents to upgrades in the (sub)systems
+% that they describe. Using parts of the content otherwise can therefore conflict
+% with existing functionality and we cannot be held responsible for that. Many of
+% the manuals contain characteristic graphics and personal notes or examples that
+% make no sense when used out-of-context.
+
+\usemodule[art-01,abr-02]
+
+\definecolor
+ [maincolor]
+ [r=.4]
+
+\setupbodyfont
+ [10pt]
+
+\setuptype
+ [color=maincolor]
+
+\setuptyping
+ [color=maincolor]
+
+\definefont
+ [TitlePageFont]
+ [file:lmmonolt10-bold.otf]
+
+\setuphead
+ [color=maincolor]
+
+\usesymbols
+ [cc]
+
+\setupinteraction
+ [hidden]
+
+\startdocument
+ [metadata:author=Hans Hagen,
+ metadata:title=SQL in ConTeXt,
+ author=Hans Hagen,
+ affiliation=PRAGMA ADE,
+ location=Hasselt NL,
+ title=SQL in \CONTEXT,
+ support=www.contextgarden.net,
+ website=www.pragma-ade.nl]
+
+\startMPpage
+
+ StartPage ;
+
+ numeric w ; w := bbwidth(Page) ;
+ numeric h ; h := bbheight(Page) ;
+
+ fill Page withcolor \MPcolor{maincolor} ;
+
+ draw textext.urt("\TitlePageFont Q") xysized (1.1 w,0.9 h) shifted (-.05w,.05h) withcolor .20white ;
+ draw textext.top("\TitlePageFont SQL") xysized (0.4725w,0.13h) shifted (.675w,.24w) withcolor .60white ;
+ draw textext.top("\TitlePageFont CONTEXT") xsized (0.6 w) shifted (.675w,.10w) withcolor .60white ;
+
+ StopPage ;
+
+\stopMPpage
+
+\startsubject[title=Contents]
+
+\placelist[section][alternative=a]
+
+\stopsubject
+
+\startsection[title=Introduction]
+
+Although \CONTEXT\ is a likely candidate for typesetting content that comes from
+databases it was only in 2011 that I ran into a project where a connection was
+needed. After all, much document related typesetting happens on files or
+dedicated storage systems.
+
+Because we run most projects in an infrastructure suitable for \TEX, it made
+sense to add some helper scripts to the \CONTEXT\ core distribution that deal
+with getting data from (in our case) \MYSQL\ databases. That way we can use the
+already stable infrastructure for installing and updating files that comes with
+\CONTEXT.
+
+As \LUA\ support is nicely integrated in \CONTEXT, and as dealing with
+information from databases involves some kind of programming anyway, there is (at
+least currently) no \TEX\ interface. The examples shown here work in \CONTEXT,
+but you need to keep in mind that \LUA\ scripts can also use this interface.
+
+{\em Although this code is under construction the interfaces are unlikely to
+change, if only because we use it on production.}
+
+\stopsection
+
+\startsection[title=Presets]
+
+In order to consult a database you need to provide credentials. You also need
+to reach the database server, either by using some client program or via a
+library. More about that later.
+
+Because we don't want to key in all that information again and again, we will
+collect it in a table. This also permits us to store it in a file and load it
+on demand. For instance:
+
+\starttyping
+local presets = {
+ database = "test",
+ username = "root",
+ password = "none",
+ host = "localhost",
+ port = 3306,
+}
+\stoptyping
+
+You can put a table in a file \type {presets.lua} like this:
+
+\starttyping
+return {
+ database = "test",
+ username = "root",
+ password = "none",
+ host = "localhost",
+ port = 3306,
+}
+\stoptyping
+
+and then load it as follows:
+
+\starttyping
+local presets = table.load("presets.lua")
+\stoptyping
+
+If you really want, you can use some library to open a connection, execute a
+query, collect results and close the connection, but here we use just one
+function that does it all. The presets are used to access the database and the
+same presets will be used more often it makes sense to keep a connection open as
+long as possible. That way you can execute much more queries per second,
+something that makes sense when there are many small ones, as in web related
+services. A connection is made persistent when the presets have an \type {id}
+key, like
+
+\starttyping
+presets.id = "myproject"
+\stoptyping
+
+\stopsection
+
+\startsection[title=Templates]
+
+A query often looks like this:
+
+\starttyping
+SELECT
+ `artist`, `title`
+FROM
+ `cd`
+WHERE
+ `artist` = 'archive' ;
+\stoptyping
+
+However, often you want to use the same query for multiple lookups, in which case
+you can do this:
+
+\starttyping
+SELECT
+ `artist`, `title`
+FROM
+ `cd`
+WHERE
+ `artist` = '%artist%' ;
+\stoptyping
+
+In the next section we will see how \type {%artist%} can be replaced by a more
+meaningful value. You can a percent sign by entering two in a row: \type {%%}.
+
+As with any programming language that deals with strings natively, you need a
+way to escape the characters that fence the string. In \SQL\ a field name is
+fenced by \type {``} and a string by \type {''}. Field names can often be
+used without \type {``} but you can better play safe.
+
+\starttyping
+`artist` = 'Chilly Gonzales'
+\stoptyping
+
+Escaping of the \type {'} is simple:
+
+\starttyping
+`artist` = 'Jasper van''t Hof'
+\stoptyping
+
+When you use templates you often pass a string as variable and you don't want to
+be bothered with escaping them. In the previous example we used:
+
+\starttyping
+`artist` = '%artist%'
+\stoptyping
+
+When you expect embedded quotes you can use this:
+
+\starttyping
+`artist` = '%[artist]%'
+\stoptyping
+
+In this case the variable {artist} will be escaped. When we reuse a template we
+store it in a variable:
+
+\starttyping
+local template = [[
+ SELECT
+ `artist`, `title`
+ FROM
+ `cd`
+ WHERE
+ `artist` = '%artist%' ;
+]]
+\stoptyping
+
+\stopsection
+
+\startsection[title=Queries]
+
+In order to execute a query you need to pass the previously discussed presets
+as well as the query itself.
+
+\starttyping
+local data, keys = utilities.sql.execute {
+ presets = presets,
+ template = template,
+ variables = {
+ artist = "Dream Theater",
+ },
+}
+\stoptyping
+
+The variables in the presets table can also be passed at the outer
+level. In fact there are three levels of inheritance: settings, presets
+and module defaults.
+
+\starttabulate
+\NC presets \NC a table with values \NC \NR
+\NC template \NC a query string \NC \NR
+\NC templatefile \NC a file containing a template \NC \NR
+\NC \em resultfile \NC a (temporary) file to store the result \NC \NR
+\NC \em queryfile \NC a (temporary) file to store a query \NC \NR
+\NC variables \NC variables that are subsituted in the template \NC \NR
+\NC username \NC used to connect to the database \NC \NR
+\NC password \NC used to connect to the database \NC \NR
+\NC host \NC the \quote {machine} where the database server runs on \NC \NR
+\NC port \NC the port where the database server listens to \NC \NR
+\NC database \NC the name of the database \NC \NR
+\stoptabulate
+
+The \type {resultfile} and \type {queryfile} parameters are used when a client
+approach is used. When a library is used all happens in memory.
+
+When the query succeeds two tables are returned: \type {data} and \type {keys}. The
+first is an indexed table where each entry is a hash. So, if we have only one
+match and that match has only one field, you get something like this:
+
+\starttyping
+data = {
+ {
+ key = "value"
+ }
+}
+
+keys = {
+ "key"
+}
+\stoptyping
+
+\stopsection
+
+\startsection[title=Converters]
+
+All values in the result are strings. Of course we could have provided some
+automatic type conversion but there are more basetypes in \MYSQL\ and some are
+not even standard \SQL. Instead the module provides a converter mechanism
+
+\starttyping
+local converter = utilities.sql.makeconverter {
+ { name = "id", type = "number" },
+ { name = "name", type = "string" },
+ { name = "enabled", type = "boolean" },
+}
+\stoptyping
+
+You can pass the converter to the execute function:
+
+\starttyping
+local data, keys = utilities.sql.execute {
+ presets = presets,
+ template = template,
+ converter = converter,
+ variables = {
+ name = "Hans Hagen",
+ },
+}
+\stoptyping
+
+In addition to numbers, strings and booleans you can also use a function
+or table:
+
+\starttyping
+local remap = {
+ ["1"] = "info"
+ ["2"] = "warning"
+ ["3"] = "debug"
+ ["4"] = "error"
+}
+
+local converter = utilities.sql.makeconverter {
+ { name = "id", type = "number" },
+ { name = "status", type = remap },
+}
+\stoptyping
+
+I use this module for managing \CONTEXT\ jobs in web services. In that case we
+need to store jobtickets and they have some common properties. The definition of
+the table looks as follows: \footnote {The tickets manager is part of the
+\CONTEXT\ distribution.}
+
+\starttyping
+CREATE TABLE IF NOT EXISTS %basename% (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `token` varchar(50) NOT NULL,
+ `subtoken` INT(11) NOT NULL,
+ `created` int(11) NOT NULL,
+ `accessed` int(11) NOT NULL,
+ `category` int(11) NOT NULL,
+ `status` int(11) NOT NULL,
+ `usertoken` varchar(50) NOT NULL,
+ `data` longtext NOT NULL,
+ `comment` longtext NOT NULL,
+
+ PRIMARY KEY (`id`),
+ UNIQUE INDEX `id_unique_index` (`id` ASC),
+ KEY `token_unique_key` (`token`)
+)
+DEFAULT CHARSET = utf8 ;
+\stoptyping
+
+We can register a ticket from (for instance) a web service and use an independent
+watchdog to consult the database for tickets that need to be processed. When the
+job is finished we register this in the database and the web service can poll for
+the status.
+
+It's easy to imagine more fields, for instance the way \CONTEXT\ is called, what
+files to use, what results to expect, what extra data to pass, like style
+directives, etc. Instead of putting that kind of information in fields we store
+them in a \LUA\ table, serialize that table, and put that in the data field.
+
+The other way around is that we take this data field and convert it back to \LUA.
+For this you can use a helper:
+
+\starttyping
+local results = utilities.sql.execute { ... }
+
+for i=1,#results do
+ local result = results[i]
+ result.data = utilities.sql.deserialize(result.data)
+end
+\stoptyping
+
+Much more efficient is to use a converter:
+
+\starttyping
+local converter = utilities.sql.makeconverter {
+ ...
+ { name = "data", type = "deserialize" },
+ ...
+}
+\stoptyping
+
+This way you don't need to loop over the result and deserialize each data
+field which not only takes less runtime (often neglectable) but also takes
+less (intermediate) memory. Of course in some cases it can make sense to
+postpone the deserialization.
+
+A variant is not to store a serialized data table, but to store a key|-|value
+list, like:
+
+\starttyping
+data = [[key_1="value_1" key_2="value_2"]]
+\stoptyping
+
+Such data fields can be converted with:
+
+\starttyping
+local converter = utilities.sql.makeconverter {
+ ...
+ { name = "data", type = utilities.parsers.keq_to_hash },
+ ...
+}
+\stoptyping
+
+You can imagine more converters like this, and if needed you can use them to
+preprocess data as well.
+
+\starttabulate[|Tl|p|]
+\NC "boolean" \NC This converts a string into the value \type {true} or \type {false}.
+ Valid values for \type {true} are: \type {1}, \type {true}, \type
+ {yes}, \type {on} and \type {t} \NC \NR
+\NC "number" \NC This one does a straightforward \type {tonumber} on the value. \NC \NR
+\NC function \NC The given function is applied to value. \NC \NR
+\NC table \NC The value is resolved via the given table. \NC \NR
+\NC "deserialize" \NC The value is deserialized into \LUA\ code. \NC \NR
+\NC "key" \NC The value is used as key which makes the result table is now hashed
+ instead of indexed. \NC \NR
+\NC "entry" \NC An entry is added with the given name and optionally with a default
+ value. \NC \NR
+\stoptabulate
+
+\stopsection
+
+\startsection[title=Typesetting]
+
+For good reason a \CONTEXT\ job often involves multiple passes. Although the
+database related code is quite efficient it can be considered a waste of time
+and bandwidth to fetch the data several times. For this reason there is
+another function:
+
+\starttyping
+local data, keys = utilities.sql.prepare {
+ tag = "table-1",
+ ...
+}
+
+-- do something useful with the result
+
+local data, keys = utilities.sql.prepare {
+ tag = "table-2",
+ ...
+}
+
+-- do something useful with the result
+\stoptyping
+
+The \type {prepare} alternative stores the result in a file and reuses
+it in successive runs.
+
+\stopsection
+
+\startsection[title=Methods]
+
+Currently we have several methods for accessing a database:
+
+\starttabulate
+\NC client \NC use the command line tool, pass arguments and use files \NC \NR
+\NC library \NC use the standard library (somewhat tricky in \LUATEX\ as we need to work around bugs) \NC \NR
+\NC lmxsql \NC use the library with a \LUA\ based pseudo client (stay in the \LUA\ domain) \NC \NR
+\NC swiglib \NC use the (still experimental) library that comes with \LUATEX \NC \NR
+\stoptabulate
+
+All methods use the same interface (\type {execute}) and hide the dirty details
+for the user. All return the data and keys tables and all take care of the proper
+escaping and parsing.
+
+\stopsection
+
+\startsection[title=Helpers]
+
+There are some helper functions and extra modules that will be described when
+they are stable.
+
+There is an \quote {extra} option to the \type {context} command that can be used
+to produce an overview of a database. You can get more information about this
+with the command:
+
+\starttyping
+context --extra=sql-tables --help
+\stoptyping
+
+\stopsection
+
+\startsection[title=Colofon]
+
+\starttabulate[|B|p|]
+\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR
+\NC version \NC \currentdate \NC \NR
+\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR
+\NC copyright \NC \symbol[cc][cc-by-sa-nc] \NC \NR
+\stoptabulate
+
+\stopsection
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/start/cont-en-extra.xml b/doc/context/sources/general/manuals/start/cont-en-extra.xml
new file mode 100644
index 000000000..4d41391d0
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/cont-en-extra.xml
@@ -0,0 +1,749 @@
+<?xml version="1.0"?>
+
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2004.11.17">
+
+<!--
+Todo:
+
+ -- bycd:section (\setuppagenumbering)
+ -- cd:sectionnumber (\setuppagenumbering)
+-->
+
+<cd:command name="textbackground" type="environment">
+ <cd:sequence>
+ <cd:string value="textbackground"/>
+ </cd:sequence>
+</cd:command>
+
+<cd:command name="textbackground">
+ <cd:sequence>
+ <cd:string value="textbackground"/>
+ </cd:sequence>
+</cd:command>
+
+<cd:command name="setuptextbackground" file="core-pgr.tex">
+ <cd:sequence>
+ <cd:string value="setuptextbackground"/>
+ </cd:sequence>
+ <cd:arguments>
+ <cd:assignments list="yes">
+ <cd:parameter name="leftoffset" default="0pt">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="rightoffset" default="0pt">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="topoffset" default="0pt">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="bottomoffset" default="0pt">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="before">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="after">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="state">
+ <cd:constant type="start" default="yes"/>
+ <cd:constant type="stop"/>
+ </cd:parameter>
+ <cd:parameter name="location">
+ <cd:constant type="text" default="yes"/>
+ <cd:constant type="paragraph"/>
+ <cd:constant type="none"/>
+ </cd:parameter>
+ <cd:parameter name="alternative">
+ <cd:constant type="0" default="yes"/>
+ <cd:constant type="1"/>
+ <cd:constant type="2"/>
+ </cd:parameter>
+ <cd:inherit name="setupframed"/>
+ </cd:assignments>
+ </cd:arguments>
+</cd:command>
+
+<cd:command name="defineinteractionmenu" variant="1" file="core-int.tex">
+ <cd:sequence>
+ <cd:string value="defineinteractionmenu"/>
+ </cd:sequence>
+ <cd:arguments>
+ <cd:keywords interactive="exclusive">
+ <cd:constant type="cd:name"/>
+ </cd:keywords>
+ <cd:keywords interactive="exclusive" list="yes">
+ <cd:constant type="left"/>
+ <cd:constant type="right"/>
+ <cd:constant type="top"/>
+ <cd:constant type="bottom"/>
+ <cd:constant type="cd:name"/>
+ </cd:keywords>
+ <cd:assignments optional="yes" list="yes">
+ <cd:parameter name="before">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="after">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="inbetween">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="left">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="right">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="middle">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="state">
+ <cd:constant type="start"/>
+ <cd:constant type="stop"/>
+ <cd:constant type="none"/>
+ <cd:constant type="local"/>
+ </cd:parameter>
+ <cd:parameter name="style">
+ <cd:resolve name="style"/>
+ </cd:parameter>
+ <cd:parameter name="color">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="distance">
+ <cd:constant type="overlay"/>
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="samepage">
+ <cd:constant type="yes"/>
+ <cd:constant type="empty"/>
+ <cd:constant type="no"/>
+ <cd:constant type="none"/>
+ </cd:parameter>
+ <cd:parameter name="unknownreference">
+ <cd:constant type="yes"/>
+ <cd:constant type="empty"/>
+ <cd:constant type="no"/>
+ <cd:constant type="none"/>
+ </cd:parameter>
+ <cd:parameter name="leftoffset">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="rightoffset">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="topoffset">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="bottomoffset">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="position">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ </cd:parameter>
+ <cd:inherit name="setupframed"/>
+ </cd:assignments>
+ </cd:arguments>
+</cd:command>
+
+<cd:command name="setupframed" file="core-rul.tex">
+ <!-- new: rulethickness -->
+ <cd:sequence>
+ <cd:string value="setupframed"/>
+ </cd:sequence>
+ <cd:arguments>
+ <cd:assignments list="yes">
+ <cd:parameter name="height">
+ <cd:constant type="fit"/>
+ <cd:constant type="broad"/>
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="width">
+ <cd:constant type="fit"/>
+ <cd:constant type="broad"/>
+ <cd:constant type="fixed"/>
+ <cd:constant type="local"/>
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="autowidth">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ <cd:constant type="force"/>
+ </cd:parameter>
+ <cd:parameter name="offset">
+ <cd:constant type="none"/>
+ <cd:constant type="overlay"/>
+ <cd:constant type="default"/>
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="location">
+ <cd:constant type="depth"/>
+ <cd:constant type="hanging"/>
+ <cd:constant type="high"/>
+ <cd:constant type="lohi"/>
+ <cd:constant type="low"/>
+ <cd:constant type="top"/>
+ <cd:constant type="middle"/>
+ <cd:constant type="bottom"/>
+ <cd:constant type="keep"/>
+ </cd:parameter>
+ <cd:parameter name="option">
+ <cd:constant type="none"/>
+ <cd:constant type="empty"/>
+ </cd:parameter>
+ <cd:parameter name="strut">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ <cd:constant type="global"/>
+ <cd:constant type="local"/>
+ </cd:parameter>
+ <cd:parameter name="align">
+ <cd:resolve name="align"/>
+ </cd:parameter>
+ <cd:parameter name="bottom">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="top">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="frame">
+ <cd:constant type="on"/>
+ <cd:constant type="off"/>
+ <cd:constant type="none"/>
+ <cd:constant type="overlay"/>
+ </cd:parameter>
+ <cd:parameter name="topframe">
+ <cd:constant type="on"/>
+ <cd:constant type="off"/>
+ </cd:parameter>
+ <cd:parameter name="bottomframe">
+ <cd:constant type="on"/>
+ <cd:constant type="off"/>
+ </cd:parameter>
+ <cd:parameter name="leftframe">
+ <cd:constant type="on"/>
+ <cd:constant type="off"/>
+ </cd:parameter>
+ <cd:parameter name="rightframe">
+ <cd:constant type="on"/>
+ <cd:constant type="off"/>
+ </cd:parameter>
+ <cd:parameter name="frameoffset">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="framedepth">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="framecorner">
+ <cd:constant type="round"/>
+ <cd:constant type="rectangular"/>
+ </cd:parameter>
+ <cd:parameter name="frameradius">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="framecolor">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="rulethickness">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="background">
+ <cd:constant type="screen"/>
+ <cd:constant type="color"/>
+ <cd:constant type="none"/>
+ <cd:constant type="foreground"/>
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="backgroundscreen">
+ <cd:constant type="cd:number"/>
+ </cd:parameter>
+ <cd:parameter name="backgroundcolor">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="backgroundoffset">
+ <cd:constant type="frame"/>
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="backgrounddepth">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="backgroundcorner">
+ <cd:constant type="round"/>
+ <cd:constant type="rectangular"/>
+ </cd:parameter>
+ <cd:parameter name="backgroundradius">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="depth">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="corner">
+ <cd:constant type="round"/>
+ <cd:constant type="rectangular"/>
+ </cd:parameter>
+ <cd:parameter name="radius">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="empty">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ </cd:parameter>
+ <cd:parameter name="foregroundcolor">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="foregroundstyle">
+ <cd:resolve name="style"/>
+ </cd:parameter>
+ </cd:assignments>
+ </cd:arguments>
+</cd:command>
+
+<cd:command name="namemakeup" type="environment" generated="yes">
+ <cd:sequence>
+ <cd:variable value="name"/>
+ <cd:string value="makeup"/>
+ </cd:sequence>
+ <cd:arguments>
+ <cd:assignments optional="yes" list="yes">
+ <cd:inherit name="startmakeup"/>
+ </cd:assignments>
+ </cd:arguments>
+</cd:command>
+
+<cd:command name="hiding" type="environment">
+ <cd:sequence>
+ <cd:string value="hiding"/>
+ </cd:sequence>
+ <cd:arguments>
+ </cd:arguments>
+</cd:command>
+
+<cd:command name="setupthinrules" file="core-rul.tex">
+ <cd:sequence>
+ <cd:string value="setupthinrules"/>
+ </cd:sequence>
+ <cd:arguments>
+ <cd:assignments>
+ <cd:parameter name="interlinespace">
+ <cd:constant type="small"/>
+ <cd:constant type="medium"/>
+ <cd:constant type="big"/>
+ </cd:parameter>
+ <cd:parameter name="n">
+ <cd:constant type="cd:number"/>
+ </cd:parameter>
+ <cd:parameter name="before">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="inbetween">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="after">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="color">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="backgroundcolor">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="height">
+ <cd:constant type="cd:dimension"/>
+ <cd:constant type="max"/>
+ </cd:parameter>
+ <cd:parameter name="depth">
+ <cd:constant type="cd:dimension"/>
+ <cd:constant type="max"/>
+ </cd:parameter>
+ <cd:parameter name="alternative">
+ <cd:constant type="a"/>
+ <!--<cd:constant type="b"/>-->
+ <cd:constant type="c"/>
+ <!--<cd:constant type="d"/>-->
+ </cd:parameter>
+ <cd:parameter name="rulethickness">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="color">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="background">
+ <cd:constant type="color"/>
+ <cd:constant type="none"/>
+ </cd:parameter>
+ <cd:parameter name="backgroundcolor">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ </cd:assignments>
+ </cd:arguments>
+</cd:command>
+
+<cd:command name="setupitemize" file="core-itm.tex">
+ <cd:sequence>
+ <cd:string value="setupitemize"/>
+ </cd:sequence>
+ <cd:arguments>
+ <cd:keywords optional="yes">
+ <cd:constant type="cd:number"/>
+ <cd:constant type="each"/>
+ </cd:keywords>
+ <cd:keywords optional="yes" list="yes">
+ <cd:constant type="standard" default="yes"/>
+ <cd:constant type="broad"/>
+ <cd:constant type="serried"/>
+ <cd:constant type="packed"/>
+ <cd:constant type="unpacked"/>
+ <cd:constant type="stopper"/>
+ <cd:constant type="joinedup"/>
+ <cd:constant type="atmargin"/>
+ <cd:constant type="inmargin"/>
+ <cd:constant type="autointro"/>
+ <cd:constant type="loose"/>
+ <cd:constant type="repeat"/>
+ <cd:constant type="cd:section"/>
+ <cd:constant type="paragraph"/>
+ <cd:constant type="intext"/>
+ <cd:constant type="random"/>
+ </cd:keywords>
+ <cd:assignments optional="yes" list="yes">
+ <cd:parameter name="margin">
+ <cd:constant type="no"/>
+ <cd:constant type="standard"/>
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="leftmargin">
+ <cd:constant type="no"/>
+ <cd:constant type="standard"/>
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="rightmargin">
+ <cd:constant type="no"/>
+ <cd:constant type="standard"/>
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="width">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="distance">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="factor">
+ <cd:constant type="cd:number"/>
+ </cd:parameter>
+ <cd:parameter name="items">
+ <cd:constant type="cd:number"/>
+ </cd:parameter>
+ <cd:parameter name="start">
+ <cd:constant type="cd:number"/>
+ </cd:parameter>
+ <cd:parameter name="before">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="inbetween">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="after">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="left">
+ <cd:constant type="cd:text"/>
+ </cd:parameter>
+ <cd:parameter name="right">
+ <cd:constant type="cd:text"/>
+ </cd:parameter>
+ <cd:parameter name="beforehead">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="afterhead">
+ <cd:constant type="cd:command"/>
+ </cd:parameter>
+ <cd:parameter name="headstyle">
+ <cd:resolve name="style"/>
+ </cd:parameter>
+ <cd:parameter name="marstyle">
+ <cd:resolve name="style"/>
+ </cd:parameter>
+ <cd:parameter name="symstyle">
+ <cd:resolve name="style"/>
+ </cd:parameter>
+ <cd:parameter name="stopper">
+ <cd:constant type="cd:text"/>
+ </cd:parameter>
+ <cd:parameter name="n">
+ <cd:constant type="cd:number"/>
+ </cd:parameter>
+ <cd:parameter name="symbol">
+ <cd:constant type="cd:number"/>
+ </cd:parameter>
+ <cd:parameter name="align">
+ <cd:resolve name="align"/>
+ </cd:parameter>
+ <cd:parameter name="indentnext">
+ <cd:resolve name="indentnext"/>
+ </cd:parameter>
+ </cd:assignments>
+ </cd:arguments>
+</cd:command>
+
+<cd:command name="itemize" type="environment" generated="yes">
+ <cd:sequence>
+ <cd:variable value="itemize"/>
+ </cd:sequence>
+ <cd:arguments>
+ <cd:keywords optional="yes" list="yes">
+ <cd:constant type="a"/>
+ <cd:constant type="A"/>
+ <cd:constant type="KA"/>
+ <cd:constant type="n"/>
+ <cd:constant type="N"/>
+ <cd:constant type="m"/>
+ <cd:constant type="r"/>
+ <cd:constant type="R"/>
+ <cd:constant type="KR"/>
+ <cd:constant type="cd:number"/>
+ <cd:constant type="continue"/>
+ <cd:constant type="standard" default="yes"/>
+ <cd:constant type="broad"/>
+ <cd:constant type="serried"/>
+ <cd:constant type="packed"/>
+ <cd:constant type="stopper"/>
+ <cd:constant type="joinedup"/>
+ <cd:constant type="atmargin"/>
+ <cd:constant type="inmargin"/>
+ <cd:constant type="intro"/>
+ <cd:constant type="columns"/>
+ <cd:constant type="text"/>
+ <cd:constant type="paragraph"/>
+ <cd:constant type="repeat"/>
+ </cd:keywords>
+ <cd:assignments optional="yes" list="yes">
+ <cd:inherit name="setupitemize"/>
+ </cd:assignments>
+ </cd:arguments>
+</cd:command>
+
+<cd:command name="framedtext" type="environment" generated="yes">
+ <cd:sequence>
+ <cd:variable value="framedtext"/>
+ </cd:sequence>
+ <cd:arguments>
+ <cd:keywords optional="yes">
+ <cd:constant type="left"/>
+ <cd:constant type="right"/>
+ <cd:constant type="middle"/>
+ <cd:constant type="none"/>
+ </cd:keywords>
+ <cd:assignments optional="yes" list="yes">
+ <cd:inherit name="setupframedtexts"/>
+ </cd:assignments>
+ <!-- new -->
+ <cd:content/>
+ <cd:content/>
+ </cd:arguments>
+</cd:command>
+
+<cd:command name="tabulate" type="environment" generated="yes">
+ <cd:sequence>
+ <cd:variable value="tabulate"/>
+ </cd:sequence>
+ <cd:arguments>
+ <cd:keywords optional="yes">
+ <cd:constant type="cd:text"/>
+ </cd:keywords>
+ <!-- change! -->
+ <cd:keywords>
+ <cd:constant type="cd:text"/>
+ </cd:keywords>
+ </cd:arguments>
+</cd:command>
+
+<cd:command name="setupcolors" file="colo-ini.tex">
+ <cd:sequence>
+ <cd:string value="setupcolors"/>
+ </cd:sequence>
+ <cd:arguments>
+ <cd:assignments list="yes">
+ <cd:parameter name="state">
+ <cd:constant type="start"/>
+ <!-- change! -->
+ <cd:constant type="stop" default="yes"/>
+ <cd:constant type="global"/>
+ <cd:constant type="local"/>
+ </cd:parameter>
+ <cd:parameter name="conversion">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ <cd:constant type="always"/>
+ </cd:parameter>
+ <cd:parameter name="reduction">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ </cd:parameter>
+ <cd:parameter name="rgb">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ </cd:parameter>
+ <cd:parameter name="cmyk">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ </cd:parameter>
+ <cd:parameter name="mpcmyk">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ </cd:parameter>
+ <cd:parameter name="mpspot">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ </cd:parameter>
+ <cd:parameter name="textcolor">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="split">
+ <cd:constant type="c"/>
+ <cd:constant type="m"/>
+ <cd:constant type="y"/>
+ <cd:constant type="k"/>
+ <cd:constant type="p"/>
+ <cd:constant type="s"/>
+ <cd:constant type="no"/>
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="criterium">
+ <cd:constant type="all"/>
+ <cd:constant type="none"/>
+ </cd:parameter>
+ </cd:assignments>
+ </cd:arguments>
+</cd:command>
+
+<cd:command name="setupinteraction" file="core-nav.tex">
+ <cd:sequence>
+ <cd:string value="setupinteraction"/>
+ </cd:sequence>
+ <cd:arguments>
+ <cd:assignments interactive="exclusive" list="yes">
+ <cd:parameter name="state">
+ <cd:constant type="start"/>
+ <!-- change! -->
+ <cd:constant type="stop" default="yes"/>
+ </cd:parameter>
+ <cd:parameter name="menu">
+ <cd:constant type="on"/>
+ <cd:constant type="off"/>
+ </cd:parameter>
+ <cd:parameter name="page">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ </cd:parameter>
+ <cd:parameter name="click">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ </cd:parameter>
+ <cd:parameter name="split">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ </cd:parameter>
+ <cd:parameter name="display">
+ <cd:constant type="new"/>
+ </cd:parameter>
+ <cd:parameter name="openaction">
+ <cd:constant type="cd:reference"/>
+ </cd:parameter>
+ <cd:parameter name="closeaction">
+ <cd:constant type="cd:reference"/>
+ </cd:parameter>
+ <cd:parameter name="openpageaction">
+ <cd:constant type="cd:reference"/>
+ </cd:parameter>
+ <cd:parameter name="closepageaction">
+ <cd:constant type="cd:reference"/>
+ </cd:parameter>
+ <cd:parameter name="calculate">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="strut">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ </cd:parameter>
+ <cd:parameter name="width">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="height">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="depth">
+ <cd:constant type="cd:dimension"/>
+ </cd:parameter>
+ <cd:parameter name="style">
+ <cd:resolve name="style"/>
+ </cd:parameter>
+ <cd:parameter name="color">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="contrastcolor">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="symbolset">
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ <cd:parameter name="title">
+ <cd:constant type="cd:text"/>
+ </cd:parameter>
+ <cd:parameter name="subtitle">
+ <cd:constant type="cd:text"/>
+ </cd:parameter>
+ <cd:parameter name="author">
+ <cd:constant type="cd:text"/>
+ </cd:parameter>
+ <cd:parameter name="date">
+ <cd:constant type="cd:text"/>
+ </cd:parameter>
+ <cd:parameter name="keyword">
+ <cd:constant type="cd:text"/>
+ </cd:parameter>
+ <!-- maybe this will move elsewhere -->
+ <cd:parameter name="fieldlayer">
+ <cd:constant type="auto"/>
+ <cd:constant type="cd:name"/>
+ </cd:parameter>
+ </cd:assignments>
+ </cd:arguments>
+</cd:command>
+
+<cd:define name="regime">
+ <cd:constant type="Latin1"/>
+ <cd:constant type="Latin2"/>
+ <cd:constant type="Latin7"/>
+ <cd:constant type="Latin15"/>
+ <cd:constant type="iso-8859-1"/>
+ <cd:constant type="iso-8859-2"/>
+ <cd:constant type="iso-8859-7"/>
+ <cd:constant type="iso-8859-15"/>
+ <cd:constant type="cp1250"/>
+ <cd:constant type="cp1251"/>
+ <cd:constant type="cp1252"/>
+ <cd:constant type="cp1253"/>
+ <cd:constant type="cp1254"/>
+ <cd:constant type="cp1257"/>
+ <cd:constant type="viscii"/>
+ <cd:constant type="cyr"/>
+ <cd:constant type="grk"/>
+ <cd:constant type="mac"/>
+ <cd:constant type="utf8"/>
+ <cd:constant type="unicode"/>
+</cd:define>
+
+<cd:command name="enableregime" file="regi-ini.tex">
+ <cd:sequence>
+ <cd:string value="enableregime"/>
+ </cd:sequence>
+ <cd:arguments>
+ <cd:keywords>
+ <cd:resolve name="regime"/>
+ </cd:keywords>
+ </cd:arguments>
+</cd:command>
+
+</cd:interface>
+
diff --git a/doc/context/sources/general/manuals/start/en/hasseltbook.bib b/doc/context/sources/general/manuals/start/en/hasseltbook.bib
new file mode 100644
index 000000000..ea7bbfd31
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/hasseltbook.bib
@@ -0,0 +1,7 @@
+@INBOOK{book01,
+ author = "Jonker, J.",
+ title = "From Hasselt to America",
+ publisher = "Bookplan Publishers",
+ year = "2012",
+ chapter = "1.2",
+}
diff --git a/doc/context/sources/general/manuals/start/en/hasseltbook.pdf b/doc/context/sources/general/manuals/start/en/hasseltbook.pdf
new file mode 100644
index 000000000..03c894ff4
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/hasseltbook.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/en/hasseltbook.tex b/doc/context/sources/general/manuals/start/en/hasseltbook.tex
new file mode 100644
index 000000000..9c0d319f5
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/hasseltbook.tex
@@ -0,0 +1,30 @@
+
+\starttext
+
+\startstandardmakeup
+ \midaligned{\tfd Festivities in Hasselt}
+\stopstandardmakeup
+
+\completecontent
+
+\startchapter[title=Introduction]
+ An introduction.
+\stopchapter
+
+\startchapter[title=Kingsday]
+ Something about the Kingsday in Hasselt.\index{Kingsday}
+\stopchapter
+
+\startchapter[title=Hassailt]
+ Something about Hassailt.\index{Hassailt}
+\stopchapter
+
+\startchapter[title=Euifeest,reference=euifeest]
+ Something about the Euifeest.\index{Euifeest}
+\stopchapter
+
+\completeindex
+
+\stoptext
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-alignments.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-alignments.tex
new file mode 100644
index 000000000..327bc8a6b
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-alignments.tex
@@ -0,0 +1,73 @@
+\startcomponent ma-cb-en-alignments
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Alignment]
+
+\index{alignment}
+
+\Command{\tex{setupalign}}
+\Command{\tex{setup tolerance}}
+\Command{\tex{rightaligned}}
+\Command{\tex{leftlines}}
+\Command{\tex{midaligned}}
+
+Horizontal and vertical alignment can be set up with:
+
+\shortsetup{setupalign}
+
+Single lines can be aligned with:
+
+\starttyping
+\rightaligned{}
+\leftaligned{}
+\midaligned{}
+\stoptyping
+
+An example can illustrate the alignment behavior:
+
+\startbuffer
+\leftaligned {Hasselt was built on a sandhill.}
+\midaligned {Hasselt was built on the crossing of two rivers.}
+\rightaligned {Hasselt's name stems from hazelwood.}
+\stopbuffer
+
+\typebuffer
+
+After processing this would look like:
+
+\getbuffer
+
+Alignment of a paragraph is done with:
+
+\shortsetup{startalignment}
+
+\startbuffer
+\startalignment[flushright,nothyphenated]
+ For Hasselt the 15th and 16th century were relatively unstable times.
+ There were uprises and disputes with neighbouring cities. To be
+ able to defend themselves the city council ordered a number of
+ arquebuses (very primitive firearms). Fourteen of these have survived
+ and now form one of the greatest arquebus collections in Europe.
+\stopalignment
+\stopbuffer
+
+\typebuffer
+
+This will become a rightaligned paragraph without hyphenations:
+
+\getbuffer
+
+In case of alignment you can specify a tolerance and the direction (vertical or
+horizontal). Normally the tolerance is \type{verystrict}. In colums you could
+specify \type{verytolerant}. The tolerance in this manual is:
+
+\starttyping
+\setuptolerance[horizontal,verystrict]
+\stoptyping
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-backpage.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-backpage.tex
new file mode 100644
index 000000000..bb7ae0250
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-backpage.tex
@@ -0,0 +1,40 @@
+\startcomponent ma-cb-en-backpage
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+This manual describes some features of \CONTEXT, a document
+production system, based on \TEX.
+
+\vfil
+
+\CONTEXT\ offers the user a flexible and high quality
+typesetting environment. No in||depth knowledge of \TEX\
+is needed. The parameter driven character of \CONTEXT\
+enables users to define their own layout rather easy.
+
+\vfil
+
+\CONTEXT\ is developed and tested in a production
+environment and is used for typesetting simple books as
+well as complex documents, paper and/or screen based. This
+introduction manual describes the functionality needed for
+everyday publications, like manuals and educational
+materials.
+
+\vfil
+
+This manual is also available as an interactive document, be
+it in a bit different layout. The macro package \CONTEXT,
+some more advanced examples and additional information can
+be found at www.pragma-ade.com.
+
+\vfil
+
+PRAGMA ADE \break
+Ridderstraat 27 \break
+8061 GH Hasselt NL \break
+www.pragma-ade.com
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-bibliography.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-bibliography.tex
new file mode 100644
index 000000000..1b8451934
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-bibliography.tex
@@ -0,0 +1,63 @@
+\startcomponent ma-cb-en-bibliography
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Bibliography]
+
+\index{bibliography}
+\index{\BIBTEX}
+
+\Command{\tex{setuppublications}}
+\Command{\tex{placepublications}}
+\Command{\tex{setupbibtex}}
+
+\CONTEXT\ support the \BIBTEX\ way of managing article and book references. The data
+is stored in a \type{.bib} file. A data entry in a \BIBTEX\ data file could be:
+
+\startbuffer
+@INBOOK{book01,
+ author = "Jonker, J.",
+ title = "From Hasselt to America",
+ publisher = "Bookplan Publishers",
+ year = "2012",
+ chapter = "1.2",
+}
+\stopbuffer
+
+\typebuffer
+
+After loading the database with \type{\setupbibtex[database=hasseltbook]} the following
+command is available:
+
+\setupbibtex[database={hasseltbook},sort=author]
+\setuppublications[refcommand=authoryear]
+
+\startbuffer
+Please refer to \cite[book01] for more information on famous people
+that were born in Hasselt.
+\stopbuffer
+
+\typebuffer
+
+Which would produce:
+
+\getbuffer
+
+In an appendix you can place the complete book list with:
+
+\startbuffer
+\placepublications[criterium=text]
+\stopbuffer
+
+\typebuffer
+
+At this moment (2013 -- 2014) the bibliography mechanism is being completely
+overhauled, so please visit the \goto {\CONTEXTWIKI} [ url
+(http://wiki.contextgarden.net) ] and the \goto {Pragma ADE website} [ url
+(http://www.pragma-ade.com/overview.htm) ] regularly for information.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-chemical.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-chemical.tex
new file mode 100644
index 000000000..3919ccb01
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-chemical.tex
@@ -0,0 +1,77 @@
+\startcomponent ma-cb-en-chemical
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Chemical stuf,reference=chemical]
+
+\index{chemistry}
+\index{chemical equitation}
+
+\Command{\tex{}chemical}
+
+Chemical structures may look very impressive.
+
+\startbuffer
+\startchemical[scale=small,width=fit,top=3000,bottom=3000]
+ \chemical[SIX,SB2356,DB14,Z2346,SR3,RZ3,SR6,-RZ6,+RZ6]
+ [C,N,C,C,H,H]
+ \chemical[PB:Z1,ONE,Z0,MOV8,Z0,SB24,DB7,Z27,PE][C,C,CH_3,O]
+ \chemical[PB:Z5,ONE,Z0,MOV6,Z0,SB24,DB7,Z47,PE][C,C,H_3C,O]
+ \chemical[SR24,RZ24][CH_3,H_3C]
+ \bottext{Compound A}
+\stopchemical
+\stopbuffer
+
+\placeformula[-]
+\startformula
+ \getbuffer
+\stopformula
+
+\CONTEXT\ relies on \METAPOST\ to draw these kind of chemical structures.
+Although these chemical structures are defined with only two or three commands,
+it takes some practice to get the right results. This is how the input looks:
+
+\typebuffer
+
+Chemical reactions can be typeset within a paragraph or as a display formula with
+the \type{\inlinechemical} and \type{\startchemicalformula} commands:
+
+\startbuffer
+\definefloat
+ [chemicalformula]
+ [chemicalformulas]
+
+One of the steps in the Hasselt canal water treatment is the removal of
+phosphate by means of a chemical reaction with iron:
+
+\placechemicalformula[none][]{}
+ {\startchemicalformula
+ \chemical{Fe(OH)_3}{iron hydroxide}
+ \chemical{PLUS}
+ \chemical{H_3PO_4}{phosphoric acid}
+ \chemical{GIVES}{\hphantom{whatever}}
+ \chemical{FePO_4}{iron phosphate}
+ \chemical{PLUS}
+ \chemical{H_2O}{water}
+ \stopchemicalformula}
+
+The \inlinechemical{FePO_4} is a solid and precipitates in water. It
+is filtered and re-used as a furtilizer resource.
+\stopbuffer
+
+\getbuffer
+
+This is defined by:
+
+\typebuffer
+
+The use of the chemical commands is described in the \goto{PPCHTeX Manual}[ url(manual:chemic) ]
+and the example manual \goto{Chemical Formulas in \CONTEXT} [ url(manual:chemic-ex) ].
+
+\stopchapter
+
+\stopcomponent
+
+
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-citations.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-citations.tex
new file mode 100644
index 000000000..b0e416ee0
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-citations.tex
@@ -0,0 +1,64 @@
+\startcomponent ma-cb-en-citations
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Citations and quotations, reference=quotations]
+
+\index{citation}
+\index{quote}
+
+\Command{\tex{quote}}
+
+The consistent use of quote and quotation marks in the running text is invoked by
+the use of \type{\quote} or \type{\quotation}. For longer text fragments you can use:
+
+\shortsetup{startquotation}
+
+\startbuffer
+In the book \quote{Hasselt, beelden van een middeleeuwse stad} it says:
+\startquotation
+Het stadhuis wordt voor het eerst vermeld in 1431. Oorspronkelijk
+is het een houten huis, dat wordt afgebroken om plaats te maken voor
+een nieuw stadhuis van steen. Dit wordt echter halverwege de 16e eeuw
+ook afgebroken en vervangen door een nog groter pand. Het nieuwe
+stadhuis wordt weer in dezelfde fraaie stijl opgebouwd. De bestuurders
+laten daarmee zien dat het is gebouwd in een tijd van grote welvaart.
+\stopquotation
+\stopbuffer
+
+\typebuffer
+
+In the example below you can see that quotation is language sensitive:
+
+\startbuffer
+\nl Hij zei tegen me: \quotation{In Hasselt noemen ze dat
+ \quote{noaberschop} of zoiets.}
+
+\en He told me: \quotation{In Hasselt they call this
+ \quote{noaberschop} or something like that.}
+
+\de Er sagte zu mir: \quotation{In Hasselt nennt man das
+ \quote{noaberschop} oder so etwas.}
+
+\fr Il a dit: \quotation{À Hasselt on c'appelle \quote{noaberschop}
+ ou quelque chose comme ça.}
+\stopbuffer
+
+\typebuffer
+
+Note the automatic change of the quotation marks in case of a quote within a
+quote.
+
+\startpacked
+\getbuffer
+\stoppacked
+
+You can alter the default settings with:
+
+\shortsetup{setuplanguage}
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-color.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-color.tex
new file mode 100644
index 000000000..1cfeadf9a
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-color.tex
@@ -0,0 +1,71 @@
+\startcomponent ma-cb-en-color
+
+\project ma-cb
+
+\startchapter[title=Color]
+
+\index{color}
+
+\Command{\tex{setupcolors}}
+\Command{\tex{color}}
+\Command{\tex{definecolor}}
+
+Text, frames or backgrounds can be set in color with:
+
+\shortsetup{color}
+
+Default the basic colors are available. Basic colors are for example
+red, white and blue. A color like orange can be defined with:
+
+\shortsetup{definecolor}
+
+You can define orange like this:
+
+\startbuffer[a]
+\definecolor [darkorange] [c=0.0,m=0.60,y=1.00,k=0.0]
+\definecolor [middleorange] [.5(darkorange)]
+\stopbuffer
+
+\typebuffer[a]
+
+\getbuffer[a]
+
+It is of good practice to check (combinations of) colors on a larger
+surface:
+
+\startbuffer
+\blackrule[width=\hsize,height=1cm,color=red,after=]
+\blackrule[width=\hsize,height=1cm,color=white,after=]
+\blackrule[width=\hsize,height=1cm,color=blue,after=]
+\blackrule[width=\hsize,height=1cm,color=darkorange]
+\stopbuffer
+
+\typebuffer
+
+so you can see if they fit together:
+
+\blank
+
+\getbuffer
+
+A color can be invoked in a number of ways:
+
+\startbuffer
+\startcolor[red]
+On {\darkorange Kingsday} {\blue Hasselt} turns into a
+\color[darkorange]{colorfull} city.
+\stopcolor
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+More information on the use of color models, transparency and palets can be found
+on the \goto {\CONTEXTWIKI} [ url (http://wiki.contextgarden.net/Color) ]
+and in the
+\goto {\em Color Separation} [ url (manual:color) ] manual.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-columns.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-columns.tex
new file mode 100644
index 000000000..06bb30259
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-columns.tex
@@ -0,0 +1,154 @@
+\startcomponent ma-cb-en-columns
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Columns]
+
+\index{columns}
+
+\Command{\tex{startcolums}}
+\Command{\tex{setupcolumns}}
+\Command{\tex{column}}
+
+Simple sections of text can be typeset in columns. If you preceed a text fragment
+by \type{\startcolumns} and close the text fragment by \type{\stopcolumns}
+everything in between will be set in columns.
+
+\shortsetup{startcolumns}
+
+Let's give an example:
+
+\startbuffer
+\startcolumns[n=3,tolerance=verytolerant]
+ Hasselt is an old Hanseatic City, situated 12~km north of Zwolle
+ at the river Zwartewater.
+
+ ...
+
+ Furthermore some events of special interest should be
+ mentioned. Every year at the end of August Hasselt celebrates
+ the \quote{Eui Festival} (hay festival).
+\stopcolumns
+\stopbuffer
+
+\typebuffer
+
+\startbuffer
+\hyphenation{Ste-pha-nus}
+\startcolumns[n=3,tolerance=verytolerant]
+Hasselt is an old Hanseatic City, situated 12~km north of Zwolle at
+the river Zwartewater.
+
+The city has a long history since obtaining the city charter around
+1252. Part and parcel of this history can be traced back to a large
+number of monuments to be admired in the city center.
+
+There you will find the St. Stephanus church, a late gothic church
+dating back to 1479 with a magnificent organ. The former Municipal
+Building is situated on The Market Place. Constituted between 1500
+and 1550 it houses a large collection of weapons, amongst which one
+of the largest collection of black powder guns (haakhussen) in the
+whole world should be mentioned.
+
+Furthermore there is a corn windmill \quote{The Swallow}, dating back to
+1748 as well as the \quote{Stenendijk}, a unique embankment and the last
+shell limekiln in Europe still in full operation.
+
+The city center with the townmoat adorned by lime-trees, the Van
+Stolkspark and the hustle and bustle at the docks are ideally suited
+for a stroll.
+
+The area around Hasselt is also worth mentioning. In wintertime
+polder Mastenbroek harbours large numbers of geese. In summertime the
+hamlets Gen\-ne, Streukel and Celle\-mui\-den form, together with the very
+rare lapwing flowers (Lat. Fritillaria meleagris) found on the banks
+of the river Zwatewater, the ideal surroundings for walking or
+cycling trips.
+
+Hasselt also is a very important center for watersports. The lakes of
+northwest Overijssel, the river IJssel, the Overijsselse Vecht and
+the Randmeren are within easy reach from the yacht harbour `De
+Molenwaard'. Sailing, fishing, swimming and ca\-noe\-ing can be fully
+enjoyed in Hasselt.
+
+Furthermore some events of special interest should be
+mentioned. Every year at the end of August Hasselt celebrates the
+\quote{Eui Festival} (hay festival).
+\stopcolumns
+\stopbuffer
+
+The result will be a three column text.
+
+\start
+\switchtobodyfont[9pt]
+\getbuffer
+\stop
+
+If possible a new column can be enforced with \type{\column}. You can set up
+columns with:
+
+\shortsetup{setupcolumns}
+
+In most cases you will obtain a better result by type setting the text on
+\quote{grid}. This is done by typing \type{grid=yes} in the command \type
+{\setuplayout}.
+
+If you want to use columns within a framed text \type{\start ... \stopframedtext}
+there is the simple column mechanism.
+
+\startbuffer
+\startframedtext[background=color,backgroundcolor=gray]
+\startsimplecolumns
+ In Hasselt's local newspaper there was a column on the
+ local customs during New Years Eve.
+ ...
+ \midaligned{\inlinechemical{CaC_2,+,2H_2O,GIVES,C_2H_2(g),+,Ca(OH)_2}}
+ ...
+ Nowadays the heavy metal lid of the milk can is replaced by
+ a football. This does not reduce the sound but it is much
+ saver.
+\stopsimplecolumns
+\stopbuffer
+
+\typebuffer
+
+\startbuffer
+\startframedtext[background=color,backgroundcolor=gray,width=\textwidth]
+\startsimplecolumns
+ In Hasselt's local newspaper there was a column on the
+ local customs during new years Eve. Next to the more
+ general custom of eating Dutch doughnuts (oliebollen)
+ and lighting fireworks there is the carbide shooting.
+ What you need is an oldfashioned metal milk can, carbide,
+ a little water and a lighter.
+
+ The carbide and water is mixed in the closed milk can and
+ will produce \inlinechemical{C_2H_2} gas (acetylene), via:
+
+ \midaligned{\inlinechemical{CaC_2,+,2H_2O,GIVES,C_2H_2 (g),+,Ca(OH)_2}}
+
+ The volatile acetylene gas in the milk can is ignited via a small
+ opening in the can. The result is a very loud detonation and the lid
+ flies off.
+
+ It will not surprise you that Hasselts youth has a designated
+ shooting ground for carbide shooting. Nowadays the heavy
+ metal lid of the milk can is replaced by a football. This
+ does not reduce the sound but it is much saver!
+\stopsimplecolumns
+\stopframedtext
+\stopbuffer
+
+This will result in:
+
+\getbuffer
+
+There is an advanced column mechanism available that is described in the
+\goto {\em Columns} [ url (manual:columns)
+] manual.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-commandlist.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-commandlist.tex
new file mode 100644
index 000000000..d14d9d202
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-commandlist.tex
@@ -0,0 +1,16 @@
+\startcomponent ma-cb-en-commandlist
+
+\project ma-cb
+
+Here we summarize the commands we introduced in the previous chapters. This is
+just a selection of the whole repertoire of \CONTEXT\ commands. Those who want to
+see them all can take a look at the more extensive manual or the {\em Quick
+Reference Manuals} that give a complete overview of all \CONTEXT||commands.
+
+Arguments that are typeset {\sl slanted} are optional and can be omited. The
+number points to the page where the command is explained. Black arrows indicate
+that the command is only of use in interactive documents and gray arrows tell us
+that additional functionality is provided in interactive mode. Keep in mind that
+we only show the commands we described in this manual, there are many more.
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-commands.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-commands.tex
new file mode 100644
index 000000000..df0d2a293
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-commands.tex
@@ -0,0 +1,94 @@
+\startcomponent ma-cb-en-commands
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Defining commands / macros]
+
+\CONTEXT\ is a set of macros based on \TEX. \TEX\ is a programming language as
+well as a typographical system. This means that you can do the programming
+yourself if you need that kind of flexability.
+
+You can define a new command with:
+
+\shortsetup{define}
+
+The next example will explain its meaning.
+
+You may have a well illustrated document and you are tired of typing:
+
+\startbuffer
+\placefigure
+ [here,force]
+ [fig:logical name]
+ {Caption.}
+ {\externalfigure[filename][width=5cm]}
+\stopbuffer
+
+\typebuffer
+
+You could define your own command with a few variables like:
+
+\startitemize[packed]
+\item logical name
+\item caption
+\item file name
+\stopitemize
+
+Your command definition and call could look something like
+this:
+
+\startbuffer
+\define[3]\myputfigure
+ {\placefigure
+ [here,force][fig:#1]
+ {#2}{\externalfigure[#3][width=5cm]}}
+
+\myputfigure{lion}{The Dutch lion is a sentry.}{ma-cb-13}
+\stopbuffer
+
+\typebuffer
+
+From then on the \type{\myputfigure} is available.
+Between brackets \type{[3]} indicates that you want to use three variables
+\type{#1}, \type{#2} and \type{#3}. In the command call \type{\myputfigure} you
+have to place these variables between curly braces. The result is shown in
+\in{figure}[fig:lion].
+
+\getbuffer
+
+Very sophisticated commands can be programmed, but this is left to your own
+inventiveness.
+
+In addition to defining commands you can also define \type{\start...\stop}
+command pairs.
+
+\shortsetup{definestartstop}
+
+For example:
+
+\startbuffer
+\definestartstop
+ [attention]
+ [before=\blank\startmarginrule,
+ after=\stopmarginrule\blank]
+
+\startattention
+{\em Hasselter Juffers} are sweet cookies but the name is no
+coincidence. On July 21 in 1233 the {\em Zwartewaterklooster}
+(Blackwater Monastery) was founded. The monastery was meant
+for unmarried girls and women belonging to the nobility of
+Hasselt. These girls and women were called {\em juffers}.
+\stopattention
+\stopbuffer
+
+\typebuffer
+
+This will result in:
+
+\getbuffer
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-composedcharacters.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-composedcharacters.tex
new file mode 100644
index 000000000..59c176004
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-composedcharacters.tex
@@ -0,0 +1,55 @@
+\startcomponent ma-cb-en-composedcharacters
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Composite characters]
+
+\index{accents}
+\index{foreign characters}
+
+In \in{chapter}[special chars] you have already seen that you have to type more
+than one token to obtain special characters like \# \$ \% \& \_ $\{$ and $\}$.
+
+Characters with accents for example can be composed or coded with specific
+\CONTEXT\ commands in order to display them on paper. In case you have a text
+editor that can display utf8 you can type the composed characters directly.
+
+It is not within the scope of this manual to go into accented characters in math
+mode. See the {\TEX Book} by Donald E. Knuth on that subject.
+
+\in{Table}[tab:composed-characters] shows a few examples and the way you can code
+composed characters.
+
+\placetable
+ [here,force]
+ [tab:composed-characters]
+ {Composed characters.}
+ {\starttable[|c|l|l|c|]
+ \HL
+ \NC \bf Character \NC \bf Composed \NC \bf \CONTEXT\ command \NC \bf UTF8 \NC\SR
+ \HL
+ \NC ü \NC \type{\"u} \NC \type{\uacute} \NC \type{ü} \NC\FR
+ \NC é \NC \type{\'e} \NC \type{\egrave} \NC \type{é} \NC\MR
+ \NC â \NC \type{\^a} \NC \type{\acircumflex} \NC \type{â} \NC\MR
+ \NC ä \NC \type{\"a} \NC \type{\aacute} \NC \type{ä} \NC\MR
+ \NC à \NC \type{\`a} \NC \type{\agrave} \NC \type{à} \NC\MR
+ \NC å \NC \type{\aa} \NC \type{\aring} \NC \type{å} \NC\MR
+ \NC ç \NC \type{\c{c}} \NC \type{\ccedilla} \NC \type{ç} \NC\MR
+ \NC ï \NC \type{\"{\i}} \NC \type{\idiaeresis} \NC \type{ï} \NC\MR
+ \NC î \NC \type{\^{\i}} \NC \type{\icircumflex} \NC \type{î} \NC\MR
+ \NC Ä \NC \type{\"A} \NC \type{\Adiaeresis} \NC \type{Ä} \NC\MR
+ \NC Å \NC \type{\AA} \NC \type{\Aring} \NC \type{Å} \NC\MR
+ \NC É \NC \type{\'E} \NC \type{\Egrave} \NC \type{É} \NC\MR
+ \NC æ \NC \type{\ae} \NC \type{\aeligature} \NC \type{æ} \NC\MR
+ \NC Æ \NC \type{\AE} \NC \type{\AEligature} \NC \type{Æ} \NC\MR
+ \NC ÿ \NC \type{\"y} \NC \type{\ydiaeresis} \NC \type{ÿ} \NC\LR
+ \HL
+ \stoptable}
+
+The character you want to display should be in the font.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-descriptions.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-descriptions.tex
new file mode 100644
index 000000000..01c8fb608
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-descriptions.tex
@@ -0,0 +1,94 @@
+\startcomponent ma-cb-en-descriptions
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Definitions]
+
+\index{definition}
+
+\Command{\tex{definedescription}}
+\Command{\tex{setupdescriptions}}
+
+If you want to display notions, concepts and ideas in a consistent manner you can
+use:
+
+\shortsetup{definedescription}
+
+For example:
+
+\startbuffer
+\definedescription
+ [concept]
+ [alternative=serried,headstyle=bold,width=broad]
+
+\concept{Hasselter juffer} A sort of biscuit made of puff pastry and
+covered with sugar. It tastes very sweet. \par
+\stopbuffer
+
+\typebuffer
+
+It would look like this:
+
+\getbuffer
+
+But you can also choose other layouts:
+
+\startbuffer
+\definedescription
+ [concept]
+ [alternative=top,
+ inbetween={\blank[none]},
+ headstyle=bold,
+ width=broad,
+ style=slanted]
+
+\concept{Hasselter bitter} A very strong alcoholic drink (up to 40\%)
+mixed with herbs to give it a special taste. It is sold in a stone
+flask and it should be served {\em ijskoud} (as cold as ice). \par
+
+\definedescription
+ [concept]
+ [alternative=inmargin,headstyle=bold,width=broad]
+
+\concept{Euifeest} A harvest home to celebrate the end of a period of
+hard work. The festivities take place in the last week of August. \par
+\stopbuffer
+
+\start
+\getbuffer
+\stop
+
+If you want to avoid the \type{\par} or when you have more than one paragraph in
+the definition you can use the \type{\start...\stop} construct.
+
+\startbuffer
+\definedescription
+ [concept]
+ [alternative=right,
+ headstyle=bold,
+ width=broad]
+
+\startconcept{Euifeest} A harvest home to celebrate the end of a
+period of hard work.
+This event takes place at the end of August and lasts one week. The
+city is completely illuminated and the streets are decorated. This
+feast week ends with a {\em Braderie}.
+\stopconcept
+\stopbuffer
+
+\typebuffer
+
+This would become:
+
+\getbuffer
+
+Layout is set up within the second bracket pair of
+\type{\definedescription[][]}. But you can also use:
+
+\shortsetup{setupdescriptions}
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-document.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-document.tex
new file mode 100644
index 000000000..94fdb7ea2
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-document.tex
@@ -0,0 +1,117 @@
+\startcomponent ma-cb-en-document
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=How to create a textbook]
+
+\index{input file}
+
+Let's assume you want to create a simple textbook. It has some structure and
+contains a title page, a few chapters, sections and sub sections. Of course there
+is a table of contents.
+
+\CONTEXT\ can create such a document automatically if you offer the right input
+by means of a file. So first you have to create an input file. An input file
+consists of a name and an extension. You can choose any name you want but the
+extension has to be \type{.tex}. If you create a file with the name
+\type{mybook.tex} you will find no difficulties in running \CONTEXT.
+
+An \pagereference[inputfile] input file could look like this:
+
+\startbuffer
+\starttext
+
+\startstandardmakeup
+ \midaligned{From Hasselt to America}
+ \midaligned{by}
+ \midaligned{J. Jonker and C. van Marle}
+\stopstandardmakeup
+
+\placecombinedlist[content]
+
+\chapter{Introduction}
+
+... ties between Hasselt and America ...
+
+\chapter[rensselaer]{The Rensselaer family}
+
+\section{The first born}
+
+... was born in the year ...
+
+\section{The early years}
+
+... in those days Hasselt was ...
+
+\section{Living and workin in America}
+
+... life in America was ...
+
+\chapter[lansing]{The Lansing family}
+
+... the Lansing family was also ...
+
+\chapter[cuyler]{The Cuyler family}
+
+... much later Tydeman Cuyler ...
+
+\stoptext
+\stopbuffer
+
+{\switchtobodyfont[9pt]\typebuffer}
+
+\CONTEXT\ expects a plain \ASCII\ input file. Of course you can use any
+text|-|editor, as long as you save the file as standard \ASCII\ (also called txt
+file) with the extension \type{.tex}. Note that spaces in the filename are
+not allowed.
+
+The input file contains the text you want to typeset and the \CONTEXT\ commands.
+A \CONTEXT\ command begins with a backslash~\tex{}. With the command
+\type{\starttext} you indicate the beginning of your text.
+
+A command is sometimes followed by an argument which is enclosed by curly braces
+\type{{}}. The command \type{\chapter[cuyler]{The Cuyler family}} that you see in
+the example will have its effect on {\em The Cuyler family}. Its actions will
+have effect on the design, typography and structure. The actions may be:
+
+\startitemize[n,packed]
+\item start a new page
+\item increase chapter number by one
+\item place chapter number in front of chapter title
+\item reserve some vertical space
+\item use a big font
+\item put chapter title (and page number) in the table of contents
+\stopitemize
+
+Other actions concerning running heads, number resetting and interactivity are
+disregarded at this moment.
+
+Sometimes you will see two brackets (\type{[]}) directly after the command. These
+brackets are used to feed specific options to the command. Further on in this
+manual you will get more information on these brackets.
+
+The commands in your input file can have the following appearance:
+
+\starttabulate[|||]
+\HL
+\NC \bf Appearance of command \NC \bf Example \NC\NR
+\HL
+\NC \type{\startcommand ... \stopcommand} \NC \type{\starttext ... \stoptext} \NC\NR
+\NC \type{\startcommand[] ... \stopcommand} \NC \type{\startitemize[packed] ... \stopitemize} \NC\NR
+\NC \type{\command} \NC \type{\item} \NC\NR
+\NC \type{\command[]} \NC \type{\in[cuyler]} \NC\NR
+\NC \type{\command{}[]} \NC \type{\at{page}[cuyler]} \NC\NR
+\NC \type{\command{}} \NC \type{\index{America}} \NC\NR
+\NC \type{\command[]{}} \NC \type{\chapter[cuyler]{The Cuyler family}} \NC\NR
+\HL
+\stoptabulate
+
+If you have \CONTEXT\ process the above example file, you would obtain a very
+simple document with a title page, a few numbered chapters and section headers
+and a table of content (because of \type{\placecombinedlist[content]}).
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-enumerations.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-enumerations.tex
new file mode 100644
index 000000000..6f2fa5f22
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-enumerations.tex
@@ -0,0 +1,106 @@
+\startcomponent ma-cb-en-enumerations
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Numbered definitions]
+
+\index{numbered definition}
+
+\Command{\tex{defineenumeration}}
+\Command{\tex{setupenumerations}}
+
+With \type{\defineenumeration} you can number text elements like remarks or
+questions. If you want to make numbered remarks in your document you use:
+
+\shortsetup{defineenumeration}
+
+For example:
+
+\startbuffer[a]
+\defineenumeration
+ [remark]
+ [alternative=top,
+ text=Remark,
+ inbetween={\blank[none]},
+ after=\blank]
+\stopbuffer
+
+\typebuffer[a]
+
+Now the new commands \type{\remark}, \type{\subremark}, \type{\resetremark} and
+\type{\nextremark} are available and you can type remarks like this:
+
+\startbuffer[b]
+\remark In the early medieval times Hasselt was a place of
+pilgrimage. The {\em Heilige Stede} (Holy Place) was torn down during
+the Reformation. In 1930, after 300 years, the {\em Heilige Stede} was
+reopened.
+
+\subremark Nowadays the {\em Heilige Stede} is closed again but once
+a year an open air service is held on the same spot. \par
+\stopbuffer
+
+\typebuffer[b]
+
+This becomes:
+
+\start
+\getbuffer[a]\getbuffer[b]
+\stop
+
+You can reset numbering with \type{\resetremark} or \type{\resetsubremark} or
+increment a number with \type{\nextremark} or \type{\nextsubremark}. This is
+normally done automatically per chapter, section or whatever.
+
+You can set up the layout of \type{\defineenumeration} with:
+
+\shortsetup{setupenumerations}
+
+You can also vary the layout of \type{remark} and \type{subremark} in the example
+above with:
+
+\starttyping
+\setupenumeration[remark][headstyle=bold]
+\setupenumeration[subremark][headstyle=slanted]
+\stoptyping
+
+If a number becomes obsolete you can type:
+
+\starttyping
+\remark[-]
+\stoptyping
+
+If the \type{remark} contains several paragraphs you should use the command
+pair \type{\start ... \stopremark} that becomes available after defining
+\type{remark} with \type{\defineenumeration[remark]}.
+
+\startbuffer[c]
+\setupenumeration
+ [remark]
+ [alternative=hanging,
+ width=broad]
+
+\startremark
+In the early medieval times Hasselt was a place of pilgrimage. The
+{\em Heilige Stede} (Holy Place) was torn down during the
+Reformation.
+
+After 300 years in 1930 the {\em Heilige Stede} was reopened.
+Nowadays the {\em Heilige Stede} is closed again but once a year an
+open air service is held on the same spot.
+\stopremark
+\stopbuffer
+
+\typebuffer[c]
+
+So the example above would look like this:
+
+\start
+\getbuffer[a]\getbuffer[c] \par
+\stop
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-errors.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-errors.tex
new file mode 100644
index 000000000..229cb66bc
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-errors.tex
@@ -0,0 +1,79 @@
+\startcomponent ma-cb-en-errors
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=trouble,title=Problems during processing]
+
+\index{errors}
+\index{problems}
+
+If processing is not succesful ---for example because you typed \type{\stptext}
+instead of \type{\stoptext}--- \CONTEXT\ produces a \type{ ? } on your screen
+and tells you it has just processed an error. It will give you some basic
+information on the type of error and the line number where the error becomes
+effective.
+
+At the instant of \type{ ? } you can type:
+
+\starttabulate[|||]
+\NC \type{H} \NC for help information on your error \NC\NR
+\NC \type{I} \NC for inserting the correct \CONTEXT\ command \NC\NR
+\NC \type{Q} \NC for quiting and entering batch mode \NC\NR
+\NC \type{X} \NC for exiting the running mode \NC\NR
+\NC \Enter \NC for ignoring the error \NC\NR
+\stoptabulate
+
+Most of the time you will type \Enter\ and processing will continue. Then you can
+edit the input file and fix the error.
+
+Some errors will produce a~\type{ * } on your screen and processing will stop.
+This error is due to a fatal error in your input file. You can't ignore this
+error and the only option you have is to type \type{\stop} or {\sc Ctrl}~Z. The
+program will be halted and you can fix the error in your text editor.
+
+\startframedtext[width=\hsize]
+A well known error is:
+
+\starttyping
+! I can't write on file 'myfile.pdf'.
+Please type another filename for output:
+\stoptyping
+
+This error is due to the fact that the file \type{myfile.pdf} is stil open
+in \READER.
+
+\blank
+
+The best way to proceed is:
+
+\startitemize[packed]
+\item close the file in \READER
+\item type \Enter\ at the console
+\stopitemize
+\stopframedtext
+
+Sometimes the error messages are very obscure. Finding the location of the error
+in an extensive document can then be a tedious job. You could try to isolate
+the error:
+
+\startitemize[packed]
+\item open the file in your text editor
+\item save a copy of your file (to be on the safe side)
+\item isolate the error
+ \startitemize[n,packed]
+ \item place a \type{\stoptext} command higher up in your text
+ \item process the file
+ \item repeat step 1 and 2 until the file processes correctly
+ \stopitemize
+\item study the content that produces the error
+\item fix the error
+\item place the \type{\stoptext} command after the corrected error
+\item process your file
+\item etc.
+\stopitemize
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-figures.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-figures.tex
new file mode 100644
index 000000000..90f249359
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-figures.tex
@@ -0,0 +1,258 @@
+\startcomponent ma-cb-en-figures
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=figures,title=Figures]
+
+\index{figure}
+\seeindex{picture}{figure}
+\index{floating blocks}
+
+\Command{\tex{placefigure}}
+\Command{\tex{startfiguretext}}
+\Command{\tex{setupfigures}}
+\Command{\tex{startcombination}}
+\Command{\tex{setupfloats}}
+\Command{\tex{setupcaptions}}
+\Command{\tex{externalfigure}}
+
+Images can be placed in your document with the command \type{\externalfigure}.
+
+\startbuffer
+\externalfigure
+ [cow.pdf]
+ [width=.1\textwidth,
+ frame=on,
+ framecolor=gray,
+ frameoffset=3pt,
+ rulethickness=3pt,
+ framecorner=round]
+\stopbuffer
+
+\typebuffer
+
+Such an image will be placed on the location where you defined it \space \getbuffer
+\space and can have some strange effects on the surrounding white space. By the way,
+the cow image is always available for \CONTEXT\ users which is very convenient when
+you are testing the figure related commands.
+
+You can use the command \type{\placefigure} to influence the positioning of
+images in your document.
+
+\startbuffer
+\placefigure
+ [][fig:church]
+ {Stephanus Church.}
+ {\externalfigure[ma-cb-24][width=.4\textwidth]}
+\stopbuffer
+
+\typebuffer
+
+After processing this will come out as \in{figure}[fig:church] at the first
+available location.
+
+\getbuffer
+
+The command \type{\placefigure} handles numbering and vertical spacing before and
+after your figure. Furthermore this command initializes a float mechanism, which
+means that \CONTEXT\ looks whether there is enough space for your figure on the
+page. If not, the figure will be placed at another location and the text carries
+on, while the figure floats in your document until the optimal location is found.
+You can influence this mechanism within the first bracket
+pair.
+
+The command \type{\placefigure} is a predefined example of:
+
+\shortsetup{placefloat}
+
+A number of basic options is described in \in{table}[tab:placefigure].
+
+\placetable
+ [here]
+ [tab:placefigure]
+ {Options in \type{\placefigure}.}
+\starttable[|l|l|]
+\HL
+\NC \bf Option \NC \bf Meaning \NC\SR
+\HL
+\NC here \NC put figure at this location if possible \NC\FR
+\NC force \NC force figure placement here \NC\MR
+\NC page \NC put figure on its own page \NC\MR
+\NC top \NC put the figure at the top of the page \NC\MR
+\NC bottom \NC put the figure at the botom of the page \NC\MR
+\NC left \NC place figure at the left margin \NC\MR
+\NC right \NC place figure at the right margin \NC\MR
+\NC margin \NC place figure in the margin \NC\MR
+\NC none \NC set no caption \NC\LR
+\HL
+\stoptable
+
+The second bracket pair is used for cross-referencing. You can refer to this
+particular figure by typing:
+
+\starttyping
+\in{figure}[fig:church]
+\stoptyping
+
+The first brace pair is used for the caption. You can type any text you want. The
+figure labels are set up with \type{\setupcaptions} and the numbering is (re)set
+by \type{\setupnumbering} (see \in{paragraph}[floatingblocks]).
+
+The second brace pair is used for defining the figure and addressing the file
+names of external figures.
+
+In the next example you see how \inframed{Hasselt} is defined within
+the last brace pair to show you the function of \type{\placefigure{}{}}.
+
+\startbuffer
+\placefigure
+ {The boundaries of Hasselt.}
+ {\framed{\tfd Hasselt}}
+\stopbuffer
+
+\typebuffer
+
+This will produce:
+
+\getbuffer
+
+However, your images are often created using programs like Illustrator and photos
+are --- after scanning --- improved in packages like PhotoShop. Then the images
+are available as files. \CONTEXT\ supports image file types like \type {JPG},
+\type {PNG} and (pages from) \type {PDF} files as well as \METAPOST\ output
+(\type {MPS} files). Users normally can trust \CONTEXT\ to find the best possible
+file type.
+
+In \in{figure}[fig:canals] you see a photo and a graphic combined into one
+figure.
+
+\startbuffer
+\placefigure
+ [here,force]
+ [fig:canals]
+ {The Hasselt Canals.}
+ {\startcombination[2*1]
+ {\externalfigure[ma-cb-03][width=.4\textwidth]}{a bitmap picture}
+ {\externalfigure[ma-cb-00][width=.4\textwidth]}{a vector graphic}
+ \stopcombination}
+\stopbuffer
+
+\getbuffer
+
+You can produce this figure by typing something like:
+
+\typebuffer
+
+In this figure two pictures are combined with:
+
+\shortsetup{startcombination}
+
+The \type{\start ...\stopcombination} pair is used for
+combining two pictures in one figure. You can type the number of pictures within
+the bracket pair. If you want to display one picture below the other you would
+have typed \type{[1*2]}. You can imagine what happens when you combine 6~pictures
+as \type{[3*2]} (\type{[rows*columns]}).
+
+The examples shown above are enough for creating illustrated documents. Sometimes
+however you want a more integrated layout of the picture and the text. For that
+purpose you can use \type{\start ...\stopfiguretext} command pair.
+
+\startbuffer
+\startfiguretext
+ [left,none]
+ [fig:citizens]
+ {}
+ {\externalfigure[ma-cb-18][width=.5\makeupwidth]}
+ Hasselt has always had a varying number of citizens due to
+ economic events. For example the Dedemsvaart was dug around
+ 1810. This canal runs through Hasselt and therefore trade
+ flourished. This led to a population growth of almost 40\%
+ within 10~years. Nowadays the Dedemsvaart has no commercial
+ value anymore and the canals have become a tourist
+ attraction. But reminders of these prosperous times can be
+ found everywhere.
+\stopfiguretext
+\stopbuffer
+
+The effect of:
+
+\typebuffer
+
+is shown in the figure below.
+
+\start
+\setuptolerance[verytolerant]
+\getbuffer
+\stop
+
+
+\startbuffer[marginpicture]
+\inmargin
+ {\externalfigure
+ [ma-cb-23]
+ [width=.7\marginwidth]}
+\stopbuffer
+
+As you have seen you in the examples above you can summon a figure with the
+command:
+
+\shortsetup{externalfigure}
+
+The command \type{\externalfigure} has two bracket pairs. The first is used for
+the exact file name without extension, the second for file formats and
+dimensions. It is not difficult to guess what happens if you
+type:\getbuffer[marginpicture]
+
+\typebuffer[marginpicture]
+
+You can set up the layout of figures with:
+
+\shortsetup{setupfloats}
+
+You can set up the numbering and the labels with:
+
+\shortsetup{setupcaptions}
+
+\startbuffer[figuresetups]
+\setupfloat
+ [figure]
+ [default=right,
+ spacebefore=none]
+
+\setupcaptions
+ [location=bottom,
+ style=boldslanted]
+\stopbuffer
+
+\startbuffer[figuredefinition]
+\placefigure
+ {A characteristic view on Hasselt.}
+ {\externalfigure[ma-cb-12][width=6cm]}
+\stopbuffer
+
+\start
+\getbuffer[figuresetups]
+\getbuffer[figuredefinition]
+\stop
+
+These commands are typed in the set up area of your input file and have a global
+effect on all floating blocks.
+
+\typebuffer[figuresetups,figuredefinition]
+
+For figure management there are commands like \crlf
+\type{\setupexternalfigure}.
+
+Please refer to the \goto {\CONTEXTWIKI} [
+url(http://wiki.contextgarden.net/Command/defineexternalfigure) ] for practical
+applications of these commands.
+
+If you want to work with a \XML\ based figure database please see the \goto
+{Figures} [ url (manual:figures) ]
+manual.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-fonts.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-fonts.tex
new file mode 100644
index 000000000..029386ec1
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-fonts.tex
@@ -0,0 +1,299 @@
+\startcomponent ma-cb-en-fonts
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Fonts and font switches]
+
+\startsection[title=Introduction]
+
+\index{Computer Modern Roman}
+\index{Lucida Bright}
+\index{AMS}
+
+The default font in \CONTEXT\ is the {\em Computer Modern Roman} (\type{cmr}).
+In \CONTEXT\ the following fonts are available.
+
+\startplacetable[reference=tab:fonts in context,title={Fonts in \CONTEXT.}]
+\starttable[|l|l|l|]
+\HL
+\NC \bf Name \NC \bf Logical name \NC \bf Also known as \NC\MR
+\HL
+\NC Computer Modern Roman \NC cmr \NC Computer Modern Roman \NC\FR
+\NC Termes \NC termes \NC Times New Roman \NC\MR
+\NC Adventor \NC adventor \NC Avant Garde \NC\MR
+\NC Bonum \NC bonum \NC Bookman \NC\MR
+\NC Chorus \NC chorus \NC Zapf Chancery \NC\MR
+\NC Cursor \NC cursor \NC Courier \NC\MR
+\NC Heros \NC heros \NC Helvetica \NC\MR
+\NC Pagella \NC pagella \NC Palatino \NC\MR
+\NC Schola \NC schola \NC Century Schoolbook \NC\MR
+\NC Dejavu \NC dejavu \NC \NC\MR
+\NC Iwona \NC iwona \NC \NC\MR
+\NC Gentium \NC gentium \NC \NC\MR
+\NC Cambria \NC cambria \NC \NC\MR
+\NC Antykwa \NC antykwa \NC \NC\MR
+\NC Utopia \NC utopia \NC \NC\MR
+\NC LucidaBright \NC lucidanova \NC \NC\LR
+\HL
+\stoptable
+\stopplacetable
+
+% in map: tex-context\tex\texmf\fonts
+
+For further reading we refer to the \goto {\em Fonts in \CONTEXT}
+[ url (manual:fonts) ] manual where you can find information on how to install
+your own font.
+
+\stopsection
+
+\startsection[title=Fontstyle and size]
+
+\index{font+style}
+\index{font+size}
+
+\Command{\tex{setupbodyfont}}
+\Command{\tex{switchtobodyfont}}
+
+You can select the font family, style and size for a document with:
+
+\shortsetup{setupbodyfont}
+
+If you typed \type{\setupbodyfont[chorus,9pt]} {\switchtobodyfont[chorus,9pt] in
+the setup area of the input file your text would look something like this.}
+
+For changes in mid-document and on section level you should use:
+
+\shortsetup{switchtobodyfont}
+
+\startbuffer
+On November 10th (one day before Saint Martinsday) the youth of
+Hasselt go from door to door to sing a special song and they
+accompany themselves on a {\em foekepot}. They won't leave
+before you give them some money or sweets. The song goes like this:
+
+\startnarrower
+\switchtobodyfont[heros,small]
+\startlines
+Foekepotterij, foekepotterij,
+Geef mij een centje dan ga'k voorbij.
+Geef mij een alfje dan blijf ik staan,
+'k Zal nog liever naar m'n arrenmoeder gaan.
+Hier woont zo'n rieke man, die zo vulle gèven kan.
+Gèf wat, old wat, gèf die arme stumpers wat,
+'k Eb zo lange met de foekepot elopen.
+'k Eb gien geld om brood te kopen.
+Foekepotterij, foekepotterij,
+Geef mij een centje dan ga'k voorbij.
+\stoplines
+\stopnarrower
+\stopbuffer
+
+\typebuffer
+
+Notice that \type{\start...\stopnarrower} is also used as a begin and end of the
+fontswitch. The function of \type{\start...\stoplines} in this example is
+obvious.
+
+\start
+\getbuffer
+\stop
+
+If you want an overview of the available font family you can type:
+
+\startbuffer
+\showbodyfont[pagella]
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+\stopsection
+
+\startsection[title=Style and size switch in commands]
+
+In a number of commands one of the parameters is \type{style} to indicate the
+desired typestyle. For example:
+
+\startbuffer
+\setuphead[chapter][style=\tfd]
+\stopbuffer
+
+\typebuffer
+
+In this case the character size for chapters is indicated with a command
+\type{\tfd}. But instead of a command you could use the predefined options that
+are related to the actual typeface:
+
+\startbuffer
+normal bold slanted boldslanted type mediaeval
+small smallbold smallslanted smallboldslanted smalltype
+capital cap
+\stopbuffer
+
+\typebuffer
+
+\stopsection
+
+\startsection[title=Local font style and size]
+
+\Command{\tex{rm}}
+\Command{\tex{ss}}
+\Command{\tex{tt}}
+\Command{\tex{sl}}
+\Command{\tex{bf}}
+\Command{\tex{tfa}}
+\Command{\tex{tfb}}
+\Command{\tex{tfc}}
+\Command{\tex{tfd}}
+
+In the running text (local) you can change the {\em typestyle} into roman, sans
+serif and teletype with \type{\rm}, \type{\ss} and \type{\tt}.
+
+You can change the {\em typeface} like italic and boldface with \type{\sl} and
+\type{\bf}.
+
+The {\em typesize} is changed with \type{\switchtobodyfont}.
+
+The actual style is indicated with \type{\tf}. If you want to change into a
+somewhat greater size you can type \type{\tfa}, \type{\tfb}, \type{\tfc} and
+\type{\tfd}. An addition of \type{a}, \type{b}, \type{c} and \type{d} to
+\type{\sl}, \type{\it} and \type{\bf} is also allowed.
+
+\startbuffer
+{\tfc Mintage}
+
+In the period from {\tt 1404} till {\tt 1585} Hasselt had its own
+{\sl right of coinage}. This right was challenged by other cities,
+but the {\switchtobodyfont[7pt] bishops of Utrecht} did not honour
+these {\slb protests}.
+\stopbuffer
+
+\typebuffer
+
+The curly braces indicate begin and end of style or size switches.
+
+\getbuffer
+
+\stopsection
+
+\startsection[title=Redefining fontsize]
+
+\index{fontsize}
+
+\Command{\tex{definebodyfont}}
+
+For special purposes you can define your own size of the bodyfont.
+
+\shortsetup{definebodyfont}
+
+A definition could look like this:
+
+\startbuffer
+\definebodyfont[10pt][rm][tfe=Regular at 36pt]
+
+{\tfe Hasselt!}
+\stopbuffer
+
+\typebuffer
+
+Now \type{\tfe} will produce 36pt characters saying:
+{\hbox{\getbuffer}}
+
+\stopsection
+
+\startsection[title=Small caps]
+
+\index{small caps}
+
+\Command{\tex{cap}}
+
+Abbreviations like \PDF\ (\infull{PDF}) are printed in pseudo small caps. A small
+capital is somewhat smaller than the capital of the actual typeface. Pseudo small
+caps are produced with:
+
+\shortsetup{cap}
+
+If you compare \type{\cap{hasselt}} and \type{\sc hasselt}: \cap{hasselt} and
+{\sc hasselt} you can see the difference. The command \type{\sc} shows the real
+small caps. The reason for using pseudo small caps instead of real small caps is
+just a matter of taste.
+
+\stopsection
+
+\startsection[title=Emphasized]
+
+\index{emphasized}
+
+\Command{\tex{em}}
+
+To emphasize words consistently throughout your document
+you use:
+
+\starttyping
+\em
+\stoptyping
+
+Empasized words appear in a slanted style.
+
+\startbuffer
+If you walk through Hasselt you should {\bf \em watch out} for
+{\em Amsterdammers}. An {\em Amsterdammer} is {\bf \em not} a
+person from Amsterdam but a little stone pillar used to separate
+sidewalk and road. A pedestrian should be protected by these
+{\em Amsterdammers} against cars but more often people get hurt
+from tripping over them.
+\stopbuffer
+
+\typebuffer
+
+This becomes:
+
+\getbuffer
+
+{\em An emphasize within an emphasize is {\em normal} again
+and a boldface emphasize looks like {\bf this or \em this}}.
+
+\stopsection
+
+\startsection[title=Teletype / verbatim]
+
+\index{type}
+\index{verbatim}
+
+\Command{\tex{starttyping}}
+\Command{\tex{type}}
+\Command{\tex{setuptyping}}
+\Command{\tex{setuptype}}
+
+If you want to display typed text and want to keep your line breaking exactly as
+it is you use:
+
+\shortsetup{starttyping}
+
+In the text you can use:
+
+\shortsetup{type}
+
+The curly braces enclose the text you want in teletype. You have to be careful
+with \type{\type} because the line breaking mechanism does not work anymore.
+
+You can set up the 'typing' with:
+
+\shortsetup{setuptyping}
+\shortsetup{setuptype}
+
+\stopsection
+
+\startsection[title=Encodings]
+
+In \CONTEXT\ \MKIV\ font ecoding is no issue (anymore).
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
+
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-footnotes.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-footnotes.tex
new file mode 100644
index 000000000..5eeade383
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-footnotes.tex
@@ -0,0 +1,99 @@
+\startcomponent ma-cb-en-footnotes
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Footnotes]
+
+\index{footnote}
+
+\Command{\tex{footnote}}
+\Command{\tex{setupfootnotes}}
+
+If you want to annotate your text you can use \type{\footnote}. The command looks
+like this:
+
+\shortsetup{footnote}
+
+The bracket pair is optional and contains a logical name. The curly braces
+contain the text you want to display at the foot of the page.
+
+The same footnote number can be called with its logical name.
+
+\shortsetup{note}
+
+If you have typed this text:
+
+\startbuffer
+The Hanse was a late medieval commercial alliance of towns in the
+regions of the North and the Baltic Sea. The association was formed
+for the furtherance and protection of the commerce of its
+members.\footnote[war]{This was the source of jealousy and fear among
+other towns that caused a number of wars.} In the Hanse period there
+was a lively trade in all sorts of articles such as wood, wool,
+metal, cloth, salt, wine and beer.\note[war] The prosperous trade
+caused an enormous growth of welfare in the Hanseatic
+towns.\footnote{Hasselt is one of these towns.}
+\stopbuffer
+
+\typebuffer
+
+It would look like this:
+
+\getbuffer
+
+The footnote numbering is done automatically. The command \type{\setupfootnotes}
+enables you to influence the display of footnotes:
+
+\shortsetup{setupfootnotes}
+
+Footnotes can be set at the bottom of a page but also at other locations, like
+the end of a chapter. This is done with the command:
+
+\shortsetup{placefootnotes}
+
+The footnotes will be placed at the end of your document with
+\type{\setupfootnotes[location=text]} in combination with \type{\placefootnotes}
+at the desired location.
+
+You can also couple footnotes to a table. In that case we speak of local
+footnotes. The commands are:
+
+\shortsetup{startlocalfootnotes}
+
+\shortsetup{placelocalfootnotes}
+
+An example illustrates the use of local footnotes:
+
+\startbuffer
+
+\placetable[][productivity]
+ {Decline of Hasselt's productivity.\footnote{Source: {\em Uit
+ de geschiedenis van Hasselt.}}}
+ {\startlocalfootnotes
+ \starttable[|l|c|c|c|c|]
+ \HL
+ \NC
+ \NC Ovens
+ \NC Blacksmiths
+ \NC Breweries
+ \NC Tile works\footnote{The factories that produced roof tiles.} \NC\SR
+ \HL
+ \NC 1682 \NC 15 \NC 9 \NC 3 \NC 2 \NC\FR
+ \NC 1752 \NC ~6 \NC 4 \NC 0 \NC 0 \NC\LR
+ \HL
+ \NC \use5 \JustLeft{\placelocalfootnotes} \NC\FR
+ \stoptable
+ \stoplocalfootnotes}
+\stopbuffer
+
+\typebuffer
+
+This will result in \in{table}[productivity] with a local footnote. The footnote
+in the caption will appear at the bottom of the page.
+\getbuffer
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-framedtexts.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-framedtexts.tex
new file mode 100644
index 000000000..2f422344b
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-framedtexts.tex
@@ -0,0 +1,58 @@
+\startcomponent ma-cb-en-framedtexts
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Outlined paragraphs]
+
+\index{outline+paragraph}
+
+\Command{\tex{startframedtext}}
+\Command{\tex{setupframedtext}}
+
+Complete paragraphs can be outlined with:
+
+\shortsetup{startframedtext}
+
+\startbuffer
+\definefloat[intermezzo]
+\setupframedtexts
+ [width=.8\makeupwidth,
+ background=color,
+ backgroundcolor=gray,
+ corner=round,
+ framecolor=blue,
+ rulethickness=2pt]
+
+\placeintermezzo[here][block:bridge]{An intermezzo.}
+\startframedtext
+ It was essential for Hasselt to have a bridge across the Zwarte
+ Water river. The bishop of Utrecht gave Hasselt his consent in
+ 1486.
+ \blank
+ Other cities in the neighbourhood of Hasselt were afraid of the
+ toll money to be paid when crossing this bridge so they
+ prevented the construction for many years.
+\stopframedtext
+\stopbuffer
+
+Let's give an example:
+
+\typebuffer
+
+This example also illustrates the command \type{\definefloat}. You can find more
+information on this command in \in{paragraph}[floatingblocks]. The \type{\blank}
+is necessary to enforce a blank line.
+
+\start
+\getbuffer
+\stop
+
+The outlining can be set up with:
+
+\shortsetup{setupframedtexts}
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-frames.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-frames.tex
new file mode 100644
index 000000000..bbdb6a61c
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-frames.tex
@@ -0,0 +1,144 @@
+\startcomponent ma-cb-en-frames
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Outlined text]
+
+\index{outline+text}
+
+\Command{\tex{framed}}
+\Command{\tex{setupframed}}
+\Command{\tex{inframed}}
+
+You can \inframed{outline} a text with \type{\framed}. The
+command looks like this:
+
+\shortsetup{framed}
+
+The bracket pair is optional and contains the set up parameters. The curly braces
+enclose the text. To be honest, the outlined text in the first paragraph was done
+with \type{\inframed}. This command takes care of the interline spacing.
+
+Some other examples of \type{\framed} and its set up parameters are shown below.
+
+\startbuffer[a]
+\framed
+ [height=fit,
+ width=.5\textwidth]
+ {Hasselt}
+\stopbuffer
+
+\placefigure[right,none][]{}{\externalfigure[a][type=buffer]}
+\typebuffer[a]
+
+\startbuffer[b]
+\framed
+ [height=3em,
+ width=.5\textwidth]
+ {Hasselt now has more space}
+\stopbuffer
+
+\placefigure[right,none][]{}{\externalfigure[b][type=buffer]}
+\typebuffer[b]
+
+\startbuffer[d]
+\framed
+ [height=3em,
+ width=.5\textwidth,
+ foregroundcolor=red,
+ framecolor=blue]
+ {Hasselt now has some color}
+\stopbuffer
+
+\placefigure[right,none][]{}{\externalfigure[d][type=buffer]}
+\typebuffer[d]
+
+\startbuffer[e]
+\framed
+ [height=3em,
+ width=.5\textwidth,
+ foregroundcolor=red,
+ framecolor=blue,
+ rulethickness=2pt]
+ {Hasselt now has more frame}
+\stopbuffer
+
+\placefigure[right,none][]{}{\externalfigure[e][type=buffer]}
+\typebuffer[e]
+
+\startbuffer[f]
+\framed
+ [height=3em,
+ width=.5\textwidth,
+ foregroundcolor=red,
+ framecolor=blue,
+ rulethickness=2pt,
+ background=color,
+ backgroundcolor=green]
+ {Hasselt now has a colorful background}
+\stopbuffer
+
+\placefigure[right,none][]{}{\externalfigure[f][type=buffer]}
+\typebuffer[f]
+
+\startbuffer[g]
+\framed
+ [height=3em,
+ width=.5\textwidth,
+ foregroundcolor=red,
+ framecolor=blue,
+ rulethickness=2pt,
+ background=color,
+ backgroundcolor=green,
+ foregroundstyle=bold]
+ {Hasselt now has another style}
+\stopbuffer
+
+\placefigure[right,none][]{}{\externalfigure[g][type=buffer]}
+\typebuffer[g]
+
+\startbuffer[needed-for-h]
+\definecolor[a][black]
+\definecolor[b][white]
+
+\startuniqueMPgraphic{LinearShade}
+ fill OverlayBox
+ withshademethod "linear" withcolor \MPcolor{a} shadedinto \MPcolor{b} ;
+\stopuniqueMPgraphic
+
+\defineoverlay
+ [linear shade]
+ [\uniqueMPgraphic{LinearShade}]
+\stopbuffer
+
+\getbuffer[needed-for-h]
+
+\startbuffer[h]
+\framed
+ [height=3em,
+ width=.5\textwidth,
+ foregroundcolor=red,
+ framecolor=blue,
+ rulethickness=2pt,
+ background=linear shade,
+ foregroundstyle=bold]
+ {Hasselt now has a little shade}
+\stopbuffer
+
+\placefigure[right,none][]{}{\externalfigure[h][type=buffer]}
+\typebuffer[h]
+
+The shady background was defined with:
+
+\typebuffer[needed-for-h]
+
+The \type{\framed} command is very sophisticated and is used in many macros.
+The command to set up frames is:
+
+\shortsetup{setupframed}
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-gettingstarted.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-gettingstarted.tex
new file mode 100644
index 000000000..6314aeec5
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-gettingstarted.tex
@@ -0,0 +1,46 @@
+\startcomponent ma-cb-en-gettingstarted
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=How to process a file]
+
+\index{input file+processing}
+\index[pdffile]{\type{pdf}--file}
+
+In this chapter we assume that you have installed and initiated \CONTEXT\ \MKIV\
+correctly so that you can run it from the commandline in your working directory.
+You can find the \CONTEXT\ installation procedure on the \goto {\CONTEXTWIKI}
+[ url (http://wiki.contextgarden.net/ConTeXt_Standalone#Windows) ].
+
+If you want to process a \CONTEXT\ input file, you should type at the command line
+prompt:
+
+\starttyping
+context myfile.tex
+\stoptyping
+
+the extension \type{.tex} is not needed. See \in{appendices}[contextcommand] and
+\in[runtimefiles] for more information on the \type{context} command.
+
+After pressing \Enter\ processing will be started. \CONTEXT\ will show processing
+information on your screen. During the processing of your input file \CONTEXT\
+will also inform you of what it is doing with your document. For example it will
+show page numbers and information about processing steps. Further more it gives
+warnings. These are of a typographical order and tells you when line breaking is
+not successful. All information on processing is stored in a \type{log} file that
+can be used for reviewing warnings and errors and the respective line numbers
+where they occur in your file.
+
+If processing is succesful the command line prompt will return and \CONTEXT\ will
+produce the file \type{myfile.pdf}. The abbreviation \PDF\ stands for Portable
+Document Format. This is a platform independent format for printing and viewing
+with \READER.
+
+When you use a configurable text editor you can also run \CONTEXT\ from that editor.
+More information on that topic can be found \in{appendix}[texteditor].
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-headers.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-headers.tex
new file mode 100644
index 000000000..d51403d5d
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-headers.tex
@@ -0,0 +1,53 @@
+\startcomponent ma-cb-en-headers
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Page headers and footers]
+
+\index{page header}
+\index{page footer}
+
+\Command{\tex{setupfootertexts}}
+\Command{\tex{setupheadertexts}}
+\Command{\tex{setupheader}}
+\Command{\tex{setupfooter}}
+\Command{\tex{noheaderandfooterlines}}
+
+In some cases you want to give your document a page header and footer. The
+commands to do this are:
+
+\shortsetup{setupfootertexts}
+\shortsetup{setupheadertexts}
+
+The first bracket pair is used for the location of the footer or header
+(\type{text}, \type{edge} etc). Footer and header are placed within the second
+and third bracket pairs. In a double sided document a fourth and fifth bracket
+pair is used for footer and header on the left-hand side page and the right-hand
+side page. In most cases you can omit these last two bracket pairs.
+
+\startbuffer
+\setupfootertexts[Manual][section]
+\stopbuffer
+
+\typebuffer
+
+In this case the text {\em Manual} will appear in the left-hand side corner and
+the title of the actual section on the right-hand side of the page. This footer
+will change with the beginning of a new section.
+
+You can set up the layout of the header and footer with:
+
+\shortsetup{setupheader}
+\shortsetup{setupfooter}
+
+If you want to leave out the page header and footer you can type:
+
+\starttyping
+\noheaderandfooterlines
+\stoptyping
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-heads.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-heads.tex
new file mode 100644
index 000000000..aa7e7b161
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-heads.tex
@@ -0,0 +1,135 @@
+\startcomponent ma-cb-en-heads
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=heads,title=Heads]
+
+\index{headers}
+
+\Command{\tex{chapter}}
+\Command{\tex{paragraph}}
+\Command{\tex{subparagraph}}
+\Command{\tex{title}}
+\Command{\tex{subject}}
+\Command{\tex{subsubject}}
+\Command{\tex{setuphead}}
+\Command{\tex{setupheads}}
+
+The structure of a document is determined by its chapter and section titles.
+These titles are created with the commands shown in \in{table}[tab:headers]:
+
+\placetable[here][tab:headers]{Headers.}
+ {\starttable[|l|l|]
+ \HL
+ \NC \bf Numbered header \NC \bf Unnumbered header \NC\SR
+ \HL
+ \NC \type{\chapter} \NC \type{\title} \NC\FR
+ \NC \type{\section} \NC \type{\subject} \NC\MR
+ \NC \type{\subsection} \NC \type{\subsubject} \NC\MR
+ \NC \type{\subsubsection} \NC \type{\subsubsubject} \NC\MR
+ \NC \unknown \NC \unknown \NC\LR
+ \HL
+ \stoptable}
+
+\shortsetup{chapter}
+\shortsetup{section}
+\shortsetup{subsection}
+\shortsetup{title}
+\shortsetup{subject}
+\shortsetup{subsubject}
+
+These commands will produce a numbered or unnumbered title in a predefined
+fontsize and fonttype with some vertical spacing before and after the header.
+
+The title commands can take several arguments, like in:
+
+\starttyping
+\title[hasselt by night]{Hasselt by night}
+\stoptyping
+
+and
+
+\starttyping
+\title{Hasselt by night}
+\stoptyping
+
+The bracket pair is optional and used for internal references. If you want to
+refer to this chapter you type for example \type{\at{page}[hasselt by night]}.
+
+For a more structured way to define chapters and sections you can use the more
+preferred \type{\start ... \stop} construction.
+
+\placetable[here][tab:headers]{Structured headers.}
+ {\starttable[|l|l|]
+ \HL
+ \NC \bf Numbered header \NC \bf Un-numbered header \NC\SR
+ \HL
+ \NC \type{\start ... \stopchapter} \NC \type{\start ... \stoptitle} \NC\FR
+ \NC \type{\start ... \stopsection} \NC \type{\start ... \stopsubject} \NC\MR
+ \NC \type{\start ... \stopsubsection} \NC \type{\start ... \stopsubsubject} \NC\MR
+ \NC \type{\start ... \stopsubsubsection} \NC \type{\start ... \stopsubsubsubject} \NC\MR
+ \NC \unknown \NC \unknown \NC\LR
+ \HL
+ \stoptable}
+
+In that case the definition looks like this:
+
+\starttyping
+\starttitle[reference="hasselt by night",title="Hasselt by night"}
+ ...
+\stoptitle
+\stoptyping
+
+Of course the chapter and section titles can be set to your own preferences and you can even
+define your own sections. This is done with the \type{\setuphead} and
+\type{\definehead} command.
+
+\shortsetup{definehead}
+
+\shortsetup{setuphead}
+
+\startbuffer
+\definehead
+ [myhead]
+ [section]
+
+\setuphead
+ [myhead]
+ [numberstyle=bold,
+ textstyle=bold,
+ before=\hairline\blank,
+ after=\nowhitespace\hairline]
+
+\myhead[headlines]{Hasselt makes headlines}
+\stopbuffer
+
+\typebuffer
+
+A new header \type{\myhead} is defined and it inherits the properties of
+\type{\section}. It would look something like this:
+
+\getbuffer
+
+There is one other command you should know now, and that is \type{\setupheads}.
+You can use this command to set up the numbering of the numbered chapters and
+sections. If you type:
+
+\startbuffer
+\setupheads
+ [alternative=inmargin,
+ separator=--]
+\stopbuffer
+
+\typebuffer
+
+all numbers will appear in the margin. Section 1.1 would look like 1--1.
+
+Commands like \type{\setupheads} are typed in the set up area of your input file.
+
+\shortsetup{setupheads}
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-interactivity.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-interactivity.tex
new file mode 100644
index 000000000..64beb179d
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-interactivity.tex
@@ -0,0 +1,310 @@
+\startcomponent ma-cb-en-interactivity
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Interactive mode in electronic documents,reference=interactivity]
+
+\startsection[title=Introduction]
+
+\index[reader]{\READER}
+
+Documents that are electronically available for consulting and displaying on a
+computer screen are called interactive documents.
+
+Interaction means that you can click on active areas and jump to the indicated
+locations. For example if you consult a register you can click on a (active) page
+number and you will jump to the corresponding page.
+
+Interaction relates to:
+
+\startitemize[packed]
+\item active chapter numbers in the table of content
+\item active page numbers in registers
+\item active page numbers, chapter numbers and figure numbers in internal
+ references to pages, chapters, figures etc. in the running text
+\item active titles, page numbers, and chapter numbers in external references to
+ other interactive documents
+\item active menus as navigation tools
+\item references to webpages and programs
+\stopitemize
+
+Interactivity depends on the program you use to view the interactive document. We
+assume here that you will use \READER\ for viewing.
+
+\CONTEXT\ is a very powerful system for producing electronic or interactive \PDF\
+documents. However, only a few standard features are described in this chapter. As
+the authors of this manual are planning to make all \CONTEXT\ related manuals
+electronically (sources included) available, reverse engineering is one of the
+options to become more acquainted with the possibilities of \CONTEXT.
+
+Good examples of interactive documents are \CONTEXT\ presentations (see \in{chapter}[presentations]).
+For more complex interactive \PDF\ documents with forms you should read the
+\goto {Widgets} [ url (manual:widget) ]
+manual.
+
+\stopsection
+
+\startsection[title=Interactive mode]
+
+\index{interactive mode}
+
+\Command{\tex{setupinteraction}}
+
+The interactive mode is activated by:
+
+\shortsetup{setupinteraction}
+
+For example:
+
+\startbuffer
+\setupinteraction
+ [state=start,
+ color=green,
+ style=bold]
+\stopbuffer
+
+\typebuffer
+
+The hyper links are now generated automatically and the active words are
+displayed in bold green.
+
+The interactive document is considerably bigger (in MB's) than its paper cousin
+because hyperlinks consume space. You will also notice that processing time
+becomes longer. Therefore it is advisable to de-activate the interactive mode as
+long as your document is under construction.
+
+\stopsection
+
+\startsection[title=Interaction within a document]
+
+\index{interaction+internal}
+
+\Command{\tex{in}}
+\Command{\tex{at}}
+\Command{\tex{goto}}
+
+Earlier you have seen how to make a reference with \type{\in} and \type{\at}. You
+may have wondered why you had to type \type{\in{chapter}[chap:introduction]}. In
+the first place {\em chapter} and its corresponding chapter number will not be
+separated at line breaking. In the second place the word {\em chapter} and its
+number are typeset differently in the interactive mode. This gives the user a
+larger clickable area.
+
+\stopsection
+
+\startsection[title=Interaction between documents]
+
+\index{interaction+external}
+
+\Command{\tex{from}}
+\Command{\tex{useexternaldocument}}
+
+It is possible to link one document to another. First you have to state that you
+want to refer to another document. This is done by:
+
+\shortsetup{useexternaldocument}
+
+The first bracket pair must contain a logical name of the document, the second
+pair the file name of the other document and the third pair is used for the title
+of the document.
+
+For refering to these other documents you can use:
+
+\shortsetup{from}
+
+The curly braces contain text and the brackets contain the reference.
+
+Look at the example below.
+
+\startbuffer
+\useexternaldocument
+ [hia][hasseltbook][Festivities in Hasselt]
+
+Most tourist attractions are described in \from[hia].\crlf
+A description of the \about[hia::euifeest] is found in \from[hia].\crlf
+The eui||feest is described on \at{page}[hia::euifeest] in \from[hia].\crlf
+See for more information \in{chapter}[hia::euifeest] in \from[hia].
+\stopbuffer
+
+\typebuffer
+
+The \type{\useexternaldocument} is usually typed in the set up area of your input
+file.
+
+After processing your input file and the file \type{hasseltbook.tex},
+you will have two \PDF\ documents. The references come out like this:
+
+\start
+\setupinteraction[state=start]
+\getbuffer
+\stop
+
+For more information on cross referencing look at
+\goto {\CONTEXT\ Magazine 1103} [ url (thisway:crossrefs)].
+
+\stopsection
+
+\startsection[title=Interaction with the world wide web]
+
+In interactive mode there is one other command that has little meaning in the
+paper version.
+
+\shortsetup{goto}
+
+The curly braces contain text, the brackets contain a reference (logical name or a
+location).
+
+\startbuffer
+In \goto {Hasselt} [ url(http://www.stadindex.nl/plattegrond/hasselt) ]
+all streets are build in a circular way.
+\stopbuffer
+
+\typebuffer
+
+In the interactive document \goto{Hasselt}[ url(http://www.stadindex.nl/plattegrond/hasselt) ]
+will be green and active. When you click the text you will jump to a map of Hasselt.
+
+For a consistent definition of the urls there is the command:
+
+\shortsetup{useURL}
+
+The adress is defined with:
+
+\startbuffer
+\useURL
+ [loc:cityplan] % id
+ [http://www.stadindex.nl/plattegrond/hasselt] % adress
+ [] % document
+ [] % text
+\stopbuffer
+
+\typebuffer
+
+The webadress is recalled by its logical name:
+\type{\goto {Hasselt} [ url(loc:cityplan) ]}.
+
+It is of good practice to define and maintain the urls in a separate
+file.
+
+\stopsection
+
+\startsection[title=Buttons]
+
+The command to define a button is:
+
+\shortsetup{button}
+
+The first bracket pair contains the setup keys, the curly brackets contain the
+button text and the last bracket pair the destination.
+
+\startbuffer
+\useexternalsoundtrack
+ [stranger][wayfaring_stranger.mp3]
+
+\button{Website Hasselt} [ url(http://www.hasselt.nl) ]
+\button{MSWord Document} [ program(hasselt.doc) ]
+\button{Sound Clip} [ StartSound{stranger} ]
+\stopbuffer
+
+\typebuffer
+
+The first example results in a jump to a webpage, the second opens the file
+\type{hasselt.doc} in \MSWORD\ and the third plays a tune. Note the use of the
+\type{\useexternalsoundtrack} command.
+
+\stopsection
+
+\startsection[title=Menus]
+
+You can define a menu with:
+
+\shortsetup{startinteractionmenu}
+
+And set it up with:
+
+\shortsetup{setupinteractionmenu}
+
+The first bracket pair is used for its name and the second pair for setting up
+the menu.
+
+A menu can be used in an interactive document. Below you can find a simple
+example that you can copy to do some experimenting:
+
+\startbuffer
+\setuppapersize
+ [S6][S6]
+
+\setuplayout
+ [header=0cm, topspace=.5cm, backspace=2cm,
+ margindistance=.5cm, margin=1cm, rightmargin=0cm,
+ edgedistance=.5cm, rightedge=2cm, width=fit,
+ height=13.8cm, footer=1cm, bottom=1cm]
+
+\setupinteraction
+ [state=start, menu=on]
+
+\setupinteractionmenu
+ [bottom]
+ [background=color, backgroundcolor=gray, frame=off]
+
+\startinteractionmenu[bottom]
+\hfill
+\startbut [content] contents \stopbut \quad
+\startbut [index] index \stopbut \quad
+\startbut [PreviousJump] last location \stopbut \quad
+\startbut [NextPage] next page \stopbut \quad
+\startbut [CloseDocument] exit \stopbut \quad
+\stopinteractionmenu
+
+\starttext
+
+\startstandardmakeup
+ \midaligned{\tfd Festivities in Hasselt}
+\stopstandardmakeup
+
+\completecontent
+
+\startchapter[title=Introduction]
+ An introduction.
+\stopchapter
+
+\startchapter[title=Kingsday]
+ Something about Kingsday in Hasselt.\index{Kingsday}
+\stopchapter
+
+\startchapter[title=Hassailt]
+ Something about Hassailt.\index{Hassailt}
+\stopchapter
+
+\startchapter[title=Euifeest,reference=euifeest]
+ Something about the Euifeest.\index{Euifeest}
+\stopchapter
+
+\completeindex
+
+\stoptext
+\stopbuffer
+
+\typebuffer
+
+The definition of the \type{\startinteractionmenu} will produce a menu at the
+bottom of every screen. The menu buttons contain the text {\em contents}, {\em
+index}, {\em last location}, {\em next page} and {\em exit} with respectively the
+following functions: jump to the table of contents, jump to the index, goto the
+last location in the document, goto next page and close the document. The labels
+to obvious destinations like \type{content} and \type{index} are predefined.
+Other predefined destinations are \type{FirstPage}, \type{LastPage},
+\type{NextPage} and \type{PreviousPage}.
+
+An action like \type{CloseDocument} is necessary to make an electronic document
+self containing. Other predefined actions you can use are \type{PrintDocument},
+\type{SearchDocument} and \type{PreviousJump}. The meaning of these actions is
+obvious.
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-introduction.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-introduction.tex
new file mode 100644
index 000000000..11acf8f9c
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-introduction.tex
@@ -0,0 +1,33 @@
+\startcomponent ma-cb-en-introduction
+
+\project ma-cb
+
+\startchapter[title=Introduction]
+
+\CONTEXT\ is a document engineering system based on \TEX, a typesetting
+system and programming language to typeset and produce documents. Ths system is
+easy to use and enables you to make complex paper and electronic documents.
+
+This manual describes the capabilities of \CONTEXT\ \MKIV, the available commands
+and their functionality.\footnote {All paper and electronic products around
+\CONTEXT\ are produced with \CONTEXT. All sources of these products are or will
+be made available electronically to give you insight in the way these products
+are made up.}
+
+This system is developed for practical applications: the typesetting and
+production of documents ranging from simple straight forward books up to very
+complex and advanced technical manuals and textbooks in a paper or an electronic
+version. This introductory manual describes the functionality necessary to apply
+standard text elements in a manual or textbook. \CONTEXT, however, is capable of
+much more and for users who want more there are other manuals and sources
+available.
+
+\CONTEXT\ has a multi lingual interface to enable users to work with the system
+in their own language. This manual is available in Dutch and English.
+
+If you want to install \CONTEXT\ on your computer you can follow the installation
+description on the \goto {\CONTEXTWIKI} [url(install)].
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-itemizations.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-itemizations.tex
new file mode 100644
index 000000000..ac711be63
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-itemizations.tex
@@ -0,0 +1,297 @@
+\startcomponent ma-cb-en-itemizations
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=itemize,title=Itemize]
+
+\index{itemize}
+\index{columns in itemize}
+
+\Command{\tex{startitemize}}
+\Command{\tex{setupitemize}}
+\Command{\tex{definesymbol}}
+\Command{\tex{item}}
+\Command{\tex{head}}
+
+One way of structuring your information is by way of enumeration or summing up
+items. The itemize command looks like this:
+
+\shortsetup{startitemize}
+
+For example:
+
+\startbuffer
+\startitemize[R,packed,broad]
+\item Hasselt was founded in the 14th century.
+\item Hasselt is known as a so called Hanze town.
+\item Hasselt's name stems from a tree.
+\stopitemize
+\stopbuffer
+
+\typebuffer
+
+Within the \type{\start ... \stopitemize} pair you start a new item with
+\type{\item}. The space after \type{\item} is required. In the example above
+\type{R} specifies Roman numbering and \type{packed} keeps line spacing to a
+minimum. The parameter \type{broad} takes care of the spacing between item
+separator and item. The example would produce:
+
+\getbuffer
+
+Items can be defined in a more structured way:
+
+\startbuffer
+\startitemize[R,packed,broad]
+\startitem Hasselt was founded in the 14th century. \stopitem
+\startitem Hasselt is known as a so called Hanze town. \stopitem
+\startitem Hasselt's name stems from a tree. \stopitem
+\stopitemize
+\stopbuffer
+
+\typebuffer
+
+The bracket pair contains information on item separators and local set up
+variables.
+
+\placetable
+ [here]
+ [tab:itemsetup]
+ {Item separators in itemize.}
+ {\starttable[|l|l|]
+ \HL
+ \NC \bf Argument \NC \bf Item separator symbol \NC\SR
+ \HL
+ \NC 1 \NC $\bullet$ \NC\FR
+ \NC 2 \NC $-$ \NC\MR
+ \NC 3 \NC $\star$ \NC\MR
+ \NC $\vdots$ \NC $\vdots$ \NC\MR
+ \NC n \NC 1 2 3 4 $\cdots$ \NC\MR
+ \NC a \NC a b c d $\cdots$ \NC\MR
+ \NC A \NC A B C D $\cdots$ \NC\MR
+ \NC r \NC i ii iii iv $\cdots$ \NC\MR
+ \NC R \NC I II III IV $\cdots$ \NC\LR
+ \HL
+ \stoptable}
+
+You can also define your own item separator by means of \type{\definesymbol}. For
+example if you try this:
+
+\startbuffer
+\definesymbol[5][$\clubsuit$]
+
+\startitemize[5,packed]
+\item Hasselt was built on a riverdune.
+\item Hasselt lies at the crossing of two rivers.
+\stopitemize
+\stopbuffer
+
+\typebuffer
+
+You will get:
+
+\getbuffer
+
+If you want to have a sort of head within an enumeration you should use
+\type{\head} instead of \type{\item}.
+
+\startbuffer
+Hasselt lies in the province of Overijssel and there are a number
+of customs that are typical of this province.
+
+\startitemize
+
+\head kraamschudden \hfill (child welcoming)
+
+ When a child is born the neighbours come to visit the new
+ parents. The women come to admire the baby and the men come to
+ judge the baby (if it is a boy) on other aspects.
+ The neighbours will bring a {\em krentenwegge} along. A
+ krentenwegge is a loaf of currant bread of about 1 \unit{Meter}
+ long. Of course the birth is celebrated with {\em jenever}.
+
+\head nabuurschap (naberschop) \hfill (neighbourship)
+
+ Smaller communities used to be very dependent on the
+ cooperation among the members for their well being. Members of
+ the {\em nabuurschap} helped each other in difficult times
+ during harvest times, funerals or any hardship that fell upon
+ the community.
+
+\head Abraham \& Sarah \hfill (identical)
+
+ When people turn 50 in Hasselt it is said that they see Abraham
+ or Sarah. The custom is to give these people a {\em speculaas}
+ Abraham or a Sarah. Speculaas is a kind of hard spiced biscuit.
+
+\stopitemize
+\stopbuffer
+
+\typebuffer
+
+The \type{\head} can be set up with \type{\setupitemize}. In case of a page
+breaking a \type{\head} will appear on a new page. (The \type {\unit{Meter}}
+command is explained in \in {chapter} [units].)
+
+The example of old customs will look like this:
+
+\getbuffer
+
+The set up parameters of itemize are described in \in {table} [tab:itemizesetup].
+
+\placetable
+ [here,force]
+ [tab:itemizesetup]
+ {Set up parameters in itemize.}
+ {\starttable[|l|l|]
+ \HL
+ \NC \bf Set up \NC \bf Meaning \NC\SR
+ \HL
+ \NC standard \NC standard (global) set up \NC\FR
+ \NC packed \NC no vertical spacing between items \NC\MR
+ \NC serried \NC no horizontal spacing between separator and text \NC\MR
+ \NC joinedup \NC no vertical spacing before and after itemize \NC\MR
+ \NC broad \NC horizontal spacing between separator and text \NC\MR
+ \NC inmargin \NC place separator in margin \NC\MR
+ \NC atmargin \NC place separator on margin \NC\MR
+ \NC stopper \NC place full stop after separator \NC\MR
+ \NC columns \NC put items in columns \NC\MR
+ \NC intro \NC prevent page breaking after introduction line \NC\MR
+ \NC continue \NC continue numbering or lettering \NC\LR
+ \HL
+ \stoptable}
+
+You can use the set up parameters in \type{\startitemize}, but for reasons of
+consistency you can make them valid for the complete document with
+\type{\setupitemize}.
+
+The parameter \type{columns} is used in conjunction with
+a (written) number. If you type this:
+
+\startbuffer
+\startitemize[n,columns,four]
+\item Achter 't Werk
+.
+.
+.
+\item Justitiebastion
+\stopitemize
+\stopbuffer
+
+\typebuffer
+
+\page[bigpreference]
+
+You will get:
+
+\startbuffer
+\startitemize[n,packed,columns,four,broad]
+\item Achter 't Werk
+\item Baangracht
+\item Brouwersgracht
+\item Eikenlaan
+\item Eiland
+\item Gasthuisstraat
+\item Heerengracht
+\item Hofstraat
+\item Hoogstraat
+\item Julianakade
+\item Justitiebastion
+\item Kaai
+\item Kalverstraat
+\item Kastanjelaan
+\item Keppelstraat
+\stopitemize
+\stopbuffer
+
+\bgroup
+\getbuffer
+\egroup
+
+Sometimes you want to continue the enumeration after a short intermezzo. Then you
+type for example \type{\startitemize[continue]} and numbering
+will continue and all other preferences are kept.
+
+\startbuffer
+\startitemize[continue]
+\item Markt
+\item Meestersteeg
+\item Prinsengracht
+\item Raamstraat
+\item Ridderstraat
+\item Rosmolenstraat
+\item Royenplein
+\item Van Nahuijsweg
+\item Vicariehof
+\item Vissteeg
+\item Watersteeg
+\item Wilhelminalaan
+\item Ziekenhuisstraat
+\stopitemize
+\stopbuffer
+
+\getbuffer
+
+The parameter \type{broad} enlarges the horizontal space between item separator
+and itemtext.
+
+\shortsetup{setupitemize}
+
+An itemize within an itemize is automatically typeset in a correct way. For
+example if you type:
+
+\startbuffer
+In the Netherlands the cities can determine the height of a number of
+taxes. So the cost of living can differ from town to town. There are
+differences of up to 50\% in taxes such as:
+
+\setupitemize[2][width=5em]
+\startitemize[n]
+
+\item[estate tax] real estate tax
+
+ The real estate tax is divided into two components:
+
+ \startitemize[a,packed]
+ \item the ownership tax
+ \item the tenant tax
+ \stopitemize
+
+ If the real estate has no tenant the owner pays both components.
+
+\item dog licence fee
+
+ The owner of one or more dogs pays a fee. When a dog has died
+ or been sold the owner has to inform city hall.
+
+\stopitemize
+\stopbuffer
+
+\typebuffer
+
+then the horizontal space between item separator and text at the second level of
+itemizing is set with \type{\setupitemize[2][width=5em]}.
+
+The example will look like this:
+
+\start
+\getbuffer
+\stop
+
+You can refer to an item if you give it a label (see \type{\item[estate tax]}).
+If you then type:
+
+\startbuffer
+\in{In item}[estate tax] we discussed one of the income sources of Hasselt.
+\stopbuffer
+
+\typebuffer
+
+You'll get a reference to that item:
+
+\getbuffer
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-layout.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-layout.tex
new file mode 100644
index 000000000..243f96b15
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-layout.tex
@@ -0,0 +1,241 @@
+\startcomponent ma-cb-en-layout
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Page layout]
+
+\index{layout}
+\index{page design}
+
+\Command{\tex{setuplayout}}
+\Command{\tex{adaptlayout}}
+\Command{\tex{showlayout}}
+\Command{\tex{showframe}} % VZ 2006-11-15
+\Command{\tex{showsetups}}
+\Command{\tex{showmakeup}}
+\Command{\tex{startlocal}}
+
+\startsection[title=Introduction]
+
+The {\em Layouts in \CONTEXT} manual by Willy Egger contains the necessary
+background information on page layout and design. Below you will find only the
+basic information necessary for defining rather simple layouts for paper and
+screen documents.
+
+For more information (examples and usage) on the \type{\setuplayout} command
+please refer to the
+\goto {\CONTEXTWIKI} [ url(http://wiki.contextgarden.net/Layout) ].
+
+\stopsection
+
+\startsection[title=Designing the pagelayout]
+
+To be able to design a page layout you have to familiarize yourself with the
+pagemodel of \CONTEXT. \in{Figure}[fig:pageareas] shows the areas on a page
+that you can use in your design.
+
+\placefigure
+ [here]
+ [fig:pageareas]
+ {The page areas.}
+ {\externalfigure[fig-page-areas-en.pdf][width=.75\hsize]}
+
+The orange bodytext area contains the running text. The top, bottom, and edge
+area are useful for buttons in screen documents.
+
+Please keep in mind that in \CONTEXT\ you are defining|/|designing a
+right-hand page. Only after you have setup
+\type{\setuppagenumbering[alternative=doublesided]} the left page
+is available (mirrored right page).
+
+\starthiding
+ % AFO: this is the file minibook-en.tex in graphics map
+ \setuppapersize[A10][A10]
+ \setuplayout[cutspace=2mm,backspace=6mm,width=15mm]
+ \setupbodyfont[6pt]
+ \setuppagenumbering[state=stop]
+ \setupbackgrounds[text][text][background=color,backgroundcolor=orange]
+ \setupbackgrounds[header,text,footer][leftmargin][background=color,backgroundcolor=lightgreen]
+ \setupbackgrounds[header,text,footer][leftmargin,text,rightmargin][frame=on]
+ \setupfootertexts[margin][\midaligned{l}][\midaligned{r}][\midaligned{r}][\midaligned{l}]
+ \starttext
+ \midaligned{design page} \page
+ \setuppagenumbering[alternative={singlesided}]
+ \inmargin{\midaligned{m}}\midaligned{left page} \page
+ \inmargin{\midaligned{m}}\midaligned{right page} \page
+ \setuppagenumbering[alternative={singlesided,doublesided}]
+ \inmargin{\midaligned{m}}\midaligned{left page} \page
+ \inmargin{\midaligned{m}}\midaligned{right page} \page
+ \setuppagenumbering[alternative={doublesided}]
+ \inmargin{\midaligned{m}}\midaligned{left page} \page
+ \inmargin{\midaligned{m}}\midaligned{right page}
+ \stoptext
+\stophiding
+
+\placefigure
+ [here]
+ [fig:sidedness]
+ {Page alternatives.}
+ {\startcombination[3*1]
+ {\externalfigure[minibook-en.pdf][type=pdf,page=2,width=2.4cm]\externalfigure[minibook-en.pdf][type=pdf,page=3,width=2.4cm]}{singlesided}
+ {\externalfigure[minibook-en.pdf][type=pdf,page=4,width=2.4cm]\externalfigure[minibook-en.pdf][type=pdf,page=5,width=2.4cm]}{single-double}
+ {\externalfigure[minibook-en.pdf][type=pdf,page=6,width=2.4cm]\externalfigure[minibook-en.pdf][type=pdf,page=7,width=2.4cm]}{doublesided}
+ \stopcombination}
+
+Note in \in{figure}[fig:sidedness] that:
+
+\startitemize[packed]
+\item the margintext (\type{\inmargin{m}}) is always in the left margin
+\item the footertext in the margin (\type{\setupfootertexts[margin][l][r][r][l]}) adapts automatically
+\item the page is completely mirrored when \type{alternative=doublesided}
+\stopitemize
+
+When designing a page ask yourself a few questions:
+
+\startitemize[packed]
+\item do I want margin texts or margin figures
+\item will I use the margin for the section numbering
+\item do I have footer and/or header texts
+\item do I want a double sided layout (right--left page mirrored)
+\item do I use ornaments (like tabs) on the page
+\item do I have navigational buttons (screen documents)
+\stopitemize
+
+\stopsection
+
+\startsection[title=Defining the papersize / screensize]
+
+Before you can set up your page layout you have to have an idea about the paper
+dimensions. The cutmarks connected by the dashed lines in \in{figure}[fig:pageareas]
+indicate the papersize. In \CONTEXT\ you set up your papersize with:
+
+\shortsetup{\tex{setuppapersize}}
+
+Most common predefined papersizes in \CONTEXT\ are A0..A10 and B1..B10 for paper
+and S3..S8 for screen documents.
+
+Mostly you will use the default setup:
+
+\startbuffer
+\setuppapersize
+ [A4][A4]
+\stopbuffer
+
+\typebuffer
+
+But you can also define your own paper size for specific products:
+
+\startbuffer
+\definelayout
+ [postcard]
+ [width=15cm,
+ height=10cm]
+\stopbuffer
+
+\typebuffer
+
+\stopsection
+
+\startsection[title=Defining the page layout]
+
+The page layout is defined by:
+
+\shortsetup{setuplayout}
+
+This command is typed in the set up area of your input file.
+
+\placefigure
+ [here]
+ [fig:pageparameters]
+ {The page parameters.}
+ {\externalfigure[fig-page-parameters-en.pdf][width=.8\hsize]}
+
+The layout of this manual was set with:
+
+\startbuffer
+\setuplayout
+ [backspace=3cm,
+ margin=2cm,
+ margindistance=.5cm,
+ width=15cm,
+ topspace=2cm,
+ header=2cm,
+ footer=2cm,
+ height=25.7cm]
+\stopbuffer
+
+\typebuffer
+
+If you want to look at your page layout you can type the command
+\type{\showframe} and process one page or the whole file. The areas are shown in
+a number of frames.
+
+The command \type{\showsetups} shows the values of the parameters. A combination
+of both commands is \type{\showlayout}.
+
+The values of the layout parameters are available as commands. This enables you
+to work more accurately when defining measures of columns, figures and tables. A
+few of these parameters are explained in \in{table}[tab:fewparameters].
+
+\placetable
+ [here,force]
+ [tab:fewparameters]
+ {A few parameters as commands.}
+\starttable[|l|l|]
+\HL
+\NC \bf Commands \NC \bf Meaning \NC\SR
+\HL
+\NC \type{\makeupwidth} \NC width of the typing area \NC\FR
+\NC \type{\makeupheight} \NC height of the typing area \NC\MR
+\NC \type{\textwidth} \NC width of the text area \NC\MR
+\NC \type{\textheight} \NC height of the text area \NC\LR
+\HL
+\stoptable
+
+If you want to define the width of a column or the height of a figure you can do
+it relative to the \type{\makeupwidth} or \type{\makeupheight}. Changes in this
+width or height will alter columns and figures proportionally.
+
+\startbuffer
+\placefigure
+ [here]
+ [fig:stepgable]
+ {A stepgable.}
+ {\externalfigure[ma-cb-19][width=.6\textwidth]}
+\stopbuffer
+
+\typebuffer
+
+After processing this would become:
+
+\getbuffer
+
+The other available values are (shown with \type{\showsetups}):
+
+\startcolumns
+\switchtobodyfont[8pt]
+\showsetups
+\stopcolumns
+
+The parameter values have a global effect and are default throughout the
+document. Nevertheless you might want to make slight changes in the page design
+for a number of pages.
+
+\startbuffer
+\adaptlayout[21,38][height=+.5cm]
+\stopbuffer
+
+\typebuffer
+
+In this case page 21 and 38 have a height of .5~cm + \type{textheight}.
+
+It is advisable not to use these local changes too often. It is always better to
+alter the text than to change the page layout.
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-margintexts.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-margintexts.tex
new file mode 100644
index 000000000..54ed6db6a
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-margintexts.tex
@@ -0,0 +1,100 @@
+\startcomponent ma-cb-en-margintexts
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Margin texts]
+
+\index{margin text}
+
+\Command{\tex{margintext}}
+\Command{\tex{inmargin}}
+\Command{\tex{inleft}}
+\Command{\tex{inright}}
+\Command{\tex{margintitle}}
+
+It is very easy to put text in the margin. You just use \type{\inmargin}.
+
+\shortsetup{inmargin}
+
+You may remember one of the earlier examples:
+
+\startbuffer[marginpicture]
+\inmargin
+ {\externalfigure
+ [ma-cb-23]
+ [width=.6\marginwidth]}
+\stopbuffer
+
+\typebuffer[marginpicture]
+
+This would result in a figure in the \pagereference [marginpicture]
+margin. You can imagine that it looks quite nice in some
+documents. But be careful. The margin is rather small so the figure could become
+very marginal.
+
+A few other examples are shown in the text below.\getbuffer
+[marginpicture]
+
+\startbuffer
+The Ridderstraat (Street of knights) \inmargin{Street of\\Knights}
+is an obvious name. In the 14th and 15th centuries, nobility and
+prominent citizens lived in this street. Some of their big houses
+were later turned into poorhouses \inright{poorhouse}and old
+peoples homes.
+
+Up until \inleft[low]{\tfc 1940}1940 there was a synagog in the
+Ridderstraat. Some 40 Jews gathered there to celebrate their
+sabbath. During the war all Jews were deported to Westerbork and
+then to the extermination camps in Germany and Poland. None of
+the Jewish families returned. The synagog was knocked down in
+1958.
+\stopbuffer
+
+\typebuffer
+
+The commands \type{\inmargin}, \type{\inleft} and \type{\inright} all have the
+same function. In a two sided document \type{\inmargin} puts the margin text in
+the correct margin. The \type{\\} is used for line breaking. The example above
+would look like this:
+
+\getbuffer
+
+You can set up the margin text with:
+
+\shortsetup{setupinmargin}
+
+Other commands that you can use for forcing text into the margin
+are listed in \in{table}[tab:margincommands].
+
+\placetable
+ [here]
+ [tab:margincommands]
+ {Overview of margin commands.}
+ {\starttable[|l|l|]
+ \HL
+ \NC \bf Command \NC \bf Meaning \NC\SR
+ \HL
+ \NC \type{\ininner} \NC text in inner margin \NC\FR
+ \NC \type{\inouter} \NC text in outer margin \NC\MR
+ \NC \type{\inright} \NC text in right margin \NC\MR
+ \NC \type{\inleft} \NC text in left margin \NC\MR
+ \NC \type{\inmargin} \NC text in the margin \NC\MR
+ \NC \type{\inothermargin} \NC text in other margin \NC\MR
+ \NC \type{\margintext} \NC text in the margin \NC\LR
+ \HL
+ \stoptable}
+
+If you want to place more extensive text blocks in the margin there is the
+command:
+
+\shortsetup{marginblock}
+
+and the accompanying command:
+
+\shortsetup{setupmarginblocks}
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-math.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-math.tex
new file mode 100644
index 000000000..c1430603f
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-math.tex
@@ -0,0 +1,524 @@
+\startcomponent ma-cb-en-math
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=formulas,title=Typesetting math]
+
+\startsection[title=Introduction]
+
+\index {math}
+
+\TEX\ is {\em the} typesetting program for math. However, this is not the
+extensive chapter on typesetting math you might expect. We advise you to do some
+further reading on typesetting formulas in \TEX. See for example: \footnote{In
+this introduction on typesetting math we relied on the booklet {\em \TEX niques}
+by Arthur Samuel.}
+
+\startitemize[packed]
+\item {\em The \TeX Book} by D.E. Knuth
+\item {\em The Beginners Book of \TeX} by S. Levy and R. Seroul
+\stopitemize
+
+\startsection[title=Typesetting math]
+
+\index {math mode}
+\index {display mode}
+\index {text mode}
+
+Normally different conventions are applied for typesetting normal text and math
+text. These conventions are \quote{known} by \TEX\ and applied accordingly when
+generating a document. We can rely on \TEX\ for delivering high quality math
+output.
+
+A number of conventions for math are:
+
+\startitemize[n,packed]
+
+\item Characters are typeset in $math\ italic$ (don't confuse this with the
+ normal {\it italic characters} in a font).
+
+\item Symbols like Greek characters ($\alpha$, $\chi$) and math symbols ($\leq$,
+ $\geq$, $\in$) are used.
+
+\item Spacing will differ from normal spacing.
+
+\item Math expressions have a different alignment than that of the running text.
+
+\item The sub and superscripts are downsized automatically, like in $a^{b}_{c}$.
+
+\item Certain symbols have different appearances in the inline and display mode.
+
+\stopitemize
+
+When typesetting math you have to work in the so called math mode in which math
+expressions can be defined by means of plain \TEX||commands.
+
+Math mode has two alternatives: text mode and display mode. Math in text
+mode is activated by \type{$} and \type{$}, while display mode is activated by
+\type{$$} and \type{$$}. In \CONTEXT\ however, display mode is activated with
+the \type{\start ... \stopformula} command pair to have more grip on vertical
+spacing around the formula.
+
+\startbuffer
+The municipality of Hasselt covers an area of 42,05 \unit{Square Kilo
+Meter}. Now, if you consider a circular area of this size with the
+market place of Hasselt as the center point $M$ you can calculate its
+diameter with ${{1}\over{4}} \pi r^2$.
+\stopbuffer
+
+\typebuffer
+
+This will become:
+
+\getbuffer
+
+The many \type{{}} (grouping) in ${{1}\over{4}} \pi r^2$ are essential for
+separating operations in the expression. If you omit the outer curly braces like
+this: \type{${1}\over{4} \pi r^2$}, you would get a non desired result:
+${1}\over{4} \pi r^2$.
+
+The letters and numbers are typeset in three different sizes: text size $a+b$,
+script size $\scriptstyle a+b$ and scriptscript size $\scriptscriptstyle a+b$.
+These can be influenced by the commands \type{\scriptstyle} and
+\type{\scriptscriptstyle}.
+
+Symbols like $\int$ and $\sum$ will have a different form in text and display
+mode. If we type \type {$\sum_{n=1}^{m}$} or \type {$\int_{-\infty}^{+\infty}$}
+we will get {$\sum_{n=1}^{m}$} and {$\int_{-\infty}^{+\infty}$}. But when you
+type:
+
+\startbuffer
+\startformula
+ \sum_{n=1}^{m} \quad {\rm and} \quad \int_{-\infty}^{+\infty}
+\stopformula
+\stopbuffer
+
+\typebuffer
+
+to get displaymode you get:
+
+\getbuffer
+
+With the commands \type {\nolimits} and \type{\limits} you can influence the
+appearances of \type{\sum} and \type{\int}:
+
+\startbuffer
+\startformula
+ \sum_{n=1}^{m}\nolimits
+ \quad {\rm and} \quad
+ \int_{-\infty}^{+\infty}\limits
+\stopformula
+\stopbuffer
+
+\typebuffer
+
+which will result in:
+
+\getbuffer
+
+For typesetting fractions there is the command \type {\over}. In \CONTEXT\ you
+can use the alternative \type {\frac}. For ${\frac{a}{1+b}}+c$ we type for
+instance \type {${\frac{a}{1+b}}+c$}.
+
+Other commands to put one thing above the other, are:
+
+\startbuffer[atop]
+${a} \atop {b}$
+\stopbuffer
+\startbuffer[choose]
+${n+1} \choose {k}$
+\stopbuffer
+\startbuffer[brack]
+${m} \brack {n}$
+\stopbuffer
+\startbuffer[brace]
+${m} \brace {n-1}$
+\stopbuffer
+
+\starttabulate[|l|l|l|l|]
+\NC \type {\atop}
+\NC \typebuffer[atop]
+\NC \mathstrut\getbuffer[atop]
+\NC
+\NC\NR
+\NC \type {\choose}
+\NC \typebuffer[choose]
+\NC
+\NC \mathstrut\getbuffer[choose]
+\NC\NR
+\NC \type {\brack}
+\NC \typebuffer[brack]
+\NC \mathstrut\getbuffer[brack]
+\NC
+\NC\NR
+\NC \type {\brace}
+\NC \typebuffer[brace]
+\NC
+\NC \mathstrut\getbuffer[brace]
+\NC\NR
+\stoptabulate
+
+\TEX\ can enlarge delimiters like (~) and $\{~\}$ automatically if the left and
+right delimiter is preceeded by the commands \type {\left} and \type {\right}
+respectively. If you type:
+
+\startbuffer
+\startformula
+ 1+\left(\frac{1}{1-x^{x-2}}\right)^3
+\stopformula
+\stopbuffer
+
+\typebuffer
+
+you will get:
+
+\getbuffer
+
+Sub and superscripts are invoked by \quote {\type{_}} and \quote {\type{^}}. They
+have effect on the next first character so grouping with $\{$~$\}$ is necessary
+in case of multi character sub and superscripts.
+
+In certain situations the delimiters can be preceeded by \type{\bigl},
+\type{\Bigl}, \type{\biggl} and \type{\Biggl} and their right counterparts. Even
+bigger delimiters can be produced by placing \type{\left} and \type{\right} in a
+\type{\vbox} construction. When we type a senseless expression like:
+
+\startbuffer
+\startformula
+ \left(\vbox to 16pt{}x^{2^{2^{2^{2}}}}\right)
+\stopformula
+\stopbuffer
+
+\typebuffer
+
+we get:
+
+\getbuffer
+
+In display mode the following delimiters will work in the automatic enlargement
+mechanism:
+
+\starttabulate[|l|l|l|l|l|l|l|l|]
+\NC \type{\lfloor} \NC $\lfloor$
+\NC \type{\langle} \NC $\langle$
+\NC \type{\vert} \NC $\vert$
+\NC \type{\downarrow} \NC $\downarrow$
+\NC\NR
+\NC \type{\rfloor} \NC $\rfloor$
+\NC \type{\rangle} \NC $\rangle$
+\NC \type{\Vert} \NC $\Vert$
+\NC \type{\Downarrow} \NC $\Downarrow$
+\NC\NR
+\NC \type{\lceil} \NC $\lceil$
+\NC \type{/} \NC $/$
+\NC \type{\uparrow} \NC $\uparrow$
+\NC \type{\updownarrow} \NC $\updownarrow$
+\NC\NR
+\NC \type{\rceil} \NC $\rceil$
+\NC \type{\backslash} \NC $\backslash$
+\NC \type{\Uparrow} \NC $\Uparrow$
+\NC \type{\Updownarrow} \NC $\Updownarrow$
+\NC\NR
+\stoptabulate
+
+In display mode we should typeset only one fraction and otherwise switch to the
+\type{a/b} notation. To get:
+
+\startformula
+ a_0 + {\frac{a}{a_1 + \frac{1}{a_2}}}
+\stopformula
+
+we will not type:
+
+\startbuffer
+\startformula
+ a_0+{\frac{a}{a_1+\frac{1}{a_2}}}
+\stopformula
+\stopbuffer
+
+\typebuffer
+
+but prefer:
+
+\startbuffer
+\startformula
+ a_0 + {\frac{a}{a_1 + 1/a_2}}
+\stopformula
+\stopbuffer
+
+\typebuffer
+
+to obtain:
+
+\getbuffer
+
+In addition we could also use the command \type{\displaystyle}. If we would type:
+
+\startbuffer
+\startformula
+ a_0 + {\frac{a}{a_1 + \frac{1}{\strut \displaystyle a_2}}}
+\stopformula
+\stopbuffer
+
+\getbuffer
+
+we will get:
+
+\getbuffer
+
+Below we demonstrate the commands \type{\matrix}, \type{\pmatrix}, \type{\ldots},
+\type{\cdots} and \type{\cases} without any further explanation.
+
+\startbuffer[a]
+\startformula
+\stopbuffer
+
+\startbuffer[c]
+\stopformula
+\stopbuffer
+
+\startbuffer[b]
+ A=\left(\matrix{x-\lambda & 1 & 0 \cr
+ 0 & x-\lambda & 1 \cr
+ 0 & 0 & x-\lambda \cr}\right)
+\stopbuffer
+
+\typebuffer[a,b,c] \startformula\getbuffer[b]\stopformula
+
+\startbuffer[b]
+ A=\left|\matrix{x-\mu& 1 & 0 \cr
+ 0 & x-\mu & 1 \cr
+ 0 & 0 & x-\mu \cr}\right|
+\stopbuffer
+
+\typebuffer[a,b,c] \startformula\getbuffer[b]\stopformula
+
+\startbuffer[b]
+ A=\pmatrix{a_{11} & a_{12} & \ldots & a_{1n} \cr
+ a_{21} & a_{22} & \ldots & a_{2n} \cr
+ \vdots & \vdots & \ddots & \vdots \cr
+ a_{m1} & a_{m2} & \ldots & a_{mn} \cr}
+\stopbuffer
+
+\typebuffer[a,b,c] \startformula\getbuffer[b]\stopformula
+
+\startbuffer[b]
+ A=\pmatrix{a_{11} & a_{12} & \ldots & a_{1n} \cr
+ a_{21} & a_{22} & \ldots & a_{2n} \cr
+ \vdots & \vdots & \ddots & \vdots \cr
+ a_{m1} & a_{m2} & \ldots & a_{mn} \cr}
+\stopbuffer
+
+\typebuffer[a,b,c] \startformula\getbuffer[b]\stopformula
+
+\startbuffer[b]
+ |x|=\cases{ x, & if $x\geq0$; \cr
+ -x, & otherwise \cr}
+\stopbuffer
+
+\typebuffer[a,b,c] \startformula\getbuffer[b]\stopformula
+
+To typeset normal text in a math expression we have to consider the following.
+First a space is not typeset in math mode so we have to enforce one with
+\type{ \ } (backslash). Second we have to indicate a font switch, because the text should
+not appear in $math\ italic$ but in the actual font. So in \CONTEXT\ we have to
+type:
+
+\startbuffer
+\startformula
+ x^3+{\tf lower\ order\ terms}
+\stopformula
+\stopbuffer
+
+\typebuffer
+
+to get:
+
+\getbuffer
+
+The math functions like $\sin$ and $\tan$ that have to be typeset in the actual
+font are predefined functions in \TEX:
+
+\starttabulate[|l|l|l|l|l|l|l|l|]
+\NC \type{\arccos} \NC \type{\cos} \NC \type{\csc} \NC \type{\exp} \NC \type{\ker} \NC \type{\limsup} \NC \type{\min} \NC \type{\sinh} \NC\NR
+\NC \type{\arcsin} \NC \type{\cosh} \NC \type{\deg} \NC \type{\gcd} \NC \type{\lg} \NC \type{\ln} \NC \type{\Pr} \NC \type{\sup} \NC\NR
+\NC \type{\arctan} \NC \type{\cot} \NC \type{\det} \NC \type{\hom} \NC \type{\lim} \NC \type{\log} \NC \type{\sec} \NC \type{\tan} \NC\NR
+\NC \type{\arg} \NC \type{\coth} \NC \type{\dim} \NC \type{\inf} \NC \type{\liminf} \NC \type{\max} \NC \type{\sin} \NC \type{\tanh} \NC\NR
+\stoptabulate
+
+If we type the sinus or limit function:
+
+\startbuffer
+\startformula
+ \sin 2\theta=2\sin\theta\cos\theta
+ \quad {\tf or} \quad
+ \lim_{x\to0}{\frac{\sin x}{x}}=1
+\stopformula
+\stopbuffer
+
+\typebuffer
+
+we get:
+
+\getbuffer
+
+Alignment in math expressions may need special attention. In multi line
+expressions we sometimes need alignment at the \quote {$=$} sign. This is done by
+the command \type{\eqalign}. If we type:
+
+\startbuffer
+\startformula
+ \eqalign{
+ ax^2+bx+c &= 0 \cr
+ x &= \frac{-b \pm \sqrt{b^2-4ac}}{2a} \cr}
+\stopformula
+\stopbuffer
+
+\typebuffer
+
+we get:
+
+\getbuffer
+
+Sometimes alignment at more than one location is wanted. Watch the second line in
+the next example and see how it is defined:
+
+\startbuffer
+\startformula
+ \eqalign{
+ ax+bx+\cdots+yx+zx & = x(a +b+ \cdots \cr
+ &\phantom{= x(a~}+y+z) \cr
+ & = y \cr}
+\stopformula
+\stopbuffer
+
+\typebuffer
+
+This results in:
+
+\getbuffer
+
+Next to the command \type{\phantom} there are \type{\hphantom} without height and
+depth and \type{\vphantom} without width.
+
+You can rely on \TEX\ for spacing within a math expression. In some situations,
+however you may want to influence spacing. This is done by:
+
+\starttabulate[|l|r|]
+\NC \type{\!} \NC $-\frac{1}{6}$\type{\quad} \NC\NR
+\NC \type{\,} \NC $\frac{1}{6}$\type{\quad} \NC\NR
+\NC \type{\>} \NC $\frac{2}{9}$\type{\quad} \NC\NR
+\NC \type{\;} \NC $\frac{5}{18}$\type{\quad} \NC\NR
+\stoptabulate
+
+These \quote {spaces} are related to \type {\quad} that stands for the width of
+the capital \quote{M}.
+
+The use of the command \type{\prime} speaks for itself. For example if would want
+$y_1^\prime+y_2^{\prime\prime}$ you should type
+\type{$y_1^\prime+y_2^{\prime\prime}$}.
+
+An expression like $\root 3 \of {x^2+y^2}$ is obtained by \type{$\root 3 \of
+{x^2+y^2}$}.
+
+At the end of this section we point to the command \type{\mathstrut} which we can
+use to enforce consistency, for example within the root symbol. With
+\type{$\sqrt{\mathstrut a}+\sqrt{\mathstrut d}+\sqrt{\mathstrut y}$} we will get
+$\sqrt{\mathstrut a}+\sqrt{\mathstrut d}+\sqrt{\mathstrut y}$ in stead of
+$\sqrt{a}+\sqrt{d}+\sqrt{y}$.
+
+See \in{appendix}[overviews] for a complete overview of math commands.
+
+\stopsection
+
+\startsection[title=Placing formulas]
+
+\index{formula}
+
+\Command{\tex{placeformula}}
+\Command{\tex{startformula}}
+\Command{\tex{setupformulas}}
+
+You can typeset numbered formulas with:
+
+\shortsetup{placeformula}
+\shortsetup{startformula}
+
+Two examples:
+
+\startbuffer
+\placeformula[formula:aformula]
+ \startformula
+ y=x^2
+ \stopformula
+
+\placeformula
+ \startformula
+ \int_0^1 x^2 dx
+ \stopformula
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+The command \type{\placeformula} handles spacing around the formulas and the
+numbering. The bracket pair is optional and is used for referencing and to switch
+numbering on and off.
+
+\startbuffer
+\placeformula[first one]
+\startformula
+ y=x^2
+\stopformula
+
+\placeformula[middle one]
+\startformula
+ y=x^3
+\stopformula
+
+\placeformula[last one]
+\startformula
+ y=x^4
+\stopformula
+\stopbuffer
+
+\getbuffer
+
+\in{Formula}[middle one] was typed like this:
+
+\startbuffer
+\placeformula[middle one]
+ \startformula
+ y=x^3
+ \stopformula
+\stopbuffer
+
+\typebuffer
+
+The lable \type{[middle one]} is used for refering to this formula. Such a
+reference is made with \type{\in{formula}[middle one]}.
+
+If no numbering is required you type:
+
+\type{\placeformula[-]}
+
+Numbering of formulas is set up with \type{\setupnumbering}. In this manual
+numbering is set up with \type{\setupnumbering[way=bychapter]}. This means that
+the chapter number preceeds the formula number and numbering is reset with each
+new chapter. For reasons of consistency the tables, figures, intermezzi etc. are
+numbered in the same way. Therefore you use \type{\setupnumbering} in the set up
+area of your input file.
+
+Formulas can be set up with:
+
+\shortsetup{setupformulae}
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
+
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-mathcharacters.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-mathcharacters.tex
new file mode 100644
index 000000000..d7f09e89a
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-mathcharacters.tex
@@ -0,0 +1,330 @@
+\startcomponent ma-cb-en-mathcharacters
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=overviews,title=Commands in math mode]
+
+\index{symbols in math mode}
+
+\startsection[title=Greek characters]
+
+\starttabulate[|l|l|l|l|l|l|l|l|l|]
+\NC \NC $\alpha$ \NC \type{\alpha}
+\NC \NC $\iota$ \NC \type{\iota}
+\NC \NC $\varrho$ \NC \type{\varrho} \NC\NR
+\NC \NC $\beta$ \NC \type{\beta}
+\NC \NC $\kappa$ \NC \type{\kappa}
+\NC $\Sigma$ \NC $\sigma$ \NC \type{\sigma} \NC\NR
+\NC $\Gamma$ \NC $\gamma$ \NC \type{\gamma}
+\NC $\Lambda$ \NC $\lambda$ \NC \type{\lambda}
+\NC \NC $\varsigma$ \NC \type{\varsigma} \NC\NR
+\NC $\Delta$ \NC $\delta$ \NC \type{\delta}
+\NC \NC $\mu$ \NC \type{\mu}
+\NC \NC $\tau$ \NC \type{\tau} \NC\NR
+\NC \NC $\epsilon$ \NC \type{\epsilon}
+\NC \NC $\nu$ \NC \type{\nu}
+\NC \NC $\upsilon$ \NC \type{\upsilon} \NC\NR
+\NC \NC $\varepsilon$ \NC \type{\varepsilon}
+\NC $\Xi$ \NC $\xi$ \NC \type{\xi}
+\NC $\Phi$ \NC $\phi$ \NC \type{\phi} \NC\NR
+\NC \NC $\zeta$ \NC \type{\zeta}
+\NC \NC $o$ \NC \type{o}
+\NC \NC $\varphi$ \NC \type{\varphi} \NC\NR
+\NC \NC $\eta$ \NC \type{\eta}
+\NC $\Pi$ \NC $\pi$ \NC \type{\pi}
+\NC \NC $\chi$ \NC \type{\chi} \NC\NR
+\NC $\Theta$ \NC $\theta$ \NC \type{\theta}
+\NC \NC $\varpi$ \NC \type{\varpi}
+\NC $\Psi$ \NC $\psi$ \NC \type{\psi} \NC\NR
+\NC \NC $\vartheta$ \NC \type{\vartheta}
+\NC \NC $\rho$ \NC \type{\rho}
+\NC $\Omega$ \NC $\omega$ \NC \type{\omega} \NC\NR
+\stoptabulate
+
+\stopsection
+
+\startsection[title=Special symbols]
+
+\starttabulate[|l|l|l|l|l|l|]
+\NC $\aleph$ \NC \type{\aleph}
+\NC $\prime$ \NC \type{\prime}
+\NC $\forall$ \NC \type{\forall}
+\NC\NR
+\NC $\hbar$ \NC \type{\hbar}
+\NC $\emptyset$ \NC \type{\emptyset}
+\NC $\exists$ \NC \type{\exists}
+\NC\NR
+\NC $\imath$ \NC \type{\imath}
+\NC $\nabla$ \NC \type{\nabla}
+\NC $\neg$ \NC \type{\neg}
+\NC\NR
+\NC $\jmath$ \NC \type{\jmath}
+\NC $\surd$ \NC \type{\surd}
+\NC $\flat$ \NC \type{\flat}
+\NC\NR
+\NC $\ell$ \NC \type{\ell}
+\NC $\top$ \NC \type{\top}
+\NC $\natural$ \NC \type{\natural}
+\NC\NR
+\NC $\wp$ \NC \type{\wp}
+\NC $\bot$ \NC \type{\bot}
+\NC $\sharp$ \NC \type{\sharp}
+\NC\NR
+\NC $\Re$ \NC \type{\Re}
+\NC $\Vert$ \NC \type{\Vert}
+\NC $\clubsuit$ \NC \type{\clubsuit}
+\NC\NR
+\NC $\Im$ \NC \type{\Im}
+\NC $\angle$ \NC \type{\angle}
+\NC $\diamondsuit$ \NC \type{\diamondsuit}
+\NC\NR
+\NC $\partial$ \NC \type{\partial}
+\NC $\triangle$ \NC \type{\triangle}
+\NC $\heartsuit$ \NC \type{\heartsuit}
+\NC\NR
+\NC $\infty$ \NC \type{\infty}
+\NC $\backslash$ \NC \type{\backslash}
+\NC $\spadesuit$ \NC \type{\spadesuit}
+\NC\NR
+\stoptabulate
+
+\stopsection
+
+\startsection[title=Operators in addition to $+$, $-$ and $*$]
+
+\starttabulate[|l|l|l|l|l|l|]
+\NC $\pm$ \NC \type{\pm}
+\NC $\cap$ \NC \type{\cap}
+\NC $\vee$ \NC \type{\vee}
+\NC\NR
+\NC $\mp$ \NC \type{\mp}
+\NC $\cup$ \NC \type{\cup}
+\NC $\wedge$ \NC \type{\wedge}
+\NC\NR
+\NC $\setminus$ \NC \type{\setminus}
+\NC $\uplus$ \NC \type{\uplus}
+\NC $\oplus$ \NC \type{\oplus}
+\NC\NR
+\NC $\cdot$ \NC \type{\cdot}
+\NC $\sqcap$ \NC \type{\sqcap}
+\NC $\ominus$ \NC \type{\ominus}
+\NC\NR
+\NC $\times$ \NC \type{\times}
+\NC $\sqcup$ \NC \type{\sqcup}
+\NC $\otimes$ \NC \type{\otimes}
+\NC\NR
+\NC $\ast$ \NC \type{\ast}
+\NC $\triangleleft$ \NC \type{\triangleleft}
+\NC $\oslash$ \NC \type{\oslash}
+\NC\NR
+\NC $\star$ \NC \type{\star}
+\NC $\triangleright$ \NC \type{\triangleright}
+\NC $\odot$ \NC \type{\odot}
+\NC\NR
+\NC $\diamond$ \NC \type{\diamond}
+\NC $\wr$ \NC \type{\wr}
+\NC $\dagger$ \NC \type{\dagger}
+\NC\NR
+\NC $\circ$ \NC \type{\circ}
+\NC $\bigcirc$ \NC \type{\bigcirc}
+\NC $\ddagger$ \NC \type{\ddagger}
+\NC\NR
+\NC $\bullet$ \NC \type{\bullet}
+\NC $\bigtriangleup$ \NC \type{\bigtriangleup}
+\NC $\amalg$ \NC \type{\amalg}
+\NC\NR
+\NC $\div$ \NC \type{\div}
+\NC $\bigtriangledown$ \NC \type{\bigtriangledown}
+\NC ~ \NC ~
+\NC\NR
+\stoptabulate
+
+\stopsection
+
+\startsection[title=Operators]
+
+\starttabulate[|l|l|l|l|l|l|]
+\NC $\sum$ \NC \type{\sum}
+\NC $\prod$ \NC \type{\prod}
+\NC $\coprod$ \NC \type{\coprod}
+\NC\NR
+\NC $\int$ \NC \type{\int}
+\NC $\oint$ \NC \type{\oint}
+\NC $\bigcap$ \NC \type{\bigcap}
+\NC\NR
+\NC $\bigcup$ \NC \type{\bigcup}
+\NC $\bigsqcup$ \NC \type{\bigsqcup}
+\NC $\bigvee$ \NC \type{\bigvee}
+\NC\NR
+\NC $\bigwedge$ \NC \type{\bigwedge}
+\NC $\bigodot$ \NC \type{\bigodot}
+\NC $\bigotimes$ \NC \type{\bigotimes}
+\NC\NR
+\NC $\bigoplus$ \NC \type{\bigoplus}
+\NC $\biguplus$ \NC \type{\biguplus}
+\NC \NC
+\NC\NR
+\stoptabulate
+
+\stopsection
+
+\startsection[title=Relation in addition to $>$, $<$ and $=$]
+
+\starttabulate[|l|l|l|l|l|l|]
+\NC $\leq$ \NC \type{\leq}
+\NC $\geq$ \NC \type{\geq}
+\NC $\equiv$ \NC \type{\equiv}
+\NC\NR
+\NC $\prec$ \NC \type{\prec}
+\NC $\succ$ \NC \type{\succ}
+\NC $\sim$ \NC \type{\sim}
+\NC\NR
+\NC $\preceq$ \NC \type{\preceq}
+\NC $\succeq$ \NC \type{\succeq}
+\NC $\simeq$ \NC \type{\simeq}
+\NC\NR
+\NC $\ll$ \NC \type{\ll}
+\NC $\gg$ \NC \type{\gg}
+\NC $\asymp$ \NC \type{\asymp}
+\NC\NR
+\NC $\subset$ \NC \type{\subset}
+\NC $\supset$ \NC \type{\supset}
+\NC $\approx$ \NC \type{\approx}
+\NC\NR
+\NC $\subseteq$ \NC \type{\subseteq}
+\NC $\supseteq$ \NC \type{\supseteq}
+\NC $\cong$ \NC \type{\cong}
+\NC\NR
+\NC $\sqsubseteq$ \NC \type{\sqsubseteq}
+\NC $\sqsupseteq$ \NC \type{\sqsupseteq}
+\NC $\bowtie$ \NC \type{\bowtie}
+\NC\NR
+\NC $\in$ \NC \type{\in}
+\NC $\ni$ \NC \type{\ni}
+\NC $\propto$ \NC \type{\propto}
+\NC\NR
+\NC $\vdash$ \NC \type{\vdash}
+\NC $\dashv$ \NC \type{\dashv}
+\NC $\models$ \NC \type{\models}
+\NC\NR
+\NC $\smile$ \NC \type{\smile}
+\NC $\mid$ \NC \type{\mid}
+\NC $\doteq$ \NC \type{\doteq}
+\NC\NR
+\NC $\frown$ \NC \type{\frown}
+\NC $\parallel$ \NC \type{\parallel}
+\NC $\perp$ \NC \type{\perp}
+\NC\NR
+\stoptabulate
+
+\stopsection
+
+\startsection[title=Negated relations]
+
+\starttabulate[|l|l|l|l|l|l|]
+\NC $\not<$ \NC \type{\not}\type{<}
+\NC $\not>$ \NC \type{\not}\type{>}
+\NC $\not=$ \NC \type{\not}\type{=}
+\NC\NR
+\NC $\not\leq$ \NC \type{\not}\type{\leq}
+\NC $\not\geq$ \NC \type{\not}\type{\geq}
+\NC $\not\equiv$ \NC \type{\not}\type{\equiv}
+\NC\NR
+\NC $\not\prec$ \NC \type{\not}\type{\prec}
+\NC $\not\succ$ \NC \type{\not}\type{\succ}
+\NC $\not\sim$ \NC \type{\not}\type{\sim}
+\NC\NR
+\NC $\not\preceq$ \NC \type{\not}\type{\preceq}
+\NC $\not\succeq$ \NC \type{\not}\type{\succeq}
+\NC $\not\simeq$ \NC \type{\not}\type{\simeq}
+\NC\NR
+\NC $\not\subset$ \NC \type{\not}\type{\subset}
+\NC $\not\supset$ \NC \type{\not}\type{\supset}
+\NC $\not\approx$ \NC \type{\not}\type{\approx}
+\NC\NR
+\NC $\not\subseteq$ \NC \type{\not}\type{\subseteq}
+\NC $\not\supseteq$ \NC \type{\not}\type{\supseteq}
+\NC $\not\cong$ \NC \type{\not}\type{\cong}
+\NC\NR
+\NC $\not\sqsubseteq$ \NC \type{\not}\type{\sqsubseteq}
+\NC $\not\sqsupseteq$ \NC \type{\not}\type{\sqsupseteq}
+\NC $\not\asymp$ \NC \type{\not}\type{\asymp}
+\NC\NR
+\stoptabulate
+
+\stopsection
+
+\startsection[title=Some arrows]
+
+\starttabulate[|l|l|l|l|l|l|]
+\NC $\leftarrow$ \NC \type{\leftarrow}
+\NC $\longleftarrow$ \NC \type{\longleftarrow}
+\NC $\uparrow$ \NC \type{\uparrow}
+\NC\NR
+\NC $\Leftarrow$ \NC \type{\Leftarrow}
+\NC $\Longleftarrow$ \NC \type{\Longleftarrow}
+\NC $\Uparrow$ \NC \type{\Uparrow}
+\NC\NR
+\NC $\rightarrow$ \NC \type{\rightarrow}
+\NC $\longrightarrow$ \NC \type{\Rightarrow}
+\NC $\downarrow$ \NC \type{\downarrow}
+\NC\NR
+\NC $\Rightarrow$ \NC \type{\Rightarrow}
+\NC $\Longrightarrow$ \NC \type{\Longrightarrow}
+\NC $\Downarrow$ \NC \type{\Downarrow}
+\NC\NR
+\NC $\leftrightarrow$ \NC \type{\leftrightarrow}
+\NC $\longleftrightarrow$ \NC \type{\longleftrightarrow}
+\NC $\updownarrow$ \NC \type{\updownarrow}
+\NC\NR
+\NC $\Leftrightarrow$ \NC \type{\Leftrightarrow}
+\NC $\Longleftrightarrow$ \NC \type{\Longleftrightarrow}
+\NC $\Updownarrow$ \NC \type{\Updownarrow}
+\NC\NR
+\NC $\mapsto$ \NC \type{\mapsto}
+\NC $\longmapsto$ \NC \type{\longmapsto}
+\NC $\nearrow$ \NC \type{\nearrow}
+\NC\NR
+\NC $\searrow$ \NC \type{\searrow}
+\NC $\swarrow$ \NC \type{\swarrow}
+\NC $\nwarrow$ \NC \type{\nwarrow}
+\NC\NR
+\NC $\hookleftarrow$ \NC \type{\hookleftarrow}
+\NC $\hookrightarrow$ \NC \type{\hookrightarrow}
+\NC ~ \NC ~
+\NC\NR
+\stoptabulate
+
+\stopsection
+
+\startsection[title=Alternative commands]
+
+\starttabulate[|l|l|l|l|l|l|l|l|l|l|]
+\NC $\ne$ \NC \type{\ne}
+\NC $\{$ \NC {\tttf\leftargument}
+\NC $\land$ \NC \type{\land}
+\NC $\to$ \NC \type{\to}
+\NC $\vert$ \NC \type{\vert}
+\NC\NR
+\NC $\le$ \NC \type{\le}
+\NC $\}$ \NC {\tttf\rightargument}
+\NC $\lor$ \NC \type{\lor}
+\NC $\gets$ \NC \type{\gets}
+\NC $\Vert$ \NC \type{\Vert}
+\NC\NR
+\NC $\ge$ \NC \type{\ge}
+\NC $\owns$ \NC \type{\owns}
+\NC $\lnot$ \NC \type{\lnot}
+\NC \NC
+\NC \NC
+\NC\NR
+\stoptabulate
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
+
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-metapost.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-metapost.tex
new file mode 100644
index 000000000..e50bed036
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-metapost.tex
@@ -0,0 +1,75 @@
+\startcomponent ma-cb-en-metapost
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Graphical extension / \METAPOST]
+
+\index[metapost]{\METAPOST}
+\index{graphical features}
+
+The graphical possibilities of \TEX||related macro packages are rather limited.
+However, by using the graphical package \METAPOST\ of John Hobby a complete range
+of graphical features has become available that may improve the look of your
+documents.
+
+In \CONTEXT\ there is a direct link to \METAPOST\ so users can apply the features
+of \METAPOST\ directly into their documents. The chapter headers and page numbers
+of this manual are extended by some graphical elements that are generated by
+\METAPOST.
+
+If you look carefully at these \METAPOST\ extensions you will notice a lot of
+contextual adaptation (width and height dependend) and randomization. So you can do
+things in your document that are not possible in other typesetting applications.
+
+A more practical example (for a mathematician at least) is drawn in \in {figure}
+[fig:metapostexample]:
+
+\startbuffer
+\startreusableMPgraphic{origin}
+ path pb; pb:=(5.5cm,0cm)..(10.5cm,0cm);
+ path qb; qb:=(8cm,-1cm)..(8cm,2.5cm);
+ pickup pencircle scaled 0.5mm;
+ drawarrow pb;
+ drawarrow qb;
+ draw thelabel.rt(btex $x$ etex,(10.6cm,0cm));
+ draw thelabel.top(btex $y$ etex,(8cm,2.6cm));
+ path l; l:=(5.5cm,-0.5cm)..(10.5cm,2cm);
+ pickup pencircle scaled 0.3mm;
+ draw l withcolor blue ;
+ pair A; A:=(6cm,-0.25cm);
+ pair B; B:=(9.3cm,1.4cm);
+ pair C; C:=(9.3cm,-0.25cm);
+ pickup pencircle scaled 0.15cm;
+ drawdot A; drawdot B; drawdot C;
+ draw thelabel.lrt(btex $\scriptstyle P_1(x_1,y_1)$ etex ,A);
+ draw thelabel.lrt(btex $\scriptstyle P_2(x_2,y_2)$ etex ,B);
+ draw thelabel.bot(btex $\scriptstyle P(x_2,y_1)$ etex ,C);
+ path s; s:=A..(9.3cm,-0.25cm);
+ draw s dashed (evenly scaled 1mm) withpen pencircle scaled 0.3mm;
+ path t; t:=B..(9.3cm,-0.25cm);
+ draw t dashed (evenly scaled 1mm) withpen pencircle scaled 0.3mm;
+\stopreusableMPgraphic
+\stopbuffer
+
+\getbuffer
+
+\placefigure
+ [here]
+ [fig:metapostexample]
+ {\METAPOST\ example.}
+ {\reuseMPgraphic{origin}}
+
+This example is taken from the mathematical text book {\em Algetrigulus} by
+Philip Brown. All graphics in his book are made by means of \METAPOST. This
+one is defined by:
+
+\typebuffer
+
+The usage and features of \METAPOST\ within \CONTEXT\ are described in the
+extensive \goto {\METAFUN\ manual} [ url (manual:metafun) ].
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-modules.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-modules.tex
new file mode 100644
index 000000000..4f92e8e47
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-modules.tex
@@ -0,0 +1,45 @@
+\startcomponent ma-cb-en-modules
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Using modules]
+
+%% VZ: many new modules was added (see ma-cb-cz-modules.tex)
+
+\index{module}
+
+\Command{\tex{usemodule}}
+
+For reasons of efficiency \CONTEXT\ comes with a number of modules that contain
+specific functionality. Loading a module is done in the set up area of your input
+file by means of:
+
+\shortsetup{usemodule}
+
+When you load a module \CONTEXT\ looks for a file with the following (prefix-)name:
+
+\startitemize[packed]
+\item m-modulename (core module)
+\item p-modulename (private module)
+\item s-modulename (\CONTEXT\ style file)
+\item x-modulename (XML module)
+\item t-modulename (third party module)
+\item modulename
+\stopitemize
+
+A few example core modules are:
+
+\startitemize[packed]
+\item m-fields (\type{m-fields.mkiv}): for PDF forms
+\item m-morse (\type{m-morse.mkvi}): for morse
+\item m-spreadsheet (\type{m-spreadsheet.mkiv}): for spreadsheets
+\item m-visual (\type{m-visual.mkiv}): for visual debugging
+\item m-zint (\type{m-zint.mkiv}): for generating bar codes
+\item s-pre-** (\type{s-pre-**}): for presentations
+\stopitemize
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-pagebackgrounds.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-pagebackgrounds.tex
new file mode 100644
index 000000000..ff7bf0b4d
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-pagebackgrounds.tex
@@ -0,0 +1,93 @@
+\startcomponent ma-cb-en-pagebackgrounds
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Backgrounds in page areas]
+
+\index{page areas}
+\index{background+page areas}
+
+\Command{\tex{setupbackgrounds}}
+
+The page background can be set, with:
+
+\shortsetup{setupbackgrounds}
+
+The first two bracket pairs are used to define the page areas. The last bracket
+pair is used for set up.
+
+\startbuffer
+\hbox
+ {\framed[width=1.5cm,frame=off] {}
+ \framed[width=2cm,frame=off] {left}
+ \framed[width=2.5cm,frame=off] {left}
+ \framed[width=3cm,frame=off] {text}
+ \framed[width=2.5cm,frame=off] {right}
+ \framed[width=2cm,frame=off] {right}}
+\hbox
+ {\framed[width=1.5cm,frame=off] {}
+ \framed[width=2cm,frame=off] {edge}
+ \framed[width=2.5cm,frame=off] {margin}
+ \framed[width=3cm,frame=off] {}
+ \framed[width=2.5cm,frame=off] {margin}
+ \framed[width=2cm,frame=off] {edge}}
+\hbox
+ {\framed[width=1.5cm,frame=off] {top}
+ \framed[width=2cm] {}
+ \framed[width=2.5cm] {}
+ \framed[width=3cm] {}
+ \framed[width=2.5cm] {}
+ \framed[width=2cm] {}}
+\hbox
+ {\framed[width=1.5cm,frame=off] {header}
+ \framed[width=2cm] {}
+ \framed[width=2.5cm,background=screen] {}
+ \framed[width=3cm,background=screen] {}
+ \framed[width=2.5cm,background=screen] {}
+ \framed[width=2cm] {}}
+\hbox
+ {\framed[width=1.5cm,frame=off,height=3cm] {text}
+ \framed[width=2cm,height=3cm] {}
+ \framed[width=2.5cm,height=3cm,background=screen]{}
+ \framed[width=3cm,height=3cm,background=screen] {}
+ \framed[width=2.5cm,height=3cm,background=screen]{}
+ \framed[width=2cm,height=3cm] {}}
+\hbox
+ {\framed[width=1.5cm,frame=off] {footer}
+ \framed[width=2cm] {}
+ \framed[width=2.5cm,background=screen] {}
+ \framed[width=3cm,background=screen] {}
+ \framed[width=2.5cm,background=screen] {}
+ \framed[width=2cm] {}}
+\hbox
+ {\framed[width=1.5cm,frame=off] {bottom}
+ \framed[width=2cm] {}
+ \framed[width=2.5cm] {}
+ \framed[width=3cm] {}
+ \framed[width=2.5cm] {}
+ \framed[width=2cm] {}}
+\stopbuffer
+
+\placefigure
+ [here]
+ [fig:pageareas]
+ {The page areas defined in \type{\setupbackgrounds}.}
+ {\tt\getbuffer}
+
+If you want to have backgrounds in the gray areas of the page layout of
+\in{figure}[fig:pageareas] you type:
+
+\startbuffer
+\setupbackgrounds
+ [header,text,footer]
+ [leftmargin,text,rightmargin]
+ [background=screen]
+\stopbuffer
+
+\typebuffer
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-pages.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-pages.tex
new file mode 100644
index 000000000..61e2d6ce9
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-pages.tex
@@ -0,0 +1,208 @@
+\startcomponent ma-cb-en-pages
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Page breaking and page numbering]
+
+\index{page breaking}
+\index{page numbering}
+
+\Command{\tex{page}}
+\Command{\tex{setuppagenumbering}}
+\Command{\tex{setupuserpagenumber}}
+
+\startsection[title=Page break]
+
+A page can be enforced or blocked by:
+
+\shortsetup{page}
+
+The options can be stated within the brackets. The options and their meaning are
+presented in \in{table}[tab:page options].
+
+\placetable
+ []
+ [tab:page options]
+ {Page options.}
+\starttable[|l|l|]
+\HL
+\NC \bf Option \NC \bf Meaning \NC\SR
+\HL
+\NC \type{yes} \NC enforce a page \NC\FR
+\NC \type{makeup} \NC enforce a page without filling \NC\MR
+\NC \type{no} \NC no page \NC\MR
+\NC \type{preference} \NC prefer a new page here \NC\MR
+\NC \type{bigpreference} \NC great preference for a new page here \NC\MR
+\NC \type{left} \NC next page is a left handside page \NC\MR
+\NC \type{right} \NC next page is a right handside page \NC\MR
+\NC \type{disable} \NC following commands have no effect \NC\MR
+\NC \type{last} \NC add pages till even number is reached \NC\MR
+\NC \type{quadruple} \NC add pages till a multiple of four is reached \NC\MR
+\NC \type{even} \NC next page is even \NC\MR
+\NC \type{odd} \NC next page in odd \NC\MR
+\NC \type{blank} \NC no page number \NC\MR
+\NC \type{empty} \NC insert an empty page \NC\MR
+\NC \type{reset} \NC following commands do have effect \NC\MR
+\NC \type{start} \NC from now on page commands have effect \NC\MR
+\NC \type{stop} \NC from now on page commands have no effect \NC\LR
+\HL
+\stoptable
+
+\stopsection
+
+\startsection[title=Page numbering]
+
+Numbering pages is done automatically by \CONTEXT. However, numbering the pages
+the way you want it may take some effort.
+
+A rather simple \type{\start ... \stoptext} document will be numbered from
+$1 .. n$ (where $n$ is the last page). If you want your document to number
+its pages alphabetical you can type:
+
+\startbuffer
+\setupuserpagenumber
+ [numberconversion=character]
+\stopbuffer
+
+\typebuffer
+
+in the setup area of your file.
+
+You can enforce a page number with:
+
+\starttyping
+\setupuserpagenumber[number=25]
+\stoptyping
+
+\shortsetup{setupuserpagenumber}
+
+The options of the \type{\setupuserpagenumber} command are given in
+\in{table}[tab:user page number options].
+
+\placetable
+ []
+ [tab:user page number options]
+ {Page numbering: numbering options.}
+\starttable[|l|l|]
+\HL
+\NC \bf Option \NC \bf Meaning \NC\SR
+\HL
+\NC \type{way} \NC how to number the document \NC\FR
+\NC \type{prefix} \NC use pagenumber prefix \NC\MR
+\NC \type{prefixset} \NC use defined prefixset \NC\MR
+\NC \type{prefixseparatorset} \NC use defined separator \NC\MR
+\NC \type{state} \NC start -- stop page numbering \NC\MR
+\NC \type{number} \NC define page number \NC\MR
+\NC \type{numberconversion} \NC convert page number \NC\MR
+\NC \type{numberconversionset} \NC used defined conversion set \NC\LR
+\HL
+\stoptable
+
+The \type{prefixset}, \type{prefixseparatorset} and the \type{numberconversionset}
+options are defined with the \type{\defineprefixset}, \type{\defineseparatorset}
+and \type{\defineconversionset} respectively.
+
+This manual uses the \CONTEXT\ standard document section blocks: frontpart,
+bodymatter and appendices. These section blocks are numbered with roman
+characters, numeral digits and characters respectively.
+
+\startbuffer
+\defineconversionset
+ [frontpart:pagenumber][][romannumerals]
+
+\defineconversionset
+ [bodypart:pagenumber] [][numbers]
+
+\defineconversionset
+ [appendix:pagenumber] [][Characters]
+\stopbuffer
+
+\typebuffer
+
+At the start of each section block the number is reset to i, 1 and A respectively.
+
+The same effect would have been obntained with:
+
+\startbuffer
+\startsectionblockenvironment[frontpart]
+ \setupuserpagenumber[numberconversion=romannumerals]
+\stopsectionblockenvironment
+\stopbuffer
+
+\typebuffer
+
+Page numbering and the location of the page numbers can be set up with:
+
+\shortsetup{setuppagenumbering}
+
+The options of this command are shown in \in{table}[tab:page numbering options]:
+
+\placetable
+ []
+ [tab:page numbering options]
+ {Page numbering: layout options.}
+\starttable[|l|l|]
+\HL
+\NC \bf Option \NC \bf Meaning \NC\SR
+\HL
+\NC \type{alternative} \NC page layout: single or double sided \NC\MR
+\NC \type{location} \NC location of page number on page \NC\MR
+\NC \type{width} \NC width of pagen umber \NC\MR
+\NC \type{left} \NC text left of page number \NC\MR
+\NC \type{right} \NC text right of page number \NC\MR
+\NC \type{page} \NC \unknown \NC\MR
+\NC \type{state} \NC start -- stop page numbering \NC\MR
+\NC \type{command} \NC invoke command \NC\MR
+\NC \type{style} \NC set character style \NC\MR
+\NC \type{color} \NC set color \NC\LR
+\HL
+\stoptable
+
+Note that this is also the command that indicates that your document is single or
+double sided which has an effect on the left-right page layout.
+
+\startbuffer
+\setuppagenumbering
+ [alternative=doublesided]
+\stopbuffer
+
+\typebuffer
+
+In this manual page numbering is set up with:
+
+\starttyping
+\setuppagenumbering
+ [location={footer,middle},
+ command=\NummerCommando]
+\stoptyping
+
+The \type{\NummerCommando} uses \METAPOST\ to draw a unique random image around
+each page number.
+
+You can recal a page number with \type{\userpagenumber}. If you set up your headertext
+with:
+
+\startbuffer
+ \setupheadertexts
+ [Page \userpagenumber\ of \lastuserpagenumber]
+\stopbuffer
+
+\typebuffer
+
+You would get a header with the actual page number and the total of pages (in that
+section block).
+
+The actual page number and the real page number may differ since there may be pages
+or sections that in your document that are not numbered. If you feel the need to
+display the real page number there is the command \type{\realpagenumber}.
+
+Please refer to the \goto {\CONTEXTWIKI} [
+url(http://wiki.contextgarden.net/Command/setupuserpagenumber) ] for more
+details.
+
+\stopchapter
+
+\stopcomponent
+
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-paragraphs.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-paragraphs.tex
new file mode 100644
index 000000000..668b6ab01
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-paragraphs.tex
@@ -0,0 +1,280 @@
+\startcomponent ma-cb-en-paragraphs
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Paragraph spacing]
+
+\startsection[title=Introduction]
+
+\index{paragraph}
+
+\Command{\tex{par}}
+\Command{\tex{paragraph}}
+
+In \TEX\ and \CONTEXT\ the most important unit of text is the paragraph. You can
+start a new paragraph by:
+
+\startitemize[packed]
+\item an empty line
+\item the \TEX\ command \type{\par}
+\stopitemize
+
+In your \ASCII\ input file you should use empty lines as paragraph separators.
+This will lead to a readable, clearly structured and well organized file and will
+prevent mistakes.
+
+In situations where a command has to be closed explicitly you should use
+\type{\par}.
+
+\startbuffer
+During one of the wars Hasselt lay under siege. After some
+time the city was famine stricken, everything edible was
+eaten. Except for one cow. The cow was kept alive and
+treated very well. \par
+Once a day the citizens of Hasselt took the cow for a walk
+on the ramparts. The besiegers saw the well fed cow and
+became very discouraged. They broke up their camps and
+Hasselt was saved. \par
+In the Hoogstraat in Hasselt there is a stone tablet with a
+representation of the cow that commemorates the siege and
+the shrewdness of the citizens of Hasselt.
+\stopbuffer
+
+\typebuffer
+
+This could also be typed without \type{\par}s and a few empty lines.
+
+\startbuffer
+During one of the wars Hasselt lay under siege. After some
+time the city was famine stricken, everything edible was
+eaten. Except for one cow. The cow was kept alive and
+treated very well.
+
+Once a day the citizens of Hasselt took the cow for a walk
+on the ramparts. The besiegers saw the well fed cow and
+became very discouraged. They broke up their camps and
+Hasselt was saved.
+
+In the Hoogstraat in Hasselt there is a stone tablet with a
+representation of the cow that commemorates the siege and
+the wisdom of the citizens of Hasselt.
+\stopbuffer
+
+\typebuffer
+
+\stopsection
+
+\startsection[title=Inter paragraph spacing]
+
+\index{inter paragraph spacing}
+
+\Command{\tex{setupwhitespace}}
+\Command{\tex{nowhitespace}}
+\Command{\tex{whitespace}}
+\Command{\tex{startlinecorrection}} % VZ 2006-11-15 setup->start
+\Command{\tex{blank}}
+\Command{\tex{setupblank}}
+\Command{\tex{startpacked}}
+\Command{\tex{startunpacked}}
+
+The vertical spacing between paragraphs can be specified by:
+
+\shortsetup{setupwhitespace}
+
+This document is produced with \type{\setupwhitespace[medium]}.
+
+When inter paragraph spacing is specified there are two commands available that
+are seldom needed:
+
+\starttyping
+\nowhitespace
+\whitespace
+\stoptyping
+
+When a paragraph consists of a horizontal line or a framed text like this:
+
+\startbuffer
+\framed{Ridderstraat 27, 8061GH Hasselt}
+\stopbuffer
+
+\getbuffer
+
+Sometimes spacing is suboptimal. For that purpose you could carry out a
+correction with:
+
+\shortsetup{startlinecorrection}
+
+So if you would type:
+
+\startbuffer
+\startlinecorrection
+\framed{Ridderstraat 27, 8061GH Hasselt}
+\stoplinecorrection
+\stopbuffer
+
+\typebuffer
+
+you will get a better output. Only use these commands if really needed!
+
+\getbuffer
+
+Another command to deal with vertical spacing is:
+
+\shortsetup{blank}
+
+The bracket pair is optional and within the bracket pair you can type the amount
+of spacing. Keywords like \type{small}, \type{medium} and \type{big} are related
+to the fontsize.
+
+\startbuffer
+In official writings Hasselt always has the affix Ov. This is an
+abbrevation for the province of {\em Overijssel}.
+\blank[2*big]
+The funny thing is that there is no other Hasselt in the Netherlands.
+So it is redundant.
+\blank
+The affix is a leftover from the times that the Netherlands and
+Belgium were one country under the reign of King Philip II of Spain.
+\blank[2*big]
+Hasselt in Belgium lies in the province of Limburg. One wonders if
+the Belgian people write Hasselt (Li) on their letters.
+\stopbuffer
+
+\typebuffer
+
+The command \type{\blank} without the bracket pair is the default space.
+
+The example would become:
+
+\getbuffer
+
+The default spacing can be set up with:
+
+\shortsetup{setupblank}
+
+If you want to surpress vertical spacing you can use:
+
+\shortsetup{startpacked}
+
+In this manual the whitespace is set at \type{medium}. In the next situation this
+set up is ignored and the lines are packed.
+
+\startbuffer
+\startpacked
+Hasselt (Ov) lies in Overijssel.
+
+Hasselt (Li) lies in Limburg.
+
+Watch out: we talk about Limburg in Belgium. There is
+also a Dutch Limburg.
+\stoppacked
+\stopbuffer
+
+\typebuffer
+
+This will become:
+
+\getbuffer
+
+It is not hard to imagine why there is also:
+
+\shortsetup{startunpacked}
+
+You can force vertical space with \type{\godown}. The distance is specified
+within the brackets.
+
+\shortsetup{godown}
+
+Try not to use this command. It is always better use the \type{\setup...} commands
+to setup your spacing model.
+
+\stopsection
+
+\startsection[title=Whitespace before and after text components]
+
+Most text components that are coded with \CONTEXT\ have a \type{\setup...} command
+with which you can define the whitespace before and after that component.
+
+\starttyping
+\setupitemize
+ [before=,after=]
+
+\setuphead
+ [chapter]
+ [before=,after=]
+
+\setupframedtexts
+ [before=,after=]
+\stoptyping
+
+The use of the \type{\setup...} commands prevents you from having to code
+whitespaces throughout your \TEX\ document. This would lead to unreadable sources
+and inconsistent use of whitepaces.
+
+\stopsection
+
+\startsection[title=Skipping space]
+
+\Command{\tex{hskip}}
+\Command{\tex{vskip}}
+
+You can introduce horizontal and vertical space with \type{\hskip} and
+\type{\vskip} commands.
+
+Try to avoid these commands in your text. It will probably lead to inconsistent
+spacing.
+
+\stopsection
+
+\startsection[title=Indentation]
+
+\index{indentation}
+\index{paragraph+indentation}
+
+\Command{\tex{indenting}}
+\Command{\tex{noindenting}}
+\Command{\tex{setupindenting}}
+
+You can set up the amount of the indentation with:
+
+\shortsetup{setupindenting}
+
+A reasonable indentation is achieved by:
+
+\starttyping
+\setupindenting[yes,]
+\stoptyping
+
+This will lead to indented paragraphs. By default, indentation after white space
+(as issued by \type {\blank}) is suppressed.
+
+You can locally influence the indentation state by using:
+
+\shortsetup{indenting}
+
+When for instance you say \type {never}, from that moment on indentation will be
+surpressed. Saying \type {none}, only influences the next paragraph.
+
+If you choose to use indentations, and at a certain place you explicitly {\em do
+not} want to indent, you can also say:
+
+\starttyping
+\noindenting
+\stoptyping
+
+In some \type{\setup...} commands you can set the parameter \type{indent=yes}. This means
+that the paragraph that follows the textcomponent will indent:
+
+\startbuffer
+\setupitemize[indentnext=yes]
+\stopbuffer
+
+\typebuffer
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-presentations.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-presentations.tex
new file mode 100644
index 000000000..623ba9490
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-presentations.tex
@@ -0,0 +1,38 @@
+\startcomponent ma-cb-en-presentations
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Presentations,reference=presentations]
+
+\index{presentation}
+
+You can use \CONTEXT\ for making your own presentations. A \CONTEXT\ presentation
+is an interactive PDF document with a screen layout. Often presentations are good
+examples of the cooperation between \CONTEXT\ and \METAPOST.
+
+\CONTEXT\ comes with a number ready-to-use presentations. A presentation is a
+module with the prefix \type{s-} and that you can load with the \type{\usemodule}
+command.
+
+If you want to use an already existing presentation the best way to proceed is:
+
+\startitemize[packed]
+\item goto \type{../your-contextdir/tex/texmf-context/tex/context/base} in your text editor
+\item open a presentation: for example \type{s-pre-05.tex}
+\item goto the end of the file and study the commands between
+ the \type{\start...\stoptext} pair
+\item copy the commands into your own presentation file
+\item invoke the presentation with \type{\usemodule[s][pre-05]} in de setup
+ area of your presentation file
+\item process the file to view the result
+\item edit the content of your presentation
+\stopitemize
+
+A stepwise setup of a presentation is given at the
+\goto{\CONTEXTWIKI}[ url (http://wiki.contextgarden.net/Presentations) ].
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-processingfiles.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-processingfiles.tex
new file mode 100644
index 000000000..1ceabfeb1
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-processingfiles.tex
@@ -0,0 +1,44 @@
+\startcomponent ma-cb-en-processingfiles
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=The \type{context} command,reference=contextcommand]
+
+\index{\type{context} (command)}
+\index{\type{mtxrun} (command)}
+\index{processing TeX file}
+
+You can process a \TEX\ file or run \CONTEXT\ with the command \type{context}
+that you can type at your console:
+
+\starttyping
+context myfile
+\stoptyping
+
+\CONTEXT\ will make multiple runs to get the layout, references, lists and
+pagenumbering straight. You can see those runs echoed on your screen and listed
+in the \type{myfile.log} file.
+
+You can add parameters to give the command \type{context} additional
+tasks while processing the file. If you want start up \READER\ automatically
+you can type:
+
+\starttyping
+context --autopdf myfile
+\stoptyping
+
+A full overview of the parameters is given when you type:
+
+\starttyping
+context --help
+\stoptyping
+
+Please refer to the manual \goto{luatools, mtxrun, context}[ url (manual:tools) ]
+for more information on running \CONTEXT.
+
+\stopchapter
+
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-references.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-references.tex
new file mode 100644
index 000000000..bc758e521
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-references.tex
@@ -0,0 +1,148 @@
+\startcomponent ma-cb-en-references
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Refering to text elements]
+
+\index{refering}
+\index{label}
+
+\Command{\tex{in}}
+\Command{\tex{at}}
+\Command{\tex{pagereference}}
+
+To disclose your document for your readers you can use the table of contents and
+the register. However, it is not uncommon to refer to specific text elements like
+formulas, tables, images and sections to enhance readability.
+
+For refering from one location in a document to another you can use the command:
+
+\shortsetup{in}
+
+The curly braces contain text and the brackets contain a logical label. If you have
+written a chapter header like this:
+
+\starttyping
+\startchapter[title=Hotels in Hasselt,reference=hotel]
+ ...
+\stopchapter
+\stoptyping
+
+then you can refer to this chapter with:
+
+\starttyping
+\in{chapter}[hotel]
+\stoptyping
+
+After processing the chapter number is available and the reference could look
+something like: {\em chapter 23}. You can use \type{\in} for any references to
+text elements like chapters, sections, figures, tables, formulas etc.
+
+Another example:
+
+\startbuffer
+There are a number of things you can do in Hasselt:
+
+\startitemize[n,packed]
+\item swimming
+\item sailing
+\item[hiking] hiking
+\item biking
+\stopitemize
+
+An activity like \in{activity}[hiking] described on \at{page}[hiking]
+is very tiring.
+\stopbuffer
+
+\typebuffer
+
+This would look like this:
+
+\getbuffer
+
+As you can see, it is also possible to refer to pages. This is done with:
+
+\shortsetup{at}
+
+For example with:
+
+\starttyping
+\at{page}[hiking]
+\stoptyping
+
+This command can be used in combination with:
+
+\shortsetup{pagereference}
+
+and
+
+\shortsetup{textreference}
+
+If you want to refer to the chapter {\em Hotels in Hasselt} you could type:
+
+\startbuffer
+Look in \in{chapter}[hotel] on \at{page}[hotel] for a complete
+overview of accomodations in \pagereference[accomodation]Hasselt.
+\stopbuffer
+
+\typebuffer
+
+A chapter number and a page number will be generated when processing the input
+file. On another spot in the document you can refer to \type{accomodation} with
+\type{\at{page}[accomodation]}.
+
+You can also define a set of labels separated by commas.
+
+\startbuffer
+\placefigure
+ [here]
+ [fig:canals,fig:boats]
+ {A characteristic picture of Hasselt.}
+ {\externalfigure[ma-cb-08][width=10cm]}
+
+There are many canals in Hasselt (see \in{figure}[fig:canals]).
+.
+.
+.
+Boats can be moored in the canals of Hasselt (see
+\in{figure}[fig:boats]).
+\stopbuffer
+
+\typebuffer
+
+This might look like this:
+
+\getbuffer
+
+You can also refer to a title of a chapter or section or even a caption of an
+image. This is done with:
+
+\shortsetup{about}
+
+This:
+
+\startbuffer
+The caption of \in{figure}[fig:canals] is {\em \about[fig:canals]}.
+\stopbuffer
+
+\typebuffer
+
+Becomes:
+
+\getbuffer
+
+With the command:
+
+\starttyping
+\setupinteraction[state=start]
+\stoptyping
+
+all references become active links. See \in{chapter}[interactivity] for more
+information on this subject.
+
+\stopchapter
+
+\stopcomponent
+
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-registers.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-registers.tex
new file mode 100644
index 000000000..315e2bfa4
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-registers.tex
@@ -0,0 +1,83 @@
+\startcomponent ma-cb-en-registers
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Registers]
+
+\index{register}
+
+\Command{\tex{index}}
+\Command{\tex{placeindex}}
+\Command{\tex{completeindex}}
+\Command{\tex{defineregister}}
+\Command{\tex{placeregister}}
+\Command{\tex{completeregister}}
+\Command{\tex{setupregister}}
+
+It is possible to generate one or more registers. By default the command
+\type{\index} is available. If you want to add a word to the index you type:
+
+\starttyping
+\index{town hall}
+\stoptyping
+
+The word {\em town hall} will appear as an index entry in the sorted register.
+Sometimes the index word does not appear in normal alphabetic order. For example,
+entries such as symbols have to provide extra sorting information in order to
+produce a correct alphabetical list:
+
+\starttyping
+\index[minus]{$-$}
+\stoptyping
+
+Sometimes you have sub- or sub sub entries. These can be defined as follows:
+
+\starttyping
+\index{town hall+location}
+\index{town hall+architecture}
+\stoptyping
+
+You can generate your register with the command:
+
+\starttyping
+\placeindex
+\stoptyping
+
+or
+
+\starttyping
+\completeindex
+\stoptyping
+
+The command \type{\index} is a predefined \CONTEXT\ command, but of course you
+can also define your own registers.
+
+\shortsetup{defineregister}
+
+For example if you want to make a new register based on the streets in Hasselt
+you could type:
+
+\starttyping
+\defineregister[street]
+\stoptyping
+
+Now a new register command \type{\street} is available. Now
+\type{\street{Ridderstraat}} is a new index entry. To produce a list of entries
+you could now use:
+
+\starttyping
+\placeregister[street]
+\placestreet
+\completestreet
+\stoptyping
+
+You can alter the layout of the registers with:
+
+\shortsetup{setupregister}
+
+\stopchapter
+
+\stopcomponent
+
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-runtimefiles.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-runtimefiles.tex
new file mode 100644
index 000000000..d72b536a5
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-runtimefiles.tex
@@ -0,0 +1,41 @@
+\startcomponent ma-cb-en-runtimefiles
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Auxilliary files,reference=runtimefiles]
+
+\index[tuc]{{\tt tuc}--file}
+\index{auxilliary files}
+
+\CONTEXT\ will produce a number of auxilliary files during processing. If your
+input file is called \type{myfile.tex} the following files may appear on your
+working directory.
+
+\index[tuc]{{\tt tuc}--file}
+\index{auxilliary files}
+
+\starttabulate[|l|l|l|]
+\HL
+\NC \darkgray \bf \CONTEXT\ MkII \NC \bf \CONTEXT\ MkIV \NC \bf Meaning \NC\NR
+\HL
+\NC \darkgray \tt myfile.tex \NC \tt myfile.tex \NC your text file \NC\NR
+\HL
+\NC \darkgray \tt myfile.log \NC \tt myfile.log \NC log information \NC\NR
+\NC \darkgray \tt myfile.tuo \NC \tt myfile.tuc \NC output information \NC\NR
+\NC \darkgray \tt myfile.tui \NC \NC \darkgray input information \NC\NR
+\NC \darkgray \tt myfile.tmp \NC \NC \darkgray temporary information \NC\NR
+\NC \darkgray \tt mpgraph.mp \NC \NC \darkgray \METAPOST\ information \NC\NR
+\HL
+\NC \darkgray \tt myfile.pdf \NC \tt myfile.pdf \NC result file \NC\NR
+\HL
+\stoptabulate
+
+The \type{myfile.tuc} file contains information about registers, lists and
+references which will be used when necessary. The \type{myfile.log}
+can be viewed in case there are problems during processing.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-setupcommands.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-setupcommands.tex
new file mode 100644
index 000000000..2f087ea8d
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-setupcommands.tex
@@ -0,0 +1,54 @@
+\startcomponent ma-cb-en-setupcommands
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Setup commands]
+
+\index{set up}
+\index{layout}
+
+Global commands are placed in the setup area of your input file, before
+\type{\starttext}. In \in{appendix}[commandsetups] there is a complete overview of the
+available commands and their parameters.
+
+The set up commands all have the same structure. They look something like:
+
+\shortsetup{setupparagraphs}
+
+A set up command consists of a more or less logical name and a number of bracket
+pairs. Bracket pairs may be optional and in that case the \type{[]} are typeset
+slanted {\tt \sl []}. In the definition the bracket pairs may contain:
+
+\starttyping
+\setupacommand[.1.][.2.][..,..=..,..]
+\stoptyping
+
+The commas indicate that a list of parameters can be enclosed. In the options
+list following the definition, the \type{.1.} and \type{.2.} show the possible
+options that can be set in the first and second bracket pair respectively. The
+parameters and their possible values are placed in the third bracket pair.
+
+The default options and parameter values are underlined.
+
+Furthermore you will notice that some values are typeset in a slanted way: {\sl
+section}, {\sl name}, {\sl dimension}, {\sl number}, {\sl command} and {\sl
+text}. This indicates that you can set the value yourself.
+
+\starttabulate[|S||]
+\NC section \NC a section name like chapter, section, subsection etc. \NC\NR
+\NC name \NC an identifier (logical name) \NC\NR
+\NC dimension \NC a dimension with a unit in \type{cm}, \type{pt},
+ \type{em}, \type{ex}, \type{sp} or \type{in} \NC\NR
+\NC number \NC an integer \NC\NR
+\NC command \NC a command \NC\NR
+\NC text \NC text \NC\NR
+\stoptabulate
+
+In the \goto {Quick Reference} [ url (manual:qr-en) ]
+manual you can find a complete overview of the commands and their parameters.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-sortedlists.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-sortedlists.tex
new file mode 100644
index 000000000..c3b47ea27
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-sortedlists.tex
@@ -0,0 +1,71 @@
+\startcomponent ma-cb-en-sortedlists
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=synonyms,title=Sorted lists]
+
+\index{sorted lists}
+
+\Command{\tex{definesorting}}
+\Command{\tex{setupsorting}}
+\Command{\tex{sort}}
+\Command{\tex{placelistofsorts}}
+\Command{\tex{completelistofsorts}}
+
+If you want to create a sorted list you can use:
+
+\shortsetup{definesorting}
+
+For example:
+
+\startbuffer
+\define[1]\street{#1\Street{#1}}
+\definesorting[Street][Streets]
+\setupsorting[Street][criterium=all]
+
+When you walk in the \street{Eikenlaan} you will cross the
+\street{Vechtlaan} and \street{Gasthuisstraat}. Go left into the
+\street{Gasthuisstraat} and take another left on the
+\street{Heerengracht}. You walk along the canal to the
+\street{Ridderstraat}, there you turn right. Cross the canal and
+turn left to the \street{Julianakade}. There you can enjoy the
+view over the Zwartewater.
+
+So the streets you visited are:
+
+\placelistofStreets
+\stopbuffer
+
+\typebuffer
+
+This will become:
+
+\getbuffer
+
+Note that the Gasthuisstraat appears only once in the list.
+
+The predefined \type{\logo} command is used for the consistent use of text logos.
+
+When you define:
+\startbuffer
+\logo [HSTEX] {Hassel\TeX}
+\stopbuffer
+
+\getbuffer\typebuffer
+
+You can use that logo througout your text.
+
+\startbuffer
+How would you call a \TEX\ based macropackage when you work
+in Hasselt? \HSTEX?
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-specialcharacters.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-specialcharacters.tex
new file mode 100644
index 000000000..619ccf3a6
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-specialcharacters.tex
@@ -0,0 +1,60 @@
+\startcomponent ma-cb-en-specialcharacters
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=special chars,title=Special characters]
+
+\index{special characters}
+
+You have seen that \CONTEXT\ commands are preceded by a \tex{} (backslash). This
+means that \tex{} has a special meaning to \CONTEXT. Aside from \tex{} there are
+other characters that need special attention when you want them to appear in
+verbatim mode or in text mode. \in{Table}[tab:specchars] gives an overview of
+these special characters and what you have to type to produce them.
+
+\placetable[here,force][tab:specchars]
+ {Special characters (1).}
+ {\starttable[|c|l|c|c|c|c|]
+ \HL
+ \NC \use2 \JustCenter{\bf Special character} \NC \use2 \bf Verbatim \NC \use2 \bf Text \NC\FR
+ \NC \bf Character \NC \bf Name \NC \bf Type \NC \bf Generates \NC \bf Type\NC \bf Generates \NC\LR
+ \HL
+ \NC \type{#} \NC hashtag \NC \type{\type{#}} \NC \type{#} \VL \type{\#} \NC \# \NC\FR
+ \NC \type{$} \NC dollar \NC \type{\type{$}} \NC \type{$} \VL \type{\$} \NC \$ \NC\MR
+ \NC \type{&} \NC ampersand \NC \type{\type{&}} \NC \type{&} \VL \type{\&} \NC \& \NC\MR
+ \NC \type{%} \NC percent \NC \type{\type{%}} \NC \type{%} \VL \type{\%} \NC \% \NC\MR
+ \NC \type{\} \NC backslash \NC \type{\type{\}} \NC \type{\} \VL \type{\backslash} \NC \backslash \NC\MR
+ \NC \type+{+ \NC right curly brace \NC \type-\type+{+- \NC \type+{+ \VL \type+\{+ \NC \{ \NC\MR
+ \NC \type+}+ \NC left curly brace \NC \type-\type+}+- \NC \type+}+ \VL \type+\}+ \NC \} \NC\MR
+ \NC \type{|} \NC vertical bar \NC \type{\type{|}} \NC \type{|} \VL \type{\|} \NC \| \NC\MR
+ \NC \type{_} \NC underscore \NC \type{\type{_}} \NC \type{_} \VL \type{\_} \NC \_ \NC\MR
+ \NC \type{~} \NC tilde \NC \type{\type{~}} \NC \type{~} \VL \type{\lettertilde} \NC \lettertilde \NC\MR
+ \NC \type{^} \NC caret \NC \type{\type{^}} \NC \type{^} \VL \type{\letterhat} \NC \letterhat \NC\LR
+ \HL
+ \stoptable}
+
+Other special characters have a meaning in typesetting mathematical expressions
+and some can be used in math mode only (see \in{chapter}[formulas]).
+
+\placetable
+ [here,force]
+ [tab:special chars]
+ {Special characters (2).}
+ {\starttable[|c|c|c|c|c|]
+ \HL
+ \NC \bf \LOW{Special character} \NC \use2 \bf Verbatim \NC \use2 \bf Text \NC\FR
+ \NC \NC \bf Type \NC \bf Generates \NC \bf Type \NC \bf Generates \NC\LR
+ \HL
+ \NC \type{+} \NC \type{\type{+}} \NC \type{+} \VL \type{$+$} \NC $+$ \NC\FR
+ \NC \type{-} \NC \type{\type{-}} \NC \type{-} \VL \type{$-$} \NC $-$ \NC\MR
+ \NC \type{=} \NC \type{\type{=}} \NC \type{=} \VL \type{$=$} \NC $=$ \NC\MR
+ \NC \type{<} \NC \type{\type{<}} \NC \type{<} \VL \type{$<$} \NC $<$ \NC\MR
+ \NC \type{>} \NC \type{\type{>}} \NC \type{>} \VL \type{$>$} \NC $>$ \NC\LR
+ \HL
+ \stoptable}
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-structure.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-structure.tex
new file mode 100644
index 000000000..4001a6831
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-structure.tex
@@ -0,0 +1,133 @@
+\startcomponent ma-cb-en-structure
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Defining a document]
+
+Every document is started with \type{\starttext} and closed with
+\type{\stoptext}. All textual input is placed between these two commands and
+\CONTEXT\ will only process that information.
+
+Setup information is placed in the set up area just before \type{\starttext}.
+
+\setuptyping
+ [escape=yes]
+
+\definestartstop
+ [comment][style={\rm}]
+
+\starttyping
+
+\setupbodyfont[12pt] /BTEX \comment{setuparea of document} /ETEX
+
+\starttext
+This is a one line document. /BTEX \comment{your text} /ETEX
+\stoptext
+\stoptyping
+
+The definition of a (very simple) book could look something like this:
+
+\startbuffer
+\starttext
+
+\startstandardmakeup
+ \midaligned{From Hasselt to America}
+ \midaligned{by}
+ \midaligned{J. Jonker and C. van Marle}
+\stopstandardmakeup
+
+\title{Foreword}
+
+\chapter{Introduction}
+
+\chapter{The Rensselaer family}
+
+\chapter{The Lansing family}
+
+\chapter{The Cuyler family}
+
+\chapter{Appendix: Photos}
+
+\stoptext
+\stopbuffer
+
+\typebuffer
+
+\CONTEXT\ comes with a predefined overall structure in which the document is
+divided into four main document divisions:\footnote{Here we try to avoid the
+word {\em section}.}
+
+\startitemize[n,packed]
+\item front matter
+\item body matter
+\item appendices
+\item back matter
+\stopitemize
+
+The document divisions are defined with:
+
+\starttyping
+\startfrontmatter ... \stopfrontmatter
+\startbodymatter ... \stopbodymatter
+\startappendices ... \stopappendices
+\startbackmatter ... \stopbackmatter
+\stoptyping
+
+The chapters in your book can be divided over these divisions.
+
+\startbuffer
+\starttext
+
+\startstandardmakeup
+ \midaligned{From Hasselt to America}
+ \midaligned{by}
+ \midaligned{J. Jonker and C. van Marle}
+\stopstandardmakeup
+
+\startfrontmatter
+
+ \title{Preface}
+
+ \chapter{Introduction}
+
+\stopfrontmatter
+
+\startbodymatter
+
+ \chapter{The Rensselaer family}
+
+ \chapter{The Lansing family}
+
+ \chapter{The Cuyler family}
+
+\stopbodymatter
+
+\startappendices
+
+ \chapter{Photos}
+
+\stopappendices
+
+\stoptext
+\stopbuffer
+
+\typebuffer
+
+In the front matter as well as back matter the command \type{\chapter}
+produces an un-numbered header in the table of contents. The front matter is mostly
+used for the table of contents, the list of figures and tables, the preface, the
+acknowledgements etc. It often comes with a roman page numbering.
+
+The appendices division is used for (indeed) appendices. Headers may be typeset in
+a different way; for example, \type{\chapter} may be numbered alphabetically.
+
+The style of each document division can be set up with:
+
+\shortsetup{setupsectionblock}
+
+\stopchapter
+
+\stopcomponent
+
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-support.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-support.tex
new file mode 100644
index 000000000..cc6b5819f
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-support.tex
@@ -0,0 +1,17 @@
+\startcomponent ma-cb-en-support
+
+\project ma-cb
+
+% only text
+
+For your Questions and Answers you can subscribe to the \goto {\CONTEXT\ mailing
+list} [ url(list:context) ].
+
+Visit the \goto {Pragma ADE website} [ url
+(http://www.pragma-ade.com/overview.htm) ] for extensive information about
+\CONTEXT.
+
+Goto the \goto {ConTeXt Garden} [ url (http://wiki.contextgarden.net) ] to find
+all kinds of practical information on how to use \CONTEXT.
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-synonyms.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-synonyms.tex
new file mode 100644
index 000000000..8d921d5b0
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-synonyms.tex
@@ -0,0 +1,89 @@
+\startcomponent ma-cb-en-synonyms
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=synonyms,title=Synonyms]
+
+\index{synonyms}
+
+\Command{\tex{definesynonyms}}
+\Command{\tex{setupsynonyms}}
+\Command{\tex{abbreviation}}
+\Command{\tex{infull}}
+\Command{\tex{loadabbreviations}}
+\Command{\tex{placelistofabbreviations}}
+\Command{\tex{completelistofabbreviations}}
+
+In many documents people want to use specific words consistently throughout the
+document. To enforce consistency the command below is available.
+
+\shortsetup{definesynonyms}
+
+The first bracket pair contains the singular form of the synonym, and the second
+contains the plural form. The third bracket pair contains a command.
+
+For example the command \type{\abbreviation} is defined by:
+
+\starttyping
+\definesynonyms[abbreviation][abbreviations][\infull]
+\setupsynonyms[style=cap]
+\stoptyping
+
+Now the command \type{\abbreviation} is available and can be used to state your
+abbreviations:
+
+\starttyping
+\abbreviation{ANWB}{Dutch Automobile Association}
+\abbreviation{VVV}{Bureau of Tourist Information}
+\abbreviation{NS}{Dutch Railways}
+\stoptyping
+
+\abbreviation{VVV}{Bureau of Tourist Information}
+
+If you would type:
+
+\startbuffer
+The Dutch \VVV\ (\infull{VVV}) can provide you with the tourist
+information on Hasselt.
+\stopbuffer
+
+\typebuffer
+
+You would obtain something like this:
+
+\getbuffer
+
+The list of synonyms or abbreviations is best defined in the set up area of your
+input file for maintenance purposes. You can also store this kind of information
+in an external file, and load the file (e.g. \type{abbrev.tex}) with:
+
+\starttyping
+\input abbrev.tex
+\stoptyping
+
+If you want to put a list of the abbreviations used in your document you can
+type:
+
+\starttyping
+\placelistofabbreviations
+\stoptyping
+
+or
+
+\starttyping
+\completelistofabbreviations
+\stoptyping
+
+A complete and sorted list with used abbreviations and their meaning is produced.
+
+The typesetting of synonynms can be influenced with:
+
+\starttyping
+\setupsynonyms
+\stoptyping
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-tables.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-tables.tex
new file mode 100644
index 000000000..39ce0cb4a
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-tables.tex
@@ -0,0 +1,385 @@
+\startcomponent ma-cb-en-tables
+
+% AFO: the \start ... \stoplinetable mechanism is not stable enough
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=tables,title=Tables]
+
+\index{tables}
+\index{natural tables}
+\index{extreme tables}
+\index{floating blocks}
+
+\Command{\tex{placetable}}
+\Command{\tex{setuptables}}
+\Command{\tex{starttable}}
+\Command{\tex{startcombination}}
+\Command{\tex{setupfloats}}
+\Command{\tex{setupcaptions}}
+\Command{\tex{NR}}
+\Command{\tex{FR}}
+\Command{\tex{LR}}
+\Command{\tex{MR}}
+\Command{\tex{SR}}
+\Command{\tex{VL}}
+\Command{\tex{NC}}
+\Command{\tex{HL}}
+\Command{\tex{DL}}
+\Command{\tex{DC}}
+\Command{\tex{DR}}
+\Command{\tex{LOW}}
+\Command{\tex{TWO}}
+\Command{\tex{THREE}}
+\Command{\tex{bTABLE}}
+\Command{\tex{eTABLE}}
+\Command{\tex{bTR}}
+\Command{\tex{eTR}}
+\Command{\tex{bTD}}
+\Command{\tex{eTD}}
+\Command{\tex{setupTABLE}}
+\Command{\tex{startxtable}}
+\Command{\tex{stopxtable}}
+\Command{\tex{startxcell}}
+\Command{\tex{startxrow}}
+\Command{\tex{setupxtable}}
+
+There are a number of ways to define a table:
+
+\startitemize[packed]
+\item the \type{\start ... \stoptable} mechanism, based on the work of M. Wichura
+\item the \type{\bTABLE ... \eTABLE} mechanism (natural tables)
+\item the \type{\start ... \stopxtable} mechanism (extreme tables)
+\stopitemize
+
+In the next sections we describe the principles of the three table mechanisms.
+
+\startsection[title=Simple tables]
+
+For defining the table you use:
+
+\shortsetup{starttable}
+
+The definition of a table could look something like this:
+
+\startbuffer
+\placetable
+ [here]
+ [tab:ships]
+ {Ships that moored at Hasselt.}
+ {\starttable[|c|c|]
+ \HL
+ \NC \bf Year \NC \bf Number of ships \NC\SR
+ \HL
+ \NC 1645 \NC 450 \NC\FR
+ \NC 1671 \NC 480 \NC\MR
+ \NC 1676 \NC 500 \NC\MR
+ \NC 1695 \NC 930 \NC\LR
+ \HL
+ \stoptable}
+\stopbuffer
+
+\typebuffer
+
+This table is typeset as \in{table}[tab:ships].
+
+\getbuffer
+
+Although this table mechanism is still available and supported in \CONTEXT\
+it is better to use one of the other mechanisms.
+
+\stopsection
+
+\startsection[title=Natural tables]
+
+The natural table mechanism (\type{\bTABLE ... \eTABLE}) is developed for more
+complex tables and has features of the general interface of \CONTEXT.
+
+\startbuffer
+\placetable
+ [here,force]
+ [tab:votedivision]
+ {Division of votes over political parties.}
+ {\bTABLE[align=middle,offset=4pt]
+ \bTABLEhead
+ \bTR[width=6cm] \bTD [nc=5] Elections City Council \eTD \eTR
+ \eTABLEhead
+ \bTABLEbody
+ \bTR \bTD[nr=2,align={right,lohi}] Party \eTD
+ \bTD[nc=3,foregroundstyle=bold] Districts \eTD
+ \bTD[nr=2,align={middle,lohi}] Total \eTD \eTR
+ \bTR \bTD 1 \eTD \bTD 2 \eTD \bTD 3 \eTD \eTR
+ \bTR \bTD[align=right] PvdA \eTD
+ \bTD 351 \eTD \bTD 433 \eTD \bTD 459 \eTD \bTD 1243 \eTD \eTR
+ \bTR \bTD[align=right] CDA \eTD
+ \bTD 346 \eTD \bTD 350 \eTD \bTD 285 \eTD \bTD ~981 \eTD \eTR
+ \bTR \bTD[align=right] VVD \eTD
+ \bTD 140 \eTD
+ \bTD[offset=2pt,background=color,
+ backgroundcolor=red,foregroundcolor=white,
+ foregroundstyle=bold,framecolor=blue,
+ rulethickness=2pt] 113 \eTD
+ \bTD 132 \eTD \bTD ~385 \eTD \eTR
+ \bTR \bTD[align=right] SGP \eTD
+ \bTD 348 \eTD \bTD 261 \eTD \bTD 158 \eTD \bTD ~767 \eTD \eTR
+ \bTR \bTD[align=right] GPV \eTD
+ \bTD 117 \eTD \bTD 192 \eTD \bTD 291 \eTD \bTD ~600 \eTD \eTR
+ \eTABLEbody
+ \eTABLE}
+\stopbuffer
+
+\start
+\switchtobodyfont[8pt]
+\typebuffer
+\stop
+
+In the last column a \type{~} is used to simulate a four digit number. The
+\type{~} has the width of a digit.
+
+\start
+\getbuffer
+\stop
+
+The setup of the table is placed between the square brackets \type{[ ]}. To keep
+the data in the table more readable you can set up the table with the \type
+{\setupTABLE} command.
+
+\shortsetup{bTABLE}
+
+\startbuffer
+\setupTABLE[row][align=middle,offset=4pt]
+\setupTABLE[1][1][width=6cm]
+\setupTABLE[1][2][align={right,lohi}]
+\setupTABLE[5][2][align={right,lohi}]
+\setupTABLE[2][2][foregroundstyle=bold]
+\setupTABLE[1][4,5,6,7,8][align=right]
+\setupTABLE[3][6][offset=2pt,background=color,
+ backgroundcolor=red,foregroundcolor=white,
+ foregroundstyle=bold,framecolor=blue,
+ rulethickness=2pt]
+
+\bTABLE
+ \bTABLEhead
+ \bTR \bTD[nc=5] Elections City Council \eTD \eTR
+ \bTR \bTD[nr=2] Party \eTD \bTD[nc=3] Districts \eTD \bTD[nr=2] Total \eTD \eTR
+ \bTR \bTD 1 \eTD \bTD 2 \eTD \bTD 3 \eTD \eTR
+ \eTABLEhead
+ \bTABLEbody
+ \bTR \bTD PvdA \eTD \bTD 351 \eTD \bTD 433 \eTD \bTD 459 \eTD \bTD 1243 \eTD \eTR
+ \bTR \bTD CDA \eTD \bTD 346 \eTD \bTD 350 \eTD \bTD 285 \eTD \bTD ~981 \eTD \eTR
+ \bTR \bTD VVD \eTD \bTD 140 \eTD \bTD 113 \eTD \bTD 132 \eTD \bTD ~385 \eTD \eTR
+ \bTR \bTD SGP \eTD \bTD 348 \eTD \bTD 261 \eTD \bTD 158 \eTD \bTD ~767 \eTD \eTR
+ \bTR \bTD GPV \eTD \bTD 117 \eTD \bTD 192 \eTD \bTD 291 \eTD \bTD ~600 \eTD \eTR
+ \eTABLEbody
+\eTABLE
+\stopbuffer
+
+\start
+\switchtobodyfont[8pt]
+\typebuffer
+\stop
+
+The meaning of the \CONTEXT\ commands are indicated in \in {table}
+[tab:tablecommands02].
+
+\placetable
+ []
+ [tab:tablecommands02]
+ {Commands to define natural tables.}
+ {\starttable[|l|l|]
+ \HL
+ \NC \bf Command \NC \bf Meaning \NC\SR
+ \HL
+ \NC \type{\bTABLE ... \eTABLE} \NC begin end table \NC\FR
+ \NC \type{\bTR ... \eTR} \NC begin end row \NC\MR
+ \NC \type{\bTD ... \eTD} \NC begin end column \NC\MR
+ \NC \type{\bTABLEhead ... \eTABLEhead} \NC begin end tablehead \NC\MR
+ \NC \type{\bTABLEbody ... \eTABLEbody} \NC begin end tablebody \NC\MR
+ \NC \type{\bTABLEfoot ...\eTABLEfoot} \NC begin end tablefoot \NC\MR
+ \NC \type{\setupTABLE} \NC table setup \NC\LR
+ \HL
+ \stoptable}
+
+You can find more information on this table mechanism on the \CONTEXTWIKI\ and
+examples in the \goto {\em Natural Tables} [ url (manual:nattab) ] manual.
+
+\stopsection
+
+\startsection[title=Extreme tables]
+
+For large tables that extend over a number of pages and where you want the
+table head repeated after each pagebreak \CONTEXT\ has the {\em extreme table}
+mechanism.
+
+\shortsetup{startxtable}
+
+\startbuffer
+\setupxtable[split=yes,header=repeat]
+\setupxtable[offset=4pt]
+
+\placetable
+ []
+ [tab:wealthdecline]
+ {Decline of wealth through the ages.}
+ {\startxtable
+ \startxtablehead[align=middle,foregroundstyle=bold]
+ \startxrow
+ \startxcell[nx=6]
+ Decline of wealth in Dutch florine (Dfl)
+ \stopxcell
+ \stopxrow
+ \startxrow[foregroundstyle=bold]
+ \startxcell[width=1.2cm] Year \stopxcell
+ \startxcell 1.000--2.000 \stopxcell
+ \startxcell 2.000--3.000 \stopxcell
+ \startxcell 3.000--5.000 \stopxcell
+ \startxcell 5.000--10.000 \stopxcell
+ \startxcell over 10.000 \stopxcell
+ \stopxrow
+ \stopxtablehead
+ \startxtablenext
+ \startxrow
+ \startxcell[nx=6,align=middle,foregroundstyle=bold]
+ Decline of wealth in Dutch florine (Dfl) / Continued
+ \stopxcell
+ \stopxrow
+ \startxrow[foregroundstyle=bold]
+ \startxcell Year \stopxcell
+ \startxcell 1.000--2.000 \stopxcell
+ \startxcell 2.000--3.000 \stopxcell
+ \startxcell 3.000--5.000 \stopxcell
+ \startxcell 5.000--10.000 \stopxcell
+ \startxcell over 10.000 \stopxcell
+ \stopxrow
+ \stopxtablenext
+ \startxtablebody[align=middle]
+ \startxrow
+ \startxcell 1675 \stopxcell
+ \startxcell 22 \stopxcell
+ \startxcell ~7 \stopxcell
+ \startxcell ~5 \stopxcell
+ \startxcell ~4 \stopxcell
+ \startxcell ~5 \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell 1724 \stopxcell
+ \startxcell ~4 \stopxcell
+ \startxcell ~4 \stopxcell
+ \startxcell -- \stopxcell
+ \startxcell ~4 \stopxcell
+ \startxcell ~3 \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell 1750 \stopxcell
+ \startxcell 12 \stopxcell
+ \startxcell ~3 \stopxcell
+ \startxcell ~2 \stopxcell
+ \startxcell ~2 \stopxcell
+ \startxcell -- \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell 1808 \stopxcell
+ \startxcell ~9 \stopxcell
+ \startxcell ~2 \stopxcell
+ \startxcell -- \stopxcell
+ \startxcell -- \stopxcell
+ \startxcell -- \stopxcell
+ \stopxrow
+ \stopxtablebody
+ \stopxtable}
+\stopbuffer
+
+\start
+\switchtobodyfont[8pt]
+\typebuffer
+\stop
+
+With the \type{\setupxtable} it is indicated that the table is allowed to split
+at a pagebreak and that the head should contain the content of the \type {\start
+... \stopxtablenext}.
+
+The result of this definition is shown in \in {table} [tab:wealthdecline].
+
+\getbuffer
+
+The meaning of the commands are explained \in {table} [tab:tablecommands03].
+
+\placetable
+ []
+ [tab:tablecommands03]
+ {Commands to define extreme tables.}
+ {\starttable[|l|l|]
+ \HL
+ \NC \bf Command \NC \bf Meaning \NC\SR
+ \HL
+ \NC \type{\startxtable ... \stopxtable} \NC begin end table \NC\FR
+ \NC \type{\startxrow ... \stopxrow} \NC begin end row \NC\MR
+ \NC \type{\startxcell ... \stopxcell} \NC begin end column \NC\MR
+ \NC \type{\startxtablehead ... \stopxtablehead} \NC begin end tablehead \NC\MR
+ \NC \type{\startxtablebody ... \stopxtablebody} \NC begin end tablebody \NC\MR
+ \NC \type{\startxtablefoot ... \stopxtablefoot} \NC begin end tablefoot \NC\MR
+ \NC \type{\setupxtable} \NC table setup \NC\LR
+ \HL
+ \stoptable}
+
+More information and examples can be found in the \goto {\em Extreme Tables} [
+url (manual:extab) ] manual.
+
+\stopsection
+
+\startsection[title=Placing tables]
+
+In all examples you see the command \type{\placetable}. This command has
+the same function as \type{placefigure}. It takes care of the vertical
+spacing and numbering. The float mechanism is invoked and the table will
+end up on the most optimal location in your document.
+
+\shortsetup{placefloat}
+
+You can also set up the layout of tables with:
+
+\shortsetup{setupfloats}
+
+You can set up the numbering and the labels with:
+
+\shortsetup{setupcaptions}
+
+These commands are typed in the set up area of your input file and have a global
+effect on all floating blocks.
+
+\startbuffer
+\setupfloats[location=left]
+\setupcaptions[style=boldslanted,location={right,middle}]
+
+\placetable[here][tab:opening hours]{Library opening hours.}
+ {\bTABLE[offset=4pt]
+ \bTR \bTD \bf Day \eTD \bTD[nx=2,align=middle] \bf Opening hours \eTD \eTR
+ \bTR \bTD Monday \eTD \bTD 14.00 -- 17.30 \eTD \bTD 18.30 -- 20.30 \eTD \eTR
+ \bTR \bTD Tuesday \eTD \bTD \eTD \bTD \eTD \eTR
+ \bTR \bTD Wednesday \eTD \bTD 10.00 -- 12.00 \eTD \bTD 14.00 -- 17.30 \eTD \eTR
+ \bTR \bTD Thursday \eTD \bTD 14.00 -- 17.30 \eTD \bTD 18.30 -- 20.30 \eTD \eTR
+ \bTR \bTD Friday \eTD \bTD 14.00 -- 17.30 \eTD \bTD \eTD \eTR
+ \bTR \bTD Saturday \eTD \bTD 10.00 -- 12.30 \eTD \bTD \eTD \eTR
+ \eTABLE}
+\stopbuffer
+
+\start
+\switchtobodyfont[8pt]
+\typebuffer
+\stop
+
+The result is displayed in \in{table}[tab:opening hours].
+
+\start
+\getbuffer
+\stop
+
+\stopsection
+
+% AFO: the \start ... \stoplinetable mechanism is not stable enough
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-tablesofcontent.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-tablesofcontent.tex
new file mode 100644
index 000000000..0bc81014e
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-tablesofcontent.tex
@@ -0,0 +1,174 @@
+\startcomponent ma-cb-en-tablesofcontent
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Table of contents (lists)]
+
+\index{table of contents}
+\index{list}
+
+\Command{\tex{completecontent}}
+\Command{\tex{placecontent}}
+\Command{\tex{definelist}}
+\Command{\tex{setuplist}}
+\Command{\tex{writetolist}}
+\Command{\tex{writebetweenlist}}
+\Command{\tex{definecombinedlist}}
+\Command{\tex{setupcombinedlist}}
+
+A table of contents contains chapter numbers, chapter titles and page numbers and
+can be extended with sections, sub sections, etc. A table of contents is
+generated automatically by typing:
+
+\starttyping
+\placecontent
+\stoptyping
+
+Which table of contents is produced depends on the location of this command in
+your document. At the start of the document it will generate a list of chapters,
+sections etc. But at the top of a chapter:
+
+\startbuffer
+\chapter{Hasselt in Summer}
+
+\placecontent
+
+\section{Hasselt in July}
+
+\section{Hasselt in August}
+
+\stopbuffer
+
+\typebuffer
+
+it will only produce a list of (sub) section titles with the corresponding
+section numbers and page numbers.
+
+The predefined command \type{\placecontent} is available because it was defined
+with:
+
+\shortsetup{definecombinedlist}
+
+This command and \type{\definelist} allows you to define your own lists necessary
+for accessing your documents.
+
+The use of this command and its related commands is illustrated for the default available
+table of contents.
+
+\startbuffer
+\definelist[chapter]
+\setuplist
+ [chapter]
+ [before=\blank,
+ after=\blank,
+ style=bold]
+
+\definelist[section]
+\setuplist
+ [section]
+ [alternative=d]
+\stopbuffer
+
+\typebuffer
+
+Now there are two lists of chapters and sections and these will be combined in a
+table of contents with the command \type{\definecombinedlist}.
+
+\startbuffer
+\definecombinedlist
+ [content]
+ [chapter,section]
+ [level=subsection]
+\stopbuffer
+
+\typebuffer
+
+Now two commands are available: \type{\placecontent} and \type{\completecontent}.
+With the second command the title of the table of contents will be added to the
+table of contents.
+
+The layout of lists can be varied with the parameter \type{alternative}.
+
+\placetable
+ [here,force]
+ [tab:alternatives]
+ {Alternatives for displaying lists.}
+ {\starttable[|c|l|]
+ \HL
+ \NC \bf Alternative \NC \bf Display \NC\SR
+ \HL
+ \NC \type{a} \NC number -- title -- page number \NC\FR
+ \NC \type{b} \NC number -- title -- spaces -- page number \NC\MR
+ \NC \type{c} \NC number -- title -- dots -- page number \NC\MR
+ \NC \type{d} \NC number -- title -- page number (continuing) \NC\MR
+ \NC \type{e} \NC reserved for interactive purposes \NC\MR
+ \NC \type{f} \NC reserved for interactive purposes \NC\MR
+ \NC \type{g} \NC reserved for interactive purposes \NC\LR
+ \HL
+ \stoptable}
+
+Lists are set up with:
+
+\shortsetup{setuplist}
+\shortsetup{setupcombinedlist}
+
+If you want to change the layout of the generated table of contents you'll have
+to remember that it is a (combined) list and that we can set the partial lists
+separately.
+
+\startbuffer
+\setuplist
+ [section]
+ [textstyle=bold,
+ pagestyle=bold,
+ numberstyle=bold]
+\stopbuffer
+
+\typebuffer
+
+This will result in a bold page number, section title and section number.
+
+Lists are generated and placed with:
+
+\shortsetup{placelist}
+
+So if you want a list of sections at the beginning of a new chapter, you type:
+
+\starttyping
+\placelist[section]
+\stoptyping
+
+only the sections will be displayed.
+
+A long list or a long table of contents will use up more than one page. To be
+able to force page breaking you can type:
+
+\starttyping
+\placecontent[extras={8.2=page}]
+\stoptyping
+
+A page break will then occur after section 8.2.
+
+In some cases you want to be able to write your own text in an automatically
+generated list. This is done with:
+
+\shortsetup{writetolist}
+\shortsetup{writebetweenlist}
+
+For example if you want to make a remark in your table of contents after a
+section titled {\em Hotels in Hasselt} you can type:
+
+\startbuffer
+\section{Hotels in Hasselt}
+\writebetweenlist[section]{\blank}
+\writetolist[section][location=here]{}{Section under construction}
+\writebetweenlist[section]{\blank}
+\stopbuffer
+
+\typebuffer
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-tabulations.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-tabulations.tex
new file mode 100644
index 000000000..5ed877c76
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-tabulations.tex
@@ -0,0 +1,163 @@
+\startcomponent ma-cb-en-tabulations
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=tabulation,title=Tabulation / Paragraph formatting]
+
+\index{tabulation}
+\index{tables+running text}
+\index{columns}
+\Command{\tex{starttabulate}}
+\Command{\tex{definetabulate}}
+\Command{\tex{setuptabulate}}
+\Command{\tex{NR}}
+\Command{\tex{NC}}
+
+Sometimes you want to typeset paragraphs in a specific formatted way. This is
+done with:
+
+\shortsetup{starttabulate}
+
+The tabulation mechanism is closely related to the table mechanism. You can use
+the tabulation mechanism in cases you want to typeset complete paragraphs within
+a cell. The tabulation mechanism also works fine at a page break.
+
+\startbuffer
+\starttabulate[|w(1.5cm)B|p(6.0cm)|p|]
+\NC 1252
+ \NC Hasselt obtains its city charter from bishop Hendrik
+ van Vianden.
+ \NC Hendrik van Vianden was pressed by other towns not
+ to agree with the charter. It took Hasselt a long
+ period of time to convince the Bishop. After
+ supporting the Bishop in a small war against the
+ Drents, the charter was released. \NC\NR
+\NC 1350
+ \NC Hasselt joins the Hanzepact to protect their
+ international trade.
+ \NC The Hanzepact was of great importance for merchants
+ in Hasselt. In those days trading goods were taxed
+ at every city, highway or rivercrossing. After
+ joining the Hanzepact duty free routes all over
+ Europe became available to Hasselt. However
+ important the Hanzepact was, Hasselt always stayed a
+ minor member of the pact. \NC\NR
+\stoptabulate
+\stopbuffer
+
+A tabulate definition could look like this:
+
+\typebuffer
+
+In this case the first column is \unit{1.5 centi meter} wide and is typeset bold
+(\type{B}). The second column has a width of \unit{6 centi meter} and is typeset
+like a paragraph. The remaining horizontal space is used up by the last
+paragraph.
+
+The example is typeset like this:
+
+\getbuffer
+
+The tabulation entries are placed between the \type{\start ... \stoptabulate}
+pair. Between the bracket pair your can specify the tabulate format with the
+column separators \type{|} and the format keys (see \in {table}
+[tab:tabularformattingkeys]).
+
+\placetable[][tab:tabularformattingkeys]
+ {Formatting keys for tabulate.}
+ {\starttable[|lT|l|lT|l|]
+ \HL
+ \NC \rm \bf Key \NC \rm \bf Meaning
+ \NC \rm \bf Key \NC \rm \bf Meaning
+ \NC \SR
+ \HL
+ \NC l \NC left align
+ \NC I \NC \it italic
+ \NC \FR
+ \NC c \NC center
+ \NC R \NC \sl roman
+ \NC \MR
+ \NC r \NC right align
+ \NC S \NC \sl slanted
+ \NC \MR
+ \NC i\sl n \NC spacing left
+ \NC T \NC \tt teletype
+ \NC \MR
+ \NC j\sl n \NC spacing right
+ \NC m \NC in||line math
+ \NC \MR
+ \NC k\sl n \NC spacing around
+ \NC M \NC display math
+ \NC \MR
+ \NC w({\sl d}) \NC 1 line, fixed width
+ \NC f\tex{command} \NC font specification
+ \NC \MR
+ \NC p({\sl d}) \NC paragraph, fixed width
+ \NC b\arg{..} \NC place \type{..} before the entry
+ \NC \MR
+ \NC p \NC paragraph, maximum width
+ \NC a\arg{..} \NC place \type{..} after the entry
+ \NC \MR
+ \NC B \NC \bf boldface
+ \NC h\tex{command} \NC apply \tex{command} on the entry
+ \NC \LR
+ \HL
+ \stoptable}
+
+In \in {table} [tab:tabulatestructurecommands] you find an overview
+of the tabulate structuring commands.
+
+\placetable
+ []
+ [tab:tabulatestructurecommands]
+ {Commands to define tabulate.}
+ {\starttable[|l|l|l|]
+ \HL
+ \NC \bf Command \NC \NC \bf Meaning \NC\SR
+ \HL
+ \NC \type{\start ... \stoptabulate} \NC \NC begin end tabulate \NC\FR
+ \NC \type{\NC} \NC next column \NC next column \NC\MR
+ \NC \type{\NR} \NC next row \NC next row \NC\MR
+ \NC \type{\HL} \NC horizontal line \NC horizontal line \NC\MR
+ \NC \type{\TB} \NC table blank \NC empty line \NC\MR
+ \NC \type{\definetabulate} \NC \NC define own tabulate \NC\MR
+ \NC \type{\setuptabulate} \NC \NC tabulate setup \NC\LR
+ \HL
+ \stoptable}
+
+Another example of paragraph formatting could look like this.
+
+\startbuffer
+\definetabulate[ChemPar][|l|p|l|]
+
+\startChemPar
+\NC Limekilns
+ \NC Hasselt has its own limekilns. These were build in 1504
+ and produced quick lime up to 1956. Nowadays they are a
+ tourist attraction.
+ \NC \inlinechemical{CaCO_3,GIVES,CaO,+,CO_2} \NC\NR
+\stopChemPar
+\stopbuffer
+
+\typebuffer
+
+And it would come out like this:
+
+\getbuffer
+
+In \in{chapter}[chemical] your can find some more information on chemistry
+and \CONTEXT.
+
+Here we also introduced the command to define our own paragraph layout.
+
+\shortsetup{definetabulate}
+
+and we also have:
+
+\shortsetup{setuptabulate}
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-textbackgrounds.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-textbackgrounds.tex
new file mode 100644
index 000000000..0f4689f3f
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-textbackgrounds.tex
@@ -0,0 +1,55 @@
+\startcomponent ma-cb-en-textbackgrounds
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Background in paragraphs]
+
+\index{background+text}
+
+\Command{\tex{setuptextbackground}}
+\Command{\tex{definetextbackground}}
+\Command{\tex{starttextbackground}}
+
+To emphasize a paragraph you can use backgrounds. A background is set with the
+command pair:
+
+\shortsetup{starttextbackground}
+
+An example can illustrate the use:
+
+\startbuffer
+\setuptextbackground
+ [corner=round,frame=on,
+ location=paragraph,
+ leftoffset=.5\bodyfontsize,
+ rightoffset=.5\bodyfontsize,
+ bottomoffset=5pt]
+
+\starttextbackground
+Hasselt has produced a number of well known people. Only recently
+it turned out that Kilian van Rensselaer played a prominent role
+in the foundation of the State of New York.
+\stoptextbackground
+\stopbuffer
+
+\typebuffer
+
+This would be displayed as:
+
+\getbuffer
+
+Backgrounds can span multiple pages.
+
+You can vary the display of the backgrounds with:
+
+\shortsetup{setuptextbackground}
+
+You can even define your own text backgrounds with:
+
+\shortsetup{definetextbackground}
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-texteditor.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-texteditor.tex
new file mode 100644
index 000000000..bed8017d5
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-texteditor.tex
@@ -0,0 +1,32 @@
+\startcomponent ma-cb-en-texteditor
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=texteditor,title=The \SCITE\ text editor]
+
+The developers of \CONTEXT\ have always been able to proces their \TEX\ files
+from a text editor. In that way \CONTEXT\ became an effective authoring tool.
+
+At this moment the text editors \SCITE\ and \TEXWORKS\ are more or less part of
+the \CONTEXT\ distribution.
+
+Please refer to the \goto {\CONTEXTWIKI} [ url (http://wiki.contextgarden.net/Windows_Installation:_ConTeXt_Suite_with_SciTe) ]
+and learn how to install \SCITE.
+
+\SCITE\ supports the:
+
+\startitemize[packed]
+\item processing \TEX\ of files
+\item colored display of commands (lexing)
+\item syntax checking of \TEX, \XML\ and \LUA\ files
+\item spell checking of your text
+\stopitemize
+
+The \CONTEXT\ specific support of \SCITE\ is described in the manual \goto
+{\SCITE\ in \CONTEXT} [ url (manual:scite) ].
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-units.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-units.tex
new file mode 100644
index 000000000..ce596c0b5
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-units.tex
@@ -0,0 +1,101 @@
+\startcomponent ma-cb-en-units
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[reference=units,title=Units]
+
+\index{units}
+\index[siunit]{SI--unit}
+
+\Command{\tex{unit}}
+
+To force yourself to use dimensions and units consistently throughout your
+document you can use the \type{\unit} command. Let's give a few examples:
+
+\startbuffer
+\unit{meter per square meter}
+\unit{cubic meter per sec}
+\unit{square milli meter per inch}
+\unit{centi liter per sec}
+\unit{meter inverse sec}
+\unit{newton per square inch}
+\unit{newton times meter per square sec}
+\stopbuffer
+
+\typebuffer
+
+It looks like a lot of typing but it does guarantee a consistent use of units.
+The command \type{\unit} also prevents linebreaking between number and unit.
+The examples above come out as:
+
+\startnarrower
+\startlines
+\getbuffer
+\stoplines
+\stopnarrower
+
+You can add your own units with:
+
+\shortsetup{registerunit}
+
+and set them up with:
+
+\shortsetup{setupunit}
+
+\startbuffer
+\registerunit[unit][inhab=inhabitants] \setupunittext[inhabitants=inh]
+\registerunit[unit][north=north] \setupunittext[north= N]
+\registerunit[unit][east=east] \setupunittext[east= E]
+
+Hasselt is part of the municipality of Zwartewaterland
+(coordinates \unit {52 degrees 35 arcminute north},
+\unit {6 degrees 5 arcminute east}). Its area is about
+\unit {88 square kilometer} (land \unit {83 square kilom}
+and water \unit{5 square km}). As of 1st Augustus 2013 the
+population is 22.201 that is \unit {268 inhab per square kilo
+meter}).
+\stopbuffer
+
+In the example below you can see some new units and the non-consistent
+use of \unit{kilo meter}.
+
+\typebuffer
+
+This results in:
+
+\getbuffer
+
+The \type{\unit} command also allows you to align rows of units in a column.
+
+\startbuffer
+\bTABLE
+\bTR \bTD \bf Street \eTD \bTD \bf Length \eTD \eTR
+\bTR \bTD Ridderstraat \eTD \bTD \unit{_,160 meter} \eTD \eTR
+\bTR \bTD Prinsengracht \eTD \bTD \unit{_,240 meter} \eTD \eTR
+\bTR \bTD Kalverstraat \eTD \bTD \unit{_,_60 meter} \eTD \eTR
+\bTR \bTD H.A.W. van de Vechtlaan \eTD \bTD \unit{1,250 meter} \eTD \eTR
+\bTR \bTD Meestersteeg \eTD \bTD \unit{_,_45 meter} \eTD \eTR
+\eTABLE
+\stopbuffer
+
+When you type:
+
+\typebuffer
+
+It will generate a well aligned second column:
+
+\bgroup
+\setupTABLE[frame=off,offset=0pt]
+\setupTABLE[c][1][width=4.5cm]
+
+\getbuffer
+\egroup
+
+Please refer to the manual \goto {\em Units} [ url(manual:units) ] for more
+information and details.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-usersetups.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-usersetups.tex
new file mode 100644
index 000000000..2d89e937a
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-usersetups.tex
@@ -0,0 +1,68 @@
+\startcomponent ma-cb-en-usersetups
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=User specifications]
+
+\index{preamble}
+\index{input file}
+
+The setup area of your document is the area before
+the \type{\starttext} command. For example:
+
+\setuptyping
+ [escape=yes]
+
+\definestartstop
+ [comment][style={\rm}]
+
+\starttyping
+ /BTEX \comment{first line of your file} /ETEX
+\setuplayout[width=25cm] /BTEX \comment{set the width of your text} /ETEX
+ /BTEX \comment{empty line for readability} /ETEX
+\starttext /BTEX \comment{starts your text} /ETEX
+Hello Hasselt. /BTEX \comment{your text} /ETEX
+\stoptext /BTEX \comment{ends your text} /ETEX
+\stoptyping
+
+Note that the first line of this file is empty. However, this first line
+is a preamble and can be used for specific user specifications. For example:
+
+\starttyping
+% engine=luatex /BTEX \comment{use the \type{luatex} engine} /ETEX
+ /BTEX \comment{empty line for readability} /ETEX
+\setuplayout[width=25cm] /BTEX \comment{set the width of your text} /ETEX
+ /BTEX \comment{empty line for readability} /ETEX
+\starttext /BTEX \comment{starts your text} /ETEX
+Hello Hasselt. /BTEX \comment{your text} /ETEX
+\stoptext /BTEX \comment{ends your text} /ETEX
+\stoptyping
+
+Note that \CONTEXT\ sees the text after the \type{ % }
+sign in this first line not as a comment.
+
+The preamble can have a meaning for both \CONTEXT\ and \SCITE:
+
+\starttyping
+% engine=pdftex interface=en modes=screen language=uk
+
+\starttext
+Hello Hasselt.
+\stoptext
+\stoptyping
+
+This will be interpreted as:
+
+\starttabulate[|T||p|]
+\NC engine=pdftex \NC \CONTEXT \EQ run as \PDFTEX \NC\NR
+\NC interface=en \NC \CONTEXT \EQ expect english \CONTEXT\ commands (lexing) \NC\NR
+\NC \NC \SCITE \EQ use english lexing \NC\NR
+\NC modes=screen \NC \CONTEXT \EQ invoke mode \type{screen} that is set in the text \NC\NR
+\NC language=uk \NC \SCITE \EQ use the english spell checker \NC\NR
+\stoptabulate
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en-whatever.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en-whatever.tex
new file mode 100644
index 000000000..aa61bb0cb
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en-whatever.tex
@@ -0,0 +1,1079 @@
+\startcomponent ma-cb-en-whatever
+
+\enablemode[**en-us]
+
+\project ma-cb
+
+\startchapter[title=Miscellaneous]
+
+\startsection[title=A titlepage]
+
+\index{titlepage}
+
+\Command{\tex{startstandardmakeup}}
+\Command{\tex{definemakeup}}
+\Command{\tex{setupmakeup}}
+
+In the first example of this manual on \at{page}[inputfile] we used the command:
+
+\shortsetup{startnamemakeup}
+%\shortsetup{start<<name>>makeup} % does not work
+
+This command can be used to define titlepages. Such a command is needed since
+title pages often have a different layout than that of the bodytext. With the
+command pair \type{\start ... \stopstandardmakeup} you can make up a page within
+the default page dimensions.
+
+A simple titlepage may look like this:
+
+\startbuffer
+\startstandardmakeup
+\blank
+\rightaligned{\tfd Hasselt in the 21st century}
+\blank
+\rightaligned{\tfb The future}
+\vfill
+\rightaligned{\tfa C. van Marle}
+\rightaligned{Hasselt, 2013}
+\stopstandardmakeup
+\stopbuffer
+
+\typebuffer
+
+In a doublesided document you have to go through some additional actions to
+typeset the back of the titlepage.
+
+\startbuffer
+\startstandardmakeup[doublesided=no]
+\blank
+\rightaligned{\tfd Hasselt in the 21st century}
+\blank
+\rightaligned{\tfb The future}
+\vfill
+\rightaligned{\tfa C. van Marle}
+\rightaligned{Hasselt, \currentdate[year]}
+\stopstandardmakeup
+\startstandardmakeup[page=no]
+\vfill
+\copyright \currentdate[year]
+
+This book is dedicated to the people living in Hasselt. We
+want to thank photographer J. Jonker for manipulating the
+photos in this book in such a way that readers can get a
+clear picture of Hasselt's future look.
+\stopstandardmakeup
+\stopbuffer
+
+\typebuffer
+
+Your own make ups can be made and set up with:
+
+\shortsetup{definemakeup}
+
+and
+
+\shortsetup{setupmakeup}
+
+Please refer to the \goto {\CONTEXTWIKI} [ url (http://wiki.contextgarden.net/Command/setupmakeup) ]
+for more information on the \type{\start...\stopmakeup} command.
+
+\stopsection
+
+\startsection[reference=overlays,title=Overlays]
+
+\index{overlay}
+
+The overlay mechanism gives you the opportunity to add a specific layout
+to a text component. When there is a background option in a \CONTEXT\ command
+you can use overlays.
+
+\startbuffer
+\defineoverlay
+ [verticalbar]
+ [{\blackrule[height=2cm,width=.5cm,color=red]}]
+
+\defineoverlay
+ [horizontalbar]
+ [{\blackrule[height=.5cm,width=12cm,color=red]}]
+
+\framed
+ [width=12cm,
+ height=6cm,
+ background={color,foreground,verticalbar,horizontalbar},
+ offset=overlay,
+ backgroundcolor=blue,
+ frame=off]
+ {\blackrule[width=12cm,height=2cm,color=white]}
+\stopbuffer
+
+The flag of Hasselt could be defined with framed and a number of overlays:
+
+\typebuffer
+
+This will become:
+
+\startlinecorrection
+\getbuffer
+\stoplinecorrection
+
+The pagenumber in this manual has a background with an overlay where the
+\type{\MPclipFive} command takes care of drawing the image with \METAPOST.
+
+\startbuffer
+\defineoverlay
+ [NumberBackground]
+ [\MPclipFive{\overlaywidth}{\overlayheight}{30pt}{5pt}]
+
+\setuppagenumbering
+ [\location={footer,middle},
+ \command=\NummerCommand]
+
+\def\NummerCommand#1%
+ {\framed
+ [\background=NumberBackground,
+ \frame=off,
+ \offset=6pt]
+ {\lower.5\dp\strutbox\hbox spread 60pt{\hss#1\hss}}}
+\stopbuffer
+
+\typebuffer
+
+\stopsection
+
+\startsection[reference=setups,title=Setups]
+
+\index{setups}
+
+\Command{\tex{setup}}
+
+While defining the layout of a document you can define setups
+with \type{\start...\stopsetups}. Setups are placed in the setup area of
+input file and mostly used to combine a number of commands.
+
+\startbuffer
+\startsetups colorize
+ \blue
+\stopsetups
+
+\startsetups decolorize
+ \black
+\stopsetups
+
+\setupitemize
+ [before=\setups{colorize},
+ after=\setups{decolorize}]
+
+Some data on the church are:
+
+\startitemize[packed,3*broad]
+\sym{997} mentioned for the first time
+\sym{1380} destroyed by fire
+\sym{1466} rebuild
+\sym{1657} restored after shelling by enemy troops
+\sym{1725} struck by lightning
+\stopitemize
+
+\stopbuffer
+
+\typebuffer
+
+Which would result in:
+
+\start % AFO: to keep color and distance local
+\getbuffer
+\stop
+
+Another way of invoking the setups is by the \type{setups} option
+that comes with some \CONTEXT\ commands:
+
+\startbuffer
+\definestartstop[remark]
+
+\setupstartstop[remark]
+ [before=\startframed,
+ after=\stopframed]
+
+\startsetups important
+ \inleftmargin
+ [scope=local,
+ hoffset=1em]{\bf\color[blue]{→}}
+\stopsetups
+
+\setupframed
+ [align=normal,
+ setups=important,
+ frame=on,
+ framecolor=blue,
+ offset=5pt]
+
+\startremark
+ The Stephanus Church was built in 997. After an enormous
+ fire in 1380 it was rebuilt and that's why it has Gothic
+ features. The rebuilding was finished in 1466.\endgraf
+\stopremark
+\stopbuffer
+
+\typebuffer
+
+This becomes:
+
+\blank
+
+\start
+\getbuffer
+\stop
+
+\stopsection
+
+\startsection[reference=variables,title=Variables]
+
+\index{variables}
+
+\Command{\tex{getvariable}}
+\Command{\tex{setvariables}}
+
+There is a mechanism in \CONTEXT\ that enables you to compact information in a
+list of variables that you can recall throughout the document.
+
+\shortsetup{setvariables}
+
+The example below shows how to use variables in defining a coverpage.
+
+\startbuffer
+\setvariables
+ [cover]
+ [set=\setups{coverpage},
+ student=no,
+ teacher=yes,
+ title=From Hasselt to America,
+ subtitle=An Odyssey,
+ authors=\setup{allauthors},
+ edition=2012,
+ isbn=0123456789]
+\stopbuffer
+
+\typebuffer
+
+The moment you need the title on your cover page (or somewhere else in your document) you can
+summon it by:
+
+\startbuffer
+\getvariable{cover}{title}
+\stopbuffer
+
+\typebuffer
+
+\stopsection
+
+\startsection[reference=floatingblocks,title=Floating blocks]
+
+\index{floating blocks}
+\index{postponing a block}
+
+\Command{\tex{definefloat}}
+\Command{\tex{setupfloat}}
+\Command{\tex{setupfloats}}
+\Command{\tex{setupcaptions}}
+\Command{\tex{placeintermezzo}}
+
+A block in \CONTEXT\ is a text element, for example a table or a figure that you
+can process in a special way. You have already seen the use of
+\type{\placefigure} and \type{\placetable}. These are both examples of floating
+blocks. The floating mechanism is described in \in{chapter}[figures] and
+\in[tables].
+
+You can define these kind of blocks yourself with:
+
+\shortsetup{definefloat}
+
+The bracket pairs are used for the name in singular and
+plural form. For example:
+
+\starttyping
+\definefloat[intermezzo][intermezzi]
+\stoptyping
+
+Now the following commands are available:
+
+\starttyping
+\placeintermezzo[][]{}{}
+\startintermezzotext ... \stopintermezzotext
+\placelistofintermezzi
+\completelistofintermezzi
+\stoptyping
+
+The newly defined floating block can be set up with:
+
+\shortsetup{setupfloat}
+
+You can set up the layout of floating blocks with:
+
+\shortsetup{setupfloats}
+
+You can set up the numbering and the labels with:
+
+\shortsetup{setupcaption}
+
+These commands are typed in the set up area of your input file and will have a
+global effect on all floating blocks.
+
+\setupframedtexts
+ [width=.8\makeupwidth,
+ background=color,
+ backgroundcolor=gray,
+ corner=round,
+ framecolor=blue,
+ rulethickness=2pt]
+
+\startbuffer
+\setupfloat[intermezzo][location=middle]
+\setupcaption[location=bottom,headstyle=boldslanted]
+
+\placeintermezzo{An intermezzo.}
+\startframedtext
+At the beginning of this century there was a tram line from
+Zwolle to Blokzijl via Hasselt. Other means of transport became
+more important and just before the second world war the tram line
+was stopped. Nowadays such a tram line would have been very
+profitable.
+\stopframedtext
+\stopbuffer
+
+\typebuffer
+
+\start
+\getbuffer
+\stop
+
+The framed texts inherits its layout from the example \at{page}[block:bridge].
+
+Tables or figures may take up a lot of space. The placing of these text elements
+can be postponed till the next page break. This is done with:
+\type{\start ... \stoppostponing}:
+
+\startbuffer
+\startpostponing
+\placefigure
+ {A postponed figure.}
+ {\externalfigure[ma-cb-16][width=\textwidth]}
+\stoppostponing
+\stopbuffer
+
+\typebuffer
+
+The figure will be placed at the top of the next page and will cause minimal
+disruption of the running text.
+
+\getbuffer
+
+\stopsection
+
+% \startsection[reference=textblocks,title=Text blocks] % AFO 2013: weggehaald, wordt toch nooit gebruikt
+
+% \index{text blocks}
+
+% \Command{\tex{defineblock}}
+% \Command{\tex{useblocks}}
+% \Command{\tex{hideblocks}}
+% \Command{\tex{setupblock}}
+
+% \stopsection
+
+\startsection[title=Storing text for later use]
+
+\index{storing text}
+
+\Command{\tex{startbuffer}}
+\Command{\tex{getbuffer}}
+\Command{\tex{typebuffer}}
+\Command{\tex{savebuffer}}
+\Command{\tex{setupbuffer}}
+
+You can store information temporarily for future use in your document with:
+
+\shortsetup{startbuffer}
+
+For example:
+
+\starttyping
+\startbuffer[visit]
+If you want to see what Hasselt has in store you should come and
+visit it some time. If you take this manual with you, you will
+recognise some locations.
+\stopbuffer
+
+\getbuffer[visit]
+\stoptyping
+
+With \type{\getbuffer[visit]} you recall the stored text. The logical name is
+optional. With \type{\typebuffer[visit]} you get back the typeset version of the
+content of the buffer.
+
+Buffers are set up with:
+
+\shortsetup{setupbuffer}
+
+You can also save a buffer to an external file with:
+
+\shortsetup{savebuffer}
+
+If you want to save the buffer \type{visit} in an external file called
+\type{myfile-sightseeing.tmp} you type:
+
+\starttyping
+\savebuffer[visit][sightseeing]
+\stoptyping
+
+\stopsection
+
+\startsection[title=Lines]
+
+\index{lines}
+
+\Command{\tex{hairline}}
+\Command{\tex{starttextrule}}
+\Command{\tex{thinrule}}
+\Command{\tex{thinrules}}
+\Command{\tex{setupthinrules}}
+\Command{\tex{underbar}}
+\Command{\tex{overstrikes}}
+\Command{\tex{periods}}
+
+There are many comands to draw lines. For a single line you type:
+
+\shortsetup{hairline}
+
+or:
+
+\shortsetup{thinrule}
+
+For more lines you type:
+
+\shortsetup{thinrules}
+
+Text in combination with lines is also possible:
+
+\startbuffer
+\starttextrule{Hasselt -- Amsterdam}
+If you draw a straight line from Hasselt to Amsterdam you would have
+to cover a distance of almost 145 \unit{Kilo Meter}.
+\stoptextrule
+
+If you draw two straight lines from Hasselt to Amsterdam you would
+have to cover a distance of almost 290 \unit{Kilo Meter}.
+
+Amsterdam \thinrules[n=3] Hasselt
+\stopbuffer
+
+\getbuffer
+
+The code of this example is:
+
+\typebuffer
+
+You always have to be careful in drawing lines. Empty lines around
+\type{\thinrules} must not be forgotten and the vertical spacing is always a
+point of concern.
+
+You can set up line spacing with:
+
+\shortsetup{setupthinrules}
+
+There are a few complementary commands that might be very
+useful.
+
+\shortsetup{setupfillinrules}
+
+These commands are introduced in the examples below:
+
+\startbuffer
+\setupfillinrules[width=2cm]
+\setupfillinlines[width=3cm]
+
+\fillinrules[n=1]{\bf name}
+\fillinrules[n=3]{\bf adress}
+
+\fillinline{Can you please state the \underbar{number} of houses
+ in Hasselt.} \par
+
+Strike out \overstrikes{Hasselt in this text}\periods[18]
+\stopbuffer
+
+\typebuffer
+
+This will become:
+
+\getbuffer
+
+These commands are used in questionaires. Text that is
+struck out or underlined will not be hyphenated.
+
+In \in{section}[overlays] you have already seen the use of the
+\type{\blackrule} command that can be set up with:
+
+\shortsetup{setupblackrules}
+
+\startbuffer
+\blank
+\blackrule[width=\textwidth,height=1cm,color=blue]
+\stopbuffer
+
+\typebuffer
+
+This will result in a rather fat line:
+
+\getbuffer
+
+
+\stopsection
+
+\startsection[title=Super- and subscript in text]
+
+\index{subscript}
+\index{superscript}
+
+\Command{\tex{low}}
+\Command{\tex{high}}
+\Command{\tex{lohi}}
+
+\startbuffer
+Hasselt's economy has known its \high{ups} and \low{downs}.
+Since the nineties of the last century its economy is
+\lohi{so}{so}.
+\stopbuffer
+
+\getbuffer
+
+This ugly text was made with \type{\low{}}, \type{\high{}} and \type{\lohi{}{}}.
+The text was placed between the curly braces.
+
+\stopsection
+
+\startsection[title=Date]
+
+\index{date}
+
+\Command{\tex{currentdate}}
+
+You can invoke the system date in your text with:
+
+\shortsetup{currentdate}
+
+With \type{\currentdate[day]}, \type{\currentdate[month]} and \type{\currentdate[year]} you can
+invoke day, month and year separately.
+
+\stopsection
+
+\startsection[title=Rotating text, figures and tables]
+
+\index{rotating}
+
+\Command{\tex{rotate}}
+
+Sometimes you may want to rotate text or images. You can rotate
+text and other objects with:
+
+\shortsetup{rotate}
+
+The first bracket pair is optional. Within that bracket pair
+you specify the rotation: \type{rotation=90}. The curly
+braces contain the text or object you want to rotate.
+
+\startbuffer
+Hasselt got its municipal rights in 1252. From that time on it had
+the \rotate[rotation=90]{right} to use its own seal on official
+documents. This seal showed Holy Stephanus known as one of the first
+Christian martyrs, and was the \rotate[rotation=270]{patron} of
+Hasselt. After the Reformation the seal was redesigned and Stephanus
+lost his \quote{holiness} and was from that time on depicted without
+his aureole.
+\stopbuffer
+
+\typebuffer
+
+This results in a very ugly paragraph:
+
+\getbuffer
+
+You can rotate an image just as easily:
+
+% \placetable[rotate][]{}{}
+
+\startbuffer
+\placefigure
+ [][fig:rotation]
+ {The 180 \unit{Degrees} rotated fishing port (de Vispoort).}
+ {\rotate[rotation=180]{\externalfigure[ma-cb-15][width=10cm]}}
+\stopbuffer
+
+\typebuffer
+
+You can see in \in{figure}[fig:rotation] that it is not always clear what you get
+when you rotate.
+
+\getbuffer
+
+We can set up rotating with:
+
+\shortsetup{setuprotate}
+
+In the example above you could also rotate image and caption by:
+
+\startbuffer
+\placefigure
+ [180][fig:rotation]
+ {The 180 \unit{Degrees} rotated fishing port (de Vispoort).}
+ {\externalfigure[ma-cb-15][width=10cm]}
+\stopbuffer
+
+\typebuffer
+
+\stopsection
+
+\startsection[title=Scaling text]
+
+\index{scaling}
+
+\Command{\tex{scale}}
+\Command{\tex{setupscale}}
+
+For some obscure reasons you may want to scale text. You can scale text and other
+objects with:
+
+\shortsetup{scale}
+
+\startbuffer
+After 1810 the Dedemsvaart brought some prosperity to Hasselt. All
+ships went through the canals of Hasselt and the \scale[factor=10]{shops} on both
+sides of the canals \scale[factor=10]{prospered}.
+\stopbuffer
+
+\typebuffer
+
+Which will result in:
+
+\getbuffer
+
+\stopsection
+
+\startsection[title=Space]
+
+\index{space}
+\index{tilde}
+\index{non-breakable space}
+
+\Command{\tex{space}}
+\Command{\tex{fixedspaces}}
+
+The command \type{\space} will produce a space. In \CONTEXT\ the
+\type{~} (tilde) is a non-breakable space.
+
+\startbuffer
+The Ridderstraat in Hasselt is about 160~m long and 5 to 6~m wide
+with houses on both sides of the street.
+\stopbuffer
+
+\typebuffer
+
+Tildes can also be used to align numbers in a row. The command
+\type{\fixedspaces} will give the tilde the fixed width of a number.
+
+\startbuffer
+\fixedspaces
+
+\bTABLE[frame=off]
+\bTR \bTD Ridderstraat \eTD \bTD 160 m \eTD \eTR
+\bTR \bTD Prinsengracht \eTD \bTD 240 m \eTD \eTR
+\bTR \bTD Kalverstraat \eTD \bTD ~60 m \eTD \eTR
+\bTR \bTD Meestersteeg \eTD \bTD ~45 m \eTD \eTR
+\eTABLE
+\stopbuffer
+
+\typebuffer
+
+\stopsection
+
+\startsection[title=Carriage return]
+
+\index{carriage return}
+
+\Command{\tex{crlf}}
+\Command{\tex{startlines}}
+
+A new line can be enforced with:
+
+\shortsetup{crlf}
+
+As a \CONTEXT\ user you should use this command only as a last resort.
+
+When a number of lines should be followed by a {\em carriage return and line feed}
+you can use:
+
+\shortsetup{startlines}
+
+\starttyping
+\startlines
+.
+.
+.
+\stoplines
+\stoptyping
+
+\startbuffer
+On a wooden panel in the town hall of Hasselt you can read:
+
+\startlines
+Heimelijcken haet
+eigen baet
+jongen raet
+Door diese drie wilt verstaen
+is het Roomsche Rijck vergaen.
+\stoplines
+
+This little rhyme contains a warning for the magistrates of
+Hasselt: don't allow personal benefits or feelings to
+influence your wisdom in decision making.
+\stopbuffer
+
+\typebuffer
+
+This will become:
+
+\getbuffer
+
+In a few commands new lines are generated by \type{\\}. For example if you type
+\type{\inmargin{in the\\margin}} then the text will be divided over two lines.
+
+\stopsection
+
+\startsection[title=Hyphenation]
+
+\index{hyphenation}
+\index{language}
+
+\Command{\tex{mainlanguage}}
+\Command{\tex{language}}
+\Command{\tex{nl}}
+\Command{\tex{en}}
+
+When writing multi-lingual texts you have to be aware of the fact that
+hyphenation may differ from one language to another.
+
+To activate a language you type:
+
+\shortsetup{mainlanguage}
+
+Between the brackets you fill in
+\type{af},
+\type{ca},
+\type{cs},
+\type{cs},
+\type{da},
+\type{de},
+\type{en},
+\type{fi},
+\type{fr},
+\type{it},
+\type{la},
+\type{nl},
+\type{nb},
+\type{nn},
+\type{pl},
+\type{pt},
+\type{es},
+\type{sv} and
+\type{tr} for
+afrikaans,
+catalan,
+czech,
+slovak,
+danish,
+german,
+english,
+finnish,
+french,
+italian,
+latin,
+dutch,
+bokmal,
+nnynorsk,
+polish,
+portuguese,
+spanish,
+swedish and
+turkish respectively.
+
+To change from one language to another you can use:
+
+\starttyping
+\language[nl] \language[en] \language[de] \language[fr] \language[sp] ...
+\stoptyping
+
+or the shorthand versions:
+
+\starttyping
+\nl \en \de \fr \sp ...
+\stoptyping
+
+An example:
+
+\startbuffer
+If you want to know more about Hasselt, the best book to read is
+probably \quote{\nl Uit de geschiedenis van Hasselt} by
+F.~Peereboom.
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+If a word is wrongly hyphenated you can define the hyphenation points yourself.
+This is done in the set up area of your input file:
+
+\startbuffer
+\hyphenation{his-to-ry}
+\stopbuffer
+
+\typebuffer
+
+Note that the language setting is also responsible for the way quotes are placed
+around quotes and quotations (see \in{section}[quotations]).
+
+In some languages (like Dutch) compound words are used that are connected with a
+hyphen. The separate words have to be hyphenated correctly. In order to do that
+you can use \type{||}.
+
+\startbuffer
+If your looking for an English||speaking person in Hasselt you should
+go to the Tourist Information Office. There you may expect to find
+full|| and part||time employees who are fluent in German, English,
+French and of course Dutch.
+\stopbuffer
+
+\typebuffer
+
+This will become:
+
+\getbuffer
+
+The double \type{||} takes care of the hyphen and the correct hyphenation of the
+separate words. Also note the suspended compounds.
+
+\stopsection
+
+\startsection[title=Charts]
+
+\index{chart}
+
+\Command{\tex{FLOWchart}}
+
+To enable you to draw flow diagrams \CONTEXT\ contains the core module
+\type{chart}. A simple organogram may look like this:
+
+\startbuffer
+\setupFLOWcharts
+ [width=9\bodyfontsize,
+ height=2\bodyfontsize,
+ dx=1\bodyfontsize,
+ dy=1\bodyfontsize]
+
+\setupFLOWlines
+ [arrow=no]
+
+\startFLOWchart[organogram]
+ \startFLOWcell
+ \shape {action}
+ \name {01}
+ \location {2,1}
+ \text {Zwartewaterland}
+ \connect [bt]{02}
+ \connect [bt]{03}
+ \connect [bt]{04}
+ \stopFLOWcell
+ \startFLOWcell
+ \shape {action}
+ \name {02}
+ \location {1,2}
+ \text {Hasselt}
+ \stopFLOWcell
+ \startFLOWcell
+ \shape {action}
+ \name {03}
+ \location {2,2}
+ \text {Zwartsluis}
+ \stopFLOWcell
+ \startFLOWcell
+ \shape {action}
+ \name {04}
+ \location {3,2}
+ \text {Genemuiden}
+ \stopFLOWcell
+\stopFLOWchart
+\stopbuffer
+
+\midaligned{\getbuffer\FLOWchart[organogram]}
+
+This diagram is defined with the commands below:
+
+\typebuffer
+
+It is of good practice to define your setups and flow diagrams in separate
+definition files (environments).
+
+\startbuffer
+\FLOWchart[organogram]
+\stopbuffer
+
+The flowchart can then be invoked by:
+
+\typebuffer
+
+\stopsection
+
+\startsection[title=Comment in input file]
+
+\index{comment}
+\index[percent]{\% in input file}
+
+All text between \type{\start...\stoptext} will be processed while running
+\CONTEXT. Sometimes however you may have text fragments you don't want to be
+processed or you want to comment on your \CONTEXT\ commands.
+
+If you preceed your text with the percentage sign \type{%}
+it will not be processed.
+
+\startbuffer
+% In very big documents you can use the command \input for
+% different files.
+%
+% For example:
+%
+% \input hass01.tex % chapter 1 on Hasselt
+% \input hass02.tex % chapter 2 on Hasselt
+% \input hass03.tex % chapter 3 on Hasselt
+\stopbuffer
+
+\typebuffer
+
+When you delete the \type{%} before \type{\input} the three files will be
+processed. The comment describing the contents of the files will not be
+processed.
+
+\stopsection
+
+\startsection[title=Notes]
+
+\index{note}
+
+\Command{\tex{startcomment}}
+
+If you want your comment in the input file visible as a 'note' in the PDF file
+you can use:
+
+\shortsetup{startcomment}
+
+\startbuffer
+\startcomment
+ The image of the Vispoort should be in color.
+\stopcomment
+\stopbuffer
+
+\typebuffer
+
+The command will produce a sticky note in the PDF.
+
+The note is only visible when interactivity is set with \type{\setupinteraction}
+and the comment with \type{\setupcomment}.
+
+\stopsection
+
+\startsection[title=Hiding text]
+
+\index{hiding text}
+
+\Command{\tex{starthiding}}
+
+Text can be hidden with:
+
+\shortsetup{starthiding}
+
+The text between \type{\start ... \stophiding} will not be processed.
+
+\stopsection
+
+\startsection[title=Input of another {\tt tex} file]
+
+\index{input other \TEX--files}
+
+\Command{\tex{input}}
+
+In a number of situations you may want to insert other \TEX\ files in your input
+file. For example, sometimes it is more efficient to specify \CONTEXT\ sources in
+more than one file in order to be able to partially process your files.
+
+Another file (with the name \type{another.tex}) can be inserted by:
+
+\starttyping
+\input another.tex
+\stoptyping
+
+The extension is optional so this will work too:
+
+\starttyping
+\input another
+\stoptyping
+
+The command \type{\input} is a \TEX\ command.
+
+For a more systematic approach in maintaining your documents \CONTEXT\ supports a
+project structure with commands like \type{\start...\stopenvironment} and
+\type{\start...\stopproduct}. Please refer to the magazine
+\goto {\em Project structure} [ url(thisway:proj-struc) ]
+for more information.
+
+\stopsection
+
+\startsection[title=XML (eXtended Markup Language)]
+
+\index{xml}
+\index{mathml}
+\index{openmath}
+
+Normally you code your document with \CONTEXT\ commands so you can tell \CONTEXT\
+what to do with the coded text elements.
+
+A more rigid way to code your content is \XML\ (eXtended Markup Language) which enables
+you to have more control over your content (scripting, xslt, validation). A simple
+\XML\ coded document could look like this:
+
+\startbuffer
+<?xml version='1.0' standalone='yes?>
+
+<document>
+ <section>
+ <title>Hasselt in winter</title>
+ <content>
+ <p>In winter scating is a very popular sport in Hasselt.
+ All over Hasselt the frozen canals offer children a great
+ play ground.</p>
+ <p>...</p>
+ </content>
+ </section>
+</document>
+\stopbuffer
+
+\typebuffer
+
+\CONTEXT\ is able to deal with \XML\ directly without underlying XML2TEX
+conversions. Please refer to the manual \goto {Dealing with XML} [ url
+(manual:xml) ] for more information on how to process \XML\ documents.
+
+\CONTEXT\ also supports \MATHML\ (presentational and content markup) and
+\OPENMATH\ with which math expressions can be coded in \XML\ documents.
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
+
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en.pdf b/doc/context/sources/general/manuals/start/en/ma-cb-en.pdf
new file mode 100644
index 000000000..6ad164eb0
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-en.tex b/doc/context/sources/general/manuals/start/en/ma-cb-en.tex
new file mode 100644
index 000000000..2e0b283af
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-en.tex
@@ -0,0 +1,86 @@
+% interface=english language=uk modes=screen,bound
+
+% \showframe
+
+\startproduct ma-cb-en
+
+\project ma-cb
+
+% \disabledirectives[otf.kernruns]
+% \disabledirectives[otf.discruns]
+% \disabledirectives[otf.compruns]
+
+\startdocument
+ [title={\ConTeXt\ Mark IV\crlf an excursion},
+ subtitle={English\crlf version},
+ author={Ton Otten\crlf PRAGMA ADE}]
+
+\startfrontmatter
+
+ \component ma-cb-en-introduction
+
+\stopfrontmatter
+
+\startbodymatter
+
+ \component ma-cb-en-document
+ \component ma-cb-en-gettingstarted
+ \component ma-cb-en-specialcharacters
+ \component ma-cb-en-structure
+ \component ma-cb-en-setupcommands
+ \component ma-cb-en-heads
+ \component ma-cb-en-itemizations
+ \component ma-cb-en-math
+ \component ma-cb-en-chemical
+ \component ma-cb-en-units
+ \component ma-cb-en-bibliography
+ \component ma-cb-en-figures
+ \component ma-cb-en-tables
+ \component ma-cb-en-tabulations
+ \component ma-cb-en-columns
+ \component ma-cb-en-footnotes % Hans: zie lokale voetnoot tabel
+ \component ma-cb-en-citations
+ \component ma-cb-en-descriptions
+ \component ma-cb-en-enumerations
+ \component ma-cb-en-frames % Hans 2015: "background=linear shape" werkt niet en zorgt ervoor dat de background van de shortsetup niet meer werken
+ \component ma-cb-en-framedtexts
+ \component ma-cb-en-margintexts
+ \component ma-cb-en-pages
+ \component ma-cb-en-headers
+ \component ma-cb-en-tablesofcontent
+ \component ma-cb-en-registers
+ \component ma-cb-en-synonyms
+ \component ma-cb-en-sortedlists
+ \component ma-cb-en-references
+ \component ma-cb-en-color
+ \component ma-cb-en-alignments
+ \component ma-cb-en-interactivity % Hans: de soundtrack werkt niet en crossref met hasseltbook.tex werkt niet
+ \component ma-cb-en-fonts
+ \component ma-cb-en-composedcharacters
+ \component ma-cb-en-layout
+ \component ma-cb-en-pagebackgrounds
+ \component ma-cb-en-textbackgrounds
+ \component ma-cb-en-paragraphs
+ \component ma-cb-en-commands
+ \component ma-cb-en-whatever
+ \component ma-cb-en-modules
+ \component ma-cb-en-presentations
+ \component ma-cb-en-metapost
+ \component ma-cb-en-usersetups
+
+\stopbodymatter
+
+\startappendices
+
+ \component ma-cb-en-mathcharacters
+ \component ma-cb-en-errors
+ \component ma-cb-en-texteditor
+ \component ma-cb-en-processingfiles
+ \component ma-cb-en-runtimefiles
+
+\stopappendices
+
+\stopdocument
+
+\stopproduct
+
diff --git a/doc/context/sources/general/manuals/start/en/ma-cb-language.tex b/doc/context/sources/general/manuals/start/en/ma-cb-language.tex
new file mode 100644
index 000000000..5c6d91d07
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/ma-cb-language.tex
@@ -0,0 +1,21 @@
+\startenvironment ma-cb-language
+
+\mainlanguage[en]
+
+\setuplabeltext
+ [en]
+ [ document:author=Main author,
+ document:design=Design and style,
+ document:contributions=Contributions,
+ document:translations=Translations,
+ document:illustrations=Illustrations,
+ document:commanddefinitions=Command definitions,
+ document:commandindex=Command index,
+ document:subjectindex=Subject index,
+ document:contents=Contents,
+ document:manuals=Manuals,
+ document:magazines=Magazines,
+ document:supportandreading=Support and further reading,
+ document:furtherreading=Further reading]
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/start/en/sounds-001.tex b/doc/context/sources/general/manuals/start/en/sounds-001.tex
new file mode 100644
index 000000000..7d1428113
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/en/sounds-001.tex
@@ -0,0 +1,34 @@
+\definerenderingwindow
+ [example]
+ [width=0pt,height=0pt,frame=off]
+
+\setupinteraction[state=start]
+
+\useexternalrendering
+ [mysound]
+ [audio/mpeg] % audio/x-mp3
+ [akkerman.mp3]
+ []
+
+\definereference [StartSoundTrack] [StartRendering{mysound}]
+\definereference [StopSoundTrack] [StopRendering{mysound}]
+
+\definelayer[resources][width=\paperwidth,height=\paperheight]
+
+\setupbackgrounds[page][background=resources]
+
+\starttext
+
+ \setlayer[resources]{\placerenderingwindow[example][mysound]} % once
+
+ \startTEXpage
+ \button{start}[StartSoundTrack]
+ \button{stop}[StopSoundTrack]
+ \stopTEXpage
+
+ \startTEXpage
+ \button{start}[StartSoundTrack]
+ \button{stop}[StopSoundTrack]
+ \stopTEXpage
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/start/graphics/cow.pdf b/doc/context/sources/general/manuals/start/graphics/cow.pdf
new file mode 100644
index 000000000..2441faf74
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/cow.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/fig-page-areas-en.md b/doc/context/sources/general/manuals/start/graphics/fig-page-areas-en.md
new file mode 100644
index 000000000..b7c0ab5a6
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/fig-page-areas-en.md
@@ -0,0 +1,830 @@
+%!PS-Adobe-3.0 EPSF-3.0
+%%Creator: Mayura Draw, Version 4.3
+%%Title: fig-page-areas-en.md
+%%CreationDate: Fri Jan 10 14:38:13 2014
+%%BoundingBox: 8 140 580 700
+%%DocumentFonts: ArialMT
+%%+ Arial-BoldMT
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset MayuraDraw_ops
+%%Version: 4.3
+%%Copyright: (c) 1993-2003 Mayura Software
+/PDXDict 100 dict def
+PDXDict begin
+% width height matrix proc key cache
+% definepattern -\> font
+/definepattern { %def
+ 7 dict begin
+ /FontDict 9 dict def
+ FontDict begin
+ /cache exch def
+ /key exch def
+ /proc exch cvx def
+ /mtx exch matrix invertmatrix def
+ /height exch def
+ /width exch def
+ /ctm matrix currentmatrix def
+ /ptm matrix identmatrix def
+ /str
+ (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
+ def
+ end
+ /FontBBox [ %def
+ 0 0 FontDict /width get
+ FontDict /height get
+ ] def
+ /FontMatrix FontDict /mtx get def
+ /Encoding StandardEncoding def
+ /FontType 3 def
+ /BuildChar { %def
+ pop begin
+ FontDict begin
+ width 0 cache { %ifelse
+ 0 0 width height setcachedevice
+ }{ %else
+ setcharwidth
+ } ifelse
+ 0 0 moveto width 0 lineto
+ width height lineto 0 height lineto
+ closepath clip newpath
+ gsave proc grestore
+ end end
+ } def
+ FontDict /key get currentdict definefont
+ end
+} bind def
+
+% dict patternpath -
+% dict matrix patternpath -
+/patternpath { %def
+ dup type /dicttype eq { %ifelse
+ begin FontDict /ctm get setmatrix
+ }{ %else
+ exch begin FontDict /ctm get setmatrix
+ concat
+ } ifelse
+ currentdict setfont
+ FontDict begin
+ FontMatrix concat
+ width 0 dtransform
+ round width div exch round width div exch
+ 0 height dtransform
+ round height div exch
+ round height div exch
+ 0 0 transform round exch round exch
+ ptm astore setmatrix
+
+ pathbbox
+ height div ceiling height mul 4 1 roll
+ width div ceiling width mul 4 1 roll
+ height div floor height mul 4 1 roll
+ width div floor width mul 4 1 roll
+
+ 2 index sub height div ceiling cvi exch
+ 3 index sub width div ceiling cvi exch
+ 4 2 roll moveto
+
+ FontMatrix ptm invertmatrix pop
+ { %repeat
+ gsave
+ ptm concat
+ dup str length idiv { %repeat
+ str show
+ } repeat
+ dup str length mod str exch
+ 0 exch getinterval show
+ grestore
+ 0 height rmoveto
+ } repeat
+ pop
+ end end
+} bind def
+
+% dict patternfill -
+% dict matrix patternfill -
+/patternfill { %def
+ gsave
+ eoclip patternpath
+ grestore
+ newpath
+} bind def
+
+/img { %def
+ gsave
+ /imgh exch def
+ /imgw exch def
+ concat
+ imgw imgh 8
+ [imgw 0 0 imgh neg 0 imgh]
+ /colorstr 768 string def
+ /colorimage where {
+ pop
+ { currentfile colorstr readhexstring pop }
+ false 3 colorimage
+ }{
+ /graystr 256 string def
+ {
+ currentfile colorstr readhexstring pop
+ length 3 idiv
+ dup 1 sub 0 1 3 -1 roll
+ {
+ graystr exch
+ colorstr 1 index 3 mul get 30 mul
+ colorstr 2 index 3 mul 1 add get 59 mul
+ colorstr 3 index 3 mul 2 add get 11 mul
+ add add 100 idiv
+ put
+ } for
+ graystr 0 3 -1 roll getinterval
+ } image
+ } ifelse
+ grestore
+} bind def
+
+/arrowhead {
+ gsave
+ [] 0 setdash
+ strokeC strokeM strokeY strokeK setcmykcolor
+ 2 copy moveto
+ 4 2 roll exch 4 -1 roll exch
+ sub 3 1 roll sub
+ exch atan rotate dup scale
+ arrowtype
+ dup 0 eq {
+ -1 2 rlineto 7 -2 rlineto -7 -2 rlineto
+ closepath fill
+ } if
+ dup 1 eq {
+ 0 3 rlineto 9 -3 rlineto -9 -3 rlineto
+ closepath fill
+ } if
+ dup 2 eq {
+ -6 -6 rmoveto 6 6 rlineto -6 6 rlineto
+ -1.4142 -1.4142 rlineto 4.5858 -4.5858 rlineto
+ -4.5858 -4.5858 rlineto closepath fill
+ } if
+ dup 3 eq {
+ -6 0 rmoveto -1 2 rlineto 7 -2 rlineto -7 -2 rlineto
+ closepath fill
+ } if
+ dup 4 eq {
+ -9 0 rmoveto 0 3 rlineto 9 -3 rlineto -9 -3 rlineto
+ closepath fill
+ } if
+ dup 5 eq {
+ currentpoint newpath 3 0 360 arc
+ closepath fill
+ } if
+ dup 6 eq {
+ 2.5 2.5 rmoveto 0 -5 rlineto -5 0 rlineto 0 5 rlineto
+ closepath fill
+ } if
+ pop
+ grestore
+} bind def
+
+/setcmykcolor where { %ifelse
+ pop
+}{ %else
+ /setcmykcolor {
+ /black exch def /yellow exch def
+ /magenta exch def /cyan exch def
+ cyan black add dup 1 gt { pop 1 } if 1 exch sub
+ magenta black add dup 1 gt { pop 1 } if 1 exch sub
+ yellow black add dup 1 gt { pop 1 } if 1 exch sub
+ setrgbcolor
+ } bind def
+} ifelse
+
+/RE { %def
+ findfont begin
+ currentdict dup length dict begin
+ { %forall
+ 1 index /FID ne { def } { pop pop } ifelse
+ } forall
+ /FontName exch def dup length 0 ne { %if
+ /Encoding Encoding 256 array copy def
+ 0 exch { %forall
+ dup type /nametype eq { %ifelse
+ Encoding 2 index 2 index put
+ pop 1 add
+ }{ %else
+ exch pop
+ } ifelse
+ } forall
+ } if pop
+ currentdict dup end end
+ /FontName get exch definefont pop
+} bind def
+
+/spacecount { %def
+ 0 exch
+ ( ) { %loop
+ search { %ifelse
+ pop 3 -1 roll 1 add 3 1 roll
+ }{ pop exit } ifelse
+ } loop
+} bind def
+
+/WinAnsiEncoding [
+ 39/quotesingle 96/grave 130/quotesinglbase/florin/quotedblbase
+ /ellipsis/dagger/daggerdbl/circumflex/perthousand
+ /Scaron/guilsinglleft/OE 145/quoteleft/quoteright
+ /quotedblleft/quotedblright/bullet/endash/emdash
+ /tilde/trademark/scaron/guilsinglright/oe/dotlessi
+ 159/Ydieresis 164/currency 166/brokenbar 168/dieresis/copyright
+ /ordfeminine 172/logicalnot 174/registered/macron/ring
+ 177/plusminus/twosuperior/threesuperior/acute/mu
+ 183/periodcentered/cedilla/onesuperior/ordmasculine
+ 188/onequarter/onehalf/threequarters 192/Agrave/Aacute
+ /Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla
+ /Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute
+ /Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute
+ /Ocircumflex/Otilde/Odieresis/multiply/Oslash
+ /Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
+ /germandbls/agrave/aacute/acircumflex/atilde/adieresis
+ /aring/ae/ccedilla/egrave/eacute/ecircumflex
+ /edieresis/igrave/iacute/icircumflex/idieresis
+ /eth/ntilde/ograve/oacute/ocircumflex/otilde
+ /odieresis/divide/oslash/ugrave/uacute/ucircumflex
+ /udieresis/yacute/thorn/ydieresis
+] def
+
+/SymbolEncoding [
+ 32/space/exclam/universal/numbersign/existential/percent
+ /ampersand/suchthat/parenleft/parenright/asteriskmath/plus
+ /comma/minus/period/slash/zero/one/two/three/four/five/six
+ /seven/eight/nine/colon/semicolon/less/equal/greater/question
+ /congruent/Alpha/Beta/Chi/Delta/Epsilon/Phi/Gamma/Eta/Iota
+ /theta1/Kappa/Lambda/Mu/Nu/Omicron/Pi/Theta/Rho/Sigma/Tau
+ /Upsilon/sigma1/Omega/Xi/Psi/Zeta/bracketleft/therefore
+ /bracketright/perpendicular/underscore/radicalex/alpha
+ /beta/chi/delta/epsilon/phi/gamma/eta/iota/phi1/kappa/lambda
+ /mu/nu/omicron/pi/theta/rho/sigma/tau/upsilon/omega1/omega
+ /xi/psi/zeta/braceleft/bar/braceright/similar
+ 161/Upsilon1/minute/lessequal/fraction/infinity/florin/club
+ /diamond/heart/spade/arrowboth/arrowleft/arrowup/arrowright
+ /arrowdown/degree/plusminus/second/greaterequal/multiply
+ /proportional/partialdiff/bullet/divide/notequal/equivalence
+ /approxequal/ellipsis/arrowvertex/arrowhorizex/carriagereturn
+ /aleph/Ifraktur/Rfraktur/weierstrass/circlemultiply
+ /circleplus/emptyset/intersection/union/propersuperset
+ /reflexsuperset/notsubset/propersubset/reflexsubset/element
+ /notelement/angle/gradient/registerserif/copyrightserif
+ /trademarkserif/product/radical/dotmath/logicalnot/logicaland
+ /logicalor/arrowdblboth/arrowdblleft/arrowdblup/arrowdblright
+ /arrowdbldown/lozenge/angleleft/registersans/copyrightsans
+ /trademarksans/summation/parenlefttp/parenleftex/parenleftbt
+ /bracketlefttp/bracketleftex/bracketleftbt/bracelefttp
+ /braceleftmid/braceleftbt/braceex
+ 241/angleright/integral/integraltp/integralex/integralbt
+ /parenrighttp/parenrightex/parenrightbt/bracketrighttp
+ /bracketrightex/bracketrightbt/bracerighttp/bracerightmid
+ /bracerightbt
+] def
+
+/patarray [
+/leftdiagonal /rightdiagonal /crossdiagonal /horizontal
+/vertical /crosshatch /fishscale /wave /brick
+] def
+/arrowtype 0 def
+/fillC 0 def /fillM 0 def /fillY 0 def /fillK 0 def
+/strokeC 0 def /strokeM 0 def /strokeY 0 def /strokeK 1 def
+/pattern -1 def
+/mat matrix def
+/mat2 matrix def
+/nesting 0 def
+/deferred /N def
+/c /curveto load def
+/c2 { pop pop c } bind def
+/C /curveto load def
+/C2 { pop pop C } bind def
+/e { gsave concat 0 0 moveto } bind def
+/F {
+ nesting 0 eq { %ifelse
+ pattern -1 eq { %ifelse
+ fillC fillM fillY fillK setcmykcolor eofill
+ }{ %else
+ gsave fillC fillM fillY fillK setcmykcolor eofill grestore
+ 0 0 0 1 setcmykcolor
+ patarray pattern get findfont patternfill
+ } ifelse
+ }{ %else
+ /deferred /F def
+ } ifelse
+} bind def
+/f { closepath F } bind def
+/K { /strokeK exch def /strokeY exch def
+ /strokeM exch def /strokeC exch def } bind def
+/k { /fillK exch def /fillY exch def
+ /fillM exch def /fillC exch def } bind def
+/opc { pop } bind def
+/Opc { pop } bind def
+/L /lineto load def
+/L2 { pop pop L } bind def
+/m /moveto load def
+/m2 { pop pop m } bind def
+/n /newpath load def
+/N {
+ nesting 0 eq { %ifelse
+ newpath
+ }{ %else
+ /deferred /N def
+ } ifelse
+} def
+/S {
+ nesting 0 eq { %ifelse
+ strokeC strokeM strokeY strokeK setcmykcolor stroke
+ }{ %else
+ /deferred /S def
+ } ifelse
+} bind def
+/s { closepath S } bind def
+/Tx { fillC fillM fillY fillK setcmykcolor show
+ 0 leading neg translate 0 0 moveto } bind def
+/T { grestore } bind def
+/TX { pop } bind def
+/Ts { pop } bind def
+/tal { pop } bind def
+/tld { pop } bind def
+/tbx { pop exch pop sub /jwidth exch def } def
+/tpt { %def
+ fillC fillM fillY fillK setcmykcolor
+ moveto show
+} bind def
+/tpj { %def
+ fillC fillM fillY fillK setcmykcolor
+ moveto
+ dup stringwidth pop
+ 3 -1 roll
+ exch sub
+ 1 index spacecount
+ dup 0 eq { %ifelse
+ pop pop show
+ }{ %else
+ div 0 8#040 4 -1 roll widthshow
+ } ifelse
+} bind def
+/u {} def
+/U {} def
+/*u { /nesting nesting 1 add def } def
+/*U {
+ /nesting nesting 1 sub def
+ nesting 0 eq {
+ deferred cvx exec
+ } if
+} def
+/w /setlinewidth load def
+/d /setdash load def
+/B {
+ nesting 0 eq { %ifelse
+ gsave F grestore S
+ }{ %else
+ /deferred /B def
+ } ifelse
+} bind def
+/b { closepath B } bind def
+/z { /align exch def pop /leading exch def exch findfont
+ exch scalefont setfont } bind def
+/tfn { exch findfont
+ exch scalefont setfont } bind def
+/Pat { /pattern exch def } bind def
+/cm { 6 array astore concat } bind def
+/q { mat2 currentmatrix pop } bind def
+/Q { mat2 setmatrix } bind def
+/Ah {
+ pop /arrowtype exch def
+ currentlinewidth 5 1 roll arrowhead
+} bind def
+/Arc {
+ mat currentmatrix pop
+ translate scale 0 0 1 5 -2 roll arc
+ mat setmatrix
+} bind def
+/Arc2 { pop pop Arc } bind def
+/Bx {
+ mat currentmatrix pop
+ concat /y1 exch def /x1 exch def /y2 exch def /x2 exch def
+ x1 y1 moveto x1 y2 lineto x2 y2 lineto x2 y1 lineto
+ mat setmatrix
+} bind def
+/Rr {
+ mat currentmatrix pop
+ concat /yrad exch def /xrad exch def
+ 2 copy gt { exch } if /x2 exch def /x1 exch def
+ 2 copy gt { exch } if /y2 exch def /y1 exch def
+ x1 xrad add y2 moveto
+ matrix currentmatrix x1 xrad add y2 yrad sub translate xrad yrad scale
+ 0 0 1 90 -180 arc setmatrix
+ matrix currentmatrix x1 xrad add y1 yrad add translate xrad yrad scale
+ 0 0 1 180 270 arc setmatrix
+ matrix currentmatrix x2 xrad sub y1 yrad add translate xrad yrad scale
+ 0 0 1 270 0 arc setmatrix
+ matrix currentmatrix x2 xrad sub y2 yrad sub translate xrad yrad scale
+ 0 0 1 0 90 arc setmatrix
+ closepath
+ mat setmatrix
+} bind def
+/Ov {
+ mat currentmatrix pop
+ concat translate scale 1 0 moveto 0 0 1 0 360 arc closepath
+ mat setmatrix
+} bind def
+end
+%%EndResource
+%%EndProlog
+%%BeginSetup
+%PDX g 3 3 1 1
+%%IncludeFont: ArialMT
+%%IncludeFont: Arial-BoldMT
+PDXDict begin
+%%EndSetup
+%%Page: 1 1
+%%BeginPageSetup
+/_PDX_savepage save def
+
+15 15 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 setlinecap
+ 7.5 0 moveto 15 7.5 lineto
+ 0 7.5 moveto 7.5 15 lineto
+ 2 setlinewidth stroke
+} bind
+/rightdiagonal true definepattern pop
+
+15 15 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 setlinecap
+ 7.5 0 moveto 0 7.5 lineto
+ 15 7.5 moveto 7.5 15 lineto
+ 2 setlinewidth stroke
+} bind
+/leftdiagonal true definepattern pop
+
+15 15 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 setlinecap
+ 0 7.5 moveto 15 7.5 lineto
+ 2 setlinewidth stroke
+} bind
+/horizontal true definepattern pop
+
+15 15 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 setlinecap
+ 7.5 0 moveto 7.5 15 lineto
+ 2 setlinewidth stroke
+} bind
+/vertical true definepattern pop
+
+15 15 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 setlinecap
+ 0 7.5 moveto 15 7.5 lineto
+ 7.5 0 moveto 7.5 15 lineto
+ 2 setlinewidth stroke
+} bind
+/crosshatch true definepattern pop
+
+30 30 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 setlinecap
+ 0 7.5 moveto 30 7.5 lineto
+ 0 22.5 moveto 30 22.5 lineto
+ 7.5 0 moveto 7.5 7.5 lineto
+ 7.5 22.5 moveto 7.5 30 lineto
+ 22.5 7.5 moveto 22.5 22.5 lineto
+ 1 setlinewidth stroke
+} bind
+/brick true definepattern pop
+
+30 30 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 2 scale
+ 2 setlinecap
+ 7.5 0 moveto 15 7.5 lineto
+ 0 7.5 moveto 7.5 15 lineto
+ 7.5 0 moveto 0 7.5 lineto
+ 15 7.5 moveto 7.5 15 lineto
+ 0.5 setlinewidth stroke
+} bind
+/crossdiagonal true definepattern pop
+
+30 30 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 2 scale
+ 1 setlinecap
+ 0 7.5 moveto 0 15 7.5 270 360 arc
+ 7.5 15 moveto 15 15 7.5 180 270 arc
+ 0 7.5 moveto 7.5 7.5 7.5 180 360 arc
+ 0.5 setlinewidth stroke
+} bind
+/fishscale true definepattern pop
+
+30 30 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 1 setlinecap 0.5 setlinewidth
+ 7.5 0 10.6 135 45 arcn
+ 22.5 15 10.6 225 315 arc
+ stroke
+ 7.5 15 10.6 135 45 arcn
+ 22.5 30 10.6 225 315 arc
+ stroke
+} bind
+/wave true definepattern pop
+
+WinAnsiEncoding /_ArialMT /ArialMT RE
+WinAnsiEncoding /_Arial-BoldMT /Arial-BoldMT RE
+
+newpath 2 setlinecap 0 setlinejoin 2 setmiterlimit
+[] 0 setdash
+8 140 moveto 8 700 lineto 580 700 lineto 580 140 lineto closepath clip
+newpath
+%%EndPageSetup
+0.862745 0.956863 -1.42109e-016 0 K
+2 w
+543 249 -9 789 [1 0 0 1 27.09 -98.91] Bx
+s
+0.133333 0.133333 0.133333 0 k
+0.133333 0.133333 0.133333 0 K
+0.5 w
+150 480 90 510 [1 0 0 1 -14.91 90.09] Bx
+b
+150 480 90 510 [1 0 0 1 60.42 90.09] Bx
+b
+150 480 90 510 [1 0 0 1 299.9 90.09] Bx
+b
+240 480 90 510 [1 0 0 1 135.1 90.09] Bx
+b
+150 480 90 510 [1 0 0 1 375.4 90.09] Bx
+b
+[1 0 0 1 15.14 -89.21] e
+33 681 33 681 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(top) 33 670.14 tpt
+T
+0.133333 0.133333 0.133333 0 k
+150 480 90 510 [1 0 0 1 -14.91 45.09] Bx
+b
+150 480 90 510 [1 0 0 1 60.09 45.09] Bx
+b
+150 480 90 510 [1 0 0 1 300.1 45.09] Bx
+b
+240 480 90 510 [1 0 0 1 135.1 45.09] Bx
+b
+150 480 90 510 [1 0 0 1 375.1 45.09] Bx
+b
+[1 0 0 1 -5.536 -83.21] e
+33 630 33 630 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(header) 33 619.14 tpt
+T
+0.133333 0.133333 0.133333 0 k
+150 480 90 510 [1 0 0 1 -14.91 -180.6] Bx
+b
+150 480 90 510 [1 0 0 1 60.09 -180.6] Bx
+b
+150 480 90 510 [1 0 0 1 300.1 -180.6] Bx
+b
+240 480 90 510 [1 0 0 1 135.1 -180.6] Bx
+b
+150 480 90 510 [1 0 0 1 375.1 -180.6] Bx
+b
+[1 0 0 1 1.136 -80.91] e
+33 402 33 402 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(footer) 33 391.14 tpt
+T
+0.133333 0.133333 0.133333 0 k
+150 480 90 510 [1 0 0 1 -14.91 -224.9] Bx
+b
+150 480 90 510 [1 0 0 1 60.09 -224.9] Bx
+b
+150 480 90 510 [1 0 0 1 300.1 -224.9] Bx
+b
+240 480 90 510 [1 0 0 1 135.1 -224.9] Bx
+b
+150 480 90 510 [1 0 0 1 375.1 -224.9] Bx
+b
+[1 0 0 1 -7.866 -86.21] e
+36 363 36 363 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(bottom) 36 352.14 tpt
+T
+0.133333 0.133333 0.133333 0 k
+150 345 90 510 [1 0 0 1 -14.91 0.09051] Bx
+b
+150 345 90 510 [1 0 0 1 60.09 0.09051] Bx
+b
+150 345 90 510 [1 0 0 1 300.1 0.09051] Bx
+b
+-1.42109e-016 0.4 0.8 0 k
+240 345 90 510 [1 0 0 1 135 0.09051] Bx
+b
+0.133333 0.133333 0.133333 0 k
+150 345 90 510 [1 0 0 1 375.1 0.09051] Bx
+b
+[1 0 0 1 21.47 -72.71] e
+24 507 24 507 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(text) 24 496.14 tpt
+T
+[1 0 0 1 -10.93 -38.72] e
+93 705 93 705 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(left edge) 93 694.14 tpt
+T
+[1 0 0 1 -4.409 -41.72] e
+159 708 159 708 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(left margin) 159 697.14 tpt
+T
+[1 0 0 1 17.42 -38.72] e
+273 705 273 705 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(text) 273 694.14 tpt
+T
+[1 0 0 1 -13.78 -35.72] e
+402 702 402 702 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(right margin) 402 691.14 tpt
+T
+[1 0 0 1 -11.25 -38.72] e
+480 705 480 705 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(right edge) 480 694.14 tpt
+T
+[1 0 0 1 -13.55 -89.21] e
+75 352.596 39 366 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+() 39 355.14 tpt
+T
+[1 0 0 1 0.09051 -89.91] e
+402 460.596 333 474 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+() 333 463.14 tpt
+T
+u
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+1 1 1 0 K
+1 w
+q
+1 0 0 1 -14.91 -89.91 cm
+60 285 m
+90 285 L
+Q
+S
+q
+1 0 0 1 0.09051 -89.91 cm
+75 285 m
+75 255 L
+Q
+S
+U
+u
+q
+-1 0 0 1 615.1 -89.91 cm
+60 285 m
+90 285 L
+Q
+S
+q
+-1 0 0 1 600.1 -89.91 cm
+75 285 m
+75 255 L
+Q
+S
+U
+u
+q
+0 -1 -1 0 810.1 735.1 cm
+60 285 m
+90 285 L
+Q
+S
+q
+0 -1 -1 0 810.1 720.1 cm
+75 285 m
+75 255 L
+Q
+S
+U
+u
+q
+0 -1 1 0 -209.9 735.1 cm
+60 285 m
+90 285 L
+Q
+S
+q
+0 -1 1 0 -209.9 720.1 cm
+75 285 m
+75 255 L
+Q
+S
+U
+0.5 w
+[3 3] 0 d
+525 735 75 285 [1 0 0 1 0.09051 -89.91] Bx
+s
+1 w
+[] 0 d
+q
+1 0 0 1 -45 -524.9 cm
+128 705 120 705 m2
+562.094 705 570.094 705 L2
+Q
+S
+q
+1 0 0 1 -45 -524.9 cm
+570.094 705 120 705 4 1 Ah
+120 705 570.094 705 4 2 Ah
+Q
+[1 0 0 1 0.09051 -89.91] e
+271.57 246.83 246 258 tbx
+0 tal
+11 tld
+0.862745 0.956863 -1.42109e-016 0 k
+/_ArialMT 10 tfn
+() 246 248.95 tpt
+T
+[1 0 0 1 0.09051 -89.91] e
+261 255 261 255 tbx
+0 tal
+11 tld
+1 1 1 0 k
+/_ArialMT 10 tfn
+() 261 245.95 tpt
+T
+[1 0 0 1 9.698 -77.82] e
+261 255 261 255 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(paperwidth) 261 244.14 tpt
+T
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+q
+0 1 -1 0 1244 74.39 cm
+128 705 120 705 m2
+562.094 705 570.094 705 L2
+Q
+S
+q
+0 1 -1 0 1244 74.39 cm
+570.094 705 120 705 4 1 Ah
+120 705 570.094 705 4 2 Ah
+Q
+[0 1 -1 0 797.3 129.1] e
+261 255 261 255 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(paperheight) 261 244.14 tpt
+T
+[1 0 0 1 -10.41 8.644] e
+273 429 273 429 tbx
+0 tal
+19 tld
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+/_Arial-BoldMT 18 tfn
+(bodytext) 273 412.71 tpt
+T
+%%PageTrailer
+_PDX_savepage restore
+%%Trailer
+end
+showpage
+%%EOF
diff --git a/doc/context/sources/general/manuals/start/graphics/fig-page-areas-en.pdf b/doc/context/sources/general/manuals/start/graphics/fig-page-areas-en.pdf
new file mode 100644
index 000000000..88350bf2a
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/fig-page-areas-en.pdf
@@ -0,0 +1,527 @@
+%PDF-1.0
+1 0 obj
+<<
+/Creator (Mayura Draw 4.3)
+>>
+endobj
+2 0 obj
+<<
+/Type /Catalog
+/Pages 4 0 R
+/Outlines 3 0 R
+>>
+endobj
+3 0 obj
+<<
+/Type /Outlines
+/Count 0
+>>
+endobj
+4 0 obj
+<<
+/Type /Pages
+/Count 1
+/Kids [ 5 0 R ]
+>>
+endobj
+5 0 obj
+<<
+/Type /Page
+/Parent 4 0 R
+/MediaBox [ 8 140 580 700 ]
+/Resources <<
+/ProcSet 6 0 R
+/XObject 9 0 R
+/Font 10 0 R
+>>
+/Contents 7 0 R
+>>
+endobj
+6 0 obj
+[ /PDF /Text ]
+endobj
+7 0 obj
+<< /Length 8 0 R >>
+stream
+1 1 1 rg
+0.137255 0.0431373 1 RG
+2 w
+18.0905 690.091 m
+18.0905 150.091 l
+570.091 150.091 l
+570.091 690.091 l
+18.0905 690.091 l
+s
+0.866667 0.866667 0.866667 rg
+0.866667 0.866667 0.866667 RG
+0.5 w
+75.0905 600.091 m
+75.0905 570.091 l
+135.091 570.091 l
+135.091 600.091 l
+75.0905 600.091 l
+b*
+150.421 600.091 m
+150.421 570.091 l
+210.421 570.091 l
+210.421 600.091 l
+150.421 600.091 l
+b*
+389.89 600.091 m
+389.89 570.091 l
+449.89 570.091 l
+449.89 600.091 l
+389.89 600.091 l
+b*
+225.091 600.091 m
+225.091 570.091 l
+375.091 570.091 l
+375.091 600.091 l
+225.091 600.091 l
+b*
+465.39 600.091 m
+465.39 570.091 l
+525.39 570.091 l
+525.39 600.091 l
+465.39 600.091 l
+b*
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 48.14 580.9 Tm
+0 Tw
+(top) Tj
+ET
+0.866667 0.866667 0.866667 rg
+75.0905 555.091 m
+75.0905 525.091 l
+135.091 525.091 l
+135.091 555.091 l
+75.0905 555.091 l
+b*
+150.091 555.091 m
+150.091 525.091 l
+210.091 525.091 l
+210.091 555.091 l
+150.091 555.091 l
+b*
+390.09 555.091 m
+390.09 525.091 l
+450.09 525.091 l
+450.09 555.091 l
+390.09 555.091 l
+b*
+225.091 555.091 m
+225.091 525.091 l
+375.091 525.091 l
+375.091 555.091 l
+225.091 555.091 l
+b*
+465.09 555.091 m
+465.09 525.091 l
+525.09 525.091 l
+525.09 555.091 l
+465.09 555.091 l
+b*
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 27.46 535.9 Tm
+0 Tw
+(header) Tj
+ET
+0.866667 0.866667 0.866667 rg
+75.0905 329.391 m
+75.0905 299.391 l
+135.091 299.391 l
+135.091 329.391 l
+75.0905 329.391 l
+b*
+150.091 329.391 m
+150.091 299.391 l
+210.091 299.391 l
+210.091 329.391 l
+150.091 329.391 l
+b*
+390.09 329.391 m
+390.09 299.391 l
+450.09 299.391 l
+450.09 329.391 l
+390.09 329.391 l
+b*
+225.091 329.391 m
+225.091 299.391 l
+375.091 299.391 l
+375.091 329.391 l
+225.091 329.391 l
+b*
+465.09 329.391 m
+465.09 299.391 l
+525.09 299.391 l
+525.09 329.391 l
+465.09 329.391 l
+b*
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 34.14 310.2 Tm
+0 Tw
+(footer) Tj
+ET
+0.866667 0.866667 0.866667 rg
+75.0905 285.091 m
+75.0905 255.091 l
+135.091 255.091 l
+135.091 285.091 l
+75.0905 285.091 l
+b*
+150.091 285.091 m
+150.091 255.091 l
+210.091 255.091 l
+210.091 285.091 l
+150.091 285.091 l
+b*
+390.09 285.091 m
+390.09 255.091 l
+450.09 255.091 l
+450.09 285.091 l
+390.09 285.091 l
+b*
+225.091 285.091 m
+225.091 255.091 l
+375.091 255.091 l
+375.091 285.091 l
+225.091 285.091 l
+b*
+465.09 285.091 m
+465.09 255.091 l
+525.09 255.091 l
+525.09 285.091 l
+465.09 285.091 l
+b*
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 28.13 265.9 Tm
+0 Tw
+(bottom) Tj
+ET
+0.866667 0.866667 0.866667 rg
+75.0905 510.091 m
+75.0905 345.091 l
+135.091 345.091 l
+135.091 510.091 l
+75.0905 510.091 l
+b*
+150.091 510.091 m
+150.091 345.091 l
+210.091 345.091 l
+210.091 510.091 l
+150.091 510.091 l
+b*
+390.09 510.091 m
+390.09 345.091 l
+450.09 345.091 l
+450.09 510.091 l
+390.09 510.091 l
+b*
+1 0.6 0.2 rg
+225 510.091 m
+225 345.091 l
+375 345.091 l
+375 510.091 l
+225 510.091 l
+b*
+0.866667 0.866667 0.866667 rg
+465.09 510.091 m
+465.09 345.091 l
+525.09 345.091 l
+525.09 510.091 l
+465.09 510.091 l
+b*
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 45.47 423.4 Tm
+0 Tw
+(text) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 82.07 655.4 Tm
+0 Tw
+(left edge) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 154.6 655.4 Tm
+0 Tw
+(left margin) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 290.4 655.4 Tm
+0 Tw
+(text) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 388.2 655.4 Tm
+0 Tw
+(right margin) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 468.8 655.4 Tm
+0 Tw
+(right edge) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 25.45 265.9 Tm
+0 Tw
+() Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 333.1 373.2 Tm
+0 Tw
+() Tj
+ET
+1 1 1 rg
+0 0 0 RG
+1 w
+45.0905 195.091 m
+75.0905 195.091 l
+S
+75.0905 195.091 m
+75.0905 165.091 l
+S
+555.091 195.091 m
+525.091 195.091 l
+S
+525.091 195.091 m
+525.091 165.091 l
+S
+525.091 675.091 m
+525.091 645.091 l
+S
+525.091 645.091 m
+555.091 645.091 l
+S
+75.0905 675.091 m
+75.0905 645.091 l
+S
+75.0905 645.091 m
+45.0905 645.091 l
+S
+0.5 w
+[3 3] 0 d
+75.0905 195.091 m
+75.0905 645.091 l
+525.091 645.091 l
+525.091 195.091 l
+75.0905 195.091 l
+s
+1 w
+[] 0 d
+83.0005 180.091 m
+517.094 180.091 l
+S
+0 0 0 rg
+0 w
+75.0005 180.091 m
+84.0005 180.091 l
+84.0005 177.091 l
+75.0005 180.091 l
+84.0005 183.091 l
+84.0005 180.091 l
+75.0005 180.091 l
+f*
+525.094 180.091 m
+516.094 180.091 l
+516.094 183.091 l
+525.094 180.091 l
+516.094 177.091 l
+516.094 180.091 l
+525.094 180.091 l
+f*
+0.137255 0.0431373 1 rg
+BT
+/F1 10 Tf
+1 0 0 1 246.1 159 Tm
+0 Tw
+() Tj
+ET
+0 0 0 rg
+BT
+/F1 10 Tf
+1 0 0 1 261.1 156 Tm
+0 Tw
+() Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 270.7 166.3 Tm
+0 Tw
+(paperwidth) Tj
+ET
+1 1 1 rg
+1 w
+539.09 202.391 m
+539.09 636.484 l
+S
+0 0 0 rg
+0 w
+539.09 194.391 m
+539.09 203.391 l
+542.09 203.391 l
+539.09 194.391 l
+536.09 203.391 l
+539.09 203.391 l
+539.09 194.391 l
+f*
+539.09 644.484 m
+539.09 635.484 l
+536.09 635.484 l
+539.09 644.484 l
+542.09 635.484 l
+539.09 635.484 l
+539.09 644.484 l
+f*
+BT
+/F1 12 Tf
+0 1 -1 0 553.2 390.1 Tm
+0 Tw
+(paperheight) Tj
+ET
+1 1 1 rg
+BT
+/F2 18 Tf
+1 0 0 1 262.6 421.4 Tm
+0 Tw
+(bodytext) Tj
+ET
+endstream
+endobj
+8 0 obj
+5066
+endobj
+10 0 obj
+<<
+/F1 11 0 R
+/F2 12 0 R
+>>
+endobj
+11 0 obj
+<<
+/Type /Font
+/Subtype /TrueType
+/Name /F1
+/BaseFont /Arial
+/Encoding /WinAnsiEncoding
+/FirstChar 30
+/LastChar 255
+/Widths [ 750 750 278 278 355 556 556 889 667 191 333 333 389 584 278 333
+ 278 278 556 556 556 556 556 556 556 556 556 556 278 278 584 584
+ 584 556 1015 667 667 722 722 667 611 778 722 278 500 667 556 833
+ 722 778 667 778 722 667 611 722 667 944 667 667 611 278 278 278
+ 469 556 333 556 556 500 556 556 278 556 556 222 222 500 222 833
+ 556 556 556 556 333 500 278 556 500 722 500 500 500 334 260 334
+ 584 750 556 750 222 556 333 1000 556 556 333 1000 667 333 1000 750
+ 611 750 750 222 222 333 333 350 556 1000 333 1000 500 333 944 750
+ 500 667 278 333 556 556 556 556 260 556 333 737 370 556 584 333
+ 737 552 400 549 333 333 333 576 537 278 333 333 365 556 834 834
+ 834 611 667 667 667 667 667 667 1000 722 667 667 667 667 278 278
+ 278 278 722 722 778 778 778 778 778 584 778 722 722 722 722 667
+ 667 611 556 556 556 556 556 556 889 500 556 556 556 556 278 278
+ 278 278 556 556 556 556 556 556 556 549 611 556 556 556 556 500
+ 556 500]
+/FontDescriptor 13 0 R
+>>
+endobj
+12 0 obj
+<<
+/Type /Font
+/Subtype /TrueType
+/Name /F2
+/BaseFont /Arial,Bold
+/Encoding /WinAnsiEncoding
+/FirstChar 30
+/LastChar 255
+/Widths [ 750 750 278 333 474 556 556 889 722 238 333 333 389 584 278 333
+ 278 278 556 556 556 556 556 556 556 556 556 556 333 333 584 584
+ 584 611 975 722 722 722 722 667 611 778 722 278 556 722 611 833
+ 722 778 667 778 722 667 611 722 667 944 667 667 611 333 278 333
+ 584 556 333 556 611 556 611 556 333 611 611 278 278 556 278 889
+ 611 611 611 611 389 556 333 611 556 778 556 556 500 389 280 389
+ 584 750 556 750 278 556 500 1000 556 556 333 1000 667 333 1000 750
+ 611 750 750 278 278 500 500 350 556 1000 333 1000 556 333 944 750
+ 500 667 278 333 556 556 556 556 280 556 333 737 370 556 584 333
+ 737 552 400 549 333 333 333 576 556 278 333 333 365 556 834 834
+ 834 611 722 722 722 722 722 722 1000 722 667 667 667 667 278 278
+ 278 278 722 722 778 778 778 778 778 584 778 722 722 722 722 667
+ 667 611 556 556 556 556 556 556 889 556 556 556 556 556 278 278
+ 278 278 611 611 611 611 611 611 611 549 611 611 611 611 611 556
+ 611 556]
+/FontDescriptor 14 0 R
+>>
+endobj
+13 0 obj
+<<
+/Type /FontDescriptor
+/FontName /Arial
+/FontBBox [ -665 -325 2000 1006 ]
+/Ascent 905
+/Descent -212
+/CapHeight 905
+/XHeight 724
+/ItalicAngle 0
+/Flags 32
+/StemV 70
+>>
+endobj
+14 0 obj
+<<
+/Type /FontDescriptor
+/FontName /Arial,Bold
+/FontBBox [ -628 -376 2000 1010 ]
+/Ascent 905
+/Descent -212
+/CapHeight 905
+/XHeight 724
+/ItalicAngle 0
+/Flags 32
+/StemV 120
+>>
+endobj
+9 0 obj
+<<
+>>
+endobj
+xref
+0 15
+0000000000 65535 f
+0000000010 00000 n
+0000000063 00000 n
+0000000135 00000 n
+0000000187 00000 n
+0000000253 00000 n
+0000000417 00000 n
+0000000450 00000 n
+0000005573 00000 n
+0000008294 00000 n
+0000005596 00000 n
+0000005646 00000 n
+0000006767 00000 n
+0000007892 00000 n
+0000008090 00000 n
+trailer
+<<
+/Size 15
+/Root 2 0 R
+/Info 1 0 R
+>>
+startxref
+8319
+%%EOF
diff --git a/doc/context/sources/general/manuals/start/graphics/fig-page-parameters-en.md b/doc/context/sources/general/manuals/start/graphics/fig-page-parameters-en.md
new file mode 100644
index 000000000..35c04b445
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/fig-page-parameters-en.md
@@ -0,0 +1,1371 @@
+%!PS-Adobe-3.0 EPSF-3.0
+%%Creator: Mayura Draw, Version 4.3
+%%Title: fig-page-parameters-en.md
+%%CreationDate: Fri Jan 10 17:04:54 2014
+%%BoundingBox: 8 230 580 790
+%%DocumentFonts: ArialMT
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset MayuraDraw_ops
+%%Version: 4.3
+%%Copyright: (c) 1993-2003 Mayura Software
+/PDXDict 100 dict def
+PDXDict begin
+% width height matrix proc key cache
+% definepattern -\> font
+/definepattern { %def
+ 7 dict begin
+ /FontDict 9 dict def
+ FontDict begin
+ /cache exch def
+ /key exch def
+ /proc exch cvx def
+ /mtx exch matrix invertmatrix def
+ /height exch def
+ /width exch def
+ /ctm matrix currentmatrix def
+ /ptm matrix identmatrix def
+ /str
+ (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
+ def
+ end
+ /FontBBox [ %def
+ 0 0 FontDict /width get
+ FontDict /height get
+ ] def
+ /FontMatrix FontDict /mtx get def
+ /Encoding StandardEncoding def
+ /FontType 3 def
+ /BuildChar { %def
+ pop begin
+ FontDict begin
+ width 0 cache { %ifelse
+ 0 0 width height setcachedevice
+ }{ %else
+ setcharwidth
+ } ifelse
+ 0 0 moveto width 0 lineto
+ width height lineto 0 height lineto
+ closepath clip newpath
+ gsave proc grestore
+ end end
+ } def
+ FontDict /key get currentdict definefont
+ end
+} bind def
+
+% dict patternpath -
+% dict matrix patternpath -
+/patternpath { %def
+ dup type /dicttype eq { %ifelse
+ begin FontDict /ctm get setmatrix
+ }{ %else
+ exch begin FontDict /ctm get setmatrix
+ concat
+ } ifelse
+ currentdict setfont
+ FontDict begin
+ FontMatrix concat
+ width 0 dtransform
+ round width div exch round width div exch
+ 0 height dtransform
+ round height div exch
+ round height div exch
+ 0 0 transform round exch round exch
+ ptm astore setmatrix
+
+ pathbbox
+ height div ceiling height mul 4 1 roll
+ width div ceiling width mul 4 1 roll
+ height div floor height mul 4 1 roll
+ width div floor width mul 4 1 roll
+
+ 2 index sub height div ceiling cvi exch
+ 3 index sub width div ceiling cvi exch
+ 4 2 roll moveto
+
+ FontMatrix ptm invertmatrix pop
+ { %repeat
+ gsave
+ ptm concat
+ dup str length idiv { %repeat
+ str show
+ } repeat
+ dup str length mod str exch
+ 0 exch getinterval show
+ grestore
+ 0 height rmoveto
+ } repeat
+ pop
+ end end
+} bind def
+
+% dict patternfill -
+% dict matrix patternfill -
+/patternfill { %def
+ gsave
+ eoclip patternpath
+ grestore
+ newpath
+} bind def
+
+/img { %def
+ gsave
+ /imgh exch def
+ /imgw exch def
+ concat
+ imgw imgh 8
+ [imgw 0 0 imgh neg 0 imgh]
+ /colorstr 768 string def
+ /colorimage where {
+ pop
+ { currentfile colorstr readhexstring pop }
+ false 3 colorimage
+ }{
+ /graystr 256 string def
+ {
+ currentfile colorstr readhexstring pop
+ length 3 idiv
+ dup 1 sub 0 1 3 -1 roll
+ {
+ graystr exch
+ colorstr 1 index 3 mul get 30 mul
+ colorstr 2 index 3 mul 1 add get 59 mul
+ colorstr 3 index 3 mul 2 add get 11 mul
+ add add 100 idiv
+ put
+ } for
+ graystr 0 3 -1 roll getinterval
+ } image
+ } ifelse
+ grestore
+} bind def
+
+/arrowhead {
+ gsave
+ [] 0 setdash
+ strokeC strokeM strokeY strokeK setcmykcolor
+ 2 copy moveto
+ 4 2 roll exch 4 -1 roll exch
+ sub 3 1 roll sub
+ exch atan rotate dup scale
+ arrowtype
+ dup 0 eq {
+ -1 2 rlineto 7 -2 rlineto -7 -2 rlineto
+ closepath fill
+ } if
+ dup 1 eq {
+ 0 3 rlineto 9 -3 rlineto -9 -3 rlineto
+ closepath fill
+ } if
+ dup 2 eq {
+ -6 -6 rmoveto 6 6 rlineto -6 6 rlineto
+ -1.4142 -1.4142 rlineto 4.5858 -4.5858 rlineto
+ -4.5858 -4.5858 rlineto closepath fill
+ } if
+ dup 3 eq {
+ -6 0 rmoveto -1 2 rlineto 7 -2 rlineto -7 -2 rlineto
+ closepath fill
+ } if
+ dup 4 eq {
+ -9 0 rmoveto 0 3 rlineto 9 -3 rlineto -9 -3 rlineto
+ closepath fill
+ } if
+ dup 5 eq {
+ currentpoint newpath 3 0 360 arc
+ closepath fill
+ } if
+ dup 6 eq {
+ 2.5 2.5 rmoveto 0 -5 rlineto -5 0 rlineto 0 5 rlineto
+ closepath fill
+ } if
+ pop
+ grestore
+} bind def
+
+/setcmykcolor where { %ifelse
+ pop
+}{ %else
+ /setcmykcolor {
+ /black exch def /yellow exch def
+ /magenta exch def /cyan exch def
+ cyan black add dup 1 gt { pop 1 } if 1 exch sub
+ magenta black add dup 1 gt { pop 1 } if 1 exch sub
+ yellow black add dup 1 gt { pop 1 } if 1 exch sub
+ setrgbcolor
+ } bind def
+} ifelse
+
+/RE { %def
+ findfont begin
+ currentdict dup length dict begin
+ { %forall
+ 1 index /FID ne { def } { pop pop } ifelse
+ } forall
+ /FontName exch def dup length 0 ne { %if
+ /Encoding Encoding 256 array copy def
+ 0 exch { %forall
+ dup type /nametype eq { %ifelse
+ Encoding 2 index 2 index put
+ pop 1 add
+ }{ %else
+ exch pop
+ } ifelse
+ } forall
+ } if pop
+ currentdict dup end end
+ /FontName get exch definefont pop
+} bind def
+
+/spacecount { %def
+ 0 exch
+ ( ) { %loop
+ search { %ifelse
+ pop 3 -1 roll 1 add 3 1 roll
+ }{ pop exit } ifelse
+ } loop
+} bind def
+
+/WinAnsiEncoding [
+ 39/quotesingle 96/grave 130/quotesinglbase/florin/quotedblbase
+ /ellipsis/dagger/daggerdbl/circumflex/perthousand
+ /Scaron/guilsinglleft/OE 145/quoteleft/quoteright
+ /quotedblleft/quotedblright/bullet/endash/emdash
+ /tilde/trademark/scaron/guilsinglright/oe/dotlessi
+ 159/Ydieresis 164/currency 166/brokenbar 168/dieresis/copyright
+ /ordfeminine 172/logicalnot 174/registered/macron/ring
+ 177/plusminus/twosuperior/threesuperior/acute/mu
+ 183/periodcentered/cedilla/onesuperior/ordmasculine
+ 188/onequarter/onehalf/threequarters 192/Agrave/Aacute
+ /Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla
+ /Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute
+ /Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute
+ /Ocircumflex/Otilde/Odieresis/multiply/Oslash
+ /Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
+ /germandbls/agrave/aacute/acircumflex/atilde/adieresis
+ /aring/ae/ccedilla/egrave/eacute/ecircumflex
+ /edieresis/igrave/iacute/icircumflex/idieresis
+ /eth/ntilde/ograve/oacute/ocircumflex/otilde
+ /odieresis/divide/oslash/ugrave/uacute/ucircumflex
+ /udieresis/yacute/thorn/ydieresis
+] def
+
+/SymbolEncoding [
+ 32/space/exclam/universal/numbersign/existential/percent
+ /ampersand/suchthat/parenleft/parenright/asteriskmath/plus
+ /comma/minus/period/slash/zero/one/two/three/four/five/six
+ /seven/eight/nine/colon/semicolon/less/equal/greater/question
+ /congruent/Alpha/Beta/Chi/Delta/Epsilon/Phi/Gamma/Eta/Iota
+ /theta1/Kappa/Lambda/Mu/Nu/Omicron/Pi/Theta/Rho/Sigma/Tau
+ /Upsilon/sigma1/Omega/Xi/Psi/Zeta/bracketleft/therefore
+ /bracketright/perpendicular/underscore/radicalex/alpha
+ /beta/chi/delta/epsilon/phi/gamma/eta/iota/phi1/kappa/lambda
+ /mu/nu/omicron/pi/theta/rho/sigma/tau/upsilon/omega1/omega
+ /xi/psi/zeta/braceleft/bar/braceright/similar
+ 161/Upsilon1/minute/lessequal/fraction/infinity/florin/club
+ /diamond/heart/spade/arrowboth/arrowleft/arrowup/arrowright
+ /arrowdown/degree/plusminus/second/greaterequal/multiply
+ /proportional/partialdiff/bullet/divide/notequal/equivalence
+ /approxequal/ellipsis/arrowvertex/arrowhorizex/carriagereturn
+ /aleph/Ifraktur/Rfraktur/weierstrass/circlemultiply
+ /circleplus/emptyset/intersection/union/propersuperset
+ /reflexsuperset/notsubset/propersubset/reflexsubset/element
+ /notelement/angle/gradient/registerserif/copyrightserif
+ /trademarkserif/product/radical/dotmath/logicalnot/logicaland
+ /logicalor/arrowdblboth/arrowdblleft/arrowdblup/arrowdblright
+ /arrowdbldown/lozenge/angleleft/registersans/copyrightsans
+ /trademarksans/summation/parenlefttp/parenleftex/parenleftbt
+ /bracketlefttp/bracketleftex/bracketleftbt/bracelefttp
+ /braceleftmid/braceleftbt/braceex
+ 241/angleright/integral/integraltp/integralex/integralbt
+ /parenrighttp/parenrightex/parenrightbt/bracketrighttp
+ /bracketrightex/bracketrightbt/bracerighttp/bracerightmid
+ /bracerightbt
+] def
+
+/patarray [
+/leftdiagonal /rightdiagonal /crossdiagonal /horizontal
+/vertical /crosshatch /fishscale /wave /brick
+] def
+/arrowtype 0 def
+/fillC 0 def /fillM 0 def /fillY 0 def /fillK 0 def
+/strokeC 0 def /strokeM 0 def /strokeY 0 def /strokeK 1 def
+/pattern -1 def
+/mat matrix def
+/mat2 matrix def
+/nesting 0 def
+/deferred /N def
+/c /curveto load def
+/c2 { pop pop c } bind def
+/C /curveto load def
+/C2 { pop pop C } bind def
+/e { gsave concat 0 0 moveto } bind def
+/F {
+ nesting 0 eq { %ifelse
+ pattern -1 eq { %ifelse
+ fillC fillM fillY fillK setcmykcolor eofill
+ }{ %else
+ gsave fillC fillM fillY fillK setcmykcolor eofill grestore
+ 0 0 0 1 setcmykcolor
+ patarray pattern get findfont patternfill
+ } ifelse
+ }{ %else
+ /deferred /F def
+ } ifelse
+} bind def
+/f { closepath F } bind def
+/K { /strokeK exch def /strokeY exch def
+ /strokeM exch def /strokeC exch def } bind def
+/k { /fillK exch def /fillY exch def
+ /fillM exch def /fillC exch def } bind def
+/opc { pop } bind def
+/Opc { pop } bind def
+/L /lineto load def
+/L2 { pop pop L } bind def
+/m /moveto load def
+/m2 { pop pop m } bind def
+/n /newpath load def
+/N {
+ nesting 0 eq { %ifelse
+ newpath
+ }{ %else
+ /deferred /N def
+ } ifelse
+} def
+/S {
+ nesting 0 eq { %ifelse
+ strokeC strokeM strokeY strokeK setcmykcolor stroke
+ }{ %else
+ /deferred /S def
+ } ifelse
+} bind def
+/s { closepath S } bind def
+/Tx { fillC fillM fillY fillK setcmykcolor show
+ 0 leading neg translate 0 0 moveto } bind def
+/T { grestore } bind def
+/TX { pop } bind def
+/Ts { pop } bind def
+/tal { pop } bind def
+/tld { pop } bind def
+/tbx { pop exch pop sub /jwidth exch def } def
+/tpt { %def
+ fillC fillM fillY fillK setcmykcolor
+ moveto show
+} bind def
+/tpj { %def
+ fillC fillM fillY fillK setcmykcolor
+ moveto
+ dup stringwidth pop
+ 3 -1 roll
+ exch sub
+ 1 index spacecount
+ dup 0 eq { %ifelse
+ pop pop show
+ }{ %else
+ div 0 8#040 4 -1 roll widthshow
+ } ifelse
+} bind def
+/u {} def
+/U {} def
+/*u { /nesting nesting 1 add def } def
+/*U {
+ /nesting nesting 1 sub def
+ nesting 0 eq {
+ deferred cvx exec
+ } if
+} def
+/w /setlinewidth load def
+/d /setdash load def
+/B {
+ nesting 0 eq { %ifelse
+ gsave F grestore S
+ }{ %else
+ /deferred /B def
+ } ifelse
+} bind def
+/b { closepath B } bind def
+/z { /align exch def pop /leading exch def exch findfont
+ exch scalefont setfont } bind def
+/tfn { exch findfont
+ exch scalefont setfont } bind def
+/Pat { /pattern exch def } bind def
+/cm { 6 array astore concat } bind def
+/q { mat2 currentmatrix pop } bind def
+/Q { mat2 setmatrix } bind def
+/Ah {
+ pop /arrowtype exch def
+ currentlinewidth 5 1 roll arrowhead
+} bind def
+/Arc {
+ mat currentmatrix pop
+ translate scale 0 0 1 5 -2 roll arc
+ mat setmatrix
+} bind def
+/Arc2 { pop pop Arc } bind def
+/Bx {
+ mat currentmatrix pop
+ concat /y1 exch def /x1 exch def /y2 exch def /x2 exch def
+ x1 y1 moveto x1 y2 lineto x2 y2 lineto x2 y1 lineto
+ mat setmatrix
+} bind def
+/Rr {
+ mat currentmatrix pop
+ concat /yrad exch def /xrad exch def
+ 2 copy gt { exch } if /x2 exch def /x1 exch def
+ 2 copy gt { exch } if /y2 exch def /y1 exch def
+ x1 xrad add y2 moveto
+ matrix currentmatrix x1 xrad add y2 yrad sub translate xrad yrad scale
+ 0 0 1 90 -180 arc setmatrix
+ matrix currentmatrix x1 xrad add y1 yrad add translate xrad yrad scale
+ 0 0 1 180 270 arc setmatrix
+ matrix currentmatrix x2 xrad sub y1 yrad add translate xrad yrad scale
+ 0 0 1 270 0 arc setmatrix
+ matrix currentmatrix x2 xrad sub y2 yrad sub translate xrad yrad scale
+ 0 0 1 0 90 arc setmatrix
+ closepath
+ mat setmatrix
+} bind def
+/Ov {
+ mat currentmatrix pop
+ concat translate scale 1 0 moveto 0 0 1 0 360 arc closepath
+ mat setmatrix
+} bind def
+end
+%%EndResource
+%%EndProlog
+%%BeginSetup
+%PDX g 3 3 1 1
+%%IncludeFont: ArialMT
+PDXDict begin
+%%EndSetup
+%%Page: 1 1
+%%BeginPageSetup
+/_PDX_savepage save def
+
+15 15 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 setlinecap
+ 7.5 0 moveto 15 7.5 lineto
+ 0 7.5 moveto 7.5 15 lineto
+ 2 setlinewidth stroke
+} bind
+/rightdiagonal true definepattern pop
+
+15 15 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 setlinecap
+ 7.5 0 moveto 0 7.5 lineto
+ 15 7.5 moveto 7.5 15 lineto
+ 2 setlinewidth stroke
+} bind
+/leftdiagonal true definepattern pop
+
+15 15 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 setlinecap
+ 0 7.5 moveto 15 7.5 lineto
+ 2 setlinewidth stroke
+} bind
+/horizontal true definepattern pop
+
+15 15 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 setlinecap
+ 7.5 0 moveto 7.5 15 lineto
+ 2 setlinewidth stroke
+} bind
+/vertical true definepattern pop
+
+15 15 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 setlinecap
+ 0 7.5 moveto 15 7.5 lineto
+ 7.5 0 moveto 7.5 15 lineto
+ 2 setlinewidth stroke
+} bind
+/crosshatch true definepattern pop
+
+30 30 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 setlinecap
+ 0 7.5 moveto 30 7.5 lineto
+ 0 22.5 moveto 30 22.5 lineto
+ 7.5 0 moveto 7.5 7.5 lineto
+ 7.5 22.5 moveto 7.5 30 lineto
+ 22.5 7.5 moveto 22.5 22.5 lineto
+ 1 setlinewidth stroke
+} bind
+/brick true definepattern pop
+
+30 30 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 2 scale
+ 2 setlinecap
+ 7.5 0 moveto 15 7.5 lineto
+ 0 7.5 moveto 7.5 15 lineto
+ 7.5 0 moveto 0 7.5 lineto
+ 15 7.5 moveto 7.5 15 lineto
+ 0.5 setlinewidth stroke
+} bind
+/crossdiagonal true definepattern pop
+
+30 30 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 2 2 scale
+ 1 setlinecap
+ 0 7.5 moveto 0 15 7.5 270 360 arc
+ 7.5 15 moveto 15 15 7.5 180 270 arc
+ 0 7.5 moveto 7.5 7.5 7.5 180 360 arc
+ 0.5 setlinewidth stroke
+} bind
+/fishscale true definepattern pop
+
+30 30 [300 72 div 0 0 300 72 div 0 0]
+{ %definepattern
+ 1 setlinecap 0.5 setlinewidth
+ 7.5 0 10.6 135 45 arcn
+ 22.5 15 10.6 225 315 arc
+ stroke
+ 7.5 15 10.6 135 45 arcn
+ 22.5 30 10.6 225 315 arc
+ stroke
+} bind
+/wave true definepattern pop
+
+WinAnsiEncoding /_ArialMT /ArialMT RE
+
+newpath 2 setlinecap 0 setlinejoin 2 setmiterlimit
+[] 0 setdash
+8 230 moveto 8 790 lineto 580 790 lineto 580 230 lineto closepath clip
+newpath
+%%EndPageSetup
+0.862745 0.956863 -1.42109e-016 0 K
+2 w
+543 249 -9 789 [1 0 0 1 27 -9] Bx
+s
+0.133333 0.133333 0.133333 0 k
+0.133333 0.133333 0.133333 0 K
+0.5 w
+150 480 90 510 [1 0 0 1 -15 180] Bx
+b
+150 480 90 510 [1 0 0 1 60.33 180] Bx
+b
+150 480 90 510 [1 0 0 1 299.8 180] Bx
+b
+240 480 90 510 [1 0 0 1 135 180] Bx
+b
+150 480 90 510 [1 0 0 1 375.3 180] Bx
+b
+[1 0 0 1 15.05 0.702] e
+33 681 33 681 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(top) 33 670.14 tpt
+T
+0.133333 0.133333 0.133333 0 k
+150 480 90 510 [1 0 0 1 -15 135] Bx
+b
+150 480 90 510 [1 0 0 1 60 135] Bx
+b
+150 480 90 510 [1 0 0 1 300 135] Bx
+b
+240 480 90 510 [1 0 0 1 135 135] Bx
+b
+150 480 90 510 [1 0 0 1 375 135] Bx
+b
+[1 0 0 1 -5.627 6.702] e
+33 630 33 630 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(header) 33 619.14 tpt
+T
+0.133333 0.133333 0.133333 0 k
+150 480 90 510 [1 0 0 1 -15 -90.7] Bx
+b
+150 480 90 510 [1 0 0 1 60 -90.7] Bx
+b
+150 480 90 510 [1 0 0 1 300 -90.7] Bx
+b
+240 480 90 510 [1 0 0 1 135 -90.7] Bx
+b
+150 480 90 510 [1 0 0 1 375 -90.7] Bx
+b
+[1 0 0 1 1.045 9] e
+33 402 33 402 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(footer) 33 391.14 tpt
+T
+0.133333 0.133333 0.133333 0 k
+150 480 90 510 [1 0 0 1 -15 -135] Bx
+b
+150 480 90 510 [1 0 0 1 60 -135] Bx
+b
+150 480 90 510 [1 0 0 1 300 -135] Bx
+b
+240 480 90 510 [1 0 0 1 135 -135] Bx
+b
+150 480 90 510 [1 0 0 1 375 -135] Bx
+b
+[1 0 0 1 -7.957 3.702] e
+36 363 36 363 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(bottom) 36 352.14 tpt
+T
+0.133333 0.133333 0.133333 0 k
+150 345 90 510 [1 0 0 1 -15 90] Bx
+b
+150 345 90 510 [1 0 0 1 60 90] Bx
+b
+150 345 90 510 [1 0 0 1 300 90] Bx
+b
+-1.42109e-016 0.4 0.8 0 k
+240 345 90 510 [1 0 0 1 135 90] Bx
+b
+0.133333 0.133333 0.133333 0 k
+150 345 90 510 [1 0 0 1 375 90] Bx
+b
+[1 0 0 1 21.38 17.2] e
+24 507 24 507 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(text) 24 496.14 tpt
+T
+[1 0 0 1 -11.02 51.19] e
+93 705 93 705 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(left edge) 93 694.14 tpt
+T
+[1 0 0 1 -4.5 48.19] e
+159 708 159 708 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(left margin) 159 697.14 tpt
+T
+[1 0 0 1 17.33 51.19] e
+273 705 273 705 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(text) 273 694.14 tpt
+T
+[1 0 0 1 -13.87 54.19] e
+402 702 402 702 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(right margin) 402 691.14 tpt
+T
+[1 0 0 1 -11.34 51.19] e
+480 705 480 705 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(right edge) 480 694.14 tpt
+T
+[1 0 0 1 -13.64 0.702] e
+75 352.596 39 366 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+() 39 355.14 tpt
+T
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+1 1 1 0 K
+1 w
+q
+1 0 0 1 91.45 14.02 cm
+150 712 150 720 m2
+150 638 150 630 L2
+Q
+S
+q
+1 0 0 1 91.45 14.02 cm
+150 630 150 720 4 1 Ah
+150 720 150 630 4 2 Ah
+Q
+q
+1 0 0 1 165 -30 cm
+150 712 150 720 m2
+150 698 150 690 L2
+Q
+S
+q
+1 0 0 1 165 -30 cm
+150 690 150 720 4 1 Ah
+150 720 150 690 4 2 Ah
+Q
+q
+1 0 0 1 -47.91 0 cm
+130.909 705 122.909 705 m2
+265 705 273 705 L2
+Q
+S
+q
+1 0 0 1 -47.91 0 cm
+273 705 122.909 705 4 1 Ah
+122.909 705 273 705 4 2 Ah
+Q
+q
+1 0 0 1 -45 -150 cm
+128 705 120 705 m2
+172 705 180 705 L2
+Q
+S
+q
+1 0 0 1 -45 -150 cm
+180 705 120 705 4 1 Ah
+120 705 180 705 4 2 Ah
+Q
+0.25 w
+q
+1 0 0 1 0.09051 53.27 cm
+225 660 m
+225 645 L
+Q
+S
+q
+1 0 0 1 6.094 0 cm
+228 645 m
+243 645 L
+Q
+S
+[1 0 0 1 -2.909 66] e
+126 654 126 654 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(backspace) 126 643.14 tpt
+T
+[1 0 0 1 -9 30] e
+255 690 255 690 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(topspace) 255 679.14 tpt
+T
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+1 w
+q
+1 0 0 1 29.91 -210 cm
+128 705 120 705 m2
+172 705 180 705 L2
+Q
+S
+q
+1 0 0 1 29.91 -210 cm
+180 705 120 705 4 1 Ah
+120 705 180 705 4 2 Ah
+Q
+q
+1 0 0 1 270 -210 cm
+128 705 120 705 m2
+172 705 180 705 L2
+Q
+S
+q
+1 0 0 1 270 -210 cm
+180 705 120 705 4 1 Ah
+120 705 180 705 4 2 Ah
+Q
+q
+1 0 0 1 345 -150 cm
+128 705 120 705 m2
+172 705 180 705 L2
+Q
+S
+q
+1 0 0 1 345 -150 cm
+180 705 120 705 4 1 Ah
+120 705 180 705 4 2 Ah
+Q
+q
+1 0 0 1 165 -75 cm
+150 712 150 720 m2
+150 698 150 690 L2
+Q
+S
+q
+1 0 0 1 165 -75 cm
+150 690 150 720 4 1 Ah
+150 720 150 690 4 2 Ah
+Q
+q
+1 0 0 1 165 -300 cm
+150 712 150 720 m2
+150 698 150 690 L2
+Q
+S
+q
+1 0 0 1 165 -300 cm
+150 690 150 720 4 1 Ah
+150 720 150 690 4 2 Ah
+Q
+q
+1 0 0 1 165 -345 cm
+150 712 150 720 m2
+150 698 150 690 L2
+Q
+S
+q
+1 0 0 1 165 -345 cm
+150 690 150 720 4 1 Ah
+150 720 150 690 4 2 Ah
+Q
+0.862745 0.956863 -1.42109e-016 0 K
+2 w
+q
+1 0 0 1 104.9 -150 cm
+136 705 120 705 m2
+254.094 705 270.094 705 L2
+Q
+S
+q
+1 0 0 1 104.9 -150 cm
+270.094 705 120 705 4 1 Ah
+120 705 270.094 705 4 2 Ah
+Q
+q
+1 0 0 1 105 -118.5 cm
+150 747.547 150 763.547 m2
+150 524.547 150 508.547 L2
+Q
+S
+q
+1 0 0 1 105 -118.5 cm
+150 508.547 150 763.547 4 1 Ah
+150 763.547 150 508.547 4 2 Ah
+Q
+[1 0 0 1 -3 6.702] e
+324 675 324 675 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(top) 324 664.14 tpt
+T
+[1 0 0 1 -3 3.702] e
+324 633 324 633 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(header) 324 622.14 tpt
+T
+[1 0 0 1 0 0] e
+261 498 261 498 tbx
+0 tal
+13 tld
+0.862745 0.956863 -1.42109e-016 0 k
+/_ArialMT 12 tfn
+(height) 261 487.14 tpt
+T
+[1 0 0 1 -14.05 7.406] e
+291 564 291 564 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(width) 291 553.14 tpt
+T
+[1 0 0 1 0 9.702] e
+321 402 321 402 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(footer) 321 391.14 tpt
+T
+[1 0 0 1 0 9.702] e
+321 357 321 357 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(bottom) 321 346.14 tpt
+T
+[1 0 0 1 -0.348 7.5] e
+84 564 84 564 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(leftedge) 84 553.14 tpt
+T
+[1 0 0 1 -13.08 4.359] e
+168 507 168 507 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(leftmargin) 168 496.14 tpt
+T
+[1 0 0 1 -17.44 7.359] e
+408 504 408 504 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(rightmargin) 408 493.14 tpt
+T
+[1 0 0 1 -13.01 7.5] e
+483 564 483 564 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(rightedge) 483 553.14 tpt
+T
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+1 1 1 0 K
+1 w
+q
+1 0 0 1 165 -120 cm
+150 712 150 720 m2
+150 563 150 555 L2
+Q
+S
+q
+1 0 0 1 165 -120 cm
+150 555 150 720 4 1 Ah
+150 720 150 555 4 2 Ah
+Q
+[1 0 0 1 0 0] e
+402 460.596 333 474 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+() 333 463.14 tpt
+T
+[1 0 0 1 -33 15.64] e
+354 468 354 468 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(textheight) 354 457.14 tpt
+T
+u
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+0.5 w
+q
+1 0 0 1 255 -60 cm
+150 716 150 720 m2
+150 709 150 705 L2
+Q
+S
+q
+1 0 0 1 255 -60 cm
+150 705 150 720 4 1 Ah
+150 720 150 705 4 2 Ah
+Q
+[1 0 0 1 -2.33 7.659] e
+411 651 411 651 tbx
+0 tal
+11 tld
+1 1 1 0 k
+/_ArialMT 10 tfn
+(topdistance) 411 641.95 tpt
+T
+U
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+q
+1 0 0 1 255 -105 cm
+150 716 150 720 m2
+150 709 150 705 L2
+Q
+S
+q
+1 0 0 1 255 -105 cm
+150 705 150 720 4 1 Ah
+150 720 150 705 4 2 Ah
+Q
+[1 0 0 1 -2.33 -37.34] e
+411 651 411 651 tbx
+0 tal
+11 tld
+1 1 1 0 k
+/_ArialMT 10 tfn
+(headerdistance) 411 641.95 tpt
+T
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+q
+1 0 0 1 255 -285 cm
+150 716 150 720 m2
+150 709 150 705 L2
+Q
+S
+q
+1 0 0 1 255 -285 cm
+150 705 150 720 4 1 Ah
+150 720 150 705 4 2 Ah
+Q
+[1 0 0 1 -2.33 -217.3] e
+411 651 411 651 tbx
+0 tal
+11 tld
+1 1 1 0 k
+/_ArialMT 10 tfn
+(footerdistance) 411 641.95 tpt
+T
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+q
+1 0 0 1 255 -330 cm
+150 716 150 720 m2
+150 709 150 705 L2
+Q
+S
+q
+1 0 0 1 255 -330 cm
+150 705 150 720 4 1 Ah
+150 720 150 705 4 2 Ah
+Q
+[1 0 0 1 -2.33 -262.3] e
+411 651 411 651 tbx
+0 tal
+11 tld
+1 1 1 0 k
+/_ArialMT 10 tfn
+(bottomdistance) 411 641.95 tpt
+T
+u
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+q
+1 0 0 1 45 0 cm
+109 330 105 330 m2
+120 330 L
+Q
+S
+q
+1 0 0 1 45 0 cm
+120 330 105 330 4 1 Ah
+Q
+q
+1 0 0 1 30 0 cm
+101 330 105 330 m2
+90 330 L
+Q
+S
+q
+1 0 0 1 30 0 cm
+90 330 105 330 4 1 Ah
+Q
+U
+u
+q
+1 0 0 1 120 -15 cm
+109 330 105 330 m2
+120 330 L
+Q
+S
+q
+1 0 0 1 120 -15 cm
+120 330 105 330 4 1 Ah
+Q
+q
+1 0 0 1 105 -15 cm
+101 330 105 330 m2
+90 330 L
+Q
+S
+q
+1 0 0 1 105 -15 cm
+90 330 105 330 4 1 Ah
+Q
+U
+u
+q
+1 0 0 1 285 -15 cm
+109 330 105 330 m2
+120 330 L
+Q
+S
+q
+1 0 0 1 285 -15 cm
+120 330 105 330 4 1 Ah
+Q
+q
+1 0 0 1 270 -15 cm
+101 330 105 330 m2
+90 330 L
+Q
+S
+q
+1 0 0 1 270 -15 cm
+90 330 105 330 4 1 Ah
+Q
+U
+u
+q
+1 0 0 1 360 0 cm
+109 330 105 330 m2
+120 330 L
+Q
+S
+q
+1 0 0 1 360 0 cm
+120 330 105 330 4 1 Ah
+Q
+q
+1 0 0 1 345 0 cm
+101 330 105 330 m2
+90 330 L
+Q
+S
+q
+1 0 0 1 345 0 cm
+90 330 105 330 4 1 Ah
+Q
+U
+[1 0 0 1 -15 5.998] e
+123 321 123 321 tbx
+0 tal
+11 tld
+1 1 1 0 k
+/_ArialMT 10 tfn
+(leftedgedistance) 123 311.95 tpt
+T
+[1 0 0 1 -36 9.633] e
+300.14 291.83 219 303 tbx
+0 tal
+11 tld
+/_ArialMT 10 tfn
+(leftmargindistance) 219 293.95 tpt
+T
+[1 0 0 1 120.2 8.906] e
+306.25 291.83 219 303 tbx
+0 tal
+11 tld
+/_ArialMT 10 tfn
+(rightmargindistance) 219 293.95 tpt
+T
+[1 0 0 1 -27 8.998] e
+450 318 450 318 tbx
+0 tal
+11 tld
+/_ArialMT 10 tfn
+(rightedgedistance) 450 308.95 tpt
+T
+[1 0 0 1 -6 58.55] e
+183 246.83 120 258 tbx
+0 tal
+11 tld
+/_ArialMT 10 tfn
+(edgedistance) 120 248.95 tpt
+T
+[1 0 0 1 18 53.27] e
+171 249 171 249 tbx
+0 tal
+11 tld
+/_ArialMT 10 tfn
+(margindistance) 171 239.95 tpt
+T
+[1 0 0 1 180 53.27] e
+171 249 171 249 tbx
+0 tal
+11 tld
+/_ArialMT 10 tfn
+(margindistance) 171 239.95 tpt
+T
+[1 0 0 1 312 58.55] e
+183 246.83 120 258 tbx
+0 tal
+11 tld
+/_ArialMT 10 tfn
+(edgedistance) 120 248.95 tpt
+T
+u
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+1 w
+q
+1 0 0 1 -15 0 cm
+60 285 m
+90 285 L
+Q
+S
+q
+1 0 0 1 0 0 cm
+75 285 m
+75 255 L
+Q
+S
+U
+u
+q
+-1 0 0 1 615 0 cm
+60 285 m
+90 285 L
+Q
+S
+q
+-1 0 0 1 600 0 cm
+75 285 m
+75 255 L
+Q
+S
+U
+u
+q
+0 -1 -1 0 810 825 cm
+60 285 m
+90 285 L
+Q
+S
+q
+0 -1 -1 0 810 810 cm
+75 285 m
+75 255 L
+Q
+S
+U
+u
+q
+0 -1 1 0 -210 825 cm
+60 285 m
+90 285 L
+Q
+S
+q
+0 -1 1 0 -210 810 cm
+75 285 m
+75 255 L
+Q
+S
+U
+0.5 w
+[3 3] 0 d
+525 735 75 285 [1 0 0 1 0 0] Bx
+s
+1 w
+[] 0 d
+q
+1 0 0 1 -45.09 -435 cm
+128 705 120 705 m2
+562.094 705 570.094 705 L2
+Q
+S
+q
+1 0 0 1 -45.09 -435 cm
+570.094 705 120 705 4 1 Ah
+120 705 570.094 705 4 2 Ah
+Q
+[1 0 0 1 0 0] e
+271.57 246.83 246 258 tbx
+0 tal
+11 tld
+0.862745 0.956863 -1.42109e-016 0 k
+/_ArialMT 10 tfn
+() 246 248.95 tpt
+T
+[1 0 0 1 0 0] e
+261 255 261 255 tbx
+0 tal
+11 tld
+1 1 1 0 k
+/_ArialMT 10 tfn
+() 261 245.95 tpt
+T
+[1 0 0 1 9.607 12.09] e
+261 255 261 255 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(paperwidth) 261 244.14 tpt
+T
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+q
+0 1 -1 0 1244 164.3 cm
+128 705 120 705 m2
+562.094 705 570.094 705 L2
+Q
+S
+q
+0 1 -1 0 1244 164.3 cm
+570.094 705 120 705 4 1 Ah
+120 705 570.094 705 4 2 Ah
+Q
+[0 1 -1 0 797.2 219] e
+261 255 261 255 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(paperheight) 261 244.14 tpt
+T
+[1 0 0 1 -12 12] e
+285 540 285 540 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(textwidth) 285 529.14 tpt
+T
+[1 0 0 1 0 12] e
+90 540 90 540 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(edge) 90 529.14 tpt
+T
+[1 0 0 1 0 9] e
+162 483 162 483 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(margin) 162 472.14 tpt
+T
+[1 0 0 1 -6.336 12] e
+408 480 408 480 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(margin) 408 469.14 tpt
+T
+[1 0 0 1 -6 18] e
+489 534 489 534 tbx
+0 tal
+13 tld
+/_ArialMT 12 tfn
+(edge) 489 523.14 tpt
+T
+-1.42109e-016 -1.42109e-016 -1.42109e-016 0 k
+q
+1 0 0 1 252.1 0 cm
+130.909 705 122.909 705 m2
+265 705 273 705 L2
+Q
+S
+q
+1 0 0 1 252.1 0 cm
+273 705 122.909 705 4 1 Ah
+122.909 705 273 705 4 2 Ah
+Q
+0.25 w
+q
+1 0 0 1 150.1 52.55 cm
+225 660 m
+225 645 L
+Q
+S
+[1 0 0 1 297.1 66] e
+126 654 126 654 tbx
+0 tal
+13 tld
+1 1 1 0 k
+/_ArialMT 12 tfn
+(cutspace) 126 643.14 tpt
+T
+%%PageTrailer
+_PDX_savepage restore
+%%Trailer
+end
+showpage
+%%EOF
diff --git a/doc/context/sources/general/manuals/start/graphics/fig-page-parameters-en.pdf b/doc/context/sources/general/manuals/start/graphics/fig-page-parameters-en.pdf
new file mode 100644
index 000000000..1dd1f75b1
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/fig-page-parameters-en.pdf
@@ -0,0 +1,1216 @@
+%PDF-1.0
+1 0 obj
+<<
+/Creator (Mayura Draw 4.3)
+>>
+endobj
+2 0 obj
+<<
+/Type /Catalog
+/Pages 4 0 R
+/Outlines 3 0 R
+>>
+endobj
+3 0 obj
+<<
+/Type /Outlines
+/Count 0
+>>
+endobj
+4 0 obj
+<<
+/Type /Pages
+/Count 1
+/Kids [ 5 0 R ]
+>>
+endobj
+5 0 obj
+<<
+/Type /Page
+/Parent 4 0 R
+/MediaBox [ 8 230 580 790 ]
+/Resources <<
+/ProcSet 6 0 R
+/XObject 9 0 R
+/Font 10 0 R
+>>
+/Contents 7 0 R
+>>
+endobj
+6 0 obj
+[ /PDF /Text ]
+endobj
+7 0 obj
+<< /Length 8 0 R >>
+stream
+1 1 1 rg
+0.137255 0.0431373 1 RG
+2 w
+18 780 m
+18 240 l
+570 240 l
+570 780 l
+18 780 l
+s
+0.866667 0.866667 0.866667 rg
+0.866667 0.866667 0.866667 RG
+0.5 w
+75 690 m
+75 660 l
+135 660 l
+135 690 l
+75 690 l
+b*
+150.33 690 m
+150.33 660 l
+210.33 660 l
+210.33 690 l
+150.33 690 l
+b*
+389.8 690 m
+389.8 660 l
+449.8 660 l
+449.8 690 l
+389.8 690 l
+b*
+225 690 m
+225 660 l
+375 660 l
+375 690 l
+225 690 l
+b*
+465.3 690 m
+465.3 660 l
+525.3 660 l
+525.3 690 l
+465.3 690 l
+b*
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 48.05 670.8 Tm
+0 Tw
+(top) Tj
+ET
+0.866667 0.866667 0.866667 rg
+75 645 m
+75 615 l
+135 615 l
+135 645 l
+75 645 l
+b*
+150 645 m
+150 615 l
+210 615 l
+210 645 l
+150 645 l
+b*
+390 645 m
+390 615 l
+450 615 l
+450 645 l
+390 645 l
+b*
+225 645 m
+225 615 l
+375 615 l
+375 645 l
+225 645 l
+b*
+465 645 m
+465 615 l
+525 615 l
+525 645 l
+465 645 l
+b*
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 27.37 625.8 Tm
+0 Tw
+(header) Tj
+ET
+0.866667 0.866667 0.866667 rg
+75 419.3 m
+75 389.3 l
+135 389.3 l
+135 419.3 l
+75 419.3 l
+b*
+150 419.3 m
+150 389.3 l
+210 389.3 l
+210 419.3 l
+150 419.3 l
+b*
+390 419.3 m
+390 389.3 l
+450 389.3 l
+450 419.3 l
+390 419.3 l
+b*
+225 419.3 m
+225 389.3 l
+375 389.3 l
+375 419.3 l
+225 419.3 l
+b*
+465 419.3 m
+465 389.3 l
+525 389.3 l
+525 419.3 l
+465 419.3 l
+b*
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 34.04 400.1 Tm
+0 Tw
+(footer) Tj
+ET
+0.866667 0.866667 0.866667 rg
+75 375 m
+75 345 l
+135 345 l
+135 375 l
+75 375 l
+b*
+150 375 m
+150 345 l
+210 345 l
+210 375 l
+150 375 l
+b*
+390 375 m
+390 345 l
+450 345 l
+450 375 l
+390 375 l
+b*
+225 375 m
+225 345 l
+375 345 l
+375 375 l
+225 375 l
+b*
+465 375 m
+465 345 l
+525 345 l
+525 375 l
+465 375 l
+b*
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 28.04 355.8 Tm
+0 Tw
+(bottom) Tj
+ET
+0.866667 0.866667 0.866667 rg
+75 600 m
+75 435 l
+135 435 l
+135 600 l
+75 600 l
+b*
+150 600 m
+150 435 l
+210 435 l
+210 600 l
+150 600 l
+b*
+390 600 m
+390 435 l
+450 435 l
+450 600 l
+390 600 l
+b*
+1 0.6 0.2 rg
+225 600 m
+225 435 l
+375 435 l
+375 600 l
+225 600 l
+b*
+0.866667 0.866667 0.866667 rg
+465 600 m
+465 435 l
+525 435 l
+525 600 l
+465 600 l
+b*
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 45.38 513.3 Tm
+0 Tw
+(text) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 81.98 745.3 Tm
+0 Tw
+(left edge) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 154.5 745.3 Tm
+0 Tw
+(left margin) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 290.3 745.3 Tm
+0 Tw
+(text) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 388.1 745.3 Tm
+0 Tw
+(right margin) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 468.7 745.3 Tm
+0 Tw
+(right edge) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 25.36 355.8 Tm
+0 Tw
+() Tj
+ET
+1 1 1 rg
+0 0 0 RG
+1 w
+241.45 726.02 m
+241.45 652.02 l
+S
+0 0 0 rg
+0 w
+241.45 734.02 m
+241.45 725.02 l
+238.45 725.02 l
+241.45 734.02 l
+244.45 725.02 l
+241.45 725.02 l
+241.45 734.02 l
+f*
+241.45 644.02 m
+241.45 653.02 l
+244.45 653.02 l
+241.45 644.02 l
+238.45 653.02 l
+241.45 653.02 l
+241.45 644.02 l
+f*
+1 1 1 rg
+1 w
+315 682 m
+315 668 l
+S
+0 0 0 rg
+0 w
+315 690 m
+315 681 l
+312 681 l
+315 690 l
+318 681 l
+315 681 l
+315 690 l
+f*
+315 660 m
+315 669 l
+318 669 l
+315 660 l
+312 669 l
+315 669 l
+315 660 l
+f*
+1 1 1 rg
+1 w
+83 705 m
+217.091 705 l
+S
+0 0 0 rg
+0 w
+75 705 m
+84 705 l
+84 702 l
+75 705 l
+84 708 l
+84 705 l
+75 705 l
+f*
+225.091 705 m
+216.091 705 l
+216.091 708 l
+225.091 705 l
+216.091 702 l
+216.091 705 l
+225.091 705 l
+f*
+1 1 1 rg
+1 w
+83 555 m
+127 555 l
+S
+0 0 0 rg
+0 w
+75 555 m
+84 555 l
+84 552 l
+75 555 l
+84 558 l
+84 555 l
+75 555 l
+f*
+135 555 m
+126 555 l
+126 558 l
+135 555 l
+126 552 l
+126 555 l
+135 555 l
+f*
+1 1 1 rg
+0.25 w
+225.091 713.273 m
+225.091 698.273 l
+S
+234.094 645 m
+249.094 645 l
+S
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 123.1 709.1 Tm
+0 Tw
+(backspace) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 246 709.1 Tm
+0 Tw
+(topspace) Tj
+ET
+1 1 1 rg
+1 w
+157.91 495 m
+201.91 495 l
+S
+0 0 0 rg
+0 w
+149.91 495 m
+158.91 495 l
+158.91 492 l
+149.91 495 l
+158.91 498 l
+158.91 495 l
+149.91 495 l
+f*
+209.91 495 m
+200.91 495 l
+200.91 498 l
+209.91 495 l
+200.91 492 l
+200.91 495 l
+209.91 495 l
+f*
+1 1 1 rg
+1 w
+398 495 m
+442 495 l
+S
+0 0 0 rg
+0 w
+390 495 m
+399 495 l
+399 492 l
+390 495 l
+399 498 l
+399 495 l
+390 495 l
+f*
+450 495 m
+441 495 l
+441 498 l
+450 495 l
+441 492 l
+441 495 l
+450 495 l
+f*
+1 1 1 rg
+1 w
+473 555 m
+517 555 l
+S
+0 0 0 rg
+0 w
+465 555 m
+474 555 l
+474 552 l
+465 555 l
+474 558 l
+474 555 l
+465 555 l
+f*
+525 555 m
+516 555 l
+516 558 l
+525 555 l
+516 552 l
+516 555 l
+525 555 l
+f*
+1 1 1 rg
+1 w
+315 637 m
+315 623 l
+S
+0 0 0 rg
+0 w
+315 645 m
+315 636 l
+312 636 l
+315 645 l
+318 636 l
+315 636 l
+315 645 l
+f*
+315 615 m
+315 624 l
+318 624 l
+315 615 l
+312 624 l
+315 624 l
+315 615 l
+f*
+1 1 1 rg
+1 w
+315 412 m
+315 398 l
+S
+0 0 0 rg
+0 w
+315 420 m
+315 411 l
+312 411 l
+315 420 l
+318 411 l
+315 411 l
+315 420 l
+f*
+315 390 m
+315 399 l
+318 399 l
+315 390 l
+312 399 l
+315 399 l
+315 390 l
+f*
+1 1 1 rg
+1 w
+315 367 m
+315 353 l
+S
+0 0 0 rg
+0 w
+315 375 m
+315 366 l
+312 366 l
+315 375 l
+318 366 l
+315 366 l
+315 375 l
+f*
+315 345 m
+315 354 l
+318 354 l
+315 345 l
+312 354 l
+315 354 l
+315 345 l
+f*
+1 1 1 rg
+0.137255 0.0431373 1 RG
+2 w
+240.9 555 m
+358.994 555 l
+S
+0.137255 0.0431373 1 rg
+0 w
+224.9 555 m
+242.9 555 l
+242.9 549 l
+224.9 555 l
+242.9 561 l
+242.9 555 l
+224.9 555 l
+f*
+374.994 555 m
+356.994 555 l
+356.994 561 l
+374.994 555 l
+356.994 549 l
+356.994 555 l
+374.994 555 l
+f*
+1 1 1 rg
+2 w
+255 629.047 m
+255 406.047 l
+S
+0.137255 0.0431373 1 rg
+0 w
+255 645.047 m
+255 627.047 l
+249 627.047 l
+255 645.047 l
+261 627.047 l
+255 627.047 l
+255 645.047 l
+f*
+255 390.047 m
+255 408.047 l
+261 408.047 l
+255 390.047 l
+249 408.047 l
+255 408.047 l
+255 390.047 l
+f*
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 321 670.8 Tm
+0 Tw
+(top) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 321 625.8 Tm
+0 Tw
+(header) Tj
+ET
+0.137255 0.0431373 1 rg
+BT
+/F1 12 Tf
+1 0 0 1 261 487.1 Tm
+0 Tw
+(height) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 277 560.5 Tm
+0 Tw
+(width) Tj
+ET
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 321 400.8 Tm
+0 Tw
+(footer) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 321 355.8 Tm
+0 Tw
+(bottom) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 83.65 560.6 Tm
+0 Tw
+(leftedge) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 154.9 500.5 Tm
+0 Tw
+(leftmargin) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 390.6 500.5 Tm
+0 Tw
+(rightmargin) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 470 560.6 Tm
+0 Tw
+(rightedge) Tj
+ET
+1 1 1 rg
+0 0 0 RG
+1 w
+315 592 m
+315 443 l
+S
+0 0 0 rg
+0 w
+315 600 m
+315 591 l
+312 591 l
+315 600 l
+318 591 l
+315 591 l
+315 600 l
+f*
+315 435 m
+315 444 l
+318 444 l
+315 435 l
+312 444 l
+315 444 l
+315 435 l
+f*
+BT
+/F1 12 Tf
+1 0 0 1 333 463.1 Tm
+0 Tw
+() Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 321 472.8 Tm
+0 Tw
+(textheight) Tj
+ET
+1 1 1 rg
+0.5 w
+405 656 m
+405 649 l
+S
+0 0 0 rg
+0 w
+405 660 m
+405 655.5 l
+403.5 655.5 l
+405 660 l
+406.5 655.5 l
+405 655.5 l
+405 660 l
+f*
+405 645 m
+405 649.5 l
+406.5 649.5 l
+405 645 l
+403.5 649.5 l
+405 649.5 l
+405 645 l
+f*
+BT
+/F1 10 Tf
+1 0 0 1 408.7 649.6 Tm
+0 Tw
+(topdistance) Tj
+ET
+1 1 1 rg
+0.5 w
+405 611 m
+405 604 l
+S
+0 0 0 rg
+0 w
+405 615 m
+405 610.5 l
+403.5 610.5 l
+405 615 l
+406.5 610.5 l
+405 610.5 l
+405 615 l
+f*
+405 600 m
+405 604.5 l
+406.5 604.5 l
+405 600 l
+403.5 604.5 l
+405 604.5 l
+405 600 l
+f*
+BT
+/F1 10 Tf
+1 0 0 1 408.7 604.6 Tm
+0 Tw
+(headerdistance) Tj
+ET
+1 1 1 rg
+0.5 w
+405 431 m
+405 424 l
+S
+0 0 0 rg
+0 w
+405 435 m
+405 430.5 l
+403.5 430.5 l
+405 435 l
+406.5 430.5 l
+405 430.5 l
+405 435 l
+f*
+405 420 m
+405 424.5 l
+406.5 424.5 l
+405 420 l
+403.5 424.5 l
+405 424.5 l
+405 420 l
+f*
+BT
+/F1 10 Tf
+1 0 0 1 408.7 424.7 Tm
+0 Tw
+(footerdistance) Tj
+ET
+1 1 1 rg
+0.5 w
+405 386 m
+405 379 l
+S
+0 0 0 rg
+0 w
+405 390 m
+405 385.5 l
+403.5 385.5 l
+405 390 l
+406.5 385.5 l
+405 385.5 l
+405 390 l
+f*
+405 375 m
+405 379.5 l
+406.5 379.5 l
+405 375 l
+403.5 379.5 l
+405 379.5 l
+405 375 l
+f*
+BT
+/F1 10 Tf
+1 0 0 1 408.7 379.7 Tm
+0 Tw
+(bottomdistance) Tj
+ET
+1 1 1 rg
+0.5 w
+154 330 m
+165 330 l
+S
+0 0 0 rg
+0 w
+150 330 m
+154.5 330 l
+154.5 328.5 l
+150 330 l
+154.5 331.5 l
+154.5 330 l
+150 330 l
+f*
+1 1 1 rg
+0.5 w
+131 330 m
+120 330 l
+S
+0 0 0 rg
+0 w
+135 330 m
+130.5 330 l
+130.5 331.5 l
+135 330 l
+130.5 328.5 l
+130.5 330 l
+135 330 l
+f*
+1 1 1 rg
+0.5 w
+229 315 m
+240 315 l
+S
+0 0 0 rg
+0 w
+225 315 m
+229.5 315 l
+229.5 313.5 l
+225 315 l
+229.5 316.5 l
+229.5 315 l
+225 315 l
+f*
+1 1 1 rg
+0.5 w
+206 315 m
+195 315 l
+S
+0 0 0 rg
+0 w
+210 315 m
+205.5 315 l
+205.5 316.5 l
+210 315 l
+205.5 313.5 l
+205.5 315 l
+210 315 l
+f*
+1 1 1 rg
+0.5 w
+394 315 m
+405 315 l
+S
+0 0 0 rg
+0 w
+390 315 m
+394.5 315 l
+394.5 313.5 l
+390 315 l
+394.5 316.5 l
+394.5 315 l
+390 315 l
+f*
+1 1 1 rg
+0.5 w
+371 315 m
+360 315 l
+S
+0 0 0 rg
+0 w
+375 315 m
+370.5 315 l
+370.5 316.5 l
+375 315 l
+370.5 313.5 l
+370.5 315 l
+375 315 l
+f*
+1 1 1 rg
+0.5 w
+469 330 m
+480 330 l
+S
+0 0 0 rg
+0 w
+465 330 m
+469.5 330 l
+469.5 328.5 l
+465 330 l
+469.5 331.5 l
+469.5 330 l
+465 330 l
+f*
+1 1 1 rg
+0.5 w
+446 330 m
+435 330 l
+S
+0 0 0 rg
+0 w
+450 330 m
+445.5 330 l
+445.5 331.5 l
+450 330 l
+445.5 328.5 l
+445.5 330 l
+450 330 l
+f*
+BT
+/F1 10 Tf
+1 0 0 1 108 317.9 Tm
+0 Tw
+(leftedgedistance) Tj
+ET
+BT
+/F1 10 Tf
+1 0 0 1 183 303.6 Tm
+0 Tw
+(leftmargindistance) Tj
+ET
+BT
+/F1 10 Tf
+1 0 0 1 339.2 302.9 Tm
+0 Tw
+(rightmargindistance) Tj
+ET
+BT
+/F1 10 Tf
+1 0 0 1 423 317.9 Tm
+0 Tw
+(rightedgedistance) Tj
+ET
+BT
+/F1 10 Tf
+1 0 0 1 114 307.5 Tm
+0 Tw
+(edgedistance) Tj
+ET
+BT
+/F1 10 Tf
+1 0 0 1 189 293.2 Tm
+0 Tw
+(margindistance) Tj
+ET
+BT
+/F1 10 Tf
+1 0 0 1 351 293.2 Tm
+0 Tw
+(margindistance) Tj
+ET
+BT
+/F1 10 Tf
+1 0 0 1 432 307.5 Tm
+0 Tw
+(edgedistance) Tj
+ET
+1 1 1 rg
+1 w
+45 285 m
+75 285 l
+S
+75 285 m
+75 255 l
+S
+555 285 m
+525 285 l
+S
+525 285 m
+525 255 l
+S
+525 765 m
+525 735 l
+S
+525 735 m
+555 735 l
+S
+75 765 m
+75 735 l
+S
+75 735 m
+45 735 l
+S
+0.5 w
+[3 3] 0 d
+75 285 m
+75 735 l
+525 735 l
+525 285 l
+75 285 l
+s
+1 w
+[] 0 d
+82.91 270 m
+517.004 270 l
+S
+0 0 0 rg
+0 w
+74.91 270 m
+83.91 270 l
+83.91 267 l
+74.91 270 l
+83.91 273 l
+83.91 270 l
+74.91 270 l
+f*
+525.004 270 m
+516.004 270 l
+516.004 273 l
+525.004 270 l
+516.004 267 l
+516.004 270 l
+525.004 270 l
+f*
+0.137255 0.0431373 1 rg
+BT
+/F1 10 Tf
+1 0 0 1 246 248.9 Tm
+0 Tw
+() Tj
+ET
+0 0 0 rg
+BT
+/F1 10 Tf
+1 0 0 1 261 245.9 Tm
+0 Tw
+() Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 270.6 256.2 Tm
+0 Tw
+(paperwidth) Tj
+ET
+1 1 1 rg
+1 w
+539 292.3 m
+539 726.394 l
+S
+0 0 0 rg
+0 w
+539 284.3 m
+539 293.3 l
+542 293.3 l
+539 284.3 l
+536 293.3 l
+539 293.3 l
+539 284.3 l
+f*
+539 734.394 m
+539 725.394 l
+536 725.394 l
+539 734.394 l
+542 725.394 l
+539 725.394 l
+539 734.394 l
+f*
+BT
+/F1 12 Tf
+0 1 -1 0 553.1 480 Tm
+0 Tw
+(paperheight) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 273 541.1 Tm
+0 Tw
+(textwidth) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 90 541.1 Tm
+0 Tw
+(edge) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 162 481.1 Tm
+0 Tw
+(margin) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 401.7 481.1 Tm
+0 Tw
+(margin) Tj
+ET
+BT
+/F1 12 Tf
+1 0 0 1 483 541.1 Tm
+0 Tw
+(edge) Tj
+ET
+1 1 1 rg
+1 w
+383 705 m
+517.091 705 l
+S
+0 0 0 rg
+0 w
+375 705 m
+384 705 l
+384 702 l
+375 705 l
+384 708 l
+384 705 l
+375 705 l
+f*
+525.091 705 m
+516.091 705 l
+516.091 708 l
+525.091 705 l
+516.091 702 l
+516.091 705 l
+525.091 705 l
+f*
+1 1 1 rg
+0.25 w
+375.091 712.545 m
+375.091 697.545 l
+S
+0 0 0 rg
+BT
+/F1 12 Tf
+1 0 0 1 423.1 709.1 Tm
+0 Tw
+(cutspace) Tj
+ET
+endstream
+endobj
+8 0 obj
+11561
+endobj
+10 0 obj
+<<
+/F1 11 0 R
+>>
+endobj
+11 0 obj
+<<
+/Type /Font
+/Subtype /TrueType
+/Name /F1
+/BaseFont /Arial
+/Encoding /WinAnsiEncoding
+/FirstChar 30
+/LastChar 255
+/Widths [ 750 750 278 278 355 556 556 889 667 191 333 333 389 584 278 333
+ 278 278 556 556 556 556 556 556 556 556 556 556 278 278 584 584
+ 584 556 1015 667 667 722 722 667 611 778 722 278 500 667 556 833
+ 722 778 667 778 722 667 611 722 667 944 667 667 611 278 278 278
+ 469 556 333 556 556 500 556 556 278 556 556 222 222 500 222 833
+ 556 556 556 556 333 500 278 556 500 722 500 500 500 334 260 334
+ 584 750 556 750 222 556 333 1000 556 556 333 1000 667 333 1000 750
+ 611 750 750 222 222 333 333 350 556 1000 333 1000 500 333 944 750
+ 500 667 278 333 556 556 556 556 260 556 333 737 370 556 584 333
+ 737 552 400 549 333 333 333 576 537 278 333 333 365 556 834 834
+ 834 611 667 667 667 667 667 667 1000 722 667 667 667 667 278 278
+ 278 278 722 722 778 778 778 778 778 584 778 722 722 722 722 667
+ 667 611 556 556 556 556 556 556 889 500 556 556 556 556 278 278
+ 278 278 556 556 556 556 556 556 556 549 611 556 556 556 556 500
+ 556 500]
+/FontDescriptor 12 0 R
+>>
+endobj
+12 0 obj
+<<
+/Type /FontDescriptor
+/FontName /Arial
+/FontBBox [ -665 -325 2000 1006 ]
+/Ascent 905
+/Descent -212
+/CapHeight 905
+/XHeight 724
+/ItalicAngle 0
+/Flags 32
+/StemV 70
+>>
+endobj
+9 0 obj
+<<
+>>
+endobj
+xref
+0 13
+0000000000 65535 f
+0000000010 00000 n
+0000000063 00000 n
+0000000135 00000 n
+0000000187 00000 n
+0000000253 00000 n
+0000000417 00000 n
+0000000450 00000 n
+0000012068 00000 n
+0000013449 00000 n
+0000012092 00000 n
+0000012130 00000 n
+0000013251 00000 n
+trailer
+<<
+/Size 13
+/Root 2 0 R
+/Info 1 0 R
+>>
+startxref
+13474
+%%EOF
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-00.eps b/doc/context/sources/general/manuals/start/graphics/ma-cb-00.eps
new file mode 100644
index 000000000..dece521c5
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-00.eps
@@ -0,0 +1,2799 @@
+%!PS-Adobe-2.0 EPSF-2.0
+%%BoundingBox: 154 313 441 529
+%%Creator: CorelDRAW!
+%%Title: GRACHT.EPS
+%%CreationDate: Wed Aug 13 17:01:56 1997
+
+%%DocumentFonts:
+%%DocumentProcessColors: Cyan Magenta Yellow Black
+%%EndComments
+%%BeginProlog
+/AutoFlatness false def
+% -------------- POSTSCRIPT PROLOG FOR CORELDRAW 3.X ------
+% Copyright 1992 Corel Corporation. All rights reserved.
+/wCorelDict 300 dict def wCorelDict begin/bd{bind def}bind def
+/ld{load def}bd/xd{exch def}bd/_ null def
+/$c 0 def/$m 0 def/$y 0 def/$k 0 def/$t 1 def
+/$n _ def/$o 0 def/$fil 0 def/$bkg false def
+/$C 0 def/$M 0 def/$Y 0 def/$K 0 def/$T 1 def
+/$N _ def/$O 0 def/$PF false def/$ctm matrix currentmatrix def
+/$ptm matrix def/$ttm matrix def/$stm matrix def
+/$fst 128 def/$pad 0 def/$rox 0 def/$roy 0 def
+currentscreen/@dsp xd/$dsp/@dsp def/$dsa xd
+/$dsf xd/$sdf false def/$SDF false def/$Scra 0.0 def
+/$sv 0 def/@cp/closepath ld/@gs/gsave ld/@gr/grestore ld
+/@np/newpath ld/@sv{/$sv save def}bd/@rs{$sv restore}bd
+/@ss{exch $Scra add exch load setscreen}bd
+AutoFlatness{/$cpx ([Error: PathTooComplex; OffendingCommand: AnyPaintingOperator]\n) def
+/@err1{$cpx print flush newpath}bd/@ifl{dup currentflat exch sub 10 gt
+{@err1 exit}{currentflat 2 add setflat}ifelse}bd
+/@fill/fill ld/fill{currentflat{{@fill}stopped{@ifl}{exit}ifelse
+}bind loop setflat}bd/@eofill/eofill ld/eofill{currentflat{{@eofill}
+stopped{@ifl}{exit}ifelse}bind loop setflat}bd
+/@clip/clip ld/clip{currentflat{{@clip}stopped{initclip @ifl}{exit
+}ifelse}bind loop setflat}bd/@eoclip/eoclip ld
+/eoclip{currentflat{{@eoclip}stopped{initclip @ifl}{exit}ifelse
+}bind loop setflat}bd/@stroke/stroke ld/stroke{currentflat{{@stroke}
+stopped{@ifl}{exit}ifelse}bind loop setflat}bd}if
+/InRange{3 -1 roll 2 copy le{pop}{exch pop}ifelse
+2 copy ge{pop}{exch pop}ifelse}bd/wDstChck{2 1 roll dup 3 -1 roll
+eq{1 add}if}bd/@dot{dup mul exch dup mul add 1 exch sub 2 div}bd
+/@lin{exch pop abs 1 exch sub}bd/@MN{2 copy le{pop}{exch pop}ifelse}bd
+/setcmykcolor where{pop}{/setcmykcolor{4 1 roll
+3{3 index add 1 @MN 1 exch sub 3 1 roll}repeat
+setrgbcolor pop}bd}ifelse/setoverprint{/$op xd}bd
+/currentoverprint{$op}bd/setsepcolor{1 exch sub setgray}bd
+/checksepcolor{1 exch sub dup setgray 1 eq exch 1 eq and not}bd
+/setprocesscolor{ColorSeparationMode 0 eq{setcmykcolor}{
+0 4 $ink sub index exch pop 5 1 roll 4{pop}repeat
+setsepcolor}ifelse}bd/findcmykcustomcolor{5 array astore}bd
+/setcustomcolor where{pop}{/setcustomcolor{ColorSeparationMode 0 eq{
+exch aload pop pop 4{4 index mul 4 1 roll}repeat
+5 -1 roll pop setcmykcolor}{exch aload pop
+CurrentInkName eq{4 index}{0}ifelse 6 1 roll
+5{pop}repeat setsepcolor}ifelse}bd}ifelse/colorimage where{pop}{
+/colorimage{pop pop pop pop pop{currentfile $dat readhexstring pop pop}
+repeat pop}bd}ifelse/@tc{dup 1 ge{pop}{4{dup
+6 -1 roll mul exch}repeat pop}ifelse}bd/@scc{1 eq setoverprint
+dup _ eq{pop setprocesscolor pop}{findcmykcustomcolor
+exch setcustomcolor}ifelse ColorSeparationMode 0 eq{true}{
+currentgray 1 eq currentoverprint and not}ifelse}bd
+/@sft{/$tx $tllx $pxf add dup $tllx gt{$pwid sub}if def
+/$ty $tury $pyf sub dup $tury lt{$phei add}if def}bd
+/@stb{pathbbox/$ury xd/$urx xd/$lly xd/$llx xd}bd
+/@ep{{cvx exec}forall}bd/@tp{@sv/$in true def
+2 copy dup $lly le{/$in false def}if $phei sub $ury ge{/$in false def}if
+dup $urx ge{/$in false def}if $pwid add $llx le{/$in false def}if
+$in{@np 2 copy m $pwid 0 rl 0 $phei neg rl $pwid neg 0 rl
+0 $phei rl clip @np $pn cvlit load aload pop
+7 -1 roll 5 index sub 7 -1 roll 3 index sub translate
+/$ctm matrix currentmatrix def @ep pop pop pop pop}{pop pop}ifelse
+@rs}bd/@th{@sft 0 1 $tly 1 sub{dup $psx mul $tx add{
+dup $llx gt{$pwid sub}{exit}ifelse}loop exch $phei mul $ty exch sub
+0 1 $tlx 1 sub{$pwid mul 3 copy 3 -1 roll add exch
+@tp pop}for pop pop}for}bd/@tv{@sft 0 1 $tlx 1 sub{dup $pwid mul $tx add
+exch $psy mul $ty exch sub{dup $ury lt{$phei add}{exit}ifelse}loop
+0 1 $tly 1 sub{$phei mul 3 copy sub @tp pop}for
+pop pop}for}bd/@pf{@gs $ctm setmatrix $pm concat
+@stb eoclip Bburx Bbury $pm itransform/$tury xd/$turx xd
+Bbllx Bblly $pm itransform/$tlly xd/$tllx xd
+/$wid $turx $tllx sub def/$hei $tury $tlly sub def
+@gs $vectpat{1 0 0 0 0 _ $o @scc{eofill}if}{$t $c $m $y $k $n $o @scc{
+$tllx $tlly translate $wid $hei scale <00> 8 1 false [ 8 0 0 1 0 0 ]{}imagemask
+/$bkg true def}if}ifelse @gr $wid 0 gt $hei 0 gt and{
+$pn cvlit load aload pop/$pd xd 3 -1 roll sub/$phei xd
+exch sub/$pwid xd/$tlx $wid $pwid div ceiling 1 add def
+/$tly $hei $phei div ceiling 1 add def $psx 0 eq{@tv}{@th}ifelse}if
+@gr @np/$bkg false def}bd/@dlt{ColorSeparationMode 0 eq{
+/$dc $toc $tot mul $frc $frt mul dup/$c xd sub $fst 1 sub div def
+/$dm $tom $tot mul $frm $frt mul dup/$m xd sub $fst 1 sub div def
+/$dy $toy $tot mul $fry $frt mul dup/$y xd sub $fst 1 sub div def
+/$dk $tok $tot mul $frk $frt mul dup/$k xd sub $fst 1 sub div def
+true}{$frt $frc $frm $fry $frk $frn $o @scc
+dup{/$frk 1 currentgray sub def}{/$frk 0 def}ifelse
+$tot $toc $tom $toy $tok $ton $o @scc dup{/$tok 1 currentgray sub def}{
+/$tok 0 def}ifelse or dup{/$c 0 def/$m 0 def/$y 0 def/$k $frk def
+/$dc 0 def/$dm 0 def/$dy 0 def/$dk $tok $frk sub $fst 1 sub div def}if
+}ifelse}bd/@ftl{1 index 4 index sub dup $pad mul dup/$pdw xd
+2 mul sub $fst div/$wid xd 2 index sub/$hei xd
+pop translate $c $m $y $k 4 copy ColorSeparationMode 0 ne
+{1 exch sub setgray pop pop pop}{setcmykcolor}ifelse
+0 0 moveto 0 $hei lineto $pdw $hei lineto $pdw 0 lineto 0 0 lineto fill
+$pdw 0 translate $fst{4 copy ColorSeparationMode 0 ne
+{1 exch sub setgray pop pop pop}{setcmykcolor}ifelse
+0 0 moveto 0 $hei lineto $wid $hei lineto $wid 0 lineto 0 0 lineto fill
+$wid 0 translate $dk add 4 1 roll $dy add 4 1 roll
+$dm add 4 1 roll $dc add 4 1 roll}repeat $dk sub 4 1 roll
+$dy sub 4 1 roll $dm sub 4 1 roll $dc sub 4 1 roll
+ColorSeparationMode 0 ne{1 exch sub setgray pop pop pop}
+{setcmykcolor}ifelse 0 0 moveto 0 $hei lineto $pdw $hei lineto $pdw 0 lineto 0 0 lineto fill
+}bd/@ftr{1 index 4 index sub dup $rox mul/$row xd
+2 div 1 index 4 index sub dup $roy mul/$roh xd
+2 div 2 copy dup mul exch dup mul add sqrt
+$row dup mul $roh dup mul add sqrt add dup/$hei xd $fst div/$wid xd
+4 index add $roh add exch 5 index add $row add
+exch translate pop pop pop pop currentflat dup 5 mul setflat
+$c $m $y $k 4 copy ColorSeparationMode 0 ne
+{1 exch sub setgray pop pop pop}{setcmykcolor}ifelse
+$wid 0 moveto 0 0 $hei 0 360 arc fill 1.0 $pad 2 mul sub dup scale
+$fst{4 copy ColorSeparationMode 0 ne{1 exch sub setgray pop pop pop}
+{setcmykcolor}ifelse $wid 0 moveto 0 0 $hei 0 360 arc fill
+/$hei $hei $wid sub def $dk add 4 1 roll $dy add 4 1 roll
+$dm add 4 1 roll $dc add 4 1 roll}repeat pop pop pop pop
+setflat}bd/@ff{@gs @dlt{$ctm setmatrix eoclip
+newpath Bbllx Bblly moveto Bbllx Bbury lineto
+Bburx Bbury lineto Bburx Bblly lineto $fan rotate
+pathbbox newpath $fty 1 eq{@ftr}{@ftl}ifelse}if
+@gr @np}bd/@Pf{@sv ColorSeparationMode 0 eq $ink 3 eq or{0 J 0 j [] 0 d
+$t $c $m $y $k $n $o @scc pop $ctm setmatrix
+72 1000 div dup matrix scale dup concat dup Bburx exch Bbury exch itransform
+ceiling cvi/Bbury xd ceiling cvi/Bburx xd Bbllx exch Bblly exch itransform
+floor cvi/Bblly xd floor cvi/Bbllx xd $Prm aload pop
+$Psn load exec}{1 setgray eofill}ifelse @rs
+@np}bd/g{1 exch sub/$k xd/$c 0 def/$m 0 def/$y 0 def/$t 1 def/$n _ def/$fil 0 def
+}bd/G{1 exch sub/$K xd/$C 0 def/$M 0 def/$Y 0 def/$T 1 def/$N _ def}bd
+/k{/$k xd/$y xd/$m xd/$c xd/$t 1 def/$n _ def/$fil 0 def}bd
+/K{/$K xd/$Y xd/$M xd/$C xd/$T 1 def/$N _ def}bd
+/x{/$t xd/$n xd/$k xd/$y xd/$m xd/$c xd/$fil 0 def}bd
+/X{/$T xd/$N xd/$K xd/$Y xd/$M xd/$C xd}bd
+/d/setdash ld/i{dup 0 ne{setflat}{pop}ifelse}bd
+/j/setlinejoin ld/J/setlinecap ld/M/setmiterlimit ld
+/w/setlinewidth ld/O{/$o xd}bd/R{/$O xd}bd
+/c/curveto ld/C/c ld/v{4 -2 roll 2 copy 6 -2 roll curveto}bd
+/V/v ld/y{2 copy curveto}bd/Y/y ld/l/lineto ld
+/L/l ld/rl/rlineto ld/m/moveto ld/n/newpath ld
+/N/newpath ld/F{matrix currentmatrix $sdf{$scf $sca $scp @ss}if
+$fil 1 eq{@pf}{$fil 2 eq{@ff}{$fil 3 eq{@Pf}{$t $c $m $y $k $n $o @scc
+{eofill}{@np}ifelse}ifelse}ifelse}ifelse $sdf{$dsf $dsa $dsp @ss}if
+setmatrix}bd/f{@cp F}bd/S{matrix currentmatrix
+$ctm setmatrix $SDF{$SCF $SCA $SCP @ss}if $T $C $M $Y $K $N $O @scc{
+matrix currentmatrix $ptm concat stroke setmatrix}{@np}ifelse
+$SDF{$dsf $dsa $dsp @ss}if setmatrix}bd/s{@cp
+S}bd/B{@gs F @gr S}bd/b{@cp B}bd/W{eoclip}bd
+/p{/$pm xd 7{pop}repeat/$pyf xd/$pxf xd/$pn xd
+/$fil 1 def}bd/P{11{pop}repeat}bd/u{}bd/U{}bd
+/A{pop}bd/q/@gs ld/Q/@gr ld/E{5 array astore
+exch cvlit exch def}bd/`{}bd/~{}bd/@{}bd/&{}bd
+/CorelDrawReencodeVect [ 16#82/quotesinglbase/florin/quotedblbase/ellipsis/dagger/daggerdbl
+16#88/circumflex/perthousand/Scaron/guilsinglleft/OE
+16#91/quoteleft/quoteright/quotedblleft/quotedblright/bullet/endash/emdash
+16#98/tilde/trademark/scaron/guilsinglright/oe
+16#9F/Ydieresis 16#A1/exclamdown/cent/sterling/currency/yen/brokenbar/section
+16#a8/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/minus/registered/macron
+16#b0/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered
+16#b8/cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown
+16#c0/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla
+16#c8/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis
+16#d0/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply
+16#d8/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls
+16#e0/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
+16#e8/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
+16#f0/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide
+16#f8/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis
+] def/@cc{currentfile $dat readhexstring pop}bd
+/@sm{/$ctm $ctm currentmatrix def}bd/@E{/Bbury xd/Bburx xd
+/Bblly xd/Bbllx xd}bd/@c{@cp}bd/@p{/$fil 1 def
+1 eq/$vectpat xd/$pm xd/$psy xd/$psx xd/$pyf xd/$pxf xd
+/$pn xd}bd/@P{/$fil 3 def/$Psn xd array astore
+/$Prm xd}bd/@k{/$fil 2 def/$roy xd/$rox xd/$pad xd
+/$fty xd/$fan xd $fty 1 eq{/$fan 0 def}if/$tok xd/$toy xd/$tom xd/$toc xd
+/$frk xd/$fry xd/$frm xd/$frc xd/$frn _ def/$frt 1 def/$ton _ def/$tot 1 def
+}bd/@x{/$fil 2 def/$roy xd/$rox xd/$pad xd
+/$fty xd/$fan xd/$tot xd/$ton xd/$tok xd/$toy xd/$tom xd/$toc xd
+/$frt xd/$frn xd/$frk xd/$fry xd/$frm xd/$frc xd}bd
+/@ii{concat 3 index 3 index m 3 index 1 index l
+2 copy l 1 index 3 index l 3 index 3 index l
+clip pop pop pop pop}bd/@i{@sm @gs @ii 6 index 1 ne{/$frg true def
+pop pop}{1 eq{$T $C $M $Y $K $N $O @scc/$frg xd}{/$frg false def
+}ifelse 1 eq{@gs $ctm setmatrix $t $c $m $y $k $n $o @scc{eofill}if
+@gr}if}ifelse/$frg $frg $bkg or def @np/$ury xd/$urx xd/$lly xd/$llx xd
+/$bts xd/$hei xd/$wid xd/$dat $wid $bts mul 8 div ceiling cvi string def
+$frg{$SDF{$SCF $SCA $SCP @ss}if $llx $lly translate
+$urx $llx sub $ury $lly sub scale $wid $hei abs
+$bts 1 eq{false}{$bts}ifelse [ $wid 0 0 $hei neg 0
+$hei 0 gt{$hei}{0}ifelse]/@cc load $bts 1 eq{imagemask}{image}ifelse
+$SDF{$dsf $dsa $dsp @ss}if}{$hei abs{@cc pop}repeat}ifelse
+@gr $ctm setmatrix}def/@M{@sv}bd/@N{/@cc{}def
+1 eq{12 -1 roll neg 12 1 roll @I}{13 -1 roll neg 13 1 roll
+@i}ifelse @rs}bd/@I{@sm @gs @ii @np/$ury xd/$urx xd/$lly xd/$llx xd
+/$ncl xd/$bts xd/$hei xd/$wid xd/$dat $wid $bts mul $ncl mul 8 div ceiling cvi string def
+$llx $lly translate $urx $llx sub $ury $lly sub scale
+$wid $hei abs $bts [ $wid 0 0 $hei neg 0 $hei 0 gt{$hei}{0}ifelse]
+/@cc load false $ncl colorimage @gr $ctm setmatrix}bd
+/z{exch findfont exch scalefont setfont}bd
+/ZB{9 dict dup begin 4 1 roll/FontType 3 def
+/FontMatrix xd/FontBBox xd/Encoding 256 array def
+0 1 255{Encoding exch/.notdef put}for/CharStrings 256 dict def
+CharStrings/.notdef{}put/Metrics 256 dict def
+Metrics/.notdef 3 -1 roll put/BuildChar{exch
+dup/$char exch/Encoding get 3 index get def
+dup/Metrics get $char get aload pop setcachedevice
+begin Encoding exch get CharStrings exch get
+end exec}def end definefont pop}bd/ZBAddChar{findfont begin
+dup 4 1 roll dup 6 1 roll Encoding 3 1 roll put
+CharStrings 3 1 roll put Metrics 3 1 roll put
+end}bd/Z{findfont dup maxlength 2 add dict exch
+dup{1 index/FID ne{3 index 3 1 roll put}{pop pop}ifelse}forall
+pop dup dup/Encoding get 256 array copy dup/$fe xd
+/Encoding exch put dup/Fontname 3 index put
+3 -1 roll dup length 0 ne{0 exch{dup type 0 type eq{exch pop}{
+$fe exch 2 index exch put 1 add}ifelse}forall
+pop}if dup 256 dict dup/$met xd/Metrics exch put
+dup/FontMatrix get 0 get 1000 mul 1 exch div
+3 index length 256 eq{0 1 255{dup $fe exch get
+dup/.notdef eq{pop pop}{5 index 3 -1 roll get
+2 index mul $met 3 1 roll put}ifelse}for}if
+pop definefont pop pop}bd/@ftx{{currentpoint 3 -1 roll
+(0) dup 3 -1 roll 0 exch put dup @gs true charpath
+$ctm setmatrix @@txt @gr @np stringwidth pop 3 -1 roll add exch moveto
+}forall}bd/@ft{matrix currentmatrix exch $sdf{$scf $sca $scp @ss}if
+$fil 1 eq{/@@txt/@pf ld @ftx}{$fil 2 eq{/@@txt/@ff ld @ftx}{$fil 3 eq
+{/@@txt/@Pf ld @ftx}{$t $c $m $y $k $n $o @scc{show}{pop}ifelse}ifelse
+}ifelse}ifelse $sdf{$dsf $dsa $dsp @ss}if setmatrix}bd
+/@st{matrix currentmatrix exch $SDF{$SCF $SCA $SCP @ss}if
+$T $C $M $Y $K $N $O @scc{{currentpoint 3 -1 roll
+(0) dup 3 -1 roll 0 exch put dup @gs true charpath
+$ctm setmatrix $ptm concat stroke @gr @np stringwidth pop 3 -1 roll add exch moveto
+}forall}{pop}ifelse $SDF{$dsf $dsa $dsp @ss}if
+setmatrix}bd/@te{@ft}bd/@tr{@st}bd/@ta{dup
+@gs @ft @gr @st}bd/@t@a{dup @gs @st @gr @ft}bd
+/@tm{/$textsave save def @sm concat}bd/e{/t{@te}def}bd
+/r{/t{@tr}def}bd/o{/t{pop}def}bd/a{/t{@ta}def}bd
+/@a{/t{@t@a}def}bd/t{@te}def/T{@np $ctm setmatrix
+/$ttm matrix def $textsave restore}bd/@t{/$stm $stm currentmatrix def
+3 1 roll moveto $ttm concat t $stm setmatrix}def
+/@n{/$ttm exch matrix rotate def}bd/@s{}bd
+/@l{}bd/@B{@gs S @gr F}bd/@b{@cp @B}bd/@w{matrix rotate/$ptm xd
+matrix scale $ptm dup concatmatrix/$ptm xd
+1 eq{$ptm exch dup concatmatrix/$ptm xd}if
+1 w}bd/@g{1 eq dup/$sdf xd{/$scp xd/$sca xd
+/$scf xd}if}bd/@G{1 eq dup/$SDF xd{/$SCP xd
+/$SCA xd/$SCF xd}if}bd/@D{3 copy @ss/$dsp xd
+/$dsa xd/$dsf xd}bd/@j{@sv @np}bind def/@J{@rs}bind def
+/@sep{/ColorSeparationMode where{pop}{/ColorSeparationMode 0 def
+/CurrentInkName (Composite) def}ifelse ColorSeparationMode 0 eq{
+/CurrentInkName (Composite) def}if/CurrentInkName where{pop}{
+/CurrentInkName (Composite) def}ifelse CurrentInkName (Composite) eq
+{/$ink -1 def}{CurrentInkName (Cyan) eq{/$ink 0 def}{
+CurrentInkName (Magenta) eq{/$ink 1 def}{CurrentInkName (Yellow) eq
+{/$ink 2 def}{CurrentInkName (Black) eq{/$ink 3 def}{/$ink 4 def
+}ifelse}ifelse}ifelse}ifelse}ifelse}bd @sep
+/@whi{@gs -72000 dup moveto -72000 72000 lineto
+72000 dup lineto 72000 -72000 lineto closepath 1 setgray fill
+@gr}bd/@neg{ [{1 exch sub}/exec cvx currenttransfer/exec cvx] cvx settransfer
+@whi}bd/@reg{[] 0 d 0 setgray .3 setlinewidth
+2 copy 5.4 0 360 arc closepath 2 copy moveto 9 0 rlineto
+2 copy moveto -9 0 rlineto 2 copy moveto 0 9 rlineto
+moveto 0 -9 rlineto stroke}bd/leftbracket{(\050)}def
+/rightbracket{(\051)}def
+
+%%EndProlog
+%%BeginSetup
+11.4737 setmiterlimit
+1.00 setflat
+/$fst 128 def
+
+%%EndSetup
+@sv
+/$ctm matrix currentmatrix def
+@sv
+%%Note: Object
+188.06 385.92 440.57 527.47 @E
+ 0 O 0 @g
+0.20 0.10 0.00 0.00 k
+%%CURV 5
+188.06 527.47 m
+440.57 527.47 L
+439.20 385.92 L
+192.17 396.86 L
+188.06 527.47 L
+@c
+F
+%%Note: Object
+216.00 452.23 288.86 468.65 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.05 k
+%%CURV 24
+216.00 465.91 m
+216.00 465.91 228.24 463.18 231.62 465.91 c
+235.08 468.65 252.07 465.91 252.07 465.91 c
+252.07 465.91 260.21 461.81 265.68 461.81 c
+271.15 461.81 284.76 460.37 284.76 460.37 c
+288.86 453.53 l
+288.86 453.53 284.11 452.88 277.92 452.88 c
+271.80 452.88 252.72 452.23 252.72 452.23 c
+236.38 452.23 L
+226.15 458.35 L
+218.02 460.37 L
+216.00 465.91 L
+@c
+F
+%%Note: Object
+223.49 392.04 439.92 439.85 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.10 k
+%%CURV 20
+356.11 425.52 m
+354.82 439.85 L
+338.47 430.99 L
+324.86 429.62 L
+304.42 430.34 L
+295.63 427.61 L
+258.19 428.26 L
+241.13 428.26 L
+223.49 426.17 L
+228.96 420.77 L
+260.21 421.42 L
+294.98 421.42 L
+301.03 423.50 L
+319.39 423.50 L
+318.74 417.38 L
+326.88 416.74 L
+439.92 392.04 L
+439.20 411.91 L
+425.59 413.93 L
+356.11 425.52 L
+@c
+F
+%%Note: Object
+413.78 461.88 439.92 506.23 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.60 0.60 0.00 k
+%%CURV 6
+439.92 506.23 m
+413.78 506.23 L
+413.78 501.70 L
+431.35 461.88 L
+439.92 468.72 L
+439.92 506.23 L
+@c
+B
+%%Note: Object
+385.85 414.00 427.32 483.62 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.10 0.10 0.00 k
+%%CURV 7
+385.85 478.66 m
+389.95 482.69 L
+400.75 483.62 L
+427.32 462.82 L
+426.89 414.00 L
+389.02 420.34 L
+385.85 478.66 L
+@c
+B
+%%Note: Object
+322.99 428.69 340.63 446.26 @E
+ 0 O 0 @g
+0.50 0.00 0.50 0.50 k
+%%CURV 40
+332.28 446.26 m
+332.28 446.26 329.98 445.39 329.11 443.09 c
+328.25 440.78 326.38 438.62 326.38 438.62 c
+326.38 438.62 324.86 437.47 324.00 434.88 c
+323.21 432.36 322.99 432.14 322.99 431.06 c
+322.99 429.98 323.21 429.19 324.43 429.41 c
+325.73 429.55 326.81 430.63 326.81 430.63 c
+329.33 429.84 l
+329.33 429.84 329.90 429.62 331.42 430.85 c
+332.86 432.14 333.29 434.52 333.72 433.22 c
+334.15 431.93 333.94 432.58 334.73 431.06 c
+335.59 429.55 337.03 428.98 338.11 429.41 c
+339.19 429.84 338.47 428.69 339.55 430.20 c
+340.63 431.71 339.19 435.74 339.19 435.74 c
+336.24 445.39 L
+332.28 446.26 L
+@c
+F
+%%Note: Object
+325.51 428.04 361.44 475.92 @E
+ 0 O 0 @g
+0.60 0.00 0.60 0.40 k
+%%CURV 42
+357.19 445.82 m
+361.44 445.82 352.58 438.84 348.55 436.61 c
+344.45 434.30 342.65 428.04 338.11 433.87 c
+333.65 439.70 338.54 445.61 334.51 446.04 c
+330.48 446.54 331.85 445.18 328.68 446.54 c
+325.51 447.84 326.45 453.31 326.45 453.31 c
+326.45 453.31 329.98 458.71 331.42 461.88 c
+332.78 465.05 331.42 465.91 331.85 468.22 c
+332.28 470.52 335.02 472.32 335.02 472.32 c
+344.02 471.82 L
+346.25 475.78 l
+346.25 475.78 350.78 475.92 353.02 474.12 c
+355.25 472.32 355.25 469.58 355.25 469.58 c
+357.98 468.22 L
+357.55 460.58 L
+355.68 456.12 l
+355.68 456.12 355.82 452.95 357.19 450.72 C
+358.56 448.42 356.76 445.82 357.19 445.82 c
+@c
+F
+%%Note: Object
+154.87 359.28 227.88 448.34 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.20 k
+%%CURV 7
+155.38 448.34 m
+217.94 442.01 L
+221.98 427.97 L
+227.88 421.63 L
+211.68 402.26 L
+154.87 359.28 L
+155.38 448.34 L
+@c
+F
+%%Note: Object
+197.28 425.66 300.74 440.21 @E
+ 0 O 0 @g
+0.60 0.00 0.60 0.40 k
+%%CURV 65
+295.27 433.87 m
+294.84 434.23 297.65 435.46 293.62 436.32 c
+289.51 437.26 288.65 435.67 283.25 435.67 c
+277.85 435.67 278.28 433.87 276.05 435.67 c
+273.82 437.47 273.38 439.27 269.28 439.27 c
+265.25 439.27 263.45 439.70 260.78 437.90 c
+258.05 436.10 256.68 436.10 254.45 436.10 c
+252.22 436.10 250.34 436.18 247.68 436.61 c
+245.02 437.04 242.78 437.47 240.05 437.90 c
+237.31 438.41 234.58 438.84 231.91 438.41 c
+229.25 437.90 224.28 437.47 220.68 437.90 c
+217.08 438.41 214.34 440.21 211.18 438.41 c
+208.08 436.61 203.11 436.61 203.11 436.61 c
+198.14 435.67 L
+199.08 428.90 l
+199.08 428.90 197.28 426.60 203.54 426.60 c
+209.88 426.60 212.98 426.60 218.88 426.60 c
+224.71 426.60 223.42 425.66 230.11 427.03 c
+236.88 428.47 240.98 428.47 245.88 428.47 c
+250.85 428.47 254.88 427.97 259.85 427.97 c
+264.82 427.97 266.62 427.97 272.02 427.97 c
+277.42 427.97 279.22 427.54 290.02 427.54 c
+300.74 427.54 300.74 428.90 300.74 428.90 c
+299.88 433.37 L
+295.27 433.87 L
+@c
+F
+%%Note: Object
+154.87 380.95 228.31 427.03 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.50 k
+%%CURV 8
+159.84 411.26 m
+181.51 422.14 L
+200.38 426.60 L
+224.28 427.03 L
+228.31 422.57 L
+203.54 418.54 L
+154.87 380.95 L
+159.84 411.26 L
+@c
+F
+%%Note: Object
+154.73 314.06 260.78 423.00 @E
+ 0 O 0 @g
+0.00 0.50 0.80 0.20 k
+%%CURV 17
+259.85 421.20 m
+260.78 398.23 L
+227.88 397.30 L
+220.25 351.14 L
+190.80 314.06 L
+154.73 314.06 L
+154.87 362.88 l
+154.87 362.88 178.78 380.09 190.08 387.79 c
+201.31 395.50 224.28 417.60 226.51 420.34 c
+228.74 423.00 231.48 421.20 231.48 421.20 C
+259.85 421.20 L
+@c
+F
+%%Note: Object
+229.25 398.23 259.85 420.77 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%RECT 56.088 -41.400 0.000
+229.25 420.77 m
+259.85 420.77 L
+259.85 398.23 L
+229.25 398.23 L
+229.25 420.77 L
+@c
+B
+%%Note: Object
+271.22 374.90 272.59 384.19 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.00 K
+0 2.23 2.23 0.00 @w
+%%CURV 2
+272.59 384.19 m
+271.22 374.90 L
+S
+%%Note: Object
+191.23 313.85 421.34 420.77 @E
+ 0 O 0 @g
+0.10 0.05 0.00 0.00 k
+%%CURV 12
+420.48 314.57 m
+421.34 358.92 L
+312.84 395.35 L
+303.26 394.20 L
+298.15 399.31 L
+294.84 420.77 L
+258.84 420.26 L
+259.92 399.31 L
+268.92 353.45 L
+209.59 351.58 L
+191.23 313.85 L
+420.48 314.57 L
+@c
+F
+%%Note: Object
+189.65 314.06 322.34 353.09 @E
+ 0 O 0 @g
+1.00 0.80 0.00 0.00 k
+%%CURV 16
+209.16 353.09 m
+267.98 350.21 L
+307.94 338.90 l
+307.94 338.90 277.42 330.84 299.88 327.67 c
+322.34 324.43 312.91 324.00 306.65 320.40 c
+300.31 316.80 272.95 314.06 267.48 314.06 c
+262.08 314.06 189.65 314.06 189.65 314.06 C
+209.16 353.09 L
+@c
+F
+%%Note: Object
+300.96 431.06 303.77 470.59 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 1.00 0.00 k
+%%RECT 5.040 -73.800 0.000
+300.96 470.59 m
+303.77 470.59 L
+303.77 431.06 L
+300.96 431.06 L
+300.96 470.59 L
+@c
+B
+%%Note: Object
+262.66 467.86 334.37 474.05 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 1.00 0.00 k
+%%CURV 5
+263.16 474.05 m
+334.37 471.53 L
+330.41 467.86 L
+262.66 470.30 L
+263.16 474.05 L
+@c
+B
+%%Note: Object
+261.65 472.54 346.18 479.74 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.10 1.00 0.00 k
+%%CURV 5
+261.65 479.74 m
+346.18 475.27 L
+343.94 472.54 L
+262.15 475.99 L
+261.65 479.74 L
+@c
+B
+%%Note: Object
+303.77 423.07 307.80 476.86 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.10 1.00 0.00 k
+%%RECT 7.416 -75.024 0.000
+303.77 476.86 m
+307.80 476.86 L
+307.80 423.07 L
+303.77 423.07 L
+303.77 476.86 L
+@c
+B
+%%Note: Object
+258.77 422.14 266.26 478.30 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 2.23 2.23 0.00 @w
+%%CURV 2
+266.26 478.30 m
+258.77 422.14 L
+S
+%%Note: Object
+256.75 429.62 263.59 472.82 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 2.23 2.23 0.00 @w
+%%CURV 2
+263.59 472.82 m
+256.75 429.62 L
+S
+%%Note: Object
+307.73 442.30 317.38 463.61 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+307.73 463.61 m
+317.38 442.30 L
+S
+%%Note: Object
+307.51 437.33 317.09 453.17 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+307.51 453.17 m
+317.09 437.33 L
+S
+%%Note: Object
+316.58 427.90 322.99 443.74 @E
+ 0 O 0 @g
+1.00 0.80 0.00 0.00 k
+%%RECT 11.736 -29.016 0.000
+316.58 443.74 m
+322.99 443.74 L
+322.99 427.90 L
+316.58 427.90 L
+316.58 443.74 L
+@c
+F
+%%Note: Object
+307.22 428.90 316.58 436.10 @E
+ 0 O 0 @g
+1.00 0.60 0.00 0.00 k
+%%RECT 17.136 -13.176 0.000
+307.22 436.10 m
+316.58 436.10 L
+316.58 428.90 L
+307.22 428.90 L
+307.22 436.10 L
+@c
+F
+%%Note: Object
+255.89 430.42 303.05 430.92 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+255.89 430.92 m
+303.05 430.42 L
+S
+%%Note: Object
+257.98 426.46 304.56 426.67 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 2.02 2.02 0.00 @w
+%%CURV 2
+257.98 426.46 m
+304.56 426.67 L
+S
+%%Note: Object
+256.25 420.77 300.82 422.71 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%RECT 81.792 -3.600 0.000
+256.25 422.71 m
+300.82 422.71 L
+300.82 420.77 L
+256.25 420.77 L
+256.25 422.71 L
+@c
+B
+%%Note: Object
+244.44 430.92 246.17 471.02 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%RECT 2.736 -73.512 0.000
+244.44 471.02 m
+246.17 471.02 L
+246.17 430.92 L
+244.44 430.92 L
+244.44 471.02 L
+@c
+B
+%%Note: Object
+315.86 405.22 318.10 407.88 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+%%RECT 4.104 -4.968 0.000
+315.86 407.88 m
+318.10 407.88 L
+318.10 405.22 L
+315.86 405.22 L
+315.86 407.88 L
+@c
+S
+%%Note: Object
+301.32 400.97 303.05 417.10 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.50 0.80 0.20 k
+%%RECT 3.168 -29.448 0.000
+301.32 417.10 m
+303.05 417.10 L
+303.05 400.97 L
+301.32 400.97 L
+301.32 417.10 L
+@c
+B
+%%Note: Object
+302.54 400.68 304.27 417.60 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%RECT 3.168 -30.888 0.000
+302.54 417.60 m
+304.27 417.60 L
+304.27 400.68 L
+302.54 400.68 L
+302.54 417.60 L
+@c
+B
+%%Note: Object
+295.20 400.25 301.10 420.55 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%RECT 10.872 -37.224 0.000
+295.20 420.55 m
+301.10 420.55 L
+301.10 400.25 L
+295.20 400.25 L
+295.20 420.55 L
+@c
+B
+%%Note: Object
+295.49 394.20 315.22 401.18 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+1.00 0.25 0.00 0.00 k
+%%CURV 5
+295.49 401.18 m
+307.58 401.18 L
+315.22 394.99 L
+297.22 394.20 L
+295.49 401.18 L
+@c
+B
+%%Note: Object
+300.53 400.97 319.10 423.22 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.60 1.00 0.00 k
+%%CURV 7
+300.53 423.22 m
+319.10 423.22 L
+319.10 416.09 L
+316.80 416.09 L
+306.94 400.97 L
+301.32 400.97 L
+300.53 423.22 L
+@c
+B
+%%Note: Object
+306.43 343.66 439.92 417.31 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.50 1.00 0.00 k
+%%CURV 15
+439.92 391.39 m
+317.09 417.31 L
+306.43 401.69 L
+314.57 395.50 l
+314.57 395.50 319.39 392.76 329.62 387.29 c
+339.84 381.82 341.86 384.55 346.61 380.45 c
+351.36 376.34 369.65 375.05 369.65 375.05 c
+439.63 343.66 L
+439.92 391.39 L
+@c
+B
+%%Note: Object
+155.38 429.62 222.98 527.47 @E
+ 0 O 0 @g
+0.70 0.00 0.70 0.10 k
+%%CURV 33
+194.18 527.47 m
+201.67 527.47 191.02 515.59 194.40 508.82 c
+197.78 501.98 195.05 507.46 201.89 500.62 c
+208.66 493.78 213.41 491.76 213.41 486.29 c
+213.41 480.82 213.41 479.45 214.13 472.61 c
+214.78 465.77 218.81 458.93 219.53 454.82 c
+220.25 450.79 222.98 447.34 220.25 443.95 c
+217.51 440.57 216.79 440.57 206.64 440.57 c
+196.49 440.57 196.49 443.30 187.63 438.48 c
+178.78 433.73 179.50 429.62 172.66 433.73 c
+165.89 437.76 155.66 441.22 155.66 441.22 c
+155.38 527.47 L
+194.18 527.47 L
+@c
+F
+%%Note: Object
+208.87 338.18 276.41 368.64 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 1.44 1.44 0.00 @w
+ 0 O 0 @g
+1.00 0.50 0.00 0.00 k
+%%CURV 30
+276.41 364.90 m
+276.41 364.90 275.76 365.47 274.25 362.38 c
+272.66 359.21 272.66 357.34 269.86 352.94 c
+267.05 348.48 268.27 349.49 264.53 345.67 c
+260.71 341.93 263.38 345.38 258.34 341.93 c
+253.30 338.47 248.26 339.34 243.79 339.70 c
+239.40 339.98 230.62 338.18 226.87 340.34 c
+223.13 342.58 221.90 343.51 219.74 347.26 c
+217.58 351.00 217.58 351.00 215.71 354.46 c
+213.84 357.91 213.34 361.58 212.26 363.31 c
+208.87 368.64 L
+276.41 364.90 L
+@c
+B
+%%Note: Object
+354.53 420.26 388.87 480.10 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+%%CURV 5
+356.04 469.87 m
+354.53 425.81 L
+388.87 420.26 L
+387.29 480.10 L
+356.04 469.87 L
+@c
+S
+%%Note: Object
+356.76 473.26 400.90 502.63 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.75 0.75 0.00 k
+%%CURV 5
+400.90 502.63 m
+377.06 490.32 L
+356.76 473.26 L
+384.55 483.55 L
+400.90 502.63 L
+@c
+B
+%%Note: Object
+384.98 482.83 428.76 501.98 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.60 0.60 0.00 k
+%%CURV 4
+400.25 501.98 m
+384.98 483.62 L
+428.76 482.83 L
+400.25 501.98 L
+@c
+B
+%%Note: Object
+384.62 434.45 436.90 507.38 @E
+ 0 O 0 @g
+0.70 0.00 0.70 0.00 k
+%%CURV 40
+409.75 435.10 m
+406.30 435.10 407.02 434.45 402.26 438.48 c
+397.51 442.58 396.79 439.20 393.41 448.06 c
+390.02 456.91 388.01 454.18 388.66 461.66 c
+389.30 469.22 384.62 468.50 390.02 476.06 c
+395.42 483.55 394.13 479.45 399.53 487.66 c
+405.00 495.79 404.28 498.53 409.03 499.90 c
+413.78 501.26 412.49 507.38 418.61 499.90 c
+424.66 492.41 425.30 487.58 430.06 486.94 c
+434.88 486.29 436.25 488.95 436.25 480.82 c
+436.25 472.61 436.90 467.86 431.50 462.38 c
+426.02 456.91 421.27 458.28 420.55 450.07 c
+419.90 441.86 420.55 437.83 417.17 437.11 C
+413.78 436.39 409.75 435.10 409.75 435.10 c
+@c
+F
+%%Note: Object
+424.66 313.63 430.78 365.47 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.50 0.80 0.20 k
+%%RECT 11.232 -94.968 0.000
+424.66 365.47 m
+430.78 365.47 L
+430.78 313.63 L
+424.66 313.63 L
+424.66 365.47 L
+@c
+B
+%%Note: Object
+244.58 465.84 246.02 471.02 @E
+ 0 O 0 @g
+0.00 0.90 0.90 0.10 k
+%%RECT 2.664 -9.576 0.000
+244.58 471.02 m
+246.02 471.02 L
+246.02 465.84 L
+244.58 465.84 L
+244.58 471.02 L
+@c
+F
+%%Note: Object
+244.58 455.47 246.02 460.66 @E
+ 0 O 0 @g
+0.00 0.90 0.90 0.10 k
+%%RECT 2.664 -9.576 0.000
+244.58 460.66 m
+246.02 460.66 L
+246.02 455.47 L
+244.58 455.47 L
+244.58 460.66 L
+@c
+F
+%%Note: Object
+244.58 445.25 246.02 450.43 @E
+ 0 O 0 @g
+0.00 0.90 0.90 0.10 k
+%%RECT 2.664 -9.576 0.000
+244.58 450.43 m
+246.02 450.43 L
+246.02 445.25 L
+244.58 445.25 L
+244.58 450.43 L
+@c
+F
+%%Note: Object
+244.58 435.96 246.02 441.14 @E
+ 0 O 0 @g
+0.00 0.90 0.90 0.10 k
+%%RECT 2.664 -9.576 0.000
+244.58 441.14 m
+246.02 441.14 L
+246.02 435.96 L
+244.58 435.96 L
+244.58 441.14 L
+@c
+F
+%%Note: Object
+353.38 468.29 390.02 482.98 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.10 1.00 0.00 k
+%%CURV 7
+357.34 473.98 m
+354.53 473.98 L
+353.38 468.29 L
+387.22 480.17 L
+390.02 482.98 L
+384.34 482.98 L
+357.34 473.98 L
+@c
+B
+%%Note: Object
+356.11 420.77 389.52 479.59 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.20 K
+0 0.22 0.22 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.30 0.00 k
+%%CURV 5
+386.14 479.59 m
+389.52 420.77 L
+356.11 425.52 L
+356.83 468.65 L
+386.14 479.59 L
+@c
+B
+%%Note: Object
+368.42 458.35 371.81 470.66 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+%%CURV 5
+368.42 469.30 m
+368.42 458.35 L
+371.81 459.07 L
+371.16 470.66 L
+368.42 469.30 L
+@c
+S
+%%Note: Object
+373.75 421.42 384.77 446.04 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 1.44 1.44 0.00 @w
+%%CURV 5
+373.90 446.04 m
+373.75 422.86 L
+384.77 421.42 L
+384.12 446.04 L
+373.90 446.04 L
+@c
+S
+%%Note: Object
+350.06 430.34 378.65 466.42 @E
+ 0 O 0 @g
+0.80 0.00 0.80 0.20 k
+%%CURV 25
+366.34 431.64 m
+371.16 435.10 373.82 430.34 375.19 439.20 c
+376.56 448.13 378.65 450.86 375.91 454.25 c
+373.18 457.70 367.06 459.07 367.06 459.07 c
+367.06 459.07 367.70 465.26 362.30 462.46 c
+356.83 459.72 350.06 466.42 350.06 458.93 c
+350.06 451.37 354.10 448.13 357.55 444.67 c
+360.94 441.29 360.22 440.57 361.58 437.18 C
+362.95 433.73 366.34 431.64 366.34 431.64 c
+@c
+F
+%%Note: Object
+405.86 405.07 411.34 435.10 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%RECT 9.936 -55.080 0.000
+405.86 435.10 m
+411.34 435.10 L
+411.34 405.07 L
+405.86 405.07 L
+405.86 435.10 L
+@c
+B
+%%Note: Object
+209.16 359.21 277.06 377.42 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 1.44 1.44 0.00 @w
+ 0 O 0 @g
+0.40 0.15 0.00 0.00 k
+%%CURV 29
+270.50 375.84 m
+270.50 375.84 277.06 370.22 277.06 367.99 c
+277.06 365.83 276.98 364.25 272.66 362.95 c
+268.27 361.73 258.62 360.79 256.10 360.79 c
+253.58 360.79 247.32 359.86 245.45 359.86 c
+243.58 359.86 231.05 359.21 228.53 359.86 c
+226.08 360.43 219.82 359.21 217.58 360.79 c
+215.42 362.38 212.33 362.95 210.74 365.47 c
+209.16 367.99 209.16 368.35 209.16 371.16 c
+209.16 373.97 213.84 377.42 213.84 377.42 C
+270.50 375.84 L
+@c
+B
+%%Note: Object
+217.37 363.60 270.29 396.50 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.20 0.10 0.00 0.00 k
+%%CURV 25
+217.37 394.42 m
+217.37 394.42 235.51 396.50 241.85 396.50 c
+248.18 396.50 265.82 395.14 265.82 395.14 c
+265.82 395.14 268.06 384.41 268.06 383.04 c
+268.06 381.74 269.64 377.64 269.64 377.64 c
+270.29 367.63 l
+270.29 367.63 252.50 365.54 247.25 365.54 c
+241.99 365.54 223.27 363.60 221.47 364.25 c
+219.67 364.90 219.67 372.82 219.67 372.82 c
+217.37 376.49 L
+217.37 394.42 L
+@c
+B
+%%Note: Object
+220.10 381.53 239.18 392.54 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 22
+220.68 391.25 m
+222.91 392.26 228.24 392.26 229.82 392.26 c
+231.34 392.26 238.25 392.54 238.25 392.54 c
+239.18 390.02 L
+239.18 385.63 L
+237.60 383.76 L
+237.60 383.76 234.22 383.76 231.05 383.11 c
+227.88 382.46 222.26 381.53 222.26 381.53 c
+222.26 381.53 220.10 382.46 220.10 384.05 C
+220.10 385.63 220.68 391.25 220.68 391.25 c
+@c
+B
+%%Note: Object
+245.16 383.40 263.30 392.83 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 21
+247.03 392.83 m
+259.85 392.54 l
+259.85 392.54 262.37 392.26 262.66 390.31 c
+262.94 388.44 263.30 385.92 263.30 385.92 c
+263.30 385.92 262.94 383.76 261.43 383.76 c
+259.85 383.76 247.61 383.40 247.61 383.40 c
+247.61 383.40 245.45 384.34 245.45 385.92 c
+245.45 387.50 245.16 390.31 245.16 390.31 C
+247.03 392.83 L
+@c
+B
+%%Note: Object
+247.03 367.70 264.82 374.33 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 16
+249.48 374.33 m
+252.65 374.33 262.01 374.33 262.01 374.33 c
+264.82 371.81 L
+264.82 369.29 L
+262.01 368.35 250.42 367.99 250.42 367.99 c
+250.42 367.99 247.32 367.70 247.32 369.29 c
+247.32 370.87 247.03 372.38 247.03 372.38 C
+249.48 374.33 L
+@c
+B
+%%Note: Object
+223.20 366.12 242.35 373.03 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 13
+238.54 373.03 m
+242.28 371.81 L
+242.28 368.64 l
+242.28 368.64 242.35 367.70 240.12 367.70 c
+237.96 367.70 225.72 366.12 225.72 366.12 c
+223.20 367.70 L
+223.20 370.51 L
+225.43 372.74 L
+238.54 373.03 L
+@c
+B
+%%Note: Object
+219.38 372.82 269.64 379.66 @E
+0 J 0 j [] 0 d 0 R 0 @G
+1.00 0.30 0.00 0.00 K
+0 2.23 2.23 0.00 @w
+%%CURV 7
+219.38 372.82 m
+224.64 376.06 235.22 379.66 242.28 379.44 c
+249.26 379.22 265.97 378.29 269.64 374.47 C
+S
+%%Note: Object
+217.58 394.20 265.82 400.39 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 1.44 1.44 0.00 @w
+ 0 O 0 @g
+0.60 0.20 0.00 0.00 k
+%%CURV 18
+265.82 395.14 m
+259.92 399.46 l
+259.92 399.46 249.98 400.39 247.90 400.39 c
+245.88 400.39 235.94 400.39 235.94 400.39 c
+228.24 400.39 L
+222.34 397.87 L
+217.58 394.92 L
+218.95 394.20 l
+218.95 394.20 233.42 396.50 241.34 396.29 C
+249.26 396.07 265.61 395.14 265.82 395.14 C
+@c
+B
+%%Note: Object
+210.82 375.77 276.62 386.93 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.00 K
+0 2.81 2.81 0.00 @w
+%%CURV 40
+267.84 385.85 m
+268.92 385.85 270.29 385.85 272.16 384.70 c
+273.96 383.54 273.53 383.54 275.11 381.96 c
+276.62 380.38 275.98 379.22 275.98 379.22 c
+275.98 379.22 274.82 378.58 273.02 378.58 c
+271.22 378.58 265.82 378.07 263.74 378.07 c
+261.72 378.07 257.40 378.07 253.80 378.07 c
+250.20 378.07 244.94 377.86 242.28 377.86 c
+239.54 377.86 233.42 377.14 230.47 376.92 c
+227.52 376.70 223.49 376.70 220.10 376.70 c
+216.72 376.70 217.80 375.77 215.35 377.14 c
+212.83 378.58 211.97 377.21 211.97 379.66 c
+211.97 382.18 210.82 382.46 213.34 384.70 c
+215.78 386.93 215.35 386.06 217.15 386.06 C
+S
+%%Note: Object
+211.82 372.17 212.11 380.09 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.00 K
+0 2.23 2.23 0.00 @w
+%%CURV 2
+211.97 380.09 m
+211.97 372.17 L
+S
+%%Note: Object
+216.79 364.25 217.08 375.77 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.00 K
+0 2.23 2.23 0.00 @w
+%%CURV 2
+216.94 375.77 m
+216.94 364.25 L
+S
+%%Note: Object
+244.30 361.94 245.45 377.86 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.00 K
+0 2.23 2.23 0.00 @w
+%%CURV 2
+244.30 377.86 m
+245.45 361.94 L
+S
+%%Note: Object
+274.61 367.63 275.26 379.01 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.00 K
+0 2.23 2.23 0.00 @w
+%%CURV 2
+275.26 379.01 m
+274.61 367.63 L
+S
+%%Note: Object
+214.92 379.01 216.00 385.85 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.00 K
+0 2.23 2.23 0.00 @w
+%%CURV 2
+214.92 385.85 m
+216.00 379.01 L
+S
+%%Note: Object
+268.56 380.38 268.85 385.56 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.00 K
+0 2.23 2.23 0.00 @w
+%%CURV 2
+268.70 385.56 m
+268.70 380.38 L
+S
+%%Note: Object
+238.61 400.10 238.90 407.38 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.00 K
+0 2.81 2.81 0.00 @w
+%%CURV 2
+238.61 400.10 m
+238.90 407.38 L
+S
+%%Note: Object
+250.70 399.46 250.99 403.78 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.00 K
+0 2.81 2.81 0.00 @w
+%%CURV 2
+250.85 399.46 m
+250.85 403.78 L
+S
+%%Note: Object
+248.11 404.21 253.15 409.25 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.90 0.90 0.10 K
+0 2.23 2.23 0.00 @w
+ 0 O 0 @g
+0.00 0.10 1.00 0.00 k
+%%ELLI 9.216 -9.216 270.000 270.000 0
+250.63 409.25 m
+252.00 409.25 253.15 408.17 253.15 406.73 c
+253.15 405.29 252.00 404.21 250.63 404.21 c
+249.26 404.21 248.11 405.29 248.11 406.73 c
+248.11 408.17 249.26 409.25 250.63 409.25 c
+@c
+B
+%%Note: Object
+431.14 313.70 439.99 342.43 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.60 1.00 0.00 k
+%%RECT 14.976 -52.632 0.000
+431.14 342.43 m
+439.99 342.43 L
+439.99 313.70 L
+431.14 313.70 L
+431.14 342.43 L
+@c
+B
+%%Note: Object
+425.16 361.94 430.70 365.62 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 5
+425.16 364.75 m
+430.49 365.62 L
+430.70 362.95 L
+425.16 361.94 L
+425.16 364.75 L
+@c
+B
+%%Note: Object
+430.85 342.36 439.56 345.53 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 5
+439.56 342.36 m
+439.27 345.53 L
+430.85 345.53 L
+431.64 342.36 L
+439.56 342.36 L
+@c
+B
+%%Note: Object
+319.82 415.08 326.95 417.53 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%RECT 13.104 -4.536 0.000
+319.82 417.53 m
+326.95 417.53 L
+326.95 415.08 L
+319.82 415.08 L
+319.82 417.53 L
+@c
+B
+%%Note: Object
+316.30 390.38 318.10 405.22 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%RECT 3.168 -25.920 0.000
+316.37 405.22 m
+316.58 405.22 316.87 405.22 317.16 405.22 c
+317.52 405.22 317.81 405.22 318.10 405.22 C
+318.02 402.77 318.02 400.32 318.02 397.87 c
+318.02 395.35 318.02 392.90 318.10 390.38 C
+317.81 390.53 317.52 390.67 317.16 390.74 c
+316.94 390.82 316.58 391.03 316.37 391.03 C
+316.30 393.41 316.30 395.78 316.30 398.16 c
+316.30 400.46 316.37 402.91 316.37 405.22 C
+@c
+B
+%%Note: Object
+315.94 405.65 318.31 406.66 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%RECT 4.248 1.800 0.000
+315.94 405.65 m
+318.31 405.65 L
+318.31 406.66 L
+315.94 406.66 L
+315.94 405.65 L
+@c
+B
+%%Note: Object
+301.25 417.53 304.34 418.90 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.90 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%RECT 5.688 -2.520 0.000
+301.25 418.90 m
+304.34 418.90 L
+304.34 417.53 L
+301.25 417.53 L
+301.25 418.90 L
+@c
+B
+%%Note: Object
+259.85 382.39 313.78 406.80 @E
+ 0 O 0 @g
+1.00 0.30 0.00 0.00 k
+%%CURV 33
+259.85 403.63 m
+264.82 405.50 264.82 405.00 267.98 405.94 c
+271.08 406.80 271.58 405.50 274.25 405.50 c
+276.91 405.50 282.67 405.00 284.62 405.00 c
+289.58 405.00 L
+295.85 406.37 L
+297.22 395.50 L
+308.45 395.50 L
+313.78 392.33 l
+313.78 392.33 313.34 385.13 309.74 385.13 c
+306.22 385.13 301.61 382.39 298.08 385.13 c
+294.55 387.79 290.88 388.22 288.22 387.79 c
+285.55 387.36 280.94 386.93 277.42 386.93 c
+273.82 386.93 267.05 386.93 267.05 386.93 c
+265.25 395.93 L
+259.85 400.46 L
+259.85 403.63 L
+@c
+F
+%%Note: Object
+258.55 404.93 293.18 417.89 @E
+ 0 O 0 @g
+1.00 0.60 0.00 0.00 k
+%%CURV 33
+263.88 413.93 m
+270.22 416.45 273.82 416.23 277.85 416.66 c
+281.95 417.10 286.49 417.89 287.35 417.60 c
+292.75 415.80 L
+290.02 412.63 l
+290.02 412.63 292.25 406.30 290.02 408.10 c
+287.78 409.90 284.18 409.90 281.02 410.33 c
+277.85 410.76 272.45 408.53 275.18 408.53 c
+277.85 408.53 285.98 408.53 288.65 407.23 c
+293.18 404.93 l
+293.18 404.93 266.18 404.93 262.51 404.93 c
+258.91 404.93 258.55 409.03 260.78 409.03 c
+263.02 409.03 269.78 411.70 269.78 411.70 c
+261.65 413.06 L
+263.88 413.93 L
+@c
+F
+%%Note: Object
+194.98 412.63 208.94 441.07 @E
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 18
+199.94 441.07 m
+199.94 441.07 199.08 435.60 199.94 431.57 c
+200.88 427.54 199.94 426.17 201.31 423.43 c
+202.68 420.77 204.48 417.17 204.48 417.17 c
+208.94 414.50 L
+206.71 412.63 L
+201.74 412.63 L
+197.21 416.30 L
+195.91 427.03 L
+195.41 436.10 L
+194.98 440.64 L
+199.94 441.07 L
+@c
+F
+%%Note: Object
+185.04 407.23 199.08 441.07 @E
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 24
+199.08 408.17 m
+199.08 408.17 196.27 411.70 195.41 414.94 c
+194.54 418.10 192.74 424.37 192.74 427.97 c
+192.74 431.57 192.74 441.07 192.74 441.07 c
+185.54 437.04 l
+185.54 437.04 185.04 432.50 185.54 429.34 c
+185.98 426.17 186.84 421.20 187.34 418.10 c
+187.78 414.94 188.21 413.57 188.21 410.83 c
+188.21 408.17 193.68 407.23 193.68 407.23 C
+199.08 408.17 L
+@c
+F
+%%Note: Object
+167.98 398.23 181.94 436.61 @E
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 24
+181.94 400.46 m
+181.94 400.46 181.51 409.46 181.51 412.20 c
+181.51 414.94 181.51 426.17 181.51 426.17 c
+181.08 433.37 L
+176.98 432.07 L
+169.34 436.61 l
+169.34 436.61 169.34 426.60 169.34 423.94 c
+169.34 421.20 169.78 414.50 169.34 409.97 c
+168.91 405.43 169.78 405.00 168.91 401.83 c
+167.98 398.66 175.18 399.53 175.18 399.53 c
+180.14 398.23 L
+181.94 400.46 L
+@c
+F
+%%Note: Object
+155.38 390.53 169.34 440.64 @E
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 16
+155.38 391.39 m
+169.34 390.53 l
+169.34 390.53 168.84 393.70 167.54 396.36 c
+166.18 399.10 161.64 399.96 160.78 405.86 c
+159.84 411.77 158.54 415.80 158.54 420.77 c
+158.54 425.74 158.11 440.21 158.11 440.21 c
+155.38 440.64 L
+155.38 391.39 L
+@c
+F
+%%Note: Object
+371.45 343.94 421.42 376.92 @E
+ 0 O 0 @g
+1.00 0.25 0.00 0.00 k
+%%CURV 29
+374.62 376.92 m
+371.45 371.52 L
+377.78 364.68 l
+377.78 364.68 384.98 360.22 388.15 359.28 c
+391.32 358.34 398.52 356.54 398.52 356.54 c
+411.12 356.54 L
+415.66 357.05 L
+421.42 355.68 L
+420.55 349.34 L
+413.78 345.74 l
+413.78 345.74 408.46 343.94 402.98 345.74 c
+397.58 347.54 394.92 347.11 390.38 347.98 c
+385.85 348.91 376.42 350.71 375.98 353.45 c
+375.55 356.11 373.32 362.02 373.32 362.02 c
+371.45 367.42 L
+372.38 375.55 L
+374.62 376.92 L
+@c
+F
+%%Note: Object
+372.82 354.74 420.98 376.92 @E
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 17
+373.75 376.92 m
+389.02 376.92 l
+389.02 376.92 392.18 376.92 397.15 375.12 c
+402.12 373.32 411.12 369.22 411.12 369.22 c
+416.09 364.25 L
+420.98 361.58 L
+420.98 355.68 L
+414.72 357.05 L
+400.32 354.74 L
+385.42 359.78 L
+376.42 365.18 L
+372.82 370.15 L
+373.75 376.92 L
+@c
+F
+%%Note: Object
+377.78 359.28 410.18 374.69 @E
+ 0 O 0 @g
+0.00 0.10 1.00 0.00 k
+%%CURV 18
+377.78 368.78 m
+381.38 373.75 L
+385.42 374.69 l
+385.42 374.69 389.88 374.69 392.62 374.26 c
+395.35 373.75 399.38 372.38 402.12 370.58 c
+404.78 368.78 410.18 365.62 410.18 365.62 c
+408.89 361.58 L
+403.42 359.28 L
+397.58 361.08 L
+391.75 366.05 L
+387.65 367.92 L
+377.78 368.78 L
+@c
+F
+%%Note: Object
+375.34 355.25 405.29 369.22 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.60 k
+%%CURV 14
+375.34 367.42 m
+378.65 363.38 l
+378.65 363.38 383.62 360.65 386.35 359.78 c
+389.02 358.85 394.56 357.62 394.92 357.48 c
+400.75 355.25 L
+405.29 361.08 L
+397.58 364.25 L
+390.02 367.42 L
+383.18 369.22 L
+375.34 367.42 L
+@c
+F
+%%Note: Object
+372.38 351.65 421.42 376.06 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.20 k
+%%CURV 32
+373.32 376.06 m
+373.32 371.02 L
+378.22 364.25 l
+378.22 364.25 385.92 360.22 389.02 358.85 c
+392.18 357.48 397.15 356.11 399.89 356.11 c
+402.55 356.11 407.09 356.11 409.75 356.11 c
+412.42 356.11 416.02 357.05 418.32 356.11 c
+420.55 355.25 421.42 353.45 421.42 353.45 c
+416.09 351.65 l
+416.09 351.65 409.75 351.65 405.65 351.65 c
+401.62 351.65 394.92 352.51 391.32 353.45 c
+387.65 354.31 380.88 356.98 377.78 360.22 c
+374.62 363.38 372.38 366.98 372.38 366.98 C
+373.32 376.06 L
+@c
+F
+%%Note: Object
+420.34 314.42 426.17 367.20 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 7
+425.45 365.90 m
+425.23 314.42 L
+420.34 314.42 L
+420.41 367.20 L
+420.41 367.20 426.17 366.19 425.45 365.90 C
+@c
+B
+%%Note: Object
+420.26 361.94 425.16 367.13 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 5
+425.16 364.75 m
+420.26 367.13 L
+420.26 363.89 L
+425.16 361.94 L
+425.16 364.75 L
+@c
+B
+%%Note: Object
+257.62 338.47 349.99 364.68 @E
+ 0 O 0 @g
+0.40 0.15 0.00 0.00 k
+%%CURV 47
+275.98 361.08 m
+283.82 361.51 292.90 361.51 297.36 361.51 c
+301.75 361.51 311.69 364.68 317.52 362.02 c
+323.42 359.28 322.99 357.05 328.82 356.54 c
+334.66 356.11 343.66 352.51 343.66 352.51 c
+343.66 352.51 344.52 348.84 347.26 347.04 c
+349.99 345.24 339.62 342.50 339.62 342.50 c
+327.89 348.84 l
+327.89 348.84 310.32 353.88 306.72 353.88 c
+303.12 353.88 288.79 352.94 288.79 352.94 c
+288.79 352.94 284.69 347.47 294.19 347.04 c
+303.55 346.61 311.69 343.94 311.69 343.94 c
+311.69 343.94 310.32 338.47 306.72 338.47 c
+303.12 338.47 283.82 339.41 279.36 339.41 c
+274.82 339.41 257.62 341.21 262.51 343.94 c
+267.48 346.61 270.79 354.31 270.79 354.31 c
+270.79 354.31 272.59 359.71 275.98 361.08 C
+@c
+F
+%%Note: Object
+420.12 364.46 430.70 367.99 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 5
+420.12 367.13 m
+425.30 364.46 L
+430.70 365.62 L
+427.68 367.99 L
+420.12 367.13 L
+@c
+B
+%%Note: Object
+330.19 468.07 343.73 472.75 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 5
+343.73 472.75 m
+339.05 468.07 L
+330.19 468.07 L
+335.09 472.75 L
+343.73 472.75 L
+@c
+B
+%%Note: Object
+344.38 416.16 349.06 436.54 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 20
+345.24 434.45 m
+345.24 431.71 345.24 428.54 345.24 426.89 c
+345.24 425.16 345.60 422.35 345.24 420.91 c
+344.81 419.54 344.38 418.46 344.38 418.46 c
+344.59 416.16 L
+347.98 417.02 L
+348.41 419.54 l
+348.41 419.54 348.41 424.94 348.41 426.02 c
+348.41 427.03 349.06 436.54 349.06 436.54 C
+345.24 434.45 L
+@c
+B
+%%Note: Object
+365.40 411.55 370.58 433.37 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 29
+370.58 411.55 m
+370.58 413.21 370.15 412.34 370.01 415.73 c
+369.79 419.11 369.14 420.12 369.14 423.22 c
+369.14 426.46 369.14 429.98 369.14 431.06 c
+369.14 432.14 369.14 433.37 369.14 433.37 c
+366.19 432.36 l
+366.19 432.36 366.19 431.71 366.19 429.98 c
+366.19 428.33 366.19 426.17 366.19 424.30 c
+366.19 422.42 366.19 422.50 366.19 419.98 c
+366.19 417.46 366.05 414.94 366.05 414.94 c
+365.40 412.34 L
+367.27 411.70 L
+370.58 411.55 L
+@c
+B
+%%Note: Object
+336.67 421.78 338.54 429.19 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 11
+338.54 421.78 m
+338.54 427.46 L
+337.46 429.19 L
+336.67 427.46 l
+336.67 427.46 336.82 426.24 336.82 425.16 c
+336.82 424.08 336.82 422.64 336.82 422.64 C
+338.54 421.78 L
+@c
+B
+%%Note: Object
+330.98 422.64 332.42 430.85 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 11
+332.28 430.85 m
+332.28 430.85 332.42 428.76 332.42 427.68 c
+332.42 426.60 332.42 424.30 332.42 424.30 c
+330.98 422.64 L
+330.98 426.46 L
+330.98 429.55 L
+332.28 430.85 L
+@c
+B
+%%Note: Object
+333.29 421.99 334.73 431.06 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 16
+334.51 422.21 m
+334.51 422.21 334.30 422.50 334.51 425.16 c
+334.73 427.90 334.73 430.85 334.73 430.85 c
+333.50 431.06 l
+333.50 431.06 333.50 428.90 333.50 427.90 c
+333.50 426.89 333.29 423.86 333.29 423.86 c
+333.50 421.99 L
+334.51 422.21 L
+@c
+B
+@rs
+@sv
+%%Note: Object
+336.24 446.90 349.06 464.98 @E
+ 0 O 0 @g
+0.50 0.00 0.50 0.50 k
+%%CURV 23
+346.46 463.97 m
+339.55 463.54 336.60 464.98 336.38 461.88 c
+336.24 458.71 338.54 463.97 339.34 458.28 c
+340.20 452.59 340.85 451.51 340.85 449.21 c
+340.85 446.90 342.86 446.90 343.30 449.42 c
+343.73 451.94 344.02 453.89 346.10 455.11 c
+348.19 456.41 349.06 459.94 345.46 459.50 c
+341.86 459.14 344.59 462.89 344.59 462.89 C
+346.46 463.97 L
+@c
+F
+%%Note: Object
+375.77 458.93 381.17 476.06 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+%%CURV 5
+375.77 472.61 m
+381.17 476.06 L
+380.52 459.65 L
+376.42 458.93 L
+375.77 472.61 L
+@c
+S
+%%Note: Object
+359.28 462.10 361.80 468.43 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+%%CURV 3
+361.80 468.43 m
+359.28 466.92 L
+359.28 462.10 L
+S
+%%Note: Object
+358.63 430.63 363.24 438.48 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 1.44 1.44 0.00 @w
+%%CURV 3
+358.63 438.48 m
+358.63 431.28 L
+363.24 430.63 L
+S
+%%Note: Object
+378.00 461.88 378.14 473.90 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+378.00 473.90 m
+378.14 461.88 L
+S
+%%Note: Object
+376.06 467.78 380.88 470.09 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+376.06 467.78 m
+380.88 470.09 L
+S
+%%Note: Object
+369.79 458.71 370.01 464.62 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+370.01 464.62 m
+369.79 458.71 L
+S
+%%Note: Object
+377.50 437.40 382.18 443.52 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 1.44 1.44 0.00 @w
+%%CURV 3
+377.50 443.52 m
+381.96 443.52 L
+382.18 437.40 L
+S
+%%Note: Object
+376.70 428.11 382.39 431.28 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 1.44 1.44 0.00 @w
+%%CURV 3
+376.70 431.28 m
+376.70 428.76 L
+382.39 428.11 L
+S
+%%Note: Object
+376.27 436.18 381.53 436.32 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 1.44 1.44 0.00 @w
+%%CURV 2
+376.27 436.32 m
+381.53 436.18 L
+S
+%%Note: Object
+390.82 426.17 395.35 439.70 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.50 K
+0 0.22 0.22 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 5
+394.42 439.27 m
+390.82 439.70 L
+390.82 426.17 L
+395.35 426.17 L
+394.42 439.27 L
+@c
+B
+%%Note: Object
+396.65 424.80 402.55 439.70 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.50 K
+0 0.22 0.22 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 6
+400.75 439.70 m
+396.65 439.70 L
+397.58 425.23 L
+402.12 424.80 L
+402.55 432.07 L
+400.75 439.70 L
+@c
+B
+%%Note: Object
+412.27 424.66 417.24 436.82 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.50 K
+0 0.22 0.22 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 6
+412.70 432.79 m
+412.70 424.66 L
+416.74 424.66 L
+417.24 436.82 L
+412.27 435.96 L
+412.70 432.79 L
+@c
+B
+%%Note: Object
+418.82 423.22 424.73 439.49 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.50 K
+0 0.22 0.22 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 5
+423.36 439.49 m
+418.82 439.49 L
+419.33 423.22 L
+424.73 423.22 L
+423.36 439.49 L
+@c
+B
+%%Note: Object
+427.32 411.26 439.92 469.58 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.20 0.20 0.00 k
+%%CURV 5
+427.32 414.50 m
+439.92 411.26 L
+439.92 469.58 L
+427.32 458.28 L
+427.32 414.50 L
+@c
+B
+%%Note: Object
+430.92 420.77 439.92 438.41 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.40 K
+0 1.44 1.44 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.05 k
+%%CURV 5
+431.86 438.41 m
+430.92 422.57 L
+439.92 420.77 L
+439.49 436.61 L
+431.86 438.41 L
+@c
+B
+%%Note: Object
+432.29 436.61 439.92 445.18 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.40 K
+0 1.44 1.44 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.10 k
+%%CURV 5
+432.29 438.84 m
+439.49 436.61 L
+439.92 444.24 L
+432.29 445.18 L
+432.29 438.84 L
+@c
+B
+%%Note: Object
+391.32 434.16 394.42 434.45 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.40 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+391.32 434.30 m
+394.42 434.30 L
+S
+%%Note: Object
+397.15 433.87 402.12 434.30 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.50 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+397.15 434.30 m
+402.12 433.87 L
+S
+%%Note: Object
+413.35 432.94 416.52 433.37 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.50 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+413.35 433.37 m
+416.52 432.94 L
+S
+%%Note: Object
+419.69 433.87 423.22 434.30 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.50 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+419.69 434.30 m
+423.22 433.87 L
+S
+%%Note: Object
+320.04 388.58 326.74 414.94 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%RECT 12.168 -43.128 0.000
+320.04 414.86 m
+321.12 414.94 322.20 414.94 323.35 414.94 c
+324.43 414.94 325.51 414.94 326.74 414.86 C
+326.66 410.54 326.66 406.15 326.66 401.76 c
+326.66 397.37 326.66 392.98 326.74 388.58 C
+325.51 389.09 324.43 389.59 323.35 390.02 c
+322.27 390.46 321.12 390.96 320.04 391.32 C
+320.04 395.28 320.04 399.17 320.04 403.13 c
+320.04 407.02 320.04 410.98 320.04 414.86 C
+@c
+B
+%%Note: Object
+157.39 457.70 189.43 508.32 @E
+ 0 O 0 @g
+0.60 0.00 0.60 0.40 k
+%%CURV 31
+179.21 464.54 m
+189.43 470.66 187.34 474.05 186.70 482.33 c
+186.05 490.54 183.31 496.01 184.68 502.13 c
+186.05 508.32 179.93 500.04 177.84 494.57 c
+175.82 489.17 167.62 484.34 167.62 484.34 c
+167.62 484.34 159.48 480.89 162.86 492.55 c
+166.25 504.22 159.48 502.78 159.48 498.02 c
+159.48 493.27 157.39 483.62 159.48 477.50 c
+161.50 471.38 166.32 470.66 166.97 474.05 c
+167.62 477.50 171.07 472.68 171.07 465.19 C
+171.07 457.70 179.21 464.54 179.21 464.54 c
+@c
+F
+%%Note: Object
+188.06 447.41 213.26 491.18 @E
+ 0 O 0 @g
+0.60 0.00 0.60 0.40 k
+%%CURV 20
+192.82 456.98 m
+198.29 463.18 198.29 468.00 198.29 472.75 c
+198.29 477.50 197.57 491.18 200.30 487.73 c
+203.04 484.34 207.79 476.86 207.79 471.38 c
+207.79 465.91 200.38 461.09 205.13 456.98 c
+209.88 452.88 213.26 449.50 204.41 449.50 c
+195.55 449.50 188.06 447.41 188.06 447.41 C
+192.82 456.98 L
+@c
+F
+%%Note: Object
+405.14 442.66 423.58 483.70 @E
+ 0 O 0 @g
+0.80 0.00 0.80 0.20 k
+%%CURV 21
+408.60 450.86 m
+408.60 458.42 405.14 461.16 408.60 468.00 c
+411.98 474.84 415.44 483.70 415.44 483.70 c
+415.44 483.70 416.74 483.70 416.74 478.94 c
+416.74 474.12 422.93 469.30 422.93 469.30 c
+423.58 462.46 L
+416.09 454.97 l
+416.09 454.97 416.09 452.23 416.09 447.48 C
+416.09 442.66 408.60 450.86 408.60 450.86 c
+@c
+F
+%%Note: Object
+201.67 479.52 360.29 518.54 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.05 k
+%%CURV 43
+234.36 510.34 m
+271.80 510.34 252.07 515.81 277.92 515.81 c
+303.77 515.81 304.42 516.53 316.66 513.79 c
+328.97 511.06 328.25 508.25 339.84 506.23 c
+351.43 504.22 360.29 502.78 358.92 498.02 c
+357.55 493.27 334.44 487.15 328.97 489.82 c
+323.50 492.55 309.17 497.38 304.42 497.38 c
+299.66 497.38 264.31 505.58 264.31 505.58 c
+264.31 505.58 256.82 501.41 269.14 498.74 c
+281.38 496.01 308.52 491.90 296.28 485.71 c
+284.04 479.52 269.78 489.17 260.93 489.17 c
+252.07 489.17 239.18 489.82 232.99 492.55 c
+226.87 495.29 215.28 503.50 208.51 506.95 c
+201.67 510.34 203.69 518.54 213.26 517.18 C
+222.77 515.81 234.36 510.34 234.36 510.34 c
+@c
+F
+%%Note: Object
+166.25 331.20 199.66 372.89 @E
+ 0 O 0 @g
+0.00 0.60 1.00 0.00 k
+%%CURV 20
+168.34 353.81 m
+175.82 358.56 186.70 366.05 188.78 369.50 c
+190.80 372.89 191.45 362.66 191.45 362.66 c
+199.66 370.15 L
+199.66 360.65 l
+199.66 360.65 196.20 355.82 193.54 351.00 c
+190.80 346.25 176.47 331.20 176.47 331.20 c
+173.81 338.04 L
+179.21 347.62 L
+177.84 354.46 L
+166.25 348.26 L
+168.34 353.81 L
+@c
+F
+%%Note: Object
+409.25 405.72 432.43 409.18 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.70 k
+%%CURV 5
+411.98 409.18 m
+432.43 407.81 L
+418.18 405.72 L
+409.25 405.72 L
+411.98 409.18 L
+@c
+F
+%%Note: Object
+369.14 410.54 384.77 415.37 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.60 k
+%%CURV 10
+369.14 415.37 m
+369.14 415.37 371.16 413.28 374.54 413.28 c
+378.00 413.28 384.77 412.56 384.77 412.56 c
+381.31 411.19 L
+369.79 410.54 L
+369.14 415.37 L
+@c
+F
+%%Note: Object
+347.33 413.93 358.92 417.38 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.60 k
+%%CURV 5
+347.98 417.38 m
+358.92 417.38 L
+357.55 413.93 L
+347.33 415.37 L
+347.98 417.38 L
+@c
+F
+%%Note: Object
+313.06 313.70 420.12 331.70 @E
+ 0 O 0 @g
+1.00 0.50 0.00 0.00 k
+%%CURV 26
+420.12 324.86 m
+414.65 328.25 405.79 331.70 400.32 331.70 c
+394.85 331.70 393.48 330.34 384.62 330.34 c
+375.70 330.34 366.91 328.97 360.07 330.34 c
+353.23 331.70 345.74 329.62 340.92 329.62 c
+336.17 329.62 337.54 324.14 332.06 323.50 c
+326.59 322.78 325.94 318.67 321.84 318.67 c
+317.74 318.67 313.06 313.85 322.49 313.85 c
+331.92 313.85 420.12 313.70 420.12 314.42 C
+420.12 324.86 L
+@c
+F
+%%Note: Object
+155.02 313.85 440.28 528.34 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+%%RECT 522.576 -392.976 0.000
+155.02 528.34 m
+440.28 528.34 L
+440.28 313.85 L
+155.02 313.85 L
+155.02 528.34 L
+@c
+S
+%%Note: Object
+431.42 344.66 440.28 348.84 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%CURV 5
+440.28 344.66 m
+434.81 348.84 L
+431.42 348.84 L
+431.42 344.66 L
+440.28 344.66 L
+@c
+B
+%%Note: Object
+223.27 498.24 235.58 505.73 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 2.81 2.81 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.70 k
+%%CURV 5
+223.27 505.73 m
+228.74 503.71 229.46 498.89 229.46 498.89 c
+235.58 498.24 L
+S
+%%Note: Object
+216.14 489.60 226.44 493.27 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 2.81 2.81 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.70 k
+%%CURV 5
+216.14 491.62 m
+221.54 489.60 223.70 489.89 223.70 489.89 c
+226.44 493.27 L
+S
+%%Note: Object
+206.35 502.27 215.21 509.11 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 2.81 2.81 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.70 k
+%%CURV 5
+206.35 509.11 m
+211.82 507.02 212.47 502.27 212.47 502.27 c
+215.21 505.66 L
+S
+%%Note: Object
+327.17 341.50 329.18 343.73 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 2.23 2.23 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 1.00 k
+%%CURV 5
+327.17 343.73 m
+327.17 342.72 327.38 341.50 327.38 341.50 c
+329.18 342.07 L
+S
+%%Note: Object
+322.13 342.36 329.98 347.40 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.80 k
+%%CURV 13
+322.99 345.74 m
+324.50 347.40 325.51 346.18 326.88 345.53 c
+328.25 344.88 329.98 345.31 329.11 344.23 c
+328.32 343.22 322.56 342.36 322.56 342.65 c
+322.63 343.94 L
+322.13 344.66 L
+322.99 345.74 L
+@c
+F
+%%Note: Object
+327.24 345.31 329.33 347.54 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 2.23 2.23 0.00 @w
+%%CURV 5
+327.24 345.31 m
+327.24 346.32 327.46 347.54 327.46 347.54 c
+329.33 346.97 L
+S
+%%Note: Object
+338.33 335.16 340.42 337.39 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 2.23 2.23 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 1.00 k
+%%CURV 5
+338.33 337.39 m
+338.33 336.38 338.54 335.16 338.54 335.16 c
+340.42 335.81 L
+S
+%%Note: Object
+333.29 336.02 341.14 341.06 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.80 k
+%%CURV 13
+334.22 339.41 m
+335.74 341.06 336.67 339.84 338.04 339.19 c
+339.41 338.54 341.14 338.98 340.34 337.97 c
+339.55 336.89 333.72 336.02 333.72 336.31 c
+333.86 337.61 L
+333.29 338.40 L
+334.22 339.41 L
+@c
+F
+%%Note: Object
+338.47 338.98 340.56 341.21 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 2.23 2.23 0.00 @w
+%%CURV 5
+338.47 338.98 m
+338.47 339.98 338.69 341.21 338.69 341.21 c
+340.56 340.63 L
+S
+%%Note: Object
+349.70 345.53 351.79 347.83 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 2.23 2.23 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 1.00 k
+%%CURV 5
+349.70 347.83 m
+349.70 346.75 349.92 345.53 349.92 345.53 c
+351.79 346.18 L
+S
+%%Note: Object
+344.66 346.46 352.51 351.50 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.80 k
+%%CURV 13
+345.60 349.78 m
+347.04 351.50 348.05 350.28 349.42 349.63 c
+350.78 348.91 352.51 349.34 351.72 348.34 c
+350.86 347.33 345.10 346.46 345.10 346.68 c
+345.24 348.05 L
+344.66 348.77 L
+345.60 349.78 L
+@c
+F
+%%Note: Object
+349.85 349.34 351.94 351.65 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 2.23 2.23 0.00 @w
+%%CURV 5
+349.85 349.34 m
+349.85 350.42 350.06 351.65 350.06 351.65 c
+351.94 351.00 L
+S
+%%Note: Object
+352.44 336.96 354.53 339.26 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 2.23 2.23 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 1.00 k
+%%CURV 5
+352.44 339.26 m
+352.44 338.18 352.66 336.96 352.66 336.96 c
+354.53 337.61 L
+S
+%%Note: Object
+347.40 337.90 355.25 342.94 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.80 k
+%%CURV 13
+348.34 341.21 m
+349.85 342.94 350.78 341.71 352.15 341.06 c
+353.52 340.34 355.25 340.78 354.46 339.77 c
+353.66 338.76 347.83 337.90 347.83 338.11 c
+347.98 339.48 L
+347.40 340.20 L
+348.34 341.21 L
+@c
+F
+%%Note: Object
+352.58 340.78 354.67 343.08 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 2.23 2.23 0.00 @w
+%%CURV 5
+352.58 340.78 m
+352.58 341.86 352.80 343.08 352.80 343.08 c
+354.67 342.43 L
+S
+%%Note: Object
+311.47 331.78 313.56 334.08 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 1.00 K
+0 2.23 2.23 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 1.00 k
+%%CURV 5
+311.47 334.08 m
+311.47 333.00 311.76 331.78 311.76 331.78 c
+313.56 332.42 L
+S
+%%Note: Object
+306.43 332.71 314.35 337.75 @E
+ 0 O 0 @g
+0.00 0.00 0.00 0.80 k
+%%CURV 13
+307.37 336.02 m
+308.88 337.75 309.82 336.53 311.18 335.88 c
+312.62 335.16 314.35 335.59 313.49 334.58 c
+312.70 333.58 306.86 332.71 306.86 332.93 c
+307.01 334.30 L
+306.43 335.02 L
+307.37 336.02 L
+@c
+F
+%%Note: Object
+311.62 335.59 313.70 337.90 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 2.23 2.23 0.00 @w
+%%CURV 5
+311.62 335.59 m
+311.62 336.67 311.83 337.90 311.83 337.90 c
+313.70 337.25 L
+S
+%%Note: Object
+268.70 422.71 268.99 426.60 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+268.85 426.60 m
+268.85 422.71 L
+S
+%%Note: Object
+278.50 422.28 278.78 426.60 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+278.64 426.60 m
+278.64 422.28 L
+S
+%%Note: Object
+288.86 422.93 289.15 426.46 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+289.01 426.46 m
+289.01 422.93 L
+S
+%%Note: Object
+297.94 423.07 298.22 426.46 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.30 0.60 0.40 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+298.08 426.46 m
+298.08 423.07 L
+S
+%%Note: Object
+345.38 380.38 373.39 402.98 @E
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 9
+345.38 402.98 m
+366.55 396.79 L
+366.55 391.32 L
+373.39 385.13 L
+372.02 380.38 L
+358.34 387.22 L
+359.06 393.34 L
+346.10 398.88 L
+345.38 402.98 L
+@c
+F
+%%Note: Object
+402.70 378.29 429.98 389.95 @E
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%CURV 9
+429.98 386.50 m
+417.02 389.95 L
+412.27 384.48 L
+404.06 385.85 L
+402.70 380.38 L
+415.01 378.29 L
+421.13 384.48 L
+429.98 381.10 L
+429.98 386.50 L
+@c
+F
+%%Note: Object
+223.27 388.58 229.46 389.95 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+223.27 388.58 m
+229.46 389.95 L
+S
+%%Note: Object
+252.86 389.52 259.92 390.67 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+252.86 390.67 m
+259.92 389.52 L
+S
+%%Note: Object
+226.94 387.14 230.40 387.65 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.50 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+226.94 387.14 m
+230.40 387.65 L
+S
+%%Note: Object
+255.17 387.50 259.63 388.44 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.60 K
+0 0.86 0.86 0.00 @w
+%%CURV 2
+255.17 388.44 m
+259.63 387.50 L
+S
+%%Note: Object
+168.19 375.34 171.43 381.74 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%RECT 5.904 11.736 1.584
+169.06 375.34 m
+170.57 375.34 l
+171.07 375.34 171.43 375.70 171.43 376.20 c
+171.43 380.88 l
+171.43 381.38 171.07 381.74 170.57 381.74 c
+169.06 381.74 l
+168.55 381.74 168.19 381.38 168.19 380.88 c
+168.19 376.20 l
+168.19 375.70 168.55 375.34 169.06 375.34 c
+@c
+B
+%%Note: Object
+166.32 380.02 173.02 383.11 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 1.44 1.44 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%RECT 12.168 -5.760 1.800
+167.33 383.11 m
+172.01 383.11 l
+172.58 383.11 173.02 382.68 173.02 382.18 c
+173.02 380.95 l
+173.02 380.45 172.58 380.02 172.01 380.02 c
+167.33 380.02 l
+166.75 380.02 166.32 380.45 166.32 380.95 c
+166.32 382.18 l
+166.32 382.68 166.75 383.11 167.33 383.11 c
+@c
+B
+%%Note: Object
+215.86 362.45 217.73 366.26 @E
+0 J 0 j [] 0 d 0 R 0 @G
+1.00 0.80 0.00 0.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.10 0.05 0.00 0.00 k
+%%RECT 5.904 11.736 1.584
+216.36 362.45 m
+217.22 362.45 l
+217.51 362.45 217.73 362.66 217.73 362.95 c
+217.73 365.76 l
+217.73 366.05 217.51 366.26 217.22 366.26 c
+216.36 366.26 l
+216.00 366.26 215.86 366.05 215.86 365.76 c
+215.86 362.95 l
+215.86 362.66 216.00 362.45 216.36 362.45 c
+@c
+B
+%%Note: Object
+214.70 365.18 218.66 367.06 @E
+0 J 0 j [] 0 d 0 R 0 @G
+1.00 0.80 0.00 0.00 K
+0 1.44 1.44 0.00 @w
+ 0 O 0 @g
+0.10 0.05 0.00 0.00 k
+%%RECT 12.168 -5.760 1.800
+215.35 367.06 m
+218.09 367.06 l
+218.38 367.06 218.66 366.84 218.66 366.48 c
+218.66 365.83 l
+218.66 365.47 218.38 365.18 218.09 365.18 c
+215.35 365.18 l
+214.99 365.18 214.70 365.47 214.70 365.83 c
+214.70 366.48 l
+214.70 366.84 214.99 367.06 215.35 367.06 c
+@c
+B
+%%Note: Object
+272.23 364.46 274.10 368.21 @E
+0 J 0 j [] 0 d 0 R 0 @G
+1.00 0.80 0.00 0.00 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.10 0.05 0.00 0.00 k
+%%RECT 5.904 11.736 1.584
+272.74 364.46 m
+273.60 364.46 l
+273.89 364.46 274.10 364.61 274.10 364.97 c
+274.10 367.70 l
+274.10 367.99 273.89 368.21 273.60 368.21 c
+272.74 368.21 l
+272.38 368.21 272.23 367.99 272.23 367.70 c
+272.23 364.97 l
+272.23 364.61 272.38 364.46 272.74 364.46 c
+@c
+B
+%%Note: Object
+271.08 367.20 274.97 369.00 @E
+0 J 0 j [] 0 d 0 R 0 @G
+1.00 0.80 0.00 0.00 K
+0 1.44 1.44 0.00 @w
+ 0 O 0 @g
+0.10 0.05 0.00 0.00 k
+%%RECT 12.168 -5.760 1.800
+271.73 369.00 m
+274.46 369.00 l
+274.75 369.00 274.97 368.78 274.97 368.42 c
+274.97 367.78 l
+274.97 367.49 274.75 367.20 274.46 367.20 c
+271.73 367.20 l
+271.37 367.20 271.08 367.49 271.08 367.78 c
+271.08 368.42 l
+271.08 368.78 271.37 369.00 271.73 369.00 c
+@c
+B
+%%Note: Object
+205.13 403.34 207.36 407.88 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 0.86 0.86 0.00 @w
+ 0 O 0 @g
+0.00 0.30 0.60 0.40 k
+%%RECT 5.904 11.736 1.584
+205.70 403.34 m
+206.78 403.34 l
+207.14 403.34 207.36 403.63 207.36 403.99 c
+207.36 407.30 l
+207.36 407.66 207.14 407.88 206.78 407.88 c
+205.70 407.88 l
+205.34 407.88 205.13 407.66 205.13 407.30 c
+205.13 403.99 l
+205.13 403.63 205.34 403.34 205.70 403.34 c
+@c
+B
+%%Note: Object
+203.83 406.66 208.51 408.89 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.70 K
+0 1.44 1.44 0.00 @w
+ 0 O 0 @g
+0.00 0.00 0.00 0.00 k
+%%RECT 12.168 -5.760 1.800
+204.48 408.89 m
+207.79 408.89 l
+208.22 408.89 208.51 408.60 208.51 408.24 c
+208.51 407.38 l
+208.51 406.94 208.22 406.66 207.79 406.66 c
+204.48 406.66 l
+204.12 406.66 203.83 406.94 203.83 407.38 c
+203.83 408.24 l
+203.83 408.60 204.12 408.89 204.48 408.89 c
+@c
+B
+%%Note: Object
+207.00 380.88 217.58 405.65 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 1.44 1.44 0.00 @w
+%%CURV 7
+207.00 405.65 m
+207.00 401.83 209.30 393.41 211.54 389.88 c
+213.77 386.35 217.58 380.88 217.58 380.88 C
+S
+%%Note: Object
+169.85 362.52 217.15 379.30 @E
+0 J 0 j [] 0 d 0 R 0 @G
+0.00 0.00 0.00 0.80 K
+0 2.02 2.02 0.00 @w
+%%CURV 7
+217.15 365.26 m
+217.15 365.26 211.03 362.52 195.98 365.98 c
+180.94 369.36 170.86 379.01 169.85 379.30 C
+S
+%%Note: Object
+241.70 426.89 248.54 436.46 @E
+ 0 O 0 @g
+0.00 0.90 0.90 0.10 k
+%%RECT 12.528 -17.568 0.000
+241.70 436.46 m
+248.54 436.46 L
+248.54 426.89 L
+241.70 426.89 L
+241.70 436.46 L
+@c
+F
+@rs
+@rs
+%%Trailer
+ end
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-00.mp b/doc/context/sources/general/manuals/start/graphics/ma-cb-00.mp
new file mode 100644
index 000000000..be9ad9b28
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-00.mp
@@ -0,0 +1,1282 @@
+% Converted from PostScript(TM) to MetaPost by pstoedit
+% MetaPost backend contributed by Scott Pakin <pakin@uiuc.edu>
+% pstoedit is Copyright (C) 1993 - 1999 Wolfgang Glunz <wglunz@geocities.com>
+
+% Generate structured PostScript
+prologues := 1;
+
+% Display a given string with its *baseline* at a given location
+% and with a given rotation angle
+vardef showtext(expr origin)(expr angle)(expr string) =
+ draw string infont defaultfont scaled defaultscale
+ rotated angle shifted origin;
+enddef;
+
+beginfig(1);
+drawoptions (withcolor (0.8,0.9,1));
+linecap := butt;
+linejoin := mitered;
+fill (34.0598,214.47)--(286.57,214.47)--(285.2,72.9199)
+ --(38.1699,83.8599)--(34.0598,214.47)--cycle;
+drawoptions (withcolor (0.95,0.95,0.95));
+fill (62,152.91)..controls (62,152.91) and (74.24,150.18)..(77.6199,152.91)
+ ..controls (81.0798,155.65) and (98.0698,152.91)..(98.0698,152.91)
+ ..controls (98.0698,152.91) and (106.21,148.81)..(111.68,148.81)
+ ..controls (117.15,148.81) and (130.76,147.37)..(130.76,147.37)
+ --(134.86,140.53)..controls (134.86,140.53) and (130.11,139.88)..(123.92,139.88)
+ ..controls (117.8,139.88) and (98.72,139.23)..(98.72,139.23)
+ --(82.3799,139.23)--(72.1499,145.35)--(64.0198,147.37)
+ --(62,152.91)--cycle;
+drawoptions (withcolor (0.9,0.9,0.9));
+fill (202.11,112.52)--(200.82,126.85)--(184.47,117.99)
+ --(170.86,116.62)--(150.42,117.34)--(141.63,114.61)
+ --(104.19,115.26)--(87.1299,115.26)--(69.49,113.17)
+ --(74.96,107.77)--(106.21,108.42)--(140.98,108.42)
+ --(147.03,110.5)--(165.39,110.5)--(164.74,104.38)
+ --(172.88,103.74)--(285.92,79.0398)--(285.2,98.9099)
+ --(271.59,100.93)--(202.11,112.52)--cycle;
+drawoptions (withcolor (1,0.4,0.4));
+fill (285.92,193.23)--(259.78,193.23)--(259.78,188.7)
+ --(277.35,148.88)--(285.92,155.72)--(285.92,193.23)
+ --cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (285.92,193.23)--(259.78,193.23)--(259.78,188.7)
+ --(277.35,148.88)--(285.92,155.72)--(285.92,193.23);
+drawoptions (withcolor (1,0.9,0.9));
+pickup pencircle scaled 0bp;
+fill (231.85,165.66)--(235.95,169.69)--(246.75,170.62)
+ --(273.32,149.82)--(272.89,101)--(235.02,107.34)
+ --(231.85,165.66)--cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (231.85,165.66)--(235.95,169.69)--(246.75,170.62)
+ --(273.32,149.82)--(272.89,101)--(235.02,107.34)
+ --(231.85,165.66);
+drawoptions (withcolor (0,0.5,0));
+pickup pencircle scaled 0bp;
+fill (178.28,133.26)..controls (178.28,133.26) and (175.98,132.39)..(175.11,130.09)
+ ..controls (174.25,127.78) and (172.38,125.62)..(172.38,125.62)
+ ..controls (172.38,125.62) and (170.86,124.47)..(170,121.88)
+ ..controls (169.21,119.36) and (168.99,119.14)..(168.99,118.06)
+ ..controls (168.99,116.98) and (169.21,116.19)..(170.43,116.41)
+ ..controls (171.73,116.55) and (172.81,117.63)..(172.81,117.63)
+ --(175.33,116.84)..controls (175.33,116.84) and (175.9,116.62)..(177.42,117.85)
+ ..controls (178.86,119.14) and (179.29,121.52)..(179.72,120.22)
+ ..controls (180.15,118.93) and (179.94,119.58)..(180.73,118.06)
+ ..controls (181.59,116.55) and (183.03,115.98)..(184.11,116.41)
+ ..controls (185.19,116.84) and (184.47,115.69)..(185.55,117.2)
+ ..controls (186.63,118.71) and (185.19,122.74)..(185.19,122.74)
+ --(182.24,132.39)--(178.28,133.26)--cycle;
+drawoptions (withcolor (0,0.6,0));
+fill (203.19,132.82)..controls (207.44,132.82) and (198.58,125.84)..(194.55,123.61)
+ ..controls (190.45,121.3) and (188.65,115.04)..(184.11,120.87)
+ ..controls (179.65,126.7) and (184.54,132.61)..(180.51,133.04)
+ ..controls (176.48,133.54) and (177.85,132.18)..(174.68,133.54)
+ ..controls (171.51,134.84) and (172.45,140.31)..(172.45,140.31)
+ ..controls (172.45,140.31) and (175.98,145.71)..(177.42,148.88)
+ ..controls (178.78,152.05) and (177.42,152.91)..(177.85,155.22)
+ ..controls (178.28,157.52) and (181.02,159.32)..(181.02,159.32)
+ --(190.02,158.82)--(192.25,162.78)..controls (192.25,162.78) and (196.78,162.92)..(199.02,161.12)
+ ..controls (201.25,159.32) and (201.25,156.58)..(201.25,156.58)
+ --(203.98,155.22)--(203.55,147.58)--(201.68,143.12)
+ ..controls (201.68,143.12) and (201.82,139.95)..(203.19,137.72)
+ ..controls (204.56,135.42) and (202.76,132.82)..(203.19,132.82)
+ --cycle;
+drawoptions (withcolor (0.8,0.8,0.8));
+fill (1.37988,135.34)--(63.9399,129.01)--(67.98,114.97)
+ --(73.8799,108.63)--(57.6799,89.26)--(0.869873,46.2798)
+ --(1.37988,135.34)--cycle;
+drawoptions (withcolor (0,0.6,0));
+fill (141.27,120.87)..controls (140.84,121.23) and (143.65,122.46)..(139.62,123.32)
+ ..controls (135.51,124.26) and (134.65,122.67)..(129.25,122.67)
+ ..controls (123.85,122.67) and (124.28,120.87)..(122.05,122.67)
+ ..controls (119.82,124.47) and (119.38,126.27)..(115.28,126.27)
+ ..controls (111.25,126.27) and (109.45,126.7)..(106.78,124.9)
+ ..controls (104.05,123.1) and (102.68,123.1)..(100.45,123.1)
+ ..controls (98.22,123.1) and (96.3398,123.18)..(93.6799,123.61)
+ ..controls (91.0198,124.04) and (88.7798,124.47)..(86.0498,124.9)
+ ..controls (83.3098,125.41) and (80.5798,125.84)..(77.9099,125.41)
+ ..controls (75.25,124.9) and (70.2798,124.47)..(66.6799,124.9)
+ ..controls (63.0798,125.41) and (60.3398,127.21)..(57.1799,125.41)
+ ..controls (54.0798,123.61) and (49.1099,123.61)..(49.1099,123.61)
+ --(44.1399,122.67)--(45.0798,115.9)..controls (45.0798,115.9) and (43.2798,113.6)..(49.5398,113.6)
+ ..controls (55.8799,113.6) and (58.98,113.6)..(64.8799,113.6)
+ ..controls (70.71,113.6) and (69.4199,112.66)..(76.1099,114.03)
+ ..controls (82.8799,115.47) and (86.98,115.47)..(91.8799,115.47)
+ ..controls (96.8499,115.47) and (100.88,114.97)..(105.85,114.97)
+ ..controls (110.82,114.97) and (112.62,114.97)..(118.02,114.97)
+ ..controls (123.42,114.97) and (125.22,114.54)..(136.02,114.54)
+ ..controls (146.74,114.54) and (146.74,115.9)..(146.74,115.9)
+ --(145.88,120.37)--(141.27,120.87)--cycle;
+drawoptions (withcolor (0.5,0.5,0.5));
+fill (5.83984,98.26)--(27.5098,109.14)--(46.3799,113.6)
+ --(70.2798,114.03)--(74.3098,109.57)--(49.5398,105.54)
+ --(0.869873,67.95)--(5.83984,98.26)--cycle;
+drawoptions (withcolor (0.8,0.3,0));
+fill (105.85,108.2)--(106.78,85.23)--(73.8799,84.2998)
+ --(66.25,38.1399)--(36.7998,1.05981)--(0.72998,1.05981)
+ --(0.869873,49.8799)..controls (0.869873,49.8799) and (24.7798,67.0898)..(36.0798,74.7898)
+ ..controls (47.3098,82.5) and (70.2798,104.6)..(72.5098,107.34)
+ ..controls (74.74,110) and (77.48,108.2)..(77.48,108.2)
+ --(105.85,108.2)--cycle;
+drawoptions (withcolor (0.6,0.3,0));
+fill (75.25,107.77)--(105.85,107.77)--(105.85,85.23)
+ --(75.25,85.23)--(75.25,107.77)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (75.25,107.77)--(105.85,107.77)--(105.85,85.23)
+ --(75.25,85.23)--(75.25,107.77);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 2.23bp;
+draw (118.59,71.1899)--(117.22,61.8999);
+drawoptions (withcolor (0.9,0.95,1));
+pickup pencircle scaled 0bp;
+fill (266.48,1.56982)--(267.34,45.9199)--(158.84,82.3499)
+ --(149.26,81.2)--(144.15,86.3098)--(140.84,107.77)
+ --(104.84,107.26)--(105.92,86.3098)--(114.92,40.45)
+ --(55.5898,38.5798)--(37.23,0.849854)--(266.48,1.56982)
+ --cycle;
+drawoptions (withcolor (0,0.2,1));
+fill (55.1599,40.0898)--(113.98,37.21)--(153.94,25.8999)
+ ..controls (153.94,25.8999) and (123.42,17.8398)..(145.88,14.6699)
+ ..controls (168.34,11.4299) and (158.91,11)..(152.65,7.3999)
+ ..controls (146.31,3.7998) and (118.95,1.05981)..(113.48,1.05981)
+ ..controls (108.08,1.05981) and (35.6499,1.05981)..(35.6499,1.05981)
+ --(55.1599,40.0898)--cycle;
+drawoptions (withcolor (1,0.7,0));
+fill (146.96,157.59)--(149.77,157.59)--(149.77,118.06)
+ --(146.96,118.06)--(146.96,157.59)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (146.96,157.59)--(149.77,157.59)--(149.77,118.06)
+ --(146.96,118.06)--(146.96,157.59);
+drawoptions (withcolor (1,0.7,0));
+pickup pencircle scaled 0bp;
+fill (109.16,161.05)--(180.37,158.53)--(176.41,154.86)
+ --(108.66,157.3)--(109.16,161.05)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (109.16,161.05)--(180.37,158.53)--(176.41,154.86)
+ --(108.66,157.3)--(109.16,161.05);
+drawoptions (withcolor (1,0.9,0));
+pickup pencircle scaled 0bp;
+fill (107.65,166.74)--(192.18,162.27)--(189.94,159.54)
+ --(108.15,162.99)--(107.65,166.74)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (107.65,166.74)--(192.18,162.27)--(189.94,159.54)
+ --(108.15,162.99)--(107.65,166.74);
+drawoptions (withcolor (1,0.9,0));
+pickup pencircle scaled 0bp;
+fill (149.77,163.86)--(153.8,163.86)--(153.8,110.07)
+ --(149.77,110.07)--(149.77,163.86)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (149.77,163.86)--(153.8,163.86)--(153.8,110.07)
+ --(149.77,110.07)--(149.77,163.86);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 2.23bp;
+draw (112.26,165.3)--(104.77,109.14);
+draw (109.59,159.82)--(102.75,116.62);
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (153.73,150.61)--(163.38,129.3);
+draw (153.51,140.17)--(163.09,124.33);
+drawoptions (withcolor (0,0.2,1));
+pickup pencircle scaled 0bp;
+fill (162.58,130.74)--(168.99,130.74)--(168.99,114.9)
+ --(162.58,114.9)--(162.58,130.74)--cycle;
+drawoptions (withcolor (0,0.4,1));
+fill (153.22,123.1)--(162.58,123.1)--(162.58,115.9)
+ --(153.22,115.9)--(153.22,123.1)--cycle;
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0.86bp;
+draw (101.89,117.92)--(149.05,117.42);
+pickup pencircle scaled 2.02bp;
+draw (103.98,113.46)--(150.56,113.67);
+pickup pencircle scaled 0bp;
+fill (102.25,109.71)--(146.82,109.71)--(146.82,107.77)
+ --(102.25,107.77)--(102.25,109.71)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (102.25,109.71)--(146.82,109.71)--(146.82,107.77)
+ --(102.25,107.77)--(102.25,109.71);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (90.4399,158.02)--(92.1699,158.02)--(92.1699,117.92)
+ --(90.4399,117.92)--(90.4399,158.02)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (90.4399,158.02)--(92.1699,158.02)--(92.1699,117.92)
+ --(90.4399,117.92)--(90.4399,158.02);
+drawoptions (withcolor (0,0,0));
+draw (161.86,94.8799)--(164.1,94.8799)--(164.1,92.22)
+ --(161.86,92.22)--(161.86,94.8799);
+drawoptions (withcolor (0.8,0.3,0));
+pickup pencircle scaled 0bp;
+fill (147.32,104.1)--(149.05,104.1)--(149.05,87.97)
+ --(147.32,87.97)--(147.32,104.1)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (147.32,104.1)--(149.05,104.1)--(149.05,87.97)
+ --(147.32,87.97)--(147.32,104.1);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (148.54,104.6)--(150.27,104.6)--(150.27,87.6799)
+ --(148.54,87.6799)--(148.54,104.6)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (148.54,104.6)--(150.27,104.6)--(150.27,87.6799)
+ --(148.54,87.6799)--(148.54,104.6);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (141.2,107.55)--(147.1,107.55)--(147.1,87.25)
+ --(141.2,87.25)--(141.2,107.55)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (141.2,107.55)--(147.1,107.55)--(147.1,87.25)
+ --(141.2,87.25)--(141.2,107.55);
+drawoptions (withcolor (0,0.75,1));
+pickup pencircle scaled 0bp;
+fill (141.49,88.1799)--(153.58,88.1799)--(161.22,81.99)
+ --(143.22,81.2)--(141.49,88.1799)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (141.49,88.1799)--(153.58,88.1799)--(161.22,81.99)
+ --(143.22,81.2)--(141.49,88.1799);
+drawoptions (withcolor (1,0.4,0));
+pickup pencircle scaled 0bp;
+fill (146.53,110.22)--(165.1,110.22)--(165.1,103.09)
+ --(162.8,103.09)--(152.94,87.97)--(147.32,87.97)
+ --(146.53,110.22)--cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (146.53,110.22)--(165.1,110.22)--(165.1,103.09)
+ --(162.8,103.09)--(152.94,87.97)--(147.32,87.97)
+ --(146.53,110.22);
+drawoptions (withcolor (1,0.5,0));
+pickup pencircle scaled 0bp;
+fill (285.92,78.3899)--(163.09,104.31)--(152.43,88.6899)
+ --(160.57,82.5)..controls (160.57,82.5) and (165.39,79.76)..(175.62,74.2898)
+ ..controls (185.84,68.8198) and (187.86,71.5498)..(192.61,67.45)
+ ..controls (197.36,63.3398) and (215.65,62.0498)..(215.65,62.0498)
+ --(285.63,30.6599)--(285.92,78.3899)--cycle;
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0.86bp;
+draw (285.92,78.3899)--(163.09,104.31)--(152.43,88.6899)
+ --(160.57,82.5)..controls (160.57,82.5) and (165.39,79.76)..(175.62,74.2898)
+ ..controls (185.84,68.8198) and (187.86,71.5498)..(192.61,67.45)
+ ..controls (197.36,63.3398) and (215.65,62.0498)..(215.65,62.0498)
+ --(285.63,30.6599)--(285.92,78.3899);
+drawoptions (withcolor (0.2,0.9,0.2));
+pickup pencircle scaled 0bp;
+fill (40.1799,214.47)..controls (47.6699,214.47) and (37.0198,202.59)..(40.3999,195.82)
+ ..controls (43.7798,188.98) and (41.0498,194.46)..(47.8899,187.62)
+ ..controls (54.6599,180.78) and (59.4099,178.76)..(59.4099,173.29)
+ ..controls (59.4099,167.82) and (59.4099,166.45)..(60.1299,159.61)
+ ..controls (60.7798,152.77) and (64.8098,145.93)..(65.5298,141.82)
+ ..controls (66.25,137.79) and (68.98,134.34)..(66.25,130.95)
+ ..controls (63.5098,127.57) and (62.7898,127.57)..(52.6399,127.57)
+ ..controls (42.49,127.57) and (42.49,130.3)..(33.6299,125.48)
+ ..controls (24.7798,120.73) and (25.5,116.62)..(18.6599,120.73)
+ ..controls (11.8899,124.76) and (1.65991,128.22)..(1.65991,128.22)
+ --(1.37988,214.47)--(40.1799,214.47)--cycle;
+drawoptions (withcolor (0,0.5,1));
+fill (122.41,51.8999)..controls (122.41,51.8999) and (121.76,52.47)..(120.25,49.3799)
+ ..controls (118.66,46.21) and (118.66,44.3398)..(115.86,39.9399)
+ ..controls (113.05,35.48) and (114.27,36.49)..(110.53,32.6699)
+ ..controls (106.71,28.9299) and (109.38,32.3799)..(104.34,28.9299)
+ ..controls (99.2998,25.47) and (94.2598,26.3398)..(89.7898,26.7)
+ ..controls (85.3999,26.98) and (76.6199,25.1799)..(72.8699,27.3398)
+ ..controls (69.1299,29.5798) and (67.8999,30.51)..(65.74,34.26)
+ ..controls (63.5798,38) and (63.5798,38)..(61.71,41.46)
+ ..controls (59.8398,44.9099) and (59.3398,48.5798)..(58.2598,50.3098)
+ --(54.8699,55.6399)--(122.41,51.8999)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 1.44bp;
+draw (122.41,51.8999)..controls (122.41,51.8999) and (121.76,52.47)..(120.25,49.3799)
+ ..controls (118.66,46.21) and (118.66,44.3398)..(115.86,39.9399)
+ ..controls (113.05,35.48) and (114.27,36.49)..(110.53,32.6699)
+ ..controls (106.71,28.9299) and (109.38,32.3799)..(104.34,28.9299)
+ ..controls (99.2998,25.47) and (94.2598,26.3398)..(89.7898,26.7)
+ ..controls (85.3999,26.98) and (76.6199,25.1799)..(72.8699,27.3398)
+ ..controls (69.1299,29.5798) and (67.8999,30.51)..(65.74,34.26)
+ ..controls (63.5798,38) and (63.5798,38)..(61.71,41.46)
+ ..controls (59.8399,44.9099) and (59.3398,48.5798)..(58.2598,50.3098)
+ --(54.8699,55.6399)--(122.41,51.8999);
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (202.04,156.87)--(200.53,112.81)--(234.87,107.26)
+ --(233.29,167.1)--(202.04,156.87);
+drawoptions (withcolor (1,0.25,0.25));
+pickup pencircle scaled 0bp;
+fill (246.9,189.63)--(223.06,177.32)--(202.76,160.26)
+ --(230.55,170.55)--(246.9,189.63)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (246.9,189.63)--(223.06,177.32)--(202.76,160.26)
+ --(230.55,170.55)--(246.9,189.63);
+drawoptions (withcolor (1,0.4,0.4));
+pickup pencircle scaled 0bp;
+fill (246.25,188.98)--(230.98,170.62)--(274.76,169.83)
+ --(246.25,188.98)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (246.25,188.98)--(230.98,170.62)--(274.76,169.83)
+ --(246.25,188.98);
+drawoptions (withcolor (0.3,1,0.3));
+pickup pencircle scaled 0bp;
+fill (255.75,122.1)..controls (252.3,122.1) and (253.02,121.45)..(248.26,125.48)
+ ..controls (243.51,129.58) and (242.79,126.2)..(239.41,135.06)
+ ..controls (236.02,143.91) and (234.01,141.18)..(234.66,148.66)
+ ..controls (235.3,156.22) and (230.62,155.5)..(236.02,163.06)
+ ..controls (241.42,170.55) and (240.13,166.45)..(245.53,174.66)
+ ..controls (251,182.79) and (250.28,185.53)..(255.03,186.9)
+ ..controls (259.78,188.26) and (258.49,194.38)..(264.61,186.9)
+ ..controls (270.66,179.41) and (271.3,174.58)..(276.06,173.94)
+ ..controls (280.88,173.29) and (282.25,175.95)..(282.25,167.82)
+ ..controls (282.25,159.61) and (282.9,154.86)..(277.5,149.38)
+ ..controls (272.02,143.91) and (267.27,145.28)..(266.55,137.07)
+ ..controls (265.9,128.86) and (266.55,124.83)..(263.17,124.11)
+ ..controls (259.78,123.39) and (255.75,122.1)..(255.75,122.1)
+ --cycle;
+drawoptions (withcolor (0.8,0.3,0));
+fill (270.66,52.47)--(276.78,52.47)--(276.78,0.629883)
+ --(270.66,0.629883)--(270.66,52.47)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (270.66,52.47)--(276.78,52.47)--(276.78,0.629898)
+ --(270.66,0.629898)--(270.66,52.47);
+drawoptions (withcolor (0.9,0,0));
+pickup pencircle scaled 0bp;
+fill (90.5798,158.02)--(92.0198,158.02)--(92.0198,152.84)
+ --(90.5798,152.84)--(90.5798,158.02)--cycle;
+fill (90.5798,147.66)--(92.0198,147.66)--(92.0198,142.47)
+ --(90.5798,142.47)--(90.5798,147.66)--cycle;
+fill (90.5798,137.43)--(92.0198,137.43)--(92.0198,132.25)
+ --(90.5798,132.25)--(90.5798,137.43)--cycle;
+fill (90.5798,128.14)--(92.0198,128.14)--(92.0198,122.96)
+ --(90.5798,122.96)--(90.5798,128.14)--cycle;
+drawoptions (withcolor (1,0.9,0));
+fill (203.34,160.98)--(200.53,160.98)--(199.38,155.29)
+ --(233.22,167.17)--(236.02,169.98)--(230.34,169.98)
+ --(203.34,160.98)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (203.34,160.98)--(200.53,160.98)--(199.38,155.29)
+ --(233.22,167.17)--(236.02,169.98)--(230.34,169.98)
+ --(203.34,160.98);
+drawoptions (withcolor (1,1,0.7));
+pickup pencircle scaled 0bp;
+fill (232.14,166.59)--(235.52,107.77)--(202.11,112.52)
+ --(202.83,155.65)--(232.14,166.59)--cycle;
+drawoptions (withcolor (0.8,0.8,0.8));
+pickup pencircle scaled 0.22bp;
+draw (232.14,166.59)--(235.52,107.77)--(202.11,112.52)
+ --(202.83,155.65)--(232.14,166.59);
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (214.42,156.3)--(214.42,145.35)--(217.81,146.07)
+ --(217.16,157.66)--(214.42,156.3);
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 1.44bp;
+draw (219.9,133.04)--(219.75,109.86)--(230.77,108.42)
+ --(230.12,133.04)--(219.9,133.04);
+drawoptions (withcolor (0,0.8,0));
+pickup pencircle scaled 0bp;
+fill (212.34,118.64)..controls (217.16,122.1) and (219.82,117.34)..(221.19,126.2)
+ ..controls (222.56,135.13) and (224.65,137.86)..(221.91,141.25)
+ ..controls (219.18,144.7) and (213.06,146.07)..(213.06,146.07)
+ ..controls (213.06,146.07) and (213.7,152.26)..(208.3,149.46)
+ ..controls (202.83,146.72) and (196.06,153.42)..(196.06,145.93)
+ ..controls (196.06,138.37) and (200.1,135.13)..(203.55,131.67)
+ ..controls (206.94,128.29) and (206.22,127.57)..(207.58,124.18)
+ ..controls (208.95,120.73) and (212.34,118.64)..(212.34,118.64)
+ --cycle;
+drawoptions (withcolor (0.6,0.3,0));
+fill (251.86,122.1)--(257.34,122.1)--(257.34,92.0698)
+ --(251.86,92.0698)--(251.86,122.1)--cycle;
+pickup pencircle scaled 0.86bp;
+draw (251.86,122.1)--(257.34,122.1)--(257.34,92.0698)
+ --(251.86,92.0698)--(251.86,122.1);
+drawoptions (withcolor (0.6,0.85,1));
+pickup pencircle scaled 0bp;
+fill (116.5,62.8398)..controls (116.5,62.8398) and (123.06,57.22)..(123.06,54.99)
+ ..controls (123.06,52.8298) and (122.98,51.25)..(118.66,49.95)
+ ..controls (114.27,48.73) and (104.62,47.7898)..(102.1,47.7898)
+ ..controls (99.5798,47.7898) and (93.3198,46.8599)..(91.45,46.8599)
+ ..controls (89.5798,46.8599) and (77.0498,46.21)..(74.5298,46.8599)
+ ..controls (72.0798,47.4299) and (65.8198,46.21)..(63.5798,47.7898)
+ ..controls (61.4199,49.3799) and (58.3298,49.95)..(56.74,52.47)
+ ..controls (55.1599,54.99) and (55.1599,55.3499)..(55.1599,58.1599)
+ ..controls (55.1599,60.97) and (59.8398,64.4199)..(59.8398,64.4199)
+ --(116.5,62.8398)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 1.44bp;
+draw (116.5,62.8398)..controls (116.5,62.8398) and (123.06,57.22)..(123.06,54.99)
+ ..controls (123.06,52.8298) and (122.98,51.25)..(118.66,49.95)
+ ..controls (114.27,48.73) and (104.62,47.7898)..(102.1,47.7898)
+ ..controls (99.5798,47.7898) and (93.3198,46.8599)..(91.45,46.8599)
+ ..controls (89.5798,46.8599) and (77.0498,46.21)..(74.5298,46.8599)
+ ..controls (72.0798,47.4299) and (65.8198,46.21)..(63.5798,47.7898)
+ ..controls (61.4199,49.3799) and (58.3298,49.95)..(56.74,52.47)
+ ..controls (55.1599,54.99) and (55.1599,55.3498)..(55.1599,58.1599)
+ ..controls (55.1599,60.97) and (59.8399,64.4199)..(59.8399,64.4199)
+ --(116.5,62.8398);
+drawoptions (withcolor (0.8,0.9,1));
+pickup pencircle scaled 0bp;
+fill (63.3699,81.4199)..controls (63.3699,81.4199) and (81.5098,83.5)..(87.8499,83.5)
+ ..controls (94.1799,83.5) and (111.82,82.1399)..(111.82,82.1399)
+ ..controls (111.82,82.1399) and (114.06,71.4099)..(114.06,70.0398)
+ ..controls (114.06,68.74) and (115.64,64.6399)..(115.64,64.6399)
+ --(116.29,54.6299)..controls (116.29,54.6299) and (98.5,52.5398)..(93.25,52.5398)
+ ..controls (87.99,52.5398) and (69.2698,50.5999)..(67.47,51.25)
+ ..controls (65.6699,51.8999) and (65.6699,59.8198)..(65.6699,59.8198)
+ --(63.3699,63.49)--(63.3699,81.4199)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (63.3699,81.4199)..controls (63.3699,81.4199) and (81.5098,83.5)..(87.8499,83.5)
+ ..controls (94.1799,83.5) and (111.82,82.1399)..(111.82,82.1399)
+ ..controls (111.82,82.1399) and (114.06,71.4099)..(114.06,70.0398)
+ ..controls (114.06,68.74) and (115.64,64.6399)..(115.64,64.6399)
+ --(116.29,54.6299)..controls (116.29,54.6299) and (98.5,52.5398)..(93.25,52.5398)
+ ..controls (87.99,52.5398) and (69.2698,50.5999)..(67.47,51.25)
+ ..controls (65.6699,51.8999) and (65.6699,59.8198)..(65.6699,59.8198)
+ --(63.3699,63.49)--(63.3699,81.4199);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (66.6799,78.25)..controls (68.9099,79.26) and (74.24,79.26)..(75.8198,79.26)
+ ..controls (77.3398,79.26) and (84.25,79.5398)..(84.25,79.5398)
+ --(85.1799,77.0198)--(85.1799,72.6299)--(83.5999,70.76)
+ ..controls (83.5999,70.76) and (80.22,70.76)..(77.0498,70.1099)
+ ..controls (73.8799,69.46) and (68.2598,68.5298)..(68.2598,68.5298)
+ ..controls (68.2598,68.5298) and (66.0999,69.46)..(66.0999,71.0498)
+ ..controls (66.0999,72.6299) and (66.6799,78.25)..(66.6799,78.25)
+ --cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (66.6799,78.25)..controls (68.9099,79.26) and (74.24,79.26)..(75.8198,79.26)
+ ..controls (77.3398,79.26) and (84.25,79.5398)..(84.25,79.5398)
+ --(85.1799,77.0198)--(85.1799,72.6299)--(83.5999,70.76)
+ ..controls (83.5999,70.76) and (80.22,70.76)..(77.0498,70.1099)
+ ..controls (73.8799,69.46) and (68.2598,68.5298)..(68.2598,68.5298)
+ ..controls (68.2598,68.5298) and (66.0999,69.46)..(66.0999,71.0498)
+ ..controls (66.0999,72.6299) and (66.6799,78.25)..(66.6799,78.25)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (93.0298,79.8298)--(105.85,79.5398)..controls (105.85,79.5398) and (108.37,79.26)..(108.66,77.3098)
+ ..controls (108.94,75.4399) and (109.3,72.9199)..(109.3,72.9199)
+ ..controls (109.3,72.9199) and (108.94,70.76)..(107.43,70.76)
+ ..controls (105.85,70.76) and (93.6099,70.3999)..(93.6099,70.3999)
+ ..controls (93.6099,70.3999) and (91.45,71.3398)..(91.45,72.9199)
+ ..controls (91.45,74.5) and (91.1599,77.3098)..(91.1599,77.3098)
+ --(93.0298,79.8298)--cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (93.0298,79.8298)--(105.85,79.5398)..controls (105.85,79.5398) and (108.37,79.26)..(108.66,77.3098)
+ ..controls (108.94,75.4399) and (109.3,72.9199)..(109.3,72.9199)
+ ..controls (109.3,72.9199) and (108.94,70.76)..(107.43,70.76)
+ ..controls (105.85,70.76) and (93.6098,70.3999)..(93.6098,70.3999)
+ ..controls (93.6098,70.3999) and (91.45,71.3399)..(91.45,72.9199)
+ ..controls (91.45,74.5) and (91.1599,77.3098)..(91.1599,77.3098)
+ --(93.0298,79.8298);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (95.48,61.3298)..controls (98.6499,61.3298) and (108.01,61.3298)..(108.01,61.3298)
+ --(110.82,58.8098)--(110.82,56.2898)..controls (108.01,55.3499) and (96.4199,54.99)..(96.4199,54.99)
+ ..controls (96.4199,54.99) and (93.3198,54.7)..(93.3198,56.2898)
+ ..controls (93.3198,57.8699) and (93.0298,59.3799)..(93.0298,59.3799)
+ --(95.48,61.3298)--cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (95.48,61.3298)..controls (98.6499,61.3298) and (108.01,61.3298)..(108.01,61.3298)
+ --(110.82,58.8098)--(110.82,56.2898)..controls (108.01,55.3499) and (96.4199,54.99)..(96.4199,54.99)
+ ..controls (96.4199,54.99) and (93.3198,54.7)..(93.3198,56.2898)
+ ..controls (93.3198,57.8699) and (93.0298,59.3799)..(93.0298,59.3799)
+ --(95.48,61.3298);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (84.5398,60.0298)--(88.2798,58.8098)--(88.2798,55.6399)
+ ..controls (88.2798,55.6399) and (88.3499,54.7)..(86.1199,54.7)
+ ..controls (83.96,54.7) and (71.72,53.1199)..(71.72,53.1199)
+ --(69.2,54.7)--(69.2,57.51)--(71.4299,59.74)
+ --(84.5398,60.0298)--cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (84.5398,60.0298)--(88.2798,58.8098)--(88.2798,55.6399)
+ ..controls (88.2798,55.6399) and (88.3499,54.7)..(86.1199,54.7)
+ ..controls (83.96,54.7) and (71.72,53.1199)..(71.72,53.1199)
+ --(69.2,54.7)--(69.2,57.51)--(71.4299,59.74)
+ --(84.5398,60.0298);
+drawoptions (withcolor (0,0.7,1));
+pickup pencircle scaled 2.23bp;
+draw (65.3799,59.8198)..controls (70.6399,63.0598) and (81.22,66.6599)..(88.2798,66.4399)
+ ..controls (95.2598,66.22) and (111.97,65.2898)..(115.64,61.47);
+drawoptions (withcolor (0.4,0.8,1));
+pickup pencircle scaled 0bp;
+fill (111.82,82.1399)--(105.92,86.46)..controls (105.92,86.46) and (95.98,87.3899)..(93.8999,87.3899)
+ ..controls (91.8799,87.3899) and (81.9399,87.3899)..(81.9399,87.3899)
+ --(74.24,87.3899)--(68.3398,84.8699)--(63.5798,81.9199)
+ --(64.95,81.2)..controls (64.95,81.2) and (79.4199,83.5)..(87.3398,83.2898)
+ ..controls (95.2598,83.0698) and (111.61,82.1399)..(111.82,82.1399)
+ --cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 1.44bp;
+draw (111.82,82.1399)--(105.92,86.46)..controls (105.92,86.46) and (95.98,87.3899)..(93.8999,87.3899)
+ ..controls (91.8799,87.3899) and (81.9399,87.3899)..(81.9399,87.3899)
+ --(74.24,87.3899)--(68.3398,84.8699)--(63.5798,81.9199)
+ --(64.95,81.2)..controls (64.95,81.2) and (79.4199,83.5)..(87.3398,83.2898)
+ ..controls (95.2598,83.0698) and (111.61,82.1399)..(111.82,82.1399)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 2.81bp;
+draw (113.84,72.8498)..controls (114.92,72.8498) and (116.29,72.8498)..(118.16,71.7)
+ ..controls (119.96,70.5398) and (119.53,70.5398)..(121.11,68.96)
+ ..controls (122.62,67.3799) and (121.98,66.22)..(121.98,66.22)
+ ..controls (121.98,66.22) and (120.82,65.5798)..(119.02,65.5798)
+ ..controls (117.22,65.5798) and (111.82,65.0698)..(109.74,65.0698)
+ ..controls (107.72,65.0698) and (103.4,65.0698)..(99.7998,65.0698)
+ ..controls (96.2,65.0698) and (90.9399,64.8599)..(88.2798,64.8599)
+ ..controls (85.5398,64.8599) and (79.4199,64.1399)..(76.47,63.9199)
+ ..controls (73.5198,63.7) and (69.49,63.7)..(66.0999,63.7)
+ ..controls (62.72,63.7) and (63.7998,62.7698)..(61.3499,64.1399)
+ ..controls (58.8298,65.5798) and (57.97,64.2099)..(57.97,66.6599)
+ ..controls (57.97,69.1799) and (56.8198,69.46)..(59.3398,71.7)
+ ..controls (61.7798,73.9299) and (61.3499,73.0598)..(63.1499,73.0598);
+pickup pencircle scaled 2.23bp;
+draw (57.97,67.0899)--(57.97,59.1699);
+draw (62.9399,62.7698)--(62.9399,51.25);
+draw (90.2998,64.8598)--(91.45,48.9399);
+draw (121.26,66.01)--(120.61,54.6299);
+draw (60.9199,72.8499)--(62,66.01);
+draw (114.7,72.5598)--(114.7,67.3799);
+pickup pencircle scaled 2.81bp;
+draw (84.6099,87.0999)--(84.8999,94.3799);
+draw (96.8498,86.46)--(96.8498,90.7798);
+drawoptions (withcolor (1,0.9,0));
+pickup pencircle scaled 0bp;
+fill (96.6299,96.25)..controls (98,96.25) and (99.1499,95.1699)..(99.1499,93.73)
+ ..controls (99.1499,92.2898) and (98,91.21)..(96.6299,91.21)
+ ..controls (95.2598,91.21) and (94.1099,92.2898)..(94.1099,93.73)
+ ..controls (94.1099,95.1699) and (95.2598,96.25)..(96.6299,96.25)
+ --cycle;
+drawoptions (withcolor (0.9,0,0));
+pickup pencircle scaled 2.23bp;
+draw (96.6299,96.25)..controls (98,96.25) and (99.1499,95.1699)..(99.1499,93.73)
+ ..controls (99.1499,92.2898) and (98,91.21)..(96.6299,91.21)
+ ..controls (95.2598,91.21) and (94.1099,92.2898)..(94.1099,93.73)
+ ..controls (94.1099,95.1699) and (95.2598,96.25)..(96.6299,96.25)
+ --cycle;
+drawoptions (withcolor (1,0.4,0));
+pickup pencircle scaled 0bp;
+fill (277.14,29.4299)--(285.99,29.4299)--(285.99,0.699951)
+ --(277.14,0.699951)--(277.14,29.4299)--cycle;
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0.86bp;
+draw (277.14,29.4299)--(285.99,29.4299)--(285.99,0.699936)
+ --(277.14,0.699936)--(277.14,29.4299);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (271.16,51.75)--(276.49,52.6199)--(276.7,49.95)
+ --(271.16,48.9399)--(271.16,51.75)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (271.16,51.75)--(276.49,52.6199)--(276.7,49.95)
+ --(271.16,48.9399)--(271.16,51.75);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (285.56,29.3599)--(285.27,32.5298)--(276.85,32.5298)
+ --(277.64,29.3599)--(285.56,29.3599)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (285.56,29.3599)--(285.27,32.5298)--(276.85,32.5298)
+ --(277.64,29.3599)--(285.56,29.3599);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (165.82,104.53)--(172.95,104.53)--(172.95,102.08)
+ --(165.82,102.08)--(165.82,104.53)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (165.82,104.53)--(172.95,104.53)--(172.95,102.08)
+ --(165.82,102.08)--(165.82,104.53);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (162.37,92.22)..controls (162.58,92.22) and (162.87,92.22)..(163.16,92.22)
+ ..controls (163.52,92.22) and (163.81,92.22)..(164.1,92.22)
+ ..controls (164.02,89.7698) and (164.02,87.3198)..(164.02,84.8699)
+ ..controls (164.02,82.3499) and (164.02,79.8999)..(164.1,77.3799)
+ ..controls (163.81,77.5298) and (163.52,77.6699)..(163.16,77.74)
+ ..controls (162.94,77.8198) and (162.58,78.0298)..(162.37,78.0298)
+ ..controls (162.3,80.4099) and (162.3,82.7798)..(162.3,85.1599)
+ ..controls (162.3,87.46) and (162.37,89.9099)..(162.37,92.22)
+ --cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (162.37,92.22)..controls (162.58,92.22) and (162.87,92.22)..(163.16,92.22)
+ ..controls (163.52,92.22) and (163.81,92.22)..(164.1,92.22)
+ ..controls (164.02,89.7698) and (164.02,87.3198)..(164.02,84.8699)
+ ..controls (164.02,82.3499) and (164.02,79.8999)..(164.1,77.3799)
+ ..controls (163.81,77.5298) and (163.52,77.6699)..(163.16,77.74)
+ ..controls (162.94,77.8198) and (162.58,78.0298)..(162.37,78.0298)
+ ..controls (162.3,80.4099) and (162.3,82.7798)..(162.3,85.1599)
+ ..controls (162.3,87.46) and (162.37,89.9099)..(162.37,92.22)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (161.94,92.6499)--(164.31,92.6499)--(164.31,93.6599)
+ --(161.94,93.6599)--(161.94,92.6499)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (161.94,92.6499)--(164.31,92.6499)--(164.31,93.6599)
+ --(161.94,93.6599)--(161.94,92.6499);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (147.25,105.9)--(150.34,105.9)--(150.34,104.53)
+ --(147.25,104.53)--(147.25,105.9)--cycle;
+drawoptions (withcolor (0.1,0.1,0.1));
+pickup pencircle scaled 0.86bp;
+draw (147.25,105.9)--(150.34,105.9)--(150.34,104.53)
+ --(147.25,104.53)--(147.25,105.9);
+drawoptions (withcolor (0,0.7,1));
+pickup pencircle scaled 0bp;
+fill (105.85,90.6299)..controls (110.82,92.5) and (110.82,92)..(113.98,92.9399)
+ ..controls (117.08,93.7998) and (117.58,92.5)..(120.25,92.5)
+ ..controls (122.91,92.5) and (128.67,92)..(130.62,92)
+ --(135.58,92)--(141.85,93.3699)--(143.22,82.5)
+ --(154.45,82.5)--(159.78,79.3298)..controls (159.78,79.3298) and (159.34,72.1299)..(155.74,72.1299)
+ ..controls (152.22,72.1299) and (147.61,69.3899)..(144.08,72.1299)
+ ..controls (140.55,74.7898) and (136.88,75.22)..(134.22,74.7898)
+ ..controls (131.55,74.3599) and (126.94,73.9299)..(123.42,73.9299)
+ ..controls (119.82,73.9299) and (113.05,73.9299)..(113.05,73.9299)
+ --(111.25,82.9299)--(105.85,87.46)--(105.85,90.6299)
+ --cycle;
+drawoptions (withcolor (0,0.4,1));
+fill (109.88,100.93)..controls (116.22,103.45) and (119.82,103.23)..(123.85,103.66)
+ ..controls (127.95,104.1) and (132.49,104.89)..(133.35,104.6)
+ --(138.75,102.8)--(136.02,99.6299)..controls (136.02,99.6299) and (138.25,93.2998)..(136.02,95.0999)
+ ..controls (133.78,96.8999) and (130.18,96.8999)..(127.02,97.3298)
+ ..controls (123.85,97.76) and (118.45,95.5298)..(121.18,95.5298)
+ ..controls (123.85,95.5298) and (131.98,95.5298)..(134.65,94.23)
+ --(139.18,91.9299)..controls (139.18,91.9299) and (112.18,91.9299)..(108.51,91.9299)
+ ..controls (104.91,91.9299) and (104.55,96.0298)..(106.78,96.0298)
+ ..controls (109.02,96.0298) and (115.78,98.7)..(115.78,98.7)
+ --(107.65,100.06)--(109.88,100.93)--cycle;
+drawoptions (withcolor (0.6,0.3,0));
+fill (45.9399,128.07)..controls (45.9399,128.07) and (45.0798,122.6)..(45.9399,118.57)
+ ..controls (46.8799,114.54) and (45.9399,113.17)..(47.3098,110.43)
+ ..controls (48.6799,107.77) and (50.48,104.17)..(50.48,104.17)
+ --(54.9399,101.5)--(52.71,99.6299)--(47.74,99.6299)
+ --(43.21,103.3)--(41.9099,114.03)--(41.4099,123.1)
+ --(40.98,127.64)--(45.9399,128.07)--cycle;
+fill (45.0798,95.1699)..controls (45.0798,95.1699) and (42.2698,98.7)..(41.4099,101.94)
+ ..controls (40.5398,105.1) and (38.74,111.37)..(38.74,114.97)
+ ..controls (38.74,118.57) and (38.74,128.07)..(38.74,128.07)
+ --(31.5398,124.04)..controls (31.5398,124.04) and (31.0398,119.5)..(31.5398,116.34)
+ ..controls (31.98,113.17) and (32.8398,108.2)..(33.3398,105.1)
+ ..controls (33.7798,101.94) and (34.21,100.57)..(34.21,97.8298)
+ ..controls (34.21,95.1699) and (39.6799,94.23)..(39.6799,94.23)
+ --(45.0798,95.1699)--cycle;
+fill (27.9399,87.46)..controls (27.9399,87.46) and (27.5098,96.46)..(27.5098,99.2)
+ ..controls (27.5098,101.94) and (27.5098,113.17)..(27.5098,113.17)
+ --(27.0798,120.37)--(22.98,119.07)--(15.3398,123.61)
+ ..controls (15.3398,123.61) and (15.3398,113.6)..(15.3398,110.94)
+ ..controls (15.3398,108.2) and (15.7798,101.5)..(15.3398,96.97)
+ ..controls (14.9099,92.4299) and (15.7798,92)..(14.9099,88.8298)
+ ..controls (13.98,85.6599) and (21.1799,86.5298)..(21.1799,86.5298)
+ --(26.1399,85.23)--(27.9399,87.46)--cycle;
+fill (1.37988,78.3899)--(15.3398,77.5298)..controls (15.3398,77.5298) and (14.8398,80.7)..(13.5398,83.3599)
+ ..controls (12.1799,86.0999) and (7.63989,86.96)..(6.77979,92.8599)
+ ..controls (5.83984,98.7698) and (4.53979,102.8)..(4.53979,107.77)
+ ..controls (4.53979,112.74) and (4.10986,127.21)..(4.10986,127.21)
+ --(1.37988,127.64)--(1.37988,78.3899)--cycle;
+drawoptions (withcolor (0,0.75,1));
+fill (220.62,63.9199)--(217.45,58.5198)--(223.78,51.6799)
+ ..controls (223.78,51.6799) and (230.98,47.22)..(234.15,46.2798)
+ ..controls (237.32,45.3398) and (244.52,43.5398)..(244.52,43.5398)
+ --(257.12,43.5398)--(261.66,44.0498)--(267.42,42.6799)
+ --(266.55,36.3398)--(259.78,32.74)..controls (259.78,32.74) and (254.46,30.9399)..(248.98,32.74)
+ ..controls (243.58,34.5398) and (240.92,34.1099)..(236.38,34.98)
+ ..controls (231.85,35.9099) and (222.42,37.71)..(221.98,40.45)
+ ..controls (221.55,43.1099) and (219.32,49.0198)..(219.32,49.0198)
+ --(217.45,54.4199)--(218.38,62.5498)--(220.62,63.9199)
+ --cycle;
+drawoptions (withcolor (0.6,0.3,0));
+fill (219.75,63.9199)--(235.02,63.9199)..controls (235.02,63.9199) and (238.18,63.9199)..(243.15,62.1199)
+ ..controls (248.12,60.3198) and (257.12,56.22)..(257.12,56.22)
+ --(262.09,51.25)--(266.98,48.5798)--(266.98,42.6799)
+ --(260.72,44.0498)--(246.32,41.74)--(231.42,46.7798)
+ --(222.42,52.1799)--(218.82,57.1499)--(219.75,63.9199)
+ --cycle;
+drawoptions (withcolor (1,0.9,0));
+fill (223.78,55.7798)--(227.38,60.75)--(231.42,61.6899)
+ ..controls (231.42,61.6899) and (235.88,61.6899)..(238.62,61.26)
+ ..controls (241.35,60.75) and (245.38,59.3799)..(248.12,57.5798)
+ ..controls (250.78,55.7798) and (256.18,52.6199)..(256.18,52.6199)
+ --(254.89,48.5798)--(249.42,46.2798)--(243.58,48.0798)
+ --(237.75,53.0498)--(233.65,54.9199)--(223.78,55.7798)
+ --cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+fill (221.34,54.4199)--(224.65,50.3799)..controls (224.65,50.3799) and (229.62,47.6499)..(232.35,46.7798)
+ ..controls (235.02,45.8499) and (240.56,44.6199)..(240.92,44.48)
+ --(246.75,42.25)--(251.29,48.0798)--(243.58,51.25)
+ --(236.02,54.4199)--(229.18,56.22)--(221.34,54.4199)
+ --cycle;
+drawoptions (withcolor (0.8,0.8,0.8));
+fill (219.32,63.0598)--(219.32,58.0198)--(224.22,51.25)
+ ..controls (224.22,51.25) and (231.92,47.22)..(235.02,45.8499)
+ ..controls (238.18,44.48) and (243.15,43.1099)..(245.89,43.1099)
+ ..controls (248.55,43.1099) and (253.09,43.1099)..(255.75,43.1099)
+ ..controls (258.42,43.1099) and (262.02,44.0498)..(264.32,43.1099)
+ ..controls (266.55,42.25) and (267.42,40.45)..(267.42,40.45)
+ --(262.09,38.6499)..controls (262.09,38.6499) and (255.75,38.6499)..(251.65,38.6499)
+ ..controls (247.62,38.6499) and (240.92,39.51)..(237.32,40.45)
+ ..controls (233.65,41.3098) and (226.88,43.98)..(223.78,47.22)
+ ..controls (220.62,50.3799) and (218.38,53.98)..(218.38,53.98)
+ --(219.32,63.0598)--cycle;
+drawoptions (withcolor (0.6,0.3,0));
+fill (271.45,52.8999)--(271.23,1.41992)--(266.34,1.41992)
+ --(266.41,54.2)..controls (266.41,54.2) and (272.17,53.1899)..(271.45,52.8999)
+ --cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (271.45,52.8999)--(271.23,1.41992)--(266.34,1.41992)
+ --(266.41,54.2)..controls (266.41,54.2) and (272.17,53.1899)..(271.45,52.8999)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (271.16,51.75)--(266.26,54.1299)--(266.26,50.8899)
+ --(271.16,48.9399)--(271.16,51.75)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (271.16,51.75)--(266.26,54.1299)--(266.26,50.8899)
+ --(271.16,48.9399)--(271.16,51.75);
+drawoptions (withcolor (0.6,0.85,1));
+pickup pencircle scaled 0bp;
+fill (121.98,48.0798)..controls (129.82,48.51) and (138.9,48.51)..(143.36,48.51)
+ ..controls (147.75,48.51) and (157.69,51.6799)..(163.52,49.0198)
+ ..controls (169.42,46.2798) and (168.99,44.0498)..(174.82,43.5398)
+ ..controls (180.66,43.1099) and (189.66,39.51)..(189.66,39.51)
+ ..controls (189.66,39.51) and (190.52,35.8398)..(193.26,34.0398)
+ ..controls (195.99,32.24) and (185.62,29.5)..(185.62,29.5)
+ --(173.89,35.8398)..controls (173.89,35.8398) and (156.32,40.8799)..(152.72,40.8799)
+ ..controls (149.12,40.8799) and (134.79,39.9399)..(134.79,39.9399)
+ ..controls (134.79,39.9399) and (130.69,34.47)..(140.19,34.0398)
+ ..controls (149.55,33.6099) and (157.69,30.9399)..(157.69,30.9399)
+ ..controls (157.69,30.9399) and (156.32,25.47)..(152.72,25.47)
+ ..controls (149.12,25.47) and (129.82,26.4099)..(125.36,26.4099)
+ ..controls (120.82,26.4099) and (103.62,28.21)..(108.51,30.9399)
+ ..controls (113.48,33.6099) and (116.79,41.3098)..(116.79,41.3098)
+ ..controls (116.79,41.3098) and (118.59,46.71)..(121.98,48.0798)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+fill (266.12,54.1299)--(271.3,51.46)--(276.7,52.6199)
+ --(273.68,54.99)--(266.12,54.1299)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (266.12,54.1299)--(271.3,51.46)--(276.7,52.6199)
+ --(273.68,54.99)--(266.12,54.1299);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (189.73,159.75)--(185.05,155.07)--(176.19,155.07)
+ --(181.09,159.75)--(189.73,159.75)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (189.73,159.75)--(185.05,155.07)--(176.19,155.07)
+ --(181.09,159.75)--(189.73,159.75);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (191.24,121.45)..controls (191.24,118.71) and (191.24,115.54)..(191.24,113.89)
+ ..controls (191.24,112.16) and (191.6,109.35)..(191.24,107.91)
+ ..controls (190.81,106.54) and (190.38,105.46)..(190.38,105.46)
+ --(190.59,103.16)--(193.98,104.02)--(194.41,106.54)
+ ..controls (194.41,106.54) and (194.41,111.94)..(194.41,113.02)
+ ..controls (194.41,114.03) and (195.06,123.54)..(195.06,123.54)
+ --(191.24,121.45)--cycle;
+pickup pencircle scaled 0.86bp;
+draw (191.24,121.45)..controls (191.24,118.71) and (191.24,115.54)..(191.24,113.89)
+ ..controls (191.24,112.16) and (191.6,109.35)..(191.24,107.91)
+ ..controls (190.81,106.54) and (190.38,105.46)..(190.38,105.46)
+ --(190.59,103.16)--(193.98,104.02)--(194.41,106.54)
+ ..controls (194.41,106.54) and (194.41,111.94)..(194.41,113.02)
+ ..controls (194.41,114.03) and (195.06,123.54)..(195.06,123.54)
+ --(191.24,121.45);
+pickup pencircle scaled 0bp;
+fill (216.58,98.5498)..controls (216.58,100.21) and (216.15,99.3398)..(216.01,102.73)
+ ..controls (215.79,106.11) and (215.14,107.12)..(215.14,110.22)
+ ..controls (215.14,113.46) and (215.14,116.98)..(215.14,118.06)
+ ..controls (215.14,119.14) and (215.14,120.37)..(215.14,120.37)
+ --(212.19,119.36)..controls (212.19,119.36) and (212.19,118.71)..(212.19,116.98)
+ ..controls (212.19,115.33) and (212.19,113.17)..(212.19,111.3)
+ ..controls (212.19,109.42) and (212.19,109.5)..(212.19,106.98)
+ ..controls (212.19,104.46) and (212.05,101.94)..(212.05,101.94)
+ --(211.4,99.3398)--(213.27,98.7)--(216.58,98.5498)
+ --cycle;
+pickup pencircle scaled 0.86bp;
+draw (216.58,98.5498)..controls (216.58,100.21) and (216.15,99.3399)..(216.01,102.73)
+ ..controls (215.79,106.11) and (215.14,107.12)..(215.14,110.22)
+ ..controls (215.14,113.46) and (215.14,116.98)..(215.14,118.06)
+ ..controls (215.14,119.14) and (215.14,120.37)..(215.14,120.37)
+ --(212.19,119.36)..controls (212.19,119.36) and (212.19,118.71)..(212.19,116.98)
+ ..controls (212.19,115.33) and (212.19,113.17)..(212.19,111.3)
+ ..controls (212.19,109.42) and (212.19,109.5)..(212.19,106.98)
+ ..controls (212.19,104.46) and (212.05,101.94)..(212.05,101.94)
+ --(211.4,99.3399)--(213.27,98.6999)--(216.58,98.5498);
+pickup pencircle scaled 0bp;
+fill (184.54,108.78)--(184.54,114.46)--(183.46,116.19)
+ --(182.67,114.46)..controls (182.67,114.46) and (182.82,113.24)..(182.82,112.16)
+ ..controls (182.82,111.08) and (182.82,109.64)..(182.82,109.64)
+ --(184.54,108.78)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (184.54,108.78)--(184.54,114.46)--(183.46,116.19)
+ --(182.67,114.46)..controls (182.67,114.46) and (182.82,113.24)..(182.82,112.16)
+ ..controls (182.82,111.08) and (182.82,109.64)..(182.82,109.64)
+ --(184.54,108.78);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (178.28,117.85)..controls (178.28,117.85) and (178.42,115.76)..(178.42,114.68)
+ ..controls (178.42,113.6) and (178.42,111.3)..(178.42,111.3)
+ --(176.98,109.64)--(176.98,113.46)--(176.98,116.55)
+ --(178.28,117.85)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (178.28,117.85)..controls (178.28,117.85) and (178.42,115.76)..(178.42,114.68)
+ ..controls (178.42,113.6) and (178.42,111.3)..(178.42,111.3)
+ --(176.98,109.64)--(176.98,113.46)--(176.98,116.55)
+ --(178.28,117.85);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (180.51,109.21)..controls (180.51,109.21) and (180.3,109.5)..(180.51,112.16)
+ ..controls (180.73,114.9) and (180.73,117.85)..(180.73,117.85)
+ --(179.5,118.06)..controls (179.5,118.06) and (179.5,115.9)..(179.5,114.9)
+ ..controls (179.5,113.89) and (179.29,110.86)..(179.29,110.86)
+ --(179.5,108.99)--(180.51,109.21)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (180.51,109.21)..controls (180.51,109.21) and (180.3,109.5)..(180.51,112.16)
+ ..controls (180.73,114.9) and (180.73,117.85)..(180.73,117.85)
+ --(179.5,118.06)..controls (179.5,118.06) and (179.5,115.9)..(179.5,114.9)
+ ..controls (179.5,113.89) and (179.29,110.86)..(179.29,110.86)
+ --(179.5,108.99)--(180.51,109.21);
+drawoptions (withcolor (0,0.5,0));
+pickup pencircle scaled 0bp;
+fill (192.46,150.97)..controls (185.55,150.54) and (182.6,151.98)..(182.38,148.88)
+ ..controls (182.24,145.71) and (184.54,150.97)..(185.34,145.28)
+ ..controls (186.2,139.59) and (186.85,138.51)..(186.85,136.21)
+ ..controls (186.85,133.9) and (188.86,133.9)..(189.3,136.42)
+ ..controls (189.73,138.94) and (190.02,140.89)..(192.1,142.11)
+ ..controls (194.19,143.41) and (195.06,146.94)..(191.46,146.5)
+ ..controls (187.86,146.14) and (190.59,149.89)..(190.59,149.89)
+ --(192.46,150.97)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (221.77,159.61)--(227.17,163.06)--(226.52,146.65)
+ --(222.42,145.93)--(221.77,159.61);
+draw (207.8,155.43)--(205.28,153.92)--(205.28,149.1);
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 1.44bp;
+draw (204.63,125.48)--(204.63,118.28)--(209.24,117.63);
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (224,160.9)--(224.14,148.88);
+draw (222.06,154.78)--(226.88,157.09);
+draw (216.01,151.62)--(215.79,145.71);
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 1.44bp;
+draw (223.5,130.52)--(227.96,130.52)--(228.18,124.4);
+draw (222.7,118.28)--(222.7,115.76)--(228.39,115.11);
+draw (222.27,123.32)--(227.53,123.18);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (240.42,126.27)--(236.82,126.7)--(236.82,113.17)
+ --(241.35,113.17)--(240.42,126.27)--cycle;
+drawoptions (withcolor (0.5,0.5,0.5));
+pickup pencircle scaled 0.22bp;
+draw (240.42,126.27)--(236.82,126.7)--(236.82,113.17)
+ --(241.35,113.17)--(240.42,126.27);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (246.75,126.7)--(242.65,126.7)--(243.58,112.23)
+ --(248.12,111.8)--(248.55,119.07)--(246.75,126.7)
+ --cycle;
+drawoptions (withcolor (0.5,0.5,0.5));
+pickup pencircle scaled 0.22bp;
+draw (246.75,126.7)--(242.65,126.7)--(243.58,112.23)
+ --(248.12,111.8)--(248.55,119.07)--(246.75,126.7);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (258.7,119.79)--(258.7,111.66)--(262.74,111.66)
+ --(263.24,123.82)--(258.27,122.96)--(258.7,119.79)
+ --cycle;
+drawoptions (withcolor (0.5,0.5,0.5));
+pickup pencircle scaled 0.22bp;
+draw (258.7,119.79)--(258.7,111.66)--(262.74,111.66)
+ --(263.24,123.82)--(258.27,122.96)--(258.7,119.79);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (269.36,126.49)--(264.82,126.49)--(265.33,110.22)
+ --(270.73,110.22)--(269.36,126.49)--cycle;
+drawoptions (withcolor (0.5,0.5,0.5));
+pickup pencircle scaled 0.22bp;
+draw (269.36,126.49)--(264.82,126.49)--(265.33,110.22)
+ --(270.73,110.22)--(269.36,126.49);
+drawoptions (withcolor (1,0.8,0.8));
+pickup pencircle scaled 0bp;
+fill (273.32,101.5)--(285.92,98.26)--(285.92,156.58)
+ --(273.32,145.28)--(273.32,101.5)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (273.32,101.5)--(285.92,98.26)--(285.92,156.58)
+ --(273.32,145.28)--(273.32,101.5);
+drawoptions (withcolor (0.95,0.95,0.95));
+pickup pencircle scaled 0bp;
+fill (277.86,125.41)--(276.92,109.57)--(285.92,107.77)
+ --(285.49,123.61)--(277.86,125.41)--cycle;
+drawoptions (withcolor (0.6,0.6,0.6));
+pickup pencircle scaled 1.44bp;
+draw (277.86,125.41)--(276.92,109.57)--(285.92,107.77)
+ --(285.49,123.61)--(277.86,125.41);
+drawoptions (withcolor (0.9,0.9,0.9));
+pickup pencircle scaled 0bp;
+fill (278.29,125.84)--(285.49,123.61)--(285.92,131.24)
+ --(278.29,132.18)--(278.29,125.84)--cycle;
+drawoptions (withcolor (0.6,0.6,0.6));
+pickup pencircle scaled 1.44bp;
+draw (278.29,125.84)--(285.49,123.61)--(285.92,131.24)
+ --(278.29,132.18)--(278.29,125.84);
+pickup pencircle scaled 0.86bp;
+draw (237.32,121.3)--(240.42,121.3);
+drawoptions (withcolor (0.5,0.5,0.5));
+draw (243.15,121.3)--(248.12,120.87);
+draw (259.35,120.37)--(262.52,119.94);
+draw (265.69,121.3)--(269.22,120.87);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (166.04,101.86)..controls (167.12,101.94) and (168.2,101.94)..(169.35,101.94)
+ ..controls (170.43,101.94) and (171.51,101.94)..(172.74,101.86)
+ ..controls (172.66,97.5398) and (172.66,93.1499)..(172.66,88.76)
+ ..controls (172.66,84.3699) and (172.66,79.98)..(172.74,75.5798)
+ ..controls (171.51,76.0898) and (170.43,76.5898)..(169.35,77.0198)
+ ..controls (168.27,77.46) and (167.12,77.96)..(166.04,78.3198)
+ ..controls (166.04,82.2798) and (166.04,86.1699)..(166.04,90.1299)
+ ..controls (166.04,94.0198) and (166.04,97.98)..(166.04,101.86)
+ --cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (166.04,101.86)..controls (167.12,101.94) and (168.2,101.94)..(169.35,101.94)
+ ..controls (170.43,101.94) and (171.51,101.94)..(172.74,101.86)
+ ..controls (172.66,97.5398) and (172.66,93.1499)..(172.66,88.76)
+ ..controls (172.66,84.3699) and (172.66,79.98)..(172.74,75.5798)
+ ..controls (171.51,76.0899) and (170.43,76.5898)..(169.35,77.0198)
+ ..controls (168.27,77.4599) and (167.12,77.9599)..(166.04,78.3198)
+ ..controls (166.04,82.2798) and (166.04,86.1699)..(166.04,90.1299)
+ ..controls (166.04,94.0198) and (166.04,97.98)..(166.04,101.86)
+ --cycle;
+drawoptions (withcolor (0,0.6,0));
+pickup pencircle scaled 0bp;
+fill (25.21,151.54)..controls (35.4299,157.66) and (33.3398,161.05)..(32.7,169.33)
+ ..controls (32.0498,177.54) and (29.3098,183.01)..(30.6799,189.13)
+ ..controls (32.0498,195.32) and (25.9299,187.04)..(23.8398,181.57)
+ ..controls (21.8198,176.17) and (13.6199,171.34)..(13.6199,171.34)
+ ..controls (13.6199,171.34) and (5.47998,167.89)..(8.85986,179.55)
+ ..controls (12.25,191.22) and (5.47998,189.78)..(5.47998,185.02)
+ ..controls (5.47998,180.27) and (3.38989,170.62)..(5.47998,164.5)
+ ..controls (7.5,158.38) and (12.3198,157.66)..(12.97,161.05)
+ ..controls (13.6199,164.5) and (17.0698,159.68)..(17.0698,152.19)
+ ..controls (17.0698,144.7) and (25.21,151.54)..(25.21,151.54)
+ --cycle;
+fill (38.8198,143.98)..controls (44.2898,150.18) and (44.2898,155)..(44.2898,159.75)
+ ..controls (44.2898,164.5) and (43.5698,178.18)..(46.2998,174.73)
+ ..controls (49.0398,171.34) and (53.7898,163.86)..(53.7898,158.38)
+ ..controls (53.7898,152.91) and (46.3799,148.09)..(51.1299,143.98)
+ ..controls (55.8799,139.88) and (59.2598,136.5)..(50.4099,136.5)
+ ..controls (41.5498,136.5) and (34.0598,134.41)..(34.0598,134.41)
+ --(38.8198,143.98)--cycle;
+drawoptions (withcolor (0,0.8,0));
+fill (254.6,137.86)..controls (254.6,145.42) and (251.14,148.16)..(254.6,155)
+ ..controls (257.98,161.84) and (261.44,170.7)..(261.44,170.7)
+ ..controls (261.44,170.7) and (262.74,170.7)..(262.74,165.94)
+ ..controls (262.74,161.12) and (268.93,156.3)..(268.93,156.3)
+ --(269.58,149.46)--(262.09,141.97)..controls (262.09,141.97) and (262.09,139.23)..(262.09,134.48)
+ ..controls (262.09,129.66) and (254.6,137.86)..(254.6,137.86)
+ --cycle;
+drawoptions (withcolor (0.95,0.95,0.95));
+fill (80.3599,197.34)..controls (117.8,197.34) and (98.0698,202.81)..(123.92,202.81)
+ ..controls (149.77,202.81) and (150.42,203.53)..(162.66,200.79)
+ ..controls (174.97,198.06) and (174.25,195.25)..(185.84,193.23)
+ ..controls (197.43,191.22) and (206.29,189.78)..(204.92,185.02)
+ ..controls (203.55,180.27) and (180.44,174.15)..(174.97,176.82)
+ ..controls (169.5,179.55) and (155.17,184.38)..(150.42,184.38)
+ ..controls (145.66,184.38) and (110.31,192.58)..(110.31,192.58)
+ ..controls (110.31,192.58) and (102.82,188.41)..(115.14,185.74)
+ ..controls (127.38,183.01) and (154.52,178.9)..(142.28,172.71)
+ ..controls (130.04,166.52) and (115.78,176.17)..(106.93,176.17)
+ ..controls (98.0698,176.17) and (85.1799,176.82)..(78.99,179.55)
+ ..controls (72.8699,182.29) and (61.2798,190.5)..(54.5098,193.95)
+ ..controls (47.6699,197.34) and (49.6899,205.54)..(59.2598,204.18)
+ ..controls (68.7698,202.81) and (80.3599,197.34)..(80.3599,197.34)
+ --cycle;
+drawoptions (withcolor (1,0.4,0));
+fill (14.3398,40.8098)..controls (21.8198,45.5598) and (32.7,53.0498)..(34.7798,56.5)
+ ..controls (36.7998,59.8899) and (37.45,49.6599)..(37.45,49.6599)
+ --(45.6599,57.1499)--(45.6599,47.6499)..controls (45.6599,47.6499) and (42.2,42.8198)..(39.5398,38)
+ ..controls (36.7998,33.25) and (22.47,18.2)..(22.47,18.2)
+ --(19.8098,25.0398)--(25.21,34.6199)--(23.8398,41.46)
+ --(12.25,35.26)--(14.3398,40.8098)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+fill (257.98,96.1799)--(278.43,94.8098)--(264.18,92.72)
+ --(255.25,92.72)--(257.98,96.1799)--cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+fill (215.14,102.37)..controls (215.14,102.37) and (217.16,100.28)..(220.54,100.28)
+ ..controls (224,100.28) and (230.77,99.5598)..(230.77,99.5598)
+ --(227.31,98.1899)--(215.79,97.5398)--(215.14,102.37)
+ --cycle;
+fill (193.98,104.38)--(204.92,104.38)--(203.55,100.93)
+ --(193.33,102.37)--(193.98,104.38)--cycle;
+drawoptions (withcolor (0,0.5,1));
+fill (266.12,11.8599)..controls (260.65,15.25) and (251.79,18.7)..(246.32,18.7)
+ ..controls (240.85,18.7) and (239.48,17.3398)..(230.62,17.3398)
+ ..controls (221.7,17.3398) and (212.91,15.97)..(206.07,17.3398)
+ ..controls (199.23,18.7) and (191.74,16.6199)..(186.92,16.6199)
+ ..controls (182.17,16.6199) and (183.54,11.1399)..(178.06,10.5)
+ ..controls (172.59,9.77979) and (171.94,5.66992)..(167.84,5.66992)
+ ..controls (163.74,5.66992) and (159.06,0.849854)..(168.49,0.849854)
+ ..controls (177.92,0.849854) and (266.12,0.699951)..(266.12,1.41992)
+ --(266.12,11.8599)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (1.01978,215.34)--(286.28,215.34)--(286.28,0.849854)
+ --(1.01978,0.849854)--(1.01978,215.34);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (286.28,31.6599)--(280.81,35.8398)--(277.42,35.8398)
+ --(277.42,31.6599)--(286.28,31.6599)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (286.28,31.6599)--(280.81,35.8398)--(277.42,35.8398)
+ --(277.42,31.6599)--(286.28,31.6599);
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 2.81bp;
+draw (69.2698,192.73)..controls (74.74,190.71) and (75.46,185.89)..(75.46,185.89)
+ --(81.5798,185.24);
+draw (62.1399,178.62)..controls (67.5398,176.6) and (69.7,176.89)..(69.7,176.89)
+ --(72.4399,180.27);
+draw (52.3499,196.11)..controls (57.8198,194.02) and (58.47,189.27)..(58.47,189.27)
+ --(61.21,192.66);
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 2.23bp;
+draw (173.17,30.73)..controls (173.17,29.72) and (173.38,28.5)..(173.38,28.5)
+ --(175.18,29.0698);
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0bp;
+fill (168.99,32.74)..controls (170.5,34.3999) and (171.51,33.1799)..(172.88,32.5298)
+ ..controls (174.25,31.8799) and (175.98,32.3098)..(175.11,31.23)
+ ..controls (174.32,30.22) and (168.56,29.3599)..(168.56,29.6499)
+ --(168.63,30.9399)--(168.13,31.6599)--(168.99,32.74)
+ --cycle;
+pickup pencircle scaled 2.23bp;
+draw (173.24,32.3098)..controls (173.24,33.3198) and (173.46,34.5398)..(173.46,34.5398)
+ --(175.33,33.97);
+drawoptions (withcolor (0,0,0));
+draw (184.33,24.3899)..controls (184.33,23.3799) and (184.54,22.1599)..(184.54,22.1599)
+ --(186.42,22.8098);
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0bp;
+fill (180.22,26.4099)..controls (181.74,28.0598) and (182.67,26.8398)..(184.04,26.1899)
+ ..controls (185.41,25.5398) and (187.14,25.98)..(186.34,24.97)
+ ..controls (185.55,23.8899) and (179.72,23.0198)..(179.72,23.3098)
+ --(179.86,24.6099)--(179.29,25.3999)--(180.22,26.4099)
+ --cycle;
+pickup pencircle scaled 2.23bp;
+draw (184.47,25.98)..controls (184.47,26.98) and (184.69,28.21)..(184.69,28.21)
+ --(186.56,27.6299);
+drawoptions (withcolor (0,0,0));
+draw (195.7,34.8298)..controls (195.7,33.75) and (195.92,32.5298)..(195.92,32.5298)
+ --(197.79,33.1799);
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0bp;
+fill (191.6,36.7798)..controls (193.04,38.5) and (194.05,37.2798)..(195.42,36.6299)
+ ..controls (196.78,35.9099) and (198.51,36.3398)..(197.72,35.3398)
+ ..controls (196.86,34.3298) and (191.1,33.46)..(191.1,33.6799)
+ --(191.24,35.0498)--(190.66,35.7698)--(191.6,36.7798)
+ --cycle;
+pickup pencircle scaled 2.23bp;
+draw (195.85,36.3398)..controls (195.85,37.4199) and (196.06,38.6499)..(196.06,38.6499)
+ --(197.94,38);
+drawoptions (withcolor (0,0,0));
+draw (198.44,26.26)..controls (198.44,25.1799) and (198.66,23.96)..(198.66,23.96)
+ --(200.53,24.6099);
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0bp;
+fill (194.34,28.21)..controls (195.85,29.9399) and (196.78,28.71)..(198.15,28.0598)
+ ..controls (199.52,27.3398) and (201.25,27.7798)..(200.46,26.7698)
+ ..controls (199.66,25.76) and (193.83,24.8999)..(193.83,25.1099)
+ --(193.98,26.48)--(193.4,27.2)--(194.34,28.21)
+ --cycle;
+pickup pencircle scaled 2.23bp;
+draw (198.58,27.7798)..controls (198.58,28.8599) and (198.8,30.0798)..(198.8,30.0798)
+ --(200.67,29.4299);
+drawoptions (withcolor (0,0,0));
+draw (157.47,21.0798)..controls (157.47,20) and (157.76,18.7798)..(157.76,18.7798)
+ --(159.56,19.4199);
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0bp;
+fill (153.37,23.0198)..controls (154.88,24.75) and (155.82,23.5298)..(157.18,22.8799)
+ ..controls (158.62,22.1599) and (160.35,22.5898)..(159.49,21.5798)
+ ..controls (158.7,20.5798) and (152.86,19.71)..(152.86,19.9299)
+ --(153.01,21.2998)--(152.43,22.0198)--(153.37,23.0198)
+ --cycle;
+pickup pencircle scaled 2.23bp;
+draw (157.62,22.5899)..controls (157.62,23.6699) and (157.83,24.8999)..(157.83,24.8999)
+ --(159.7,24.25);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0.86bp;
+draw (114.85,113.6)--(114.85,109.71);
+draw (124.64,113.6)--(124.64,109.28);
+draw (135.01,113.46)--(135.01,109.93);
+draw (144.08,113.46)--(144.08,110.07);
+pickup pencircle scaled 0bp;
+fill (191.38,89.98)--(212.55,83.7898)--(212.55,78.3198)
+ --(219.39,72.1299)--(218.02,67.3799)--(204.34,74.22)
+ --(205.06,80.3398)--(192.1,85.8799)--(191.38,89.98)
+ --cycle;
+fill (275.98,73.5)--(263.02,76.95)--(258.27,71.48)
+ --(250.06,72.8499)--(248.7,67.3799)--(261.01,65.2898)
+ --(267.13,71.48)--(275.98,68.0999)--(275.98,73.5)
+ --cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (69.2698,75.5798)--(75.46,76.95);
+drawoptions (withcolor (0.3,0.3,0.3));
+draw (98.8599,77.6699)--(105.92,76.5198);
+drawoptions (withcolor (0.5,0.5,0.5));
+draw (72.9399,74.1399)--(76.3999,74.6499);
+drawoptions (withcolor (0.4,0.4,0.4));
+draw (101.17,75.4399)--(105.63,74.5);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (15.0598,62.3398)--(16.5698,62.3398)..controls (17.0698,62.3398) and (17.4299,62.7)..(17.4299,63.2)
+ --(17.4299,67.8799)..controls (17.4299,68.3799) and (17.0698,68.74)..(16.5698,68.74)
+ --(15.0598,68.74)..controls (14.5498,68.74) and (14.1899,68.3799)..(14.1899,67.8799)
+ --(14.1899,63.2)..controls (14.1899,62.7) and (14.5498,62.3398)..(15.0598,62.3398)
+ --cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (15.0598,62.3399)--(16.5698,62.3399)..controls (17.0698,62.3399) and (17.4299,62.7)..(17.4299,63.2)
+ --(17.4299,67.8799)..controls (17.4299,68.3799) and (17.0698,68.74)..(16.5698,68.74)
+ --(15.0598,68.74)..controls (14.5498,68.74) and (14.1899,68.3799)..(14.1899,67.8799)
+ --(14.1899,63.2)..controls (14.1899,62.7) and (14.5498,62.3399)..(15.0598,62.3399)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (13.3298,70.1099)--(18.0098,70.1099)..controls (18.5798,70.1099) and (19.0198,69.6799)..(19.0198,69.1799)
+ --(19.0198,67.95)..controls (19.0198,67.45) and (18.5798,67.0198)..(18.0098,67.0198)
+ --(13.3298,67.0198)..controls (12.75,67.0198) and (12.3198,67.45)..(12.3198,67.95)
+ --(12.3198,69.1799)..controls (12.3198,69.6799) and (12.75,70.1099)..(13.3298,70.1099)
+ --cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 1.44bp;
+draw (13.3298,70.1098)--(18.0098,70.1098)..controls (18.5798,70.1098) and (19.0198,69.6799)..(19.0198,69.1799)
+ --(19.0198,67.9499)..controls (19.0198,67.45) and (18.5798,67.0198)..(18.0098,67.0198)
+ --(13.3298,67.0198)..controls (12.75,67.0198) and (12.3198,67.45)..(12.3198,67.9499)
+ --(12.3198,69.1799)..controls (12.3198,69.6799) and (12.75,70.1098)..(13.3298,70.1098)
+ --cycle;
+drawoptions (withcolor (0.9,0.95,1));
+pickup pencircle scaled 0bp;
+fill (62.3599,49.45)--(63.22,49.45)..controls (63.5098,49.45) and (63.73,49.6599)..(63.73,49.95)
+ --(63.73,52.76)..controls (63.73,53.0498) and (63.5098,53.26)..(63.22,53.26)
+ --(62.3599,53.26)..controls (62,53.26) and (61.8599,53.0498)..(61.8599,52.76)
+ --(61.8599,49.95)..controls (61.8599,49.6599) and (62,49.45)..(62.3599,49.45)
+ --cycle;
+drawoptions (withcolor (0,0.2,1));
+pickup pencircle scaled 0.86bp;
+draw (62.3599,49.45)--(63.22,49.45)..controls (63.5098,49.45) and (63.73,49.6599)..(63.73,49.95)
+ --(63.73,52.76)..controls (63.73,53.0498) and (63.5098,53.26)..(63.22,53.26)
+ --(62.3599,53.26)..controls (62,53.26) and (61.8599,53.0498)..(61.8599,52.76)
+ --(61.8599,49.95)..controls (61.8599,49.6599) and (62,49.45)..(62.3599,49.45)
+ --cycle;
+drawoptions (withcolor (0.9,0.95,1));
+pickup pencircle scaled 0bp;
+fill (61.3499,54.0598)--(64.0898,54.0598)..controls (64.3799,54.0598) and (64.6599,53.8398)..(64.6599,53.48)
+ --(64.6599,52.8298)..controls (64.6599,52.47) and (64.3799,52.1799)..(64.0898,52.1799)
+ --(61.3499,52.1799)..controls (60.99,52.1799) and (60.7,52.47)..(60.7,52.8298)
+ --(60.7,53.48)..controls (60.7,53.8398) and (60.99,54.0598)..(61.3499,54.0598)
+ --cycle;
+drawoptions (withcolor (0,0.2,1));
+pickup pencircle scaled 1.44bp;
+draw (61.3499,54.0598)--(64.0899,54.0598)..controls (64.3799,54.0598) and (64.6599,53.8398)..(64.6599,53.48)
+ --(64.6599,52.8298)..controls (64.6599,52.47) and (64.3799,52.1799)..(64.0899,52.1799)
+ --(61.3499,52.1799)..controls (60.99,52.1799) and (60.7,52.47)..(60.7,52.8298)
+ --(60.7,53.48)..controls (60.7,53.8398) and (60.99,54.0598)..(61.3499,54.0598)
+ --cycle;
+drawoptions (withcolor (0.9,0.95,1));
+pickup pencircle scaled 0bp;
+fill (118.74,51.46)--(119.6,51.46)..controls (119.89,51.46) and (120.1,51.6099)..(120.1,51.97)
+ --(120.1,54.7)..controls (120.1,54.99) and (119.89,55.21)..(119.6,55.21)
+ --(118.74,55.21)..controls (118.38,55.21) and (118.23,54.99)..(118.23,54.7)
+ --(118.23,51.97)..controls (118.23,51.6099) and (118.38,51.46)..(118.74,51.46)
+ --cycle;
+drawoptions (withcolor (0,0.2,1));
+pickup pencircle scaled 0.86bp;
+draw (118.74,51.46)--(119.6,51.46)..controls (119.89,51.46) and (120.1,51.6098)..(120.1,51.97)
+ --(120.1,54.7)..controls (120.1,54.99) and (119.89,55.21)..(119.6,55.21)
+ --(118.74,55.21)..controls (118.38,55.21) and (118.23,54.99)..(118.23,54.7)
+ --(118.23,51.97)..controls (118.23,51.6098) and (118.38,51.46)..(118.74,51.46)
+ --cycle;
+drawoptions (withcolor (0.9,0.95,1));
+pickup pencircle scaled 0bp;
+fill (117.73,56)--(120.46,56)..controls (120.75,56) and (120.97,55.7798)..(120.97,55.4199)
+ --(120.97,54.7798)..controls (120.97,54.49) and (120.75,54.2)..(120.46,54.2)
+ --(117.73,54.2)..controls (117.37,54.2) and (117.08,54.49)..(117.08,54.7798)
+ --(117.08,55.4199)..controls (117.08,55.7798) and (117.37,56)..(117.73,56)
+ --cycle;
+drawoptions (withcolor (0,0.2,1));
+pickup pencircle scaled 1.44bp;
+draw (117.73,56)--(120.46,56)..controls (120.75,56) and (120.97,55.7798)..(120.97,55.4199)
+ --(120.97,54.7798)..controls (120.97,54.49) and (120.75,54.2)..(120.46,54.2)
+ --(117.73,54.2)..controls (117.37,54.2) and (117.08,54.49)..(117.08,54.7798)
+ --(117.08,55.4199)..controls (117.08,55.7798) and (117.37,56)..(117.73,56)
+ --cycle;
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (51.7,90.3398)--(52.7798,90.3398)..controls (53.1399,90.3398) and (53.3599,90.6299)..(53.3599,90.99)
+ --(53.3599,94.2998)..controls (53.3599,94.6599) and (53.1399,94.8799)..(52.7798,94.8799)
+ --(51.7,94.8799)..controls (51.3398,94.8799) and (51.1299,94.6599)..(51.1299,94.2998)
+ --(51.1299,90.99)..controls (51.1299,90.6299) and (51.3398,90.3398)..(51.7,90.3398)
+ --cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (51.7,90.3399)--(52.7798,90.3399)..controls (53.1399,90.3399) and (53.3599,90.6299)..(53.3599,90.99)
+ --(53.3599,94.2998)..controls (53.3599,94.6599) and (53.1399,94.8799)..(52.7798,94.8799)
+ --(51.7,94.8799)..controls (51.3398,94.8799) and (51.1299,94.6599)..(51.1299,94.2998)
+ --(51.1299,90.99)..controls (51.1299,90.6299) and (51.3398,90.3399)..(51.7,90.3399)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (50.48,95.8899)--(53.7898,95.8899)..controls (54.22,95.8899) and (54.5098,95.5999)..(54.5098,95.24)
+ --(54.5098,94.3799)..controls (54.5098,93.9399) and (54.22,93.6599)..(53.7898,93.6599)
+ --(50.48,93.6599)..controls (50.1199,93.6599) and (49.8298,93.9399)..(49.8298,94.3799)
+ --(49.8298,95.24)..controls (49.8298,95.5999) and (50.1199,95.8899)..(50.48,95.8899)
+ --cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 1.44bp;
+draw (50.48,95.8899)--(53.7898,95.8899)..controls (54.22,95.8899) and (54.5098,95.5998)..(54.5098,95.24)
+ --(54.5098,94.3799)..controls (54.5098,93.9399) and (54.22,93.6599)..(53.7898,93.6599)
+ --(50.48,93.6599)..controls (50.1199,93.6599) and (49.8298,93.9399)..(49.8298,94.3799)
+ --(49.8298,95.24)..controls (49.8298,95.5998) and (50.1199,95.8899)..(50.48,95.8899)
+ --cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+draw (53,92.6499)..controls (53,88.8298) and (55.2998,80.4099)..(57.5398,76.8799)
+ ..controls (59.7698,73.3498) and (63.5798,67.8799)..(63.5798,67.8799);
+pickup pencircle scaled 2.02bp;
+draw (63.1499,52.26)..controls (63.1499,52.26) and (57.0298,49.5198)..(41.98,52.98)
+ ..controls (26.9399,56.3599) and (16.8599,66.01)..(15.8498,66.2998);
+drawoptions (withcolor (0.9,0,0));
+pickup pencircle scaled 0bp;
+fill (87.7,123.46)--(94.5398,123.46)--(94.5398,113.89)
+ --(87.7,113.89)--(87.7,123.46)--cycle;
+endfig;
+end
+
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-00.pdf b/doc/context/sources/general/manuals/start/graphics/ma-cb-00.pdf
new file mode 100644
index 000000000..118276b5d
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-00.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-01.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-01.png
new file mode 100644
index 000000000..be41b9e22
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-01.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-03.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-03.png
new file mode 100644
index 000000000..2a0b2de58
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-03.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-04.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-04.png
new file mode 100644
index 000000000..5487062fd
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-04.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-07.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-07.png
new file mode 100644
index 000000000..e69c2877f
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-07.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-08.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-08.png
new file mode 100644
index 000000000..e49426e89
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-08.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-12.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-12.png
new file mode 100644
index 000000000..f27252027
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-12.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-13.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-13.png
new file mode 100644
index 000000000..9e8d72e6c
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-13.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-15.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-15.png
new file mode 100644
index 000000000..8c7ed6ae7
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-15.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-16.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-16.png
new file mode 100644
index 000000000..e22eab8dc
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-16.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-18.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-18.png
new file mode 100644
index 000000000..25a529b33
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-18.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-19.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-19.png
new file mode 100644
index 000000000..d1af184c4
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-19.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-20.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-20.png
new file mode 100644
index 000000000..289738886
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-20.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-21.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-21.png
new file mode 100644
index 000000000..af876a546
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-21.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-22.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-22.png
new file mode 100644
index 000000000..55ded4c35
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-22.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-23.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-23.png
new file mode 100644
index 000000000..9a1bf14e8
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-23.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-24.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-24.png
new file mode 100644
index 000000000..47b4409e0
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-24.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-25.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-25.png
new file mode 100644
index 000000000..079b8556a
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-25.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/ma-cb-26.png b/doc/context/sources/general/manuals/start/graphics/ma-cb-26.png
new file mode 100644
index 000000000..f4294dc57
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/ma-cb-26.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/minibook-en.pdf b/doc/context/sources/general/manuals/start/graphics/minibook-en.pdf
new file mode 100644
index 000000000..a75e7e491
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/minibook-en.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/start/graphics/minibook-en.tex b/doc/context/sources/general/manuals/start/graphics/minibook-en.tex
new file mode 100644
index 000000000..1bde2de3c
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/graphics/minibook-en.tex
@@ -0,0 +1,20 @@
+\setuppapersize[A10][A10]
+\setuplayout[cutspace=2mm,backspace=6mm,width=15mm]
+\setupbodyfont[6pt]
+\setuppagenumbering[state=stop]
+\setupbackgrounds[text][text][background=color,backgroundcolor=orange]
+\setupbackgrounds[header,text,footer][leftmargin][background=color,backgroundcolor=lightgreen]
+\setupbackgrounds[header,text,footer][leftmargin,text,rightmargin][frame=on]
+\setupfootertexts[margin][\midaligned{l}][\midaligned{r}][\midaligned{r}][\midaligned{l}]
+\starttext
+\midaligned{design page} \page
+\setuppagenumbering[alternative={singlesided}]
+\inmargin{\midaligned{m}}\midaligned{left page} \page
+\inmargin{\midaligned{m}}\midaligned{right page} \page
+\setuppagenumbering[alternative={singlesided,doublesided}]
+\inmargin{\midaligned{m}}\midaligned{left page} \page
+\inmargin{\midaligned{m}}\midaligned{right page} \page
+\setuppagenumbering[alternative={doublesided}]
+\inmargin{\midaligned{m}}\midaligned{left page} \page
+\inmargin{\midaligned{m}}\midaligned{right page}
+\stoptext
diff --git a/doc/context/sources/general/manuals/start/ma-cb-abbreviations.tex b/doc/context/sources/general/manuals/start/ma-cb-abbreviations.tex
new file mode 100644
index 000000000..1f5f10744
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/ma-cb-abbreviations.tex
@@ -0,0 +1,7 @@
+\startenvironment ma-cb-abbreviations
+
+% a weird one: (\keycap) ... volledige lijst maken ... symbol
+
+\logo [Enter] {\type{Enter}}
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/start/ma-cb-colofon.tex b/doc/context/sources/general/manuals/start/ma-cb-colofon.tex
new file mode 100644
index 000000000..feb77726a
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/ma-cb-colofon.tex
@@ -0,0 +1,95 @@
+\startcomponent ma-cb-colophon
+
+\unprotect
+
+\startmakeup[\v!standard]
+
+ % This reference is needed for the interactive version.
+
+ \pagereference[colofon]
+
+ % We align the text in the middle.
+
+ \setupalign
+ [\v!middle]
+
+ % We use the default \framed macro but add a background. For most
+ % texts an offset of 20pt is adequate.
+
+ \defineframed
+ [colofon]
+ [\c!frame=\v!off,
+ \c!background=basic-shape-dark,
+ \c!rulethickness=10pt,
+ \c!align=\v!middle,
+ \c!offset=15pt]
+
+ \bfa \setupinterlinespace
+
+ \doifsomething {\documentvariable{author}} {
+
+ \dontleavehmode \startframed[colofon]
+ \labeltext{document:author}:\space
+ \documentvariable{author}
+ \stopframed
+
+ \vfill
+
+ }
+
+ \doifsomething {\documentvariable{translator}} {
+
+ \dontleavehmode \startframed[colofon]
+ \labeltext{document:translations}:\space
+ \documentvariable{translator}
+ \stopframed
+
+ \vfill
+
+ }
+
+ \doifsomething {\documentvariable{contributer}} {
+
+ \dontleavehmode \startframed[colofon]
+ \labeltext{document:contributions}:\space
+ \documentvariable{contributer}
+ \stopframed
+
+ \vfill
+
+ }
+
+ \dontleavehmode \startframed[colofon]
+ \labeltext{document:design}:\space
+ Hans Hagen
+ \stopframed
+
+ \vfill
+
+ \dontleavehmode \startframed[colofon]
+ \labeltext{document:illustrations}:\space
+ Johan Jonker
+ \stopframed
+
+ \vfill
+
+ \dontleavehmode \startframed[colofon][offset=25pt]
+ PRAGMA ADE\\
+ Ridderstraat 27\\
+ 8061GH Hasselt NL\\
+ www.pragma-ade.com
+ \stopframed
+
+ \vfill
+
+ \dontleavehmode \startframed[colofon]
+ \currentdate
+ \stopframed
+
+ \vfill
+
+\stopmakeup
+
+\protect
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/ma-cb-copyright.tex b/doc/context/sources/general/manuals/start/ma-cb-copyright.tex
new file mode 100644
index 000000000..abb344eef
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/ma-cb-copyright.tex
@@ -0,0 +1,41 @@
+\startcomponent ma-cb-copyright
+
+% The copyright page. English it is and english it will be.
+
+\unprotect
+
+\page
+ [\v!right]
+
+\startmakeup[\v!standard]
+
+ \switchtobodyfont
+ [\v!small]
+
+ \setupframed
+ [\c!frame=\v!off,
+ \c!width=.8\textwidth,
+ \c!align=\v!normal,
+ \c!background=basic-shape-dark,
+ \c!rulethickness=10pt,
+ \c!offset=30pt]
+
+ \vfill
+
+ \hfill \startframed
+ This document is produced with \CONTEXT\ \MKIV\ and \LUATEX. The source is edited
+ with \SCITE\ and previewed with \SUMATRAPDF.
+ \stopframed
+
+ \blank[3*\v!big]
+
+ \hfill \startframed
+ \copyright\ 1991\endash\currentdate[\v!year]\ PRAGMA ADE, Ridderstraat 27, 8061GH
+ Hasselt, The Netherlands, www.pragma-ade.com
+ \stopframed
+
+\stopmakeup
+
+\protect
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/start/ma-cb-graphics.tex b/doc/context/sources/general/manuals/start/ma-cb-graphics.tex
new file mode 100644
index 000000000..bb85c0031
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/ma-cb-graphics.tex
@@ -0,0 +1,266 @@
+\startenvironment ma-cb-graphics
+
+% These graphics were made when I had little experience in MetaPost so
+% they are not that efficient or nicely codes. Sorry about that.
+
+\definecolor[ShapeDarkLine] [s=.4]
+\definecolor[ShapeDarkDots] [r=1]
+\definecolor[ShapeDarkEnd] [g=1]
+\definecolor[ShapeLightLine] [s=.95]
+\definecolor[ShapeLightDots] [r=.9,g=,5,b=.5]
+\definecolor[ShapeLightFill] [s=.95]
+\definecolor[ShapeLightFrame][r=.5,g=.50,b=.9]
+
+\startuseMPgraphic{basic-shape-dark}
+ color shapedotscolor ; shapedotscolor := \MPcolor{ShapeDarkDots} ;
+ color shapelinecolor ; shapelinecolor := \MPcolor{ShapeDarkLine} ;
+ \includeMPgraphic{basic-shape}
+\stopuseMPgraphic
+
+\startuseMPgraphic{basic-shape-light}
+ color shapedotscolor ; shapedotscolor := \MPcolor{ShapeLightDots} ;
+ color shapelinecolor ; shapelinecolor := \MPcolor{ShapeLightLine} ;
+ \includeMPgraphic{basic-shape}
+\stopuseMPgraphic
+
+\startuseMPgraphic{basic-shape}
+ w := OverlayWidth ; width := 100 ; wfactor := w/width ;
+ h := OverlayHeight ; height := 100 ; hfactor := h/height ;
+ d := OverlayOffset ;
+ %
+ def random_delta (expr d) =
+ d - (uniformdeviate 2d)
+ enddef;
+ %
+ z1 = (0,height) ;
+ z2 = (0,0) ;
+ z3 = (width,0) ;
+ z4 = (width,height) ;
+ %
+ z5 = ( width+random_delta(.2width),height+random_delta(.2height)) ;
+ z6 = (.5width+random_delta(.1width),height+random_delta(.1height)) ;
+ %
+ pickup pencircle
+ xscaled (OverlayLineWidth/ wfactor)
+ yscaled (OverlayLineWidth/(2*hfactor))
+ rotated 30 ;
+ %
+ draw z5 .. z1 .. z2 .. z3 .. z4 .. z6 withcolor shapelinecolor ;
+ %
+ pickup pencircle
+ xscaled (OverlayLineWidth/wfactor)
+ yscaled (OverlayLineWidth/hfactor) ;
+ %
+ draw z1 withcolor shapedotscolor ;
+ draw z2 withcolor shapedotscolor ;
+ draw z3 withcolor shapedotscolor ;
+ draw z4 withcolor shapedotscolor ;
+ draw z5 withcolor shapedotscolor ;
+ draw z6 withcolor shapedotscolor ;
+ %
+ currentpicture := currentpicture xysized (w,h) ;
+\stopuseMPgraphic
+
+\startuniqueMPpagegraphic{chapter-state}
+ color shapelinecolor ; shapelinecolor := \MPcolor{ShapeDarkLine} ;
+ %
+ delta := OverlayOffset ;
+ width := OverlayWidth - 2*delta ;
+ height := (OverlayHeight - 2*delta) / 3 ;
+ %
+ z1 = (0,3height) ;
+ z2 = (0,2height) ;
+ z3 = (if not odd RealPageNumber : - fi width,1.5height) ;
+ z4 = (0,height) ;
+ z5 = (0,0) ;
+ %
+ pickup pencircle
+ xscaled delta
+ yscaled .5delta
+ rotated 30 ;
+ %
+ draw z1 -- z2{up} .. z3 .. {up} z4 -- z5 withcolor shapelinecolor ;
+ %
+ pickup pencircle
+ scaled delta ;
+ %
+ draw z1 withcolor red ;
+ draw z2 withcolor red ;
+ draw z3 withcolor red ;
+ draw z4 withcolor red ;
+ draw z5 withcolor red ;
+ %
+\stopuniqueMPpagegraphic
+
+\startreusableMPgraphic{pagenumber-state}
+ color shapelinecolor ; shapelinecolor := \MPcolor{ShapeDarkLine} ;
+ %
+ delta := OverlayOffset ;
+ width := OverlayWidth - 2delta ;
+ height := OverlayHeight - 2delta ;
+ lines := 5*OverlayOffset ;
+ %
+ z1 = (0,0) ;
+ z2 = (lines,0) ;
+ z3 = (.5width,height) ;
+ z4 = (width-lines,0) ;
+ z5 = (width,0) ;
+ %
+ pickup pencircle
+ xscaled delta
+ yscaled .5delta
+ rotated 30;
+ %
+ draw z1 -- z2 {dir 135} ... z3 ... {dir -135} z4 -- z5 withcolor shapelinecolor ;
+ %
+ pickup pencircle
+ scaled delta ;
+ %
+ draw z1 withcolor red ;
+ draw z2 withcolor red ;
+ draw z3 withcolor red ;
+ draw z4 withcolor red ;
+ draw z5 withcolor red ;
+ %
+\stopreusableMPgraphic
+
+\startreusableMPgraphic{manualsymbol}
+ logo_type := 401 ;
+ input "mp-prag" ;
+ currentpicture := currentpicture scaled 0.25 ;
+\stopreusableMPgraphic
+
+\startuseMPgraphic{frame-shape}
+ delta := OverlayOffset ;
+ width := OverlayWidth - 2delta ;
+ height := OverlayHeight - 2delta ;
+ %
+ vardef gamma =
+ g := OverlayOffset ; ((g/3) + (uniformdeviate (2g/3)))
+ enddef;
+ %
+ z1 = (0,0) ;
+ z2 = (width,0) ;
+ z3 = (width,height) ;
+ z4 = (0,height) ;
+ %
+ x12= .5[x1,x2] ; y12=y1 + gamma ;
+ y23= .5[y2,y3] ; x23=x2 - gamma ;
+ x34= .5[x3,x4] ; y34=y3 - gamma ;
+ y41= .5[y4,y1] ; x41=x4 + gamma ;
+ %
+ pickup pencircle
+ xscaled OverlayLineWidth
+ yscaled .5OverlayLineWidth
+ rotated 30;
+ %
+ path p;
+ p :=
+ z1..z12..z2 &
+ z2..z23..z3 &
+ z3..z34..z4 &
+ z4..z41..z1 &
+ cycle ;
+ %
+ fill p withcolor shapefillcolor ;
+ draw p withcolor shapelinecolor ;
+\stopuseMPgraphic
+
+\startuseMPgraphic{setup-shape}
+ color shapelinecolor ; shapelinecolor := \MPcolor{ShapeLightFrame} ;
+ color shapefillcolor ; shapefillcolor := \MPcolor{ShapeLightFill} ;
+ \includeMPgraphic{frame-shape}
+\stopuseMPgraphic
+
+% \startuseMPgraphic{setup-shape-x}
+% color shapelinecolor ; shapelinecolor := \MPcolor{ShapeLightFrame} ;
+% color shapelinecolor ; shapelinecolor := \MPcolor{ShapeLightFill} ;
+% \includeMPgraphic{frame-shape}
+% \stopuseMPgraphic
+
+\startuniqueMPgraphic{note-rule}
+ color shapelinecolor ; shapelinecolor := \MPcolor{ShapeDarkLine} ;
+ color shapeendcolor ; shapeendcolor := \MPcolor{ShapeDarkEnd} ;
+ %
+ draw bottomboundary OverlayBox withcolor shapelinecolor withpen pencircle scaled OverlayLineWidth ;
+ draw llcorner OverlayBox withcolor shapeendcolor withpen pencircle scaled 3OverlayLineWidth ;
+ draw lrcorner OverlayBox withcolor shapeendcolor withpen pencircle scaled 3OverlayLineWidth ;
+ %
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{column-rule}
+ color shapelinecolor ; shapelinecolor := \MPcolor{ShapeDarkLine} ;
+ color shapeendcolor ; shapeendcolor := \MPcolor{ShapeDarkEnd} ;
+ %
+ draw leftboundary OverlayBox withcolor shapelinecolor withpen pencircle scaled OverlayLineWidth ;
+ draw ulcorner OverlayBox withcolor shapeendcolor withpen pencircle scaled 3OverlayLineWidth ;
+ draw llcorner OverlayBox withcolor shapeendcolor withpen pencircle scaled 3OverlayLineWidth ;
+ %
+\stopuniqueMPgraphic
+
+% alternative implemenation
+%
+% \startuniqueMPgraphic{column-rule}{height,linewidth}
+% color shapelinecolor ; shapelinecolor := \MPcolor{ShapeDarkLine} ;
+% color shapeendcolor ; shapeendcolor := \MPcolor{ShapeDarkEnd} ;
+% numeric shapelinewidth ; shapelinewidth := \MPvar{linewidth} ;
+% pair shapeboundary ; shapeboundary := (0,\MPvar{height}) ;
+% %
+% draw origin -- shapeboundary withcolor shapelinecolor withpen pencircle scaled shapelinewidth ;
+% draw origin withcolor shapeendcolor withpen pencircle scaled 3shapelinewidth ;
+% draw shapeboundary withcolor shapeendcolor withpen pencircle scaled 3shapelinewidth ;
+% %
+% \stopuniqueMPgraphic
+
+% todo
+
+% \startreusableMPgraphic{clip:six}
+% %
+% delta := OverlayOffset ;
+% height := OverlayWidth - delta ;
+% %
+% color green; green := (.1,.8,.1) ;
+% %
+% z1 = (0,0) ;
+% z2 = (0,height) ;
+% %
+% pickup pencircle
+% scaled OverlayLineWidth ;
+% %
+% draw z1 -- z2 withcolor .5white ;
+% %
+% pickup pencircle
+% scaled 3OverlayLineWidth ;
+% %
+% draw z1 withcolor green ;
+% draw z2 withcolor green ;
+% %
+% \stopreusableMPgraphic
+
+% \startreusableMPgraphic{clip:seven}
+% %
+% width := OverlayWidth ;
+% height := OverlayHeight ;
+% delta := OverlayOffset ;
+% %
+% color green ; green := (.1,.8,.1) ;
+% %
+% x1 = x4 = 0 ; x2 = x3 = width ;
+% y1 = y2 = 0 ; y3 = y4 = height ;
+% %
+% pickup pencircle
+% scaled OverlayLineWidth ;
+% %
+% draw z1 -- z2 -- z3 -- z4 -- cycle withcolor .white ;
+% %
+% pickup pencircle
+% scaled 3OverlayLineWidth ;
+% %
+% draw z1 withcolor green ;
+% draw z2 withcolor green ;
+% draw z3 withcolor green ;
+% draw z4 withcolor green ;
+% %
+% \stopreusableMPgraphic
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/start/ma-cb-links.tex b/doc/context/sources/general/manuals/start/ma-cb-links.tex
new file mode 100644
index 000000000..d2e03944d
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/ma-cb-links.tex
@@ -0,0 +1,268 @@
+\startenvironment ma-cb-links
+
+% Links to external document for referencing.
+
+% --- www
+
+\useURL
+ [www:pragma]
+ [http://www.pragma-ade.com]
+ []
+ [Pragma ADE]
+
+\useURL
+ [www:garden]
+ [http://wiki.contextgarden.net]
+ []
+ [ConTeXt garden]
+
+\useURL
+ [www:showweb]
+ [http://texshow.contextgarden.net]
+ []
+ [Show-web]
+
+\useURL
+ [www:wiki-modules]
+ [http://wiki.contextgarden.net/Modules]
+ []
+ [Wiki Modules]
+
+\useURL
+ [www:supelec]
+ [https://foundry.supelec.fr]
+ []
+ [Supelec]
+
+\useURL
+ [www:dir]
+ [http://www.pragma-ade.com/dir/general]
+ []
+ [http://www.pragma-ade.com/dir/general]
+
+\useURL
+ [www:cstug]
+ [http://www.cstug.cz]
+ []
+ [\CSTUG]
+
+\useURL
+ [modul:storm]
+ [http://modules.contextgarden.net/stormfontsupport]
+ []
+ [http://modules.contextgarden.net/stormfontsupport]
+
+\useURL
+ [modul:storm-catalog]
+ [http://dl.contextgarden.net/modules/stormfontsupport/cont-storm-catalog.pdf]
+ []
+ [cont-storm-catalog.pdf]
+
+% --- usergroups
+
+\useURL
+ [list:context]
+ [http://www.ntg.nl/mailman/listinfo/ntg-context]
+ []
+ []
+
+\useURL
+ [group:tug]
+ [https://tug.org]
+ []
+ []
+
+\useURL
+ [group:ntg]
+ [www.ntg.nl]
+ []
+ []
+
+\useURL
+ [group:context]
+ [www.????]
+ []
+ []
+
+\useURL
+ [install]
+ [http://wiki.contextgarden.net/ConTeXt_Standalone]
+ []
+ []
+
+
+% --- manuals
+
+\useURL
+ [manual:general]
+ [http://www.pragma-ade.com/general/manuals/cont-eni.pdf]
+ []
+ [cont-eni.pdf]
+
+\useURL
+ [manual:metafun]
+ [http://www.pragma-ade.com/general/manuals/metafun-s.pdf]
+ []
+ [metafun-s.pdf]
+
+\useURL
+ [manual:columns]
+ [http://www.pragma-ade.com/general/manuals/columns.pdf]
+ []
+ [columns.pdf]
+
+\useURL
+ [manual:nattab]
+ [http://www.pragma-ade.com/general/manuals/enattab.pdf]
+ []
+ [enattab.pdf]
+
+\useURL
+ [manual:extab]
+ [http://www.pragma-ade.com/general/manuals/xtables-mkiv.pdf]
+ []
+ [xtables-mkiv.pdf]
+
+\useURL
+ [manual:details]
+ [http://www.pragma-ade.com/general/manuals/details.pdf]
+ []
+ [details.pdf]
+
+\useURL
+ [manual:fonts]
+ [http://www.pragma-ade.com/general/manuals/mfonts.pdf]
+ []
+ [mfonts.pdf]
+
+\useURL
+ [manual:charts]
+ [http://www.pragma-ade.com/general/manuals/mcharts.pdf]
+ []
+ [mcharts.pdf]
+
+\useURL
+ [manual:context]
+ [http://www.pragma-ade.com/general/manuals/cont-enp.pdf]
+ []
+ [cont-enp.pdf]
+
+\useURL
+ [manual:chemic]
+ [http://www.pragma-ade.com/general/manuals/mp-ch-en.pdf]
+ []
+ [mp-ch-en.pdf]
+
+\useURL
+ [manual:chemic-ex]
+ [http://www.pragma-ade.com/general/manuals/eppchtex.pdf]
+ []
+ [eppchtex.pdf]
+
+\useURL
+ [manual:labels]
+ [http://www.pragma-ade.com/general/manuals/mlabels.pdf]
+ []
+ [mlabels.pdf]
+
+\useURL
+ [manual:widgets]
+ [http://www.pragma-ade.com/general/manuals/mwidget.pdf]
+ []
+ [mwidget.pdf]
+
+\useURL
+ [manual:style]
+ [http://www.pragma-ade.com/general/manuals/style.pdf]
+ []
+ [style.pdf]
+
+\useURL
+ [manual:xml]
+ [http://www.pragma-ade.com/general/manuals/xml-mkiv.pdf]
+ []
+ [xml-mkiv.pdf]
+
+\useURL
+ [manual:units]
+ [http://www.pragma-ade.com/general/manuals/units-mkiv.pdf]
+ []
+ [units-mkiv.pdf]
+
+\useURL
+ [manual:scite]
+ [http://www.pragma-ade.com/general/manuals/scite-context-readme.pdf]
+ []
+ [scite-context-readme.pdf]
+
+\useURL
+ [manual:qr-en]
+ [http://www.pragma-ade.com/general/qrcs/setup-en.pdf]
+ []
+ [setup-en.pdf]
+
+\useURL
+ [manual:qr-nl]
+ [http://www.pragma-ade.com/general/qrcs/setup-nl.pdf]
+ []
+ [setup-nl.pdf]
+
+\useURL
+ [manual:tools]
+ [http://www.pragma-ade.com/general/manuals/tools-mkiv.pdf]
+ []
+ [tools-mkiv.pdf]
+
+\useURL
+ [manual:figures]
+ [http://www.pragma-ade.com/general/manuals/xfigures-p.pdf]
+ []
+ [xfigures-p.pdf]
+
+\useURL
+ [manual:color]
+ [http://www.pragma-ade.nl/general/manuals/msplit.pdf]
+ []
+ [msplit.pdf]
+
+% --- magazins
+
+\useURL
+ [thisway:shapes]
+ [http://www.pragma-ade.com/general/myway/mag-0010.pdf]
+ []
+ [mag-0010.pdf]
+
+\useURL
+ [thisway:crossrefs]
+ [http://www.pragma-ade.com/general/magazines/mag-1103.pdf]
+ []
+ [mag-1103.pdf]
+
+\useURL
+ [thisway:proj-struc]
+ [http://www.pragma-ade.com/general/magazines/mag-1101.pdf]
+ []
+ [mag-1103.pdf]
+
+\useURL
+ [myway:nattab]
+ [http://www.pragma-ade.com/general/myway/NaturalTables.pdf]
+ []
+ [NaturalTables.pdf]
+
+\useURL
+ [myway:startalign]
+ [http://www.pragma-ade.com/general/myway/mathalign.pdf]
+ []
+ [mathalign.pdf]
+
+% AFO 2013: needed for example in manual
+
+\useURL
+ [loc:cityplan]
+ [http://www.stadindex.nl/plattegrond/hasselt]
+ []
+ []
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/start/ma-cb-screen.tex b/doc/context/sources/general/manuals/start/ma-cb-screen.tex
new file mode 100644
index 000000000..c3af1f783
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/ma-cb-screen.tex
@@ -0,0 +1,201 @@
+\startenvironment ma-cb-screen
+
+% This setups adds some functionality as well as redefines
+% some of the previously defined layout.
+
+\unprotect
+
+\definepapersize
+ [LocalPaperFormat]
+ [\c!width=28cm,
+ \c!height=21cm]
+
+\setuppapersize
+ [LocalPaperFormat]
+ [LocalPaperFormat]
+
+\setuplayout
+ [\c!location=\v!middle,
+ \c!topspace=.5cm,
+ \c!header=1.5cm,
+ \c!height=20cm,
+ \c!rightedge=5cm,
+ \c!rightedgedistance=1cm]
+
+\setupinteractionscreen
+ [\c!width=28cm,
+ \c!height=21cm,
+ \c!option=\v!max]
+
+% We place the pagenumber (not that useful in an interactive
+% document) somewhere else and the chapter number in the
+% footer.
+
+\setuppagenumbering
+ [\c!alternative=\v!singlesided,
+ \c!location=,
+ \c!command=\NummerCommando]
+
+\unexpanded\def\NummerCommando#1% uitlijnen op onderkant voet
+ {\hbox to \rightedgewidth
+ {\scratchcounter=\lastpage
+ \advance\scratchcounter by -\realpageno
+ \hskip0pt plus \realpageno cm
+ \framed
+ [\c!background=NummerAchtergrond,
+ \c!frame=\v!off,
+ \c!offset=4pt]%
+ {\lower.5\dp\strutbox\hbox spread 60pt{\hss\tx#1\hss}}% {\hss#1\hss}}%
+ \hskip0pt plus \scratchcounter cm}}
+
+\setupfootertexts
+ [\v!edge]
+ [][\v!pagenumber]
+
+\unexpanded\def\PlaatsHoofdstukStatus
+ {\determineheadnumber[\v!chapter]%
+ \ifnum\currentheadnumber>0
+ \hbox to \hsize
+ {\hss
+ \framed
+ [\c!background=NummerAchtergrond,
+ \c!frame=\v!off,
+ \c!offset=6pt]
+ {\lower.5\dp\strutbox\hbox spread 60pt
+ {\hss\getmarking[\v!chapter\v!number]\hss}}%
+ \hss}
+ \fi}
+
+\setupfootertexts
+ [\v!margin]
+ [][]
+
+\setupfootertexts
+ [\v!text]
+ [][\PlaatsHoofdstukStatus]
+
+\setupinteraction
+ [\c!state=\v!start,
+ \c!color=,
+ \c!menu=\v!on]
+
+% We let users click on the whole table of contents line and
+% provide some menus.
+
+\setuplist
+ [\v!chapter]
+ [\c!interaction=\v!all]
+
+\setupinteractionmenu
+ [\v!right]
+ [\c!state=\v!start,
+ \c!color=,
+ \c!offset=4pt,
+ \c!background=MenuAchtergrond,
+ \c!frame=\v!off]
+
+\startmode[**nl]
+
+ \setupinteractionmenu
+ [\v!right]
+ [ {inhoud[contents]},
+ {index[subind]},
+ {commando's[comind]},
+ {definities[comdefs]},
+ {colofon[colofon]},
+ {\vfill},
+ {stoppen[\v!CloseDocument]},
+ {\ZoekEnZoek{zoeken}},
+ {terug[\v!PreviousJump]},
+ {\HeenEnWeer}]
+
+\stopmode
+
+\startmode[**en,**uk]
+
+ \setupinteractionmenu
+ [\v!right]
+ [ {contents[contents]},
+ {index[subind]},
+ {commands[comind]},
+ {definitions[comdefs]},
+ {colofon[colofon]},
+ {\vfill},
+ {exit[\v!CloseDocument]},
+ {\ZoekEnZoek{search}},
+ {go back[\v!PreviousJump]},
+ {\HeenEnWeer}]
+
+\stopmode
+
+\startmode[**cz]
+
+ \setupinteractionmenu
+ [\v!right]
+ [ {obsah[contents]},
+ {rejst\rcaron\iacute k[subind]},
+ {seznam p\rcaron\iacute kaz\uring[comind]},
+ {definice p\rcaron\iacute kaz\uring[comdefs]},
+ {tir\aacute\zcaron[colofon]},
+ {\vfill},
+ {konec[\v!CloseDocument]},
+ {\ZoekEnZoek{vyhledej}},
+ {krok zp\ecaron t[\v!PreviousJump]},
+ {\HeenEnWeer}]
+
+\stopmode
+
+\startmode[**fr]
+
+ \setupinteractionmenu
+ [\v!right]
+ [ {table des mati\egrave res[contents]},
+ {index[subind]},
+ {commandes[comind]},
+ {d\eacute finitions[comdefs]},
+ {colophon[colofon]},
+ {\vfill},
+ {quitter[\v!CloseDocument]},
+ {\ZoekEnZoek{recherche}},
+ {retour[\v!PreviousJump]},
+ {\HeenEnWeer}]
+
+\stopmode
+
+\startmode[**vn]
+
+ \setupinteractionmenu
+ [\v!right]
+ [ {mục lục[contents]},
+ {bảng tra[subind]},
+ {lệnh[comind]},
+ {định nghĩa[comdefs]},
+ {trang cuối[colofon]},
+ {\vfill},
+ {thoát[\v!CloseDocument]},
+ {\ZoekEnZoek{tìm kiếm}},
+ {quay lại[\v!PreviousJump]},
+ {\HeenEnWeer}]
+
+\stopmode
+
+% This not that \TEX nical definition deals with the two sets
+% of buttons. Someday I'll make a general macro for this.
+
+\def\TwoMenuButtons#1[#2]#3[#4]%
+ {\hbox to \hsize
+ {\dimen0=\hsize
+ \advance\hsize by -12pt
+ \menubutton[\v!right][\c!width=.5\hsize]{#1}[#2]%
+ \hss
+ \menubutton[\v!right][\c!width=.5\hsize]{#3}[#4]}}
+
+\def\HeenEnWeer
+ {\TwoMenuButtons{--}[\v!previouspage]{+}[\v!nextpage]}
+
+\def\ZoekEnZoek#1%
+ {\TwoMenuButtons{#1}[\v!SearchDocument]{+}[\v!SearchAgain]}
+
+\protect
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/start/ma-cb-style.tex b/doc/context/sources/general/manuals/start/ma-cb-style.tex
new file mode 100644
index 000000000..294e4a5cc
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/ma-cb-style.tex
@@ -0,0 +1,678 @@
+% macros=mkvi
+
+\startenvironment ma-cb-style
+
+\usemodule[chart]
+
+\usemodule[s][abr-03]
+\usemodule[x][set-11]
+
+\unprotect
+
+% Setups are kind of special.
+
+\loadsetups[cont-\currentmainlanguage.xml]
+
+\setupsetup
+ [\c!criterium=\v!used]
+
+\setupframedtexts
+ [setuptext]
+ [\c!before={\blank[\v!big]},
+ \c!after={\blank[\v!big]},
+ \c!background=setup-shape,
+ \c!backgroundoffset=10pt,
+ \c!rulethickness=5pt,
+ \c!offset=15pt,
+ \c!frame=\v!off]
+
+\setupexternalfigures
+ [\c!directory={../graphics}]
+
+% The layout dimensions are based on the A4 paper dimensions because that way users
+% can print this manual themselves. Let's be economical with paper. We also assume a
+% decent doublesided A4 printer. We use equal margins so that a single sided run or
+% print also comes out all right.
+
+\setuplayout
+ [\c!backspace=22.5mm,
+ \c!width=\v!fit,
+ \c!cutspace=22.5mm,
+ \c!margin=20mm,
+ \c!margindistance=5mm,
+ \c!topspace=15mm,
+ \c!header=10mm,
+ \c!headerdistance=5mm,
+ \c!height=\v!fit,
+ \c!footerdistance=5mm,
+ \c!footer=15mm,
+ \c!bottomspace=15mm]
+
+\setuppagenumbering
+ [\c!alternative=\v!doublesided]
+
+% The lucida fonts look a bit more informal.
+
+\doifmodeelse {atpragma} {
+ \setupbodyfont[lucidaot,10pt]
+} {
+ \setupbodyfont[palatino,10pt]
+}
+
+% All colors will go here.
+
+% todo
+
+% Let's keep the text compact.
+
+\setupwhitespace
+ [\v!medium]
+
+\setupblank
+ [\v!medium]
+
+% We indent verbatim with the default indenting value.
+
+\setuptyping
+ [\c!margin=\v!standard,
+ \c!blank=\v!medium]
+
+% Manuals as usual need a bit more tolerance, because a lot of in||line verbatim is
+% used.
+
+\setuptolerance
+ [\v!verytolerant,\v!stretch]
+
+% This manual makes heavy use of backgrounds. During a run about many metaclips are
+% generated.
+
+\defineoverlay [chapter-state] [\uniqueMPpagegraphic{chapter-state}]
+\defineoverlay [pagenumber-state] [\uniqueMPgraphic{pagenumber-state}]
+
+\defineoverlay [basic-shape-light] [\useMPgraphic{basic-shape-light}]
+\defineoverlay [basic-shape-dark] [\useMPgraphic{basic-shape-dark}]
+
+\defineoverlay [setup-shape] [\useMPgraphic{setup-shape}]
+\defineoverlay [note-rule] [\uniqueMPgraphic{note-rule}]
+\defineoverlay [column-rule] [\uniqueMPgraphic{column-rule}]
+
+% \defineoverlay
+% [MenuAchtergrond]
+% [\MPclipTwoA{\overlaywidth}{\overlayheight}{3pt}{3pt}{red}{white}]
+
+\starttexdefinition unexpanded FootnoteRule
+ \blank[2*\v!big]
+ \framed
+ [\c!background=note-rule,
+ \c!width=.4\makeupwidth,
+ \c!height=2pt,
+ \c!offset=\v!overlay,
+ \c!rulethickness=2pt,
+ \c!frame=\v!off]
+ {}
+ \blank[\v!small]
+\stoptexdefinition
+
+\setupfootnotes
+ [\c!rule=off,
+ \c!before=\FootnoteRule]
+
+% Chapter titles have a fancy shape around them. Because we have a lot of small
+% chapters, we don't go to a new page. Titles look the same, but there we go to
+% a new page.
+
+\setuphead
+ [\v!chapter]
+ [\c!command=\HeadCommand,
+ \c!page=,
+ \c!before={\blank[3*\v!big]},
+ \c!after={\blank[2*\v!big,\v!samepage]}]
+
+\setuphead
+ [\v!title]
+ [\c!page=\v!right]
+
+\starttexdefinition unexpanded HeadCommand #number #title
+ \alignedline {\v!outer} {\v!left} {
+ \framed [
+ \c!background=basic-shape-dark,
+ \c!rulethickness=10pt,
+ \c!frame=\v!off,
+ \c!strut=\v!no,
+ \c!offset=24pt,
+ \c!align=\v!middle
+ ] {
+ \doifmode {*\v!sectionnumber} {
+ #number
+ \kern.5em
+ \blackrule [
+ color=green,
+ width=1pt,
+ height=1.5\ht\strutbox,
+ depth=1.25\dp\strutbox
+ ]
+ \kern.5em
+ }
+ #title
+ }
+ }
+\stoptexdefinition
+
+% The current chapter number is typeset in the (outer) margin and slowly moves
+% down. We could have directly put it in the margin but using the footermargin as
+% starting point works better. This is an old command and there is no reason to
+% change the definition to more fabce MkIV version.
+
+\setupfootertexts
+ [\v!margin]
+ [][\fastsetup{chapterindicator}]
+
+\startsetups chapterindicator
+ \determineheadnumber[\v!chapter]
+ \ifcase\currentheadnumber\else
+ \vbox to \makeupheight {
+ \scratchcounter=\numexpr\lastpage-\realpageno\relax
+ \vskip2cm
+ \vskip0pt plus \realpageno cm
+ \framed [
+ \c!background=chapter-state,
+ \c!width=36pt,
+ \c!height=72pt,
+ \c!backgroundoffset=5pt,
+ %\c!align={\v!lohi,\v!middle},
+ \c!frame=\v!off
+ ] {
+ \lower.5\dp\strutbox\hbox {
+ \bfb
+ \getmarking[\v!chapter\v!number]
+ }
+ }
+ \vskip0pt plus \scratchcounter cm
+ \vskip2cm
+ }
+ \fi
+\stopsetups
+
+% The index is put on a double collumned grid. The numbers is surrounded by a
+% shape.
+
+\setupregister
+ [\v!index]
+ [\c!command=\IndexCommand,
+ \c!before={\blank[\v!line]},
+ \c!after=]
+
+\starttexdefinition unexpanded IndexCommand #text
+ \framed [
+ \c!background=basic-shape-dark,
+ \c!width=36pt,
+ \c!frame=\v!off,
+ \c!offset=4pt,
+ \c!align=\v!middle,
+ \c!rulethickness=4pt
+ ] {
+ #text
+ }
+\stoptexdefinition
+
+% When bound, we use a double sided layout and put the pagenumber in the margin,
+% enhanced by a fancy background.
+
+\setuppagenumbering
+ [\c!location={\v!footer,\v!middle},
+ \c!command=\PageNumberCommand]
+
+\starttexdefinition unexpanded PageNumberCommand #pagenumber
+ \framed [
+ \c!background=pagenumber-state,
+ \c!backgroundoffset=5pt,
+ \c!frame=\v!off,
+ \c!offset=6pt
+ ] {
+ \lower.5\dp\strutbox\hbox spread 60pt {
+ \hss
+ #pagenumber
+ \hss
+ }
+ }
+\stoptexdefinition
+
+% We put the chapter title in the head. If we wouldn't have to center, the more
+% simple setting would be:
+
+\setupheadertexts
+ [{\getmarking[\v!chapter]}]
+
+% Guess what the next one does.
+
+\setupitemgroup
+ [\v!itemize]
+ [1]
+ [\v!autointro]
+
+% The coverpage looks more complex than it is. We can reuse it.
+
+\newbox\CoverBackgroundBox % reuse saves .8 sec, could be an object!
+
+\starttexdefinition unexpanded ShowSetupOnCover #n #tag #xmlroot
+ \dontleavehmode
+ \framed [
+ \c!background=basic-shape-light,
+ \c!backgroundoffset=5pt,
+ \c!rulethickness=2pt,
+ \c!frame=\v!off
+ ] {
+ \xmlsetup{#xmlroot}{xml:setups:assemblename}
+ \tttf
+ \texescape\currentSETUPfullname
+ }
+ \hskip1.25em plus 1em minus 1em\relax
+\stoptexdefinition
+
+% \startsetups coverbackground
+%
+% \ifvoid\CoverBackgroundBox
+%
+% \global\setbox\CoverBackgroundBox=\vbox to \paperheight \bgroup
+% \hsize\paperwidth
+% \emergencystretch3em
+% \parfillskip0pt
+% \switchtobodyfont
+% [6pt]
+% \baselineskip 0pt plus 1pt minus 1pt
+% \setupsorting
+% [texcommand]
+% [\c!command=\ShowSetupOnCover,
+% \c!criterium=\v!all]
+% \beginofshapebox
+% \leftskip3pt
+% \rightskip3pt
+% \placelistofsorts
+% [texcommand]
+% \endofshapebox
+% \doreshapebox
+% {\box\shapebox}
+% {\penalty\shapepenalty}
+% {\kern\shapekern}
+% {\vfil}
+% \kern3pt
+% \vfilneg
+% \flushshapebox
+% \vfilneg
+% \kern3pt
+% \egroup
+%
+% \fi
+%
+% \copy\CoverBackgroundBox
+%
+% \stopsetups
+
+\startsetups coverbackground
+
+ \ifvoid\CoverBackgroundBox
+
+ \global\setbox\CoverBackgroundBox
+ \startnicelyfilledbox
+ [\c!width=\paperwidth,
+ \c!height=\paperheight,
+ \c!offset=\exheight,
+ \c!strut=\v!no]
+ \switchtobodyfont
+ [6pt]
+ \placelistofsorts
+ [texcommand]
+ [\c!command=\ShowSetupOnCover,
+ \c!criterium=\v!all]
+ \stopnicelyfilledbox
+
+ \fi
+
+ \copy\CoverBackgroundBox
+
+\stopsetups
+
+\defineoverlay[coverbackground][\setups{coverbackground}]
+
+\setupdocument
+ [author={Ton Otten\crlf PRAGMA ADE},
+ translator=,
+ contributer=,
+ before=\setups{coverpage},
+ after=\setups{backpage}]
+
+\defineoverlay[gotocontents][\overlaybutton{contents}]
+
+\startsetups coverpage
+
+ \setupbackgrounds
+ [\v!rightpage]
+ [\c!background=coverbackground]
+
+ \setupbackgrounds
+ [\v!text]
+ [\v!text]
+ [\c!background=gotocontents]
+
+ \startmakeup
+ [\v!standard]
+ [\c!doublesided=\v!empty,
+ \c!headerstate=\v!none,
+ \c!footerstate=\v!none]
+
+ \hbox to \hsize \bgroup
+ \hss
+ \definedfont[SansBold*default at 40pt]
+ \framed
+ [\c!background=basic-shape-dark,
+ \c!frame=\v!off,
+ \c!rulethickness=15pt,
+ \c!align=\v!middle,
+ \c!offset=40pt]
+ {\documentvariable{title}}
+ \egroup
+
+ \vfill
+
+ \doifsomething {\documentvariable{subtitle}} {
+
+ \hbox to \hsize \bgroup
+ \definedfont[SansBold*default at 14pt]
+ \framed
+ [\c!background=basic-shape-dark,
+ \c!frame=\v!off,
+ \c!rulethickness=10pt,
+ \c!align=\v!middle,
+ \c!offset=20pt]
+ {\documentvariable{subtitle}}
+ \hss
+ \egroup
+
+ }
+
+ \hbox to \hsize \bgroup
+ \hss
+ \definedfont[SansBold*default at 20pt]
+ \framed
+ [\c!background=basic-shape-dark,
+ \c!frame=\v!off,
+ \c!rulethickness=12.5pt,
+ \c!align=\v!middle,
+ \c!offset=35pt]
+ {\documentvariable{author}}
+ \egroup
+
+ \stopmakeup
+
+ \setupbackgrounds
+ [\v!text]
+ [\v!text]
+ [\c!background=]
+
+ \setupbackgrounds
+ [\v!rightpage]
+ [\c!background=]
+
+ \doifmode {screen} {
+
+ \setupbackgrounds
+ [\v!page]
+ [\c!background=\v!screen,
+ \c!backgroundscreen=.95]
+
+ \setupbackgrounds
+ [\v!text]
+ [\v!text]
+ [\c!backgroundoffset=.25cm,
+ \c!depth=.125cm,
+ \c!background=\v!color,
+ \c!backgroundcolor=white]
+
+ }
+
+ \component[ma-cb-copyright]
+
+\stopsetups
+
+% The backpage uses the same background and overlays a piece of text.
+
+\startsetups backpage
+
+ \page
+ [\v!yes,\v!blank,\v!right]
+
+ \component[ma-cb-colofon]
+
+ \page
+ [\v!yes,\v!blank,\v!left]
+
+ \setupbackgrounds
+ [\v!leftpage]
+ [\c!background=coverbackground]
+
+ \startmakeup
+ [\v!standard]
+ [\c!page=,
+ \c!doublesided=\v!no,
+ \c!headerstate=\v!none,
+ \c!footerstate=\v!none]
+
+ \setuptolerance
+ [\v!verytolerant]
+
+ \vfill
+
+ \hbox to \hsize \bgroup
+
+ \framed
+ [\c!background=\v!color,
+ \c!backgroundcolor=white,
+ \c!frame=\v!off,
+ \c!offset=10pt,
+ \c!corner=\v!round,
+ \c!width=.4\makeupwidth,
+ \c!height=\textheight,
+ \c!align=\v!middle,
+ \c!strut=\v!no]
+ {
+ \vfil
+ \component[ma-cb-en-backpage]
+ \vfil
+ }
+
+ \hss
+
+ \egroup
+
+ \vfill
+
+ \stopmakeup
+
+\stopsetups
+
+% To save space we don't start chapters on a new page, except in appendices and the
+% introduction. These settings happen in dedicated setups sections (see later). We
+% also add some white space between table of content entries.
+
+\setupsectionblock [\v!frontpart] [\c!page=\v!right,\c!before=\setups{frontpart}]
+\setupsectionblock [\v!bodypart] [\c!page=\v!right,\c!before=\setups{bodypart}]
+\setupsectionblock [\v!appendix] [\c!page=\v!right,\c!before=\setups{appendix}]
+\setupsectionblock [\v!backpart] [\c!page=\v!right,\c!before=\setups{backpart}]
+
+\setuplist
+ [\v!chapter]
+ [\c!criterium=\v!all,
+ \c!before=,
+ \c!after=]
+
+\startsetups frontpart
+
+ \setuphead[\v!chapter][\c!page=\v!right]
+
+ \writebetweenlist[\v!chapter]{\blank}
+
+ \startnamedsection[\v!chapter][\c!title=\labeltext{document:contents}]
+
+ \startmixedcolumns[documentcolumns]
+ \placelist[\v!chapter]
+ \stopmixedcolumns
+
+ \stopnamedsection
+
+ \page[\v!right]
+
+\stopsetups
+
+\startsetups bodypart
+
+ \setuphead[\v!chapter][\c!page=]
+
+ \writebetweenlist[\v!chapter]{\blank}
+
+\stopsetups
+
+\startsetups appendix
+
+ \setuphead[\v!chapter][\c!page=\v!right]
+
+ \writebetweenlist[\v!chapter]{\blank}
+
+ \startnamedsection[\v!chapter][\c!title=\labeltext{document:commanddefinitions},\c!reference=commandsetups]
+
+ \component[ma-cb-\currentmainlanguage-commandlist]
+
+ \blank[2*\v!big]
+
+ \start
+
+ \switchtobodyfont[8pt]
+
+ \startmixedcolumns[documentcolumns]
+ \placelistofsorts[texcommand]
+ \stopmixedcolumns
+
+ \stop
+
+ \stopnamedsection
+
+ \startnamedsection[\v!chapter][\c!title=\labeltext{document:commandindex}]
+
+ \startmixedcolumns[documentcolumns]
+ \placeregister[Command]
+ \stopmixedcolumns
+
+ \stopnamedsection
+
+ \startnamedsection[\v!chapter][\c!title=\labeltext{document:subjectindex}]
+
+ \startmixedcolumns[documentcolumns]
+ \placeregister[\v!index]
+ \stopmixedcolumns
+
+ \stopnamedsection
+
+ \startnamedsection[\v!chapter][\c!title=\labeltext{document:supportandreading}]
+
+ \index{support}
+
+ \startnamedsection[\v!section][\c!title=\labeltext{document:support}]
+
+ \component[ma-cb-\currentmainlanguage-support]
+
+ \stopnamedsection
+
+ \startnamedsection[\v!section][\c!title=\labeltext{document:manuals}]
+
+ % this will be done from a bib file
+
+ \startlines
+ \goto {Chemical Formulas in \CONTEXT} [ url (manual:chemic-ex) ]
+ \goto {Color Separation} [ url (manual:color) ]
+ \goto {Columns} [ url (manual:columns) ]
+ \goto {\CONTEXT, the manual} [ url (manual:context) ]
+ \goto {Dealing with \XML} [ url (manual:xml) ]
+ \goto {Extreme Tables} [ url (manual:extab) ]
+ \goto {Figures} [ url (manual:figures) ]
+ \goto {Fonts in \CONTEXT} [ url (manual:fonts) ]
+ \goto {luatools, mtxrun, context} [ url (manual:tools) ]
+ \goto {\METAFUN\ manual} [ url (manual:metafun) ]
+ \goto {Natural Tables} [ url (manual:nattab) ]
+ \goto {\PPCHTEX\ Manual} [ url (manual:chemic) ]
+ \goto {Quick Reference (dutch)} [ url (manual:qr-nl) ]
+ \goto {Quick Reference (english)} [ url (manual:qr-en) ]
+ \goto {\SCITE\ in \CONTEXT} [ url (manual:scite) ]
+ \goto {Units} [ url (manual:units) ]
+ \goto {Widgets} [ url (manual:widgets) ]
+ \stoplines
+
+ \stopnamedsection
+
+ \startnamedsection[\v!section][\c!title=\labeltext{document:magazines}]
+
+ % this will be done from a bib file
+
+ \startlines
+ \goto {\CONTEXT\ Magazine 1103} [ url (thisway:crossrefs) ]
+ \goto {Project structure} [ url (thisway:proj-struc) ]
+ \stoplines
+
+ \stopnamedsection
+
+ \stopnamedsection
+
+\stopsetups
+
+\startsetups backpart
+
+ \setuphead[\v!chapter][\c!page=\v!right]
+
+ \writebetweenlist[\v!chapter]{\blank}
+
+\stopsetups
+
+% In normal documents one will never find awful things like below. Because we want
+% an international setup, we just call the chapters in an indirect way.
+
+% We draw a nice line between columns. The next command does the job. Of course a
+% normal line can be set more easily, but here we hook in a command.
+
+\installmixedcolumnseparator{ColumnRule}%
+ {\framed
+ [\c!background=column-rule,
+ \c!height=\mixedcolumnseparatorheight,
+ \c!depth=\mixedcolumnseparatordepth,
+ \c!width=\mixedcolumnseparatorwidth,
+ \c!offset=\v!overlay,
+ \c!rulethickness=2pt,
+ \c!frame=\v!off]
+ {}}
+
+% alternative implemenation
+%
+% \installmixedcolumnseparator{ColumnRule}%
+% {\lower\mixedcolumnseparatordepth\hbox{\uniqueMPgraphic
+% {column-rule}%
+% {height=\the\dimexpr\mixedcolumnseparatorheight+\mixedcolumnseparatordepth,linewidth=2pt}}}
+
+\setupmixedcolumns
+ [\c!n=2,
+ \c!distance=36pt,
+ \c!separator=ColumnRule]
+
+\definemixedcolumns
+ [documentcolumns]
+ [\c!n=2,
+ \c!distance=36pt,
+ \c!separator=ColumnRule]
+
+\defineregister
+ [Command]
+
+\setupregister
+ [Command]
+ [\c!indicator=\v!off,
+ c!before={\blank[\v!line]}]
+
+\protect
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/start/ma-cb.tex b/doc/context/sources/general/manuals/start/ma-cb.tex
new file mode 100644
index 000000000..7f23597a1
--- /dev/null
+++ b/doc/context/sources/general/manuals/start/ma-cb.tex
@@ -0,0 +1,17 @@
+\startproject ma-cb
+
+ \environment ma-cb-language
+
+ \environment ma-cb-abbreviations
+ \environment ma-cb-graphics
+ \environment ma-cb-style
+ \environment ma-cb-links
+
+ \startmode[screen]
+ \environment ma-cb-screen
+ \stopmode
+
+ \product ma-cb-en
+ \product ma-cb-nl
+
+\stopproject
diff --git a/doc/context/sources/general/manuals/steps/steps-mkiv.tex b/doc/context/sources/general/manuals/steps/steps-mkiv.tex
new file mode 100644
index 000000000..947f08fbb
--- /dev/null
+++ b/doc/context/sources/general/manuals/steps/steps-mkiv.tex
@@ -0,0 +1,655 @@
+\environment manuals-xml-environment.tex
+
+\useMPlibrary [ove]
+
+\usemodule[x][mathml]
+\usemodule[m][steps]
+
+\startdocument[title=Steps,author=Hans Hagen,palet=steps]
+
+\startbuffer
+\startSTEPchart
+\cell {A}
+\cell {one} \text{+2}
+\cell {two} \text{+3}
+\cell {three} \text{+4}
+\cell {four} \text{+5}
+\cell {five}
+\stopSTEPchart
+\stopbuffer
+
+\startsection[title=Description]
+
+This module is written in the process of defining a couple of styles for an
+educational math book. The macros provide you a way to visualize steps in for
+instance solving equations.
+
+The horizontal visualization is called stepchart, while the vertical alternative
+carries the name steptable. The vertical alternative has a special case that
+permits alignment on a mid symbol (in most cases a relation).
+
+The implementation uses a combination of \TEX\ and \METAPOST, and is set up in
+such a way that hyperlinks and alike will work okay.
+
+\stopsection
+
+\startsection[title=Structure]
+
+The horizontal stepcharts have at most four rows: two rows of cells with each an
+associated row of texts. The plural elements \type {cells} and \type {texts} each
+have two subelements. The \type {texts} elements are put between \type {cells}.
+
+\startbuffer
+<stepchart>
+ <cells> <top> some text </top> <bot> some text </bot> </cells>
+ <texts> <top> text </top> <bot> text </bot> </texts>
+ <cells> <top> some text </top> <bot> some text </bot> </cells>
+</stepchart>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+When a singular \type {cell} element is used in combination with the plural \type
+{texts}, we get one row of step cells with both top and bottom texts.
+
+\startbuffer
+<stepchart>
+ <cell> some text </cell>
+ <texts> <top> text </top> <bot> text </bot> </texts>
+ <cell> some text </cell>
+</stepchart>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+The third horizontal alternative only has singular elements, and as a result the
+texts are put above the step cells.
+
+\startbuffer
+<stepchart>
+ <cell> some cell </cell>
+ <cell> another cell </cell> <text> a bit of text </text>
+ <cell> third cell </cell> <text> more text </text>
+ <cell> last cell </cell>
+</stepchart>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+Normally, the lines go from cell to cell via a text. When you let the \type
+{cell} element follow by more than one \type {text} element (or their plural
+forms), all lines will start at the same point.
+
+\startbuffer
+<stepchart>
+ <cell> some text </cell>
+ <cell> some text </cell> <text> text 1 </text> <text> text 2 </text>
+ <cell> some text </cell>
+ <cell> some text </cell> <text> text 3 </text>
+ <cell> some text </cell>
+</stepchart>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+The vertical alternative (of course) looks different and permits pretty long
+explanations.
+
+\startbuffer
+<steptable>
+ <cell> cell 1 </cell>
+ <text> text 1 </text>
+ <cell> cell 2 </cell>
+ <text> text 2 </text>
+ <cell> cell 3 </cell>
+</steptable>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+When the plural element \type {cells} is used, three sub||elements are expected.
+These align around the mid element \type {c2}.
+
+\startbuffer
+<stepaligntable>
+ <cells> <c1> left </c1> <c2> center </c2> <c3> right </c3> </cells>
+ <text> text </text>
+ <cells> <c1> lft </c1> <c2> ctr </c2> <c3> rgt </c3> </cells>
+ <text> text </text>
+ <cells> <c1> l </c1> <c2> c </c2> <c3> r </c3> </cells>
+</stepaligntable>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+\stopsection
+
+\startsection[title=Usage]
+
+The step chart module is loaded with:
+
+\starttyping
+\usemodule[cell] % was step
+\stoptyping
+
+\noindentation but in the case of embedded math, you should also load the \MATHML\ module:
+
+\starttyping
+\usemodule[cell,mathml]
+\stoptyping
+
+\stopsection
+
+\startsection[title=\XML\ example]
+
+Because we don't want to clutter the examples with \MATHML\ we stick to a simple
+mapping:
+
+\startbuffer
+\startxmlsetups xml:math:simple
+ \xmlsetsetup {#1} {m} {xml:math:simple:tex}
+\stopxmlsetups
+
+\startxmlsetups xml:math:simple:tex
+ \mathematics{\xmlflush{#1}}
+\stopxmlsetups
+
+\xmlregistersetup{xml:math:simple}
+\stopbuffer
+
+\typebuffer \getbuffer
+
+So, in the next examples the \type {m} element contains \TEX\ math.
+
+\startbuffer
+<stepchart>
+ <cells> <top> A </top> <bot> B </bot> </cells>
+ <cells> <top> one </top> <bot> five </bot> </cells>
+ <texts> <top> <m> +2 </m> </top> <bot> <m> -2 </m> </bot> </texts>
+ <cells> <top> two </top> <bot> four </bot> </cells>
+ <texts> <top> <m> +3 </m> </top> <bot> <m> -3 </m> </bot> </texts>
+ <cells> <top> three </top> <bot> three </bot> </cells>
+ <texts> <top> <m> +4 </m> </top> <bot> <m> -4 </m> </bot> </texts>
+ <cells> <top> four </top> <bot> two </bot> </cells>
+ <texts> <top> <m> +5 </m> </top> <bot> <m> -5 </m> </bot> </texts>
+ <cells> <top> five </top> <bot> one </bot> </cells>
+</stepchart>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+\startbuffer
+<stepchart>
+ <cell> A </cell>
+ <cell> one </cell> <text> <m> +2 </m> </text>
+ <cell> two </cell> <text> <m> +3 </m> </text>
+ <cell> three </cell> <text> <m> +4 </m> </text>
+ <cell> four </cell> <text> <m> +5 </m> </text>
+ <cell> five </cell>
+</stepchart>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+\startbuffer
+<steptable>
+ <cell>
+ <math xmlns="mathml">
+ <apply> <eq/> <ci> c </ci>
+ <apply> <plus/>
+ <apply> <times/> <cn> 2 </cn> <ci> a </ci> </apply>
+ <apply> <times/> <cn> 3 </cn> <ci> b </ci> </apply>
+ </apply>
+ </apply>
+ </math>
+ </cell>
+ <text> with
+ <math xmlns="mathml">
+ <apply> <eq/> <ci> a </ci> <cn> 5 </cn> </apply>
+ </math>
+ </text>
+ <cell>
+ <math xmlns="mathml">
+ <apply> <eq/> <ci> c </ci>
+ <apply> <plus/> <cn> 10 </cn>
+ <apply> <times/> <cn> 3 </cn> <ci> b </ci> </apply>
+ </apply>
+ </apply>
+ </math>
+ </cell>
+ <text> and
+ <math xmlns="mathml">
+ <apply> <eq/> <ci> b </ci> <cn> 6 </cn> </apply>
+ </math>
+ </text>
+ <cell>
+ <math xmlns="mathml">
+ <apply> <eq/> <ci> c </ci>
+ <apply> <plus/> <cn> 10 </cn> <cn> 18 </cn> </apply>
+ </apply>
+ </math>
+ </cell>
+ <text>
+ we get
+ </text>
+ <cell>
+ <math xmlns="mathml">
+ <apply> <eq/> <ci> c </ci> <cn> 28 </cn> </apply>
+ </math>
+ </cell>
+</steptable>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+\startbuffer
+<stepaligntable>
+ <cells>
+ <c1> <m>c</m> </c1> <c2> <m>=</m> </c2> <c3> <m>2a+3b</m> </c3>
+ </cells>
+ <text>
+ with <m>a=5</m>
+ </text>
+ <cells>
+ <c1> <m>c</m> </c1> <c2> <m>=</m> </c2> <c3> <m>10+3b</m> </c3>
+ </cells>
+ <text>
+ and <m>b=6</m>
+ </text>
+ <cells>
+ <c1> <m>c</m> </c1> <c2> <m>=</m> </c2> <c3> <m>10+18</m> </c3>
+ </cells>
+ <text>
+ we get
+ </text>
+ <cells>
+ <c1> <m>c</m> </c1> <c2> <m>=</m> </c2> <c3> <m>28</m> </c3>
+ </cells>
+</stepaligntable>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+\stopsection
+
+\startsection[title=\TEX\ example]
+
+\startbuffer
+\startSTEPchart
+\cells {A} {B}
+\cells {one} {five or more} \texts{$+2$}{$-2$}
+\cells {two} {four} \texts{$+3$}{$-3$}
+\cells {three} {three} \texts{$+4$}{$-4$}
+\cells {four} {two} \texts{$+5$}{$-5$}
+\cells {five or more} {one}
+\stopSTEPchart
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startSTEPchart
+\cell {A}
+\cell {one} \texts{$+2$}{$-2$}
+\cell {two} \texts{$+3$}{$-3$}
+\cell {three} \texts{$+4$}{$-4$}
+\cell {four} \texts{$+5$}{$-5$}
+\cell {five or more}
+\stopSTEPchart
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startSTEPchart
+\cells {A} {B}
+\cells {one} {five or more} \texts{$+2$}{}
+\cells {two} {four} \texts{}{$-3$}
+\cells {three} {three} \texts{$+4$}{}
+\cells {four} {two} \texts{}{$-5$}
+\cells {five or more} {one}
+\stopSTEPchart
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startSTEPchart
+\cell {A}
+\cell {one} \text{+2} \text{+3} \text{+4} \text{+5}
+\cell {two}
+\cell {three}
+\cell {four}
+\cell {five}
+\stopSTEPchart
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startSTEPchart
+\cell {A}
+\cell {one} \texts{}{+2} \texts{}{+3}
+\cell {two}
+\cell {three} \texts{+4}{} \texts{+5}{}
+\cell {four}
+\cell {five}
+\stopSTEPchart
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startSTEPchart
+\cell {A}
+\cell {one} \text{+2}
+\cell {two} \text{+3}
+\cell {three} \text{+4}
+\cell {four} \text{+5}
+\cell {five}
+\stopSTEPchart
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startSTEPtable
+\cell {$c=2a+3b$}
+\text {with $a=5$}
+\cell {$c=10+3b$}
+\text {and $b=6$}
+\cell {$c=10+18$}
+\text {we get}
+\cell {$c=28$}
+\stopSTEPtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startSTEPaligntable
+\cells {$2c$} {$=$} {$2a+3b$}
+\text {with $a=5$}
+\cells {$2c$}{$=$} {$10+3b$}
+\text {and $b=6$}
+\cells {$2c$} {$=$} {$10+18$}
+\text {we get}
+\cells {$2c$} {$=$} {$28$}
+\text {and therefore}
+\cells {$c$} {$=$} {$28/2$}
+\text {which reduces to}
+\cells {$c$} {$=$} {$14$}
+\stopSTEPaligntable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startSTEPchart
+ \cells {A} {B}
+ \cells {one} {five} \texts{$+2$}{$-2$}
+ \cells {two} {four} \texts{$+3$}{$-3$}
+ \cells {three} {three} \texts{$+4$}{$-4$}
+ \cells {four} {two} \texts{$+5$}{$-5$}
+ \cells {five} {one}
+\stopSTEPchart
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\stopsection
+
+\startsection[title=Configuring]
+
+The charts and tables can have their own spacing set. Quite certainly the
+distances between cells will differ.
+
+\starttabulate[|Tl|l|]
+\HL
+\NC \rlap{\tex{setupSTEPcharts} \tex{setupSTEPtables}} \NC \NC \NR
+\HL
+\NC after \NC hook for commands to execute after the table \NC \NR
+\NC before \NC hook for commands to execute before the table \NC \NR
+% \NC method \NC line drawing method\NC \NR
+% \NC height \NC height of the connecting line \NC \NR
+% \NC offset \NC the distance between lines and cells and texts \NC \NR
+% \NC hoffset \NC the horizontal distance between cells \NC \NR
+% \NC voffset \NC the vertical distance between cells \NC \NR
+\HL
+\stoptabulate
+
+Both charts and tables have common settings with respect to the cells, texts and
+lines.
+
+\starttabulate[|Tl|l|]
+\HL
+\NC \rlap{\tex{setupSTEPcells} \tex{setupSTEPtexts}} \NC \NC \NR
+\HL
+\NC alternative \NC the kind of shape to be drawn \NC \NR
+\NC backgroundcolor \NC the background color identified by name \NC \NR
+\NC rulethickness \NC the width of frame around cells \NC \NR
+\NC framecolor \NC the frame color identified by name \NC \NR
+\NC offset \NC the space between content and frame \NC \NR
+\NC style \NC a (preferable named) style \NC \NR
+\NC color \NC the color of the content \NC \NR
+\HL
+\stoptabulate
+
+\starttabulate[|Tl|l|]
+\HL
+\NC \rlap{\tex{setupSTEPlines}} \NC \NC \NR
+\HL
+\NC alternative \NC the kind of line to draw between cells \NC \NR
+\NC distance \NC the distance between lines and text \NC \NR
+\NC offset \NC the shift to the right of the start of the line \NC \NR
+\NC height \NC the height of the (curved) line \NC \NR
+\NC rulethickness \NC the width of the lines between cells \NC \NR
+\NC color \NC the line color identified by name \NC \NR
+\HL
+\stoptabulate
+
+In \TEX, some of the settings, like \type {style} and \type {color} can be set
+between elements. In \XML, the settings are passed as processing instructions.
+
+\startbuffer
+\startSTEPchart
+\cell {A}
+\cell {one} \text{+2}
+\cell {two} \text{+3}
+\start
+ \setupSTEPcells[color=darkred,style=bold]
+ \cell {three} \text{+4}
+ \cell {four} \text{+5}
+\stop
+\cell {five}
+\stopSTEPchart
+\stopbuffer
+
+\typebuffer \getbuffer
+
+There are a couple of alternative shapes available. The most relevant ones are:
+\removeunwantedspaces \dostepwiserecurse {5} {9} {1} { \TestShape {\recurselevel}}
+\removeunwantedspaces \dostepwiserecurse {12} {19} {1} { \TestShape {\recurselevel}}
+\removeunwantedspaces \dostepwiserecurse {22} {29} {1} { \TestShape {\recurselevel}}.
+
+Although it is not too wise to set up the layout in the middle of a document, for
+graphics one can seldom get by some local fine||tuning. Here we encounter a
+rather fundamental difference between \TEX\ and \XML. In \TEX, you can easily
+change settings on a temporary basis by using groups. In \XML\ on the other hand,
+settings are bound to a category. So, in \TEX\ you can do this:
+
+\startbuffer
+\setupSTEPcells
+ [important]
+ [color=darkgreen,
+ style=bold]
+
+\startSTEPchart
+\cell {A}
+\cell {one} \text{+2}
+\cell {two} \text{+3}
+\cell [important] {three} \text{+4}
+\cell [important] {four} \text{+5}
+\cell {five}
+\stopSTEPchart
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\noindentation An \XML\ example is:
+
+\startbuffer
+\setupSTEPcells[demo-1][alternative=5]
+\setupSTEPcells[demo-1][framecolor=darkred]
+\setupSTEPtexts[demo-1][framecolor=darkgreen]
+\setupSTEPlines[demo-1][alternative=4]
+\setupSTEPtexts[demo-2][style=bold]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\noindentation This will be applied to:
+
+\startbuffer
+<steptable class="demo-1">
+ <cell> type 5 </cell>
+ <text> type 6 </text>
+ <cell> type 7 </cell>
+ <text class="demo-2"> type 8 </text>
+ <cell> type 9 </cell>
+</steptable>
+\stopbuffer
+
+\typebuffer
+
+\noindentation so that we get:
+
+\processxmlbuffer
+
+You can also use processing instructions:
+
+\startbuffer
+<stepchart>
+ <cells> <top> some text 1 </top> <bot> some text 2 </bot> </cells>
+ <?context-stepchart-directive text color darkred ?>
+ <texts> <top> text 3 </top> <bot> text 4 </bot> </texts>
+ <cells> <top> some text 5 </top> <bot> some text 6 </bot> </cells>
+ <?context-stepchart-directive text color darkblue ?>
+ <texts> <top> text 7t </top> </texts>
+ <cells> <top> some text 8 </top> </cells>
+</stepchart>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+\startbuffer
+<steptable>
+ <?context-stepchart-directive cell alternative 12 ?>
+ <cell> cell 12 </cell> <text> 12 to 13 </text>
+ <?context-stepchart-directive cell alternative 13 ?>
+ <cell> cell 13 </cell> <text> 13 to 14 </text>
+ <?context-stepchart-directive cell alternative 14 ?>
+ <cell> cell 14 </cell> <text> 14 to 15 </text>
+ <?context-stepchart-directive cell alternative 15 ?>
+ <cell> cell 15 </cell>
+</steptable>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+Some settings apply to the whole chart. In \TEX\ this is easy since we
+can group the whole chart including settings but in \XML\ this is somewhat
+problematic. We can however fall back on basic tex commands but it's
+probably better to use as category (class), like:
+
+\startbuffer
+\setupSTEPtexts[demo-5][distance=3em]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\noindentation So, the following works as expected:
+
+\startbuffer
+<document>
+ <?context-tex-directive start ?>
+ <?context-stepchart-directive text distance 1em ?>
+ <stepaligntable>
+ <cells> <c1>a</c1> <c2>b</c2> <c3>c</c3> </cells>
+ <text> test 1 </text>
+ <cells> <c1>aa</c1> <c2>b</c2> <c3>ccc</c3> </cells>
+ </stepaligntable>
+ <?context-tex-directive stop ?>
+ <stepaligntable>
+ <cells> <c1>a</c1> <c2>b</c2> <c3>c</c3> </cells>
+ <text> test 2 </text>
+ <cells> <c1>aa</c1> <c2>b</c2> <c3>ccc</c3> </cells>
+ </stepaligntable>
+ <stepaligntable class="demo-5">
+ <cells> <c1>a</c1> <c2>b</c2> <c3>c</c3> </cells>
+ <text> test 3 </text>
+ <cells> <c1>aa</c1> <c2>b</c2> <c3>ccc</c3> </cells>
+ </stepaligntable>
+</document>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+\startbuffer
+<document>
+ <?context-tex-directive start ?>
+ <?context-stepchart-directive cell dx 10ex ?>
+ <stepchart>
+ <cells> <top> from here </top> <bot> there </bot> </cells>
+ <texts> <top> to </top> <bot> to </bot> </texts>
+ <cells> <top> and here </top> <bot> there </bot> </cells>
+ </stepchart>
+ <?context-tex-directive stop ?>
+</document>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+\startbuffer
+<document>
+ <?context-tex-directive start ?>
+ <?context-stepchart-directive line height 30pt ?>
+ <?context-stepchart-directive line offset 5pt ?>
+ <steptable>
+ <cell> some cell </cell>
+ <cell> another cell </cell> <text> a bit of text </text>
+ <cell> third cell </cell> <text> more text </text>
+ <cell> last cell </cell>
+ </steptable>
+ <?context-tex-directive stop ?>
+</document>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+\startbuffer
+<document>
+ <?context-tex-directive start ?>
+ <?context-stepchart-directive line height 30pt ?>
+ <?context-stepchart-directive line offset 15pt ?>
+ <stepchart>
+ <cell> some cell </cell>
+ <cell> another cell </cell> <text> a bit of text </text>
+ <cell> third cell </cell> <text> more text </text>
+ <cell> last cell </cell>
+ </stepchart>
+ <?context-tex-directive stop ?>
+</document>
+\stopbuffer
+
+\typebuffer \processxmlbuffer
+
+\stopsection
+
+\startsection[title=Documentation]
+
+There is no additional documentation on this module.
+
+\stopsection
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/swiglib/swiglib-mkiv-gm-1.jpg b/doc/context/sources/general/manuals/swiglib/swiglib-mkiv-gm-1.jpg
new file mode 100644
index 000000000..8c45b41b9
--- /dev/null
+++ b/doc/context/sources/general/manuals/swiglib/swiglib-mkiv-gm-1.jpg
Binary files differ
diff --git a/doc/context/sources/general/manuals/swiglib/swiglib-mkiv-gm-1.pdf b/doc/context/sources/general/manuals/swiglib/swiglib-mkiv-gm-1.pdf
new file mode 100644
index 000000000..d576c7d91
--- /dev/null
+++ b/doc/context/sources/general/manuals/swiglib/swiglib-mkiv-gm-1.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/swiglib/swiglib-mkiv-gm-1.png b/doc/context/sources/general/manuals/swiglib/swiglib-mkiv-gm-1.png
new file mode 100644
index 000000000..fba526e9f
--- /dev/null
+++ b/doc/context/sources/general/manuals/swiglib/swiglib-mkiv-gm-1.png
Binary files differ
diff --git a/doc/context/sources/general/manuals/swiglib/swiglib-mkiv.tex b/doc/context/sources/general/manuals/swiglib/swiglib-mkiv.tex
new file mode 100644
index 000000000..c24be76bf
--- /dev/null
+++ b/doc/context/sources/general/manuals/swiglib/swiglib-mkiv.tex
@@ -0,0 +1,352 @@
+% language=uk
+
+% author : Hans Hagen
+% copyright : PRAGMA ADE & ConTeXt Development Team
+% license : Creative Commons Attribution ShareAlike 4.0 International
+% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
+% origin : the ConTeXt distribution
+%
+% comment : Because this manual is distributed with TeX distributions it comes with a rather
+% liberal license. We try to adapt these documents to upgrades in the (sub)systems
+% that they describe. Using parts of the content otherwise can therefore conflict
+% with existing functionality and we cannot be held responsible for that. Many of
+% the manuals contain characteristic graphics and personal notes or examples that
+% make no sense when used out-of-context.
+
+\usemodule[art-01,abr-02]
+
+\definecolor
+ [maincolor]
+ [r=.4]
+
+\definecolor
+ [extracolor]
+ [g=.4]
+
+\setupbodyfont
+ [11pt]
+
+\setuptype
+ [color=maincolor]
+
+\setuptyping
+ [color=maincolor]
+
+\definefontsynonym
+ [TitlePageMono]
+ [file:lmmonoproplt10-bold*default]
+
+\setuphead
+ [color=maincolor]
+
+\usesymbols
+ [cc]
+
+\setupinteraction
+ [hidden]
+
+\loadfontgoodies[lm]
+
+\startdocument
+ [metadata:author=Hans Hagen,
+ metadata:title=SwigLib basics,
+ author=Hans Hagen,
+ affiliation=PRAGMA ADE,
+ location=Hasselt NL,
+ title=SwigLib basics,
+ support=www.contextgarden.net,
+ website=www.pragma-ade.nl]
+
+\startluasetups[swiglib]
+ for i=1,640 do
+ context.definedfont { string.formatters["TitlePageMono at %p"](65536*(10+math.random(5))) }
+ context("SwigLib ")
+ end
+ context.removeunwantedspaces()
+\stopluasetups
+
+\startMPpage
+
+StartPage ;
+
+ fill Page enlarged 1cm withcolor \MPcolor{extracolor} ;
+
+ draw textext("\framed[loffset=2pt,roffset=2pt,frame=off,width=\paperwidth,align={normal,paragraph,verytolerant,stretch}]{\luasetup{swiglib}}")
+ xysized (PaperWidth,PaperHeight)
+ shifted center Page
+ withcolor .8white ;
+
+ draw textext.ulft("\definedfont[TitlePageMono]basics")
+ xsized .75PaperWidth
+ shifted lrcorner Page
+ shifted (-1cm,2cm)
+ withcolor \MPcolor{maincolor} ;
+
+ % draw textext.ulft("\definedfont[TitlePageMono]in context mkiv")
+ % xsized .6PaperWidth
+ % shifted lrcorner Page
+ % shifted (-1cm,6cm)
+ % withcolor \MPcolor{maincolor} ;
+
+StopPage ;
+
+\stopMPpage
+
+\dontcomplain
+
+\startsubject[title=Contents]
+
+\placelist[section][alternative=a]
+
+\stopsubject
+
+\startsection[title=Introduction]
+
+The \SWIGLIB\ project is related to \LUATEX\ and aims as adding portable library
+support to this \TEX\ engine without too much fixed binding. The project does not
+provide \LUA\ code, unless really needed, because it assumes that macro packages
+have different demands. It also fits in the spirit of \TEX\ and \LUA\ to minimize
+the core components.
+
+The technical setup is by Luigi Scarso and documentation about how to build the
+libraries is part of the \SWIGLIB\ repository. Testing happens with help of the
+\CONTEXT\ (garden) infrastructure. This short document only deals with usage in
+\CONTEXT\ but also covers rather plain usage.
+
+\blank \start \em todo: reference to Luigi's manual \stop \blank
+
+\stopsection
+
+\startsection[title=Inside \CONTEXT]
+
+The recommended way to load a library in \CONTEXT\ is by using the
+\type {swiglib} function. This function lives in the global namespace.
+
+\starttyping
+local gm = swiglib("gmwand.core")
+\stoptyping
+
+After this call you have the functionality available in the \type {gm}
+namespace. This way of loading makes \CONTEXT\ aware that such a library
+has been loading and it will report the loaded libraries as part of the
+statistics.
+
+If you want, you can use the more ignorant \type {require} instead but in
+that case you need to be more explicit.
+
+\starttyping
+local gm = require("swiglib.gmwand.core")
+\stoptyping
+
+Here is an example of using such a library (by Luigi):
+
+\startbuffer
+\startluacode
+local gm = swiglib("gmwand.core")
+local findfile = resolvers.findfile
+
+if not gm then
+ -- no big deal for this manual as we use a system in flux
+ logs.report("swiglib","no swiglib libraries loaded")
+ return
+end
+
+gm.InitializeMagick(".")
+
+local magick_wand = gm.NewMagickWand()
+local drawing_wand = gm.NewDrawingWand()
+local pixel_wand = gm.NewPixelWand();
+
+gm.MagickSetSize(magick_wand,800,600)
+gm.MagickReadImage(magick_wand,"xc:gray")
+
+gm.DrawPushGraphicContext(drawing_wand)
+
+gm.DrawSetFillColor(drawing_wand,pixel_wand)
+
+gm.DrawSetFont(drawing_wand,findfile("dejavuserifbold.ttf"))
+gm.DrawSetFontSize(drawing_wand,96)
+gm.DrawAnnotation(drawing_wand,200,200,"ConTeXt 1")
+
+gm.DrawSetFont(drawing_wand,findfile("texgyreschola-bold.otf"))
+gm.DrawSetFontSize(drawing_wand,78)
+gm.DrawAnnotation(drawing_wand,250,300,"ConTeXt 2")
+
+gm.DrawSetFont(drawing_wand,findfile("lmroman10-bold.otf"))
+gm.DrawSetFontSize(drawing_wand,48)
+gm.DrawAnnotation(drawing_wand,300,400,"ConTeXt 3")
+
+gm.DrawPopGraphicContext(drawing_wand)
+
+gm.MagickDrawImage(magick_wand,drawing_wand)
+
+gm.MagickWriteImages(magick_wand,"./swiglib-mkiv-gm-1.png",1)
+gm.MagickWriteImages(magick_wand,"./swiglib-mkiv-gm-1.jpg",1)
+gm.MagickWriteImages(magick_wand,"./swiglib-mkiv-gm-1.pdf",1)
+
+gm.DestroyDrawingWand(drawing_wand)
+gm.DestroyPixelWand(pixel_wand)
+gm.DestroyMagickWand(magick_wand)
+\stopluacode
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+In practice you will probably stay away from manipulating text this way, but it
+illustrates that you can use the regular \CONTEXT\ helpers to locate files.
+
+\startlinecorrection[big]
+ \startcombination[3*1]
+ {\externalfigure[swiglib-mkiv-gm-1.png][width=.3\textwidth]} {png}
+ {\externalfigure[swiglib-mkiv-gm-1.pdf][width=.3\textwidth]} {pdf}
+ {\externalfigure[swiglib-mkiv-gm-1.jpg][width=.3\textwidth]} {jpg}
+ \stopcombination
+\stoplinecorrection
+
+You'd better make sure to use unique filenames for such graphics. Of course a more
+clever mechanism would only run time consuming tasks once for each iteration of a
+document.
+
+\stopsection
+
+\startsection[title=Outside \CONTEXT]
+
+In the \CONTEXT\ distribution we ship some generic macros and code for usage in
+plain \TEX\ but there is no reason why they shouldn't work in other macro packages
+as well. A rather plain example is this:
+
+\starttyping
+\input luatex-swiglib.tex
+
+\directlua {
+ dofile("luatex-swiglib-test.lua")
+}
+
+\pdfximage {luatex-swiglib-test.jpg} \pdfrefximage\pdflastximage
+
+\end
+\stoptyping
+
+Assuming that you made the \type {luatex-plain} format, such a file can be processed using:
+
+\starttyping
+luatex --fmt=luatex=plain luatex-swiglib-test.tex
+\stoptyping
+
+The loaded \LUA\ file \type {luatex-swiglib-test.lua} liike like this:
+
+\starttyping
+local gm = swiglib("gmwand.core")
+
+gm.InitializeMagick(".")
+
+local magick_wand = gm.NewMagickWand()
+local drawing_wand = gm.NewDrawingWand()
+
+gm.MagickSetSize(magick_wand,800,600)
+gm.MagickReadImage(magick_wand,"xc:red")
+gm.DrawPushGraphicContext(drawing_wand)
+gm.DrawSetFillColor(drawing_wand,gm.NewPixelWand())
+gm.DrawPopGraphicContext(drawing_wand)
+gm.MagickDrawImage(magick_wand,drawing_wand)
+gm.MagickWriteImages(magick_wand,"./luatex-swiglib-test.jpg",1)
+
+gm.DestroyDrawingWand(drawing_wand)
+gm.DestroyMagickWand(magick_wand)
+\stoptyping
+
+Instead of loading a library with the \type {swiglib} function, you can also
+use \type {require}:
+
+\starttyping
+local gm = require("swiglib.gmwand.core")
+\stoptyping
+
+Watch the explicit \type {swiglib} reference. Both methods are equivalent.
+
+\stopsection
+
+\startsection[title={The libraries}]
+
+Most libraries are small but some can be rather large and have additional files.
+This is why we keep them separated. On my system they are collected in the
+platform binary tree:
+
+\starttyping
+e:/tex-context/tex/texmf-mswin/bin/lib/luatex/lua/swiglib/gmwand
+e:/tex-context/tex/texmf-mswin/bin/lib/luatex/lua/swiglib/mysql
+e:/tex-context/tex/texmf-mswin/bin/lib/luatex/lua/swiglib/....
+\stoptyping
+
+One can modulate on this:
+
+\starttyping
+...tex/texmf-mswin/bin/lib/luatex/lua/swiglib/mysql/core.dll
+...tex/texmf-mswin/bin/lib/luajittex/lua/swiglib/mysql/core.dll
+...tex/texmf-mswin/bin/lib/luatex/context/lua/swiglib/mysql/core.dll
+\stoptyping
+
+are all valid. When versions are used you can provide an additional argument to the
+\type {swiglib} loader:
+
+\starttyping
+tex/texmf-mswin/bin/lib/luatex/lua/swiglib/mysql/5.6/core.dll
+\stoptyping
+
+This works with:
+
+\starttyping
+local mysql = swiglib("mysql.core","5.6")
+\stoptyping
+
+as well as:
+
+\starttyping
+local mysql = swiglib("mysql.core")
+\stoptyping
+
+It is hard to predict how operating systems look up libraries and especially
+nested loads, but as long as the root of the \type {swiglib} path is known to the
+file search routine. We've kept the main conditions for success simple: the core
+library is called \type {core.dll} or \type {core.so}. Each library has an
+(automatically called) initialize function named \type {luaopen_core}. There is no
+reason why (sym)links from the \type {swiglib} path to someplace else shouldn't
+work.
+
+In \type {texmfcnf.lua} you will find an entry like:
+
+\starttyping
+CLUAINPUTS = ".;$SELFAUTOLOC/lib/{$engine/context,$engine}/lua//"
+\stoptyping
+
+Which in practice boils down to a search for \type {luatex} or \type {luajittex}
+specific libraries. When both binaries are compatible and there are no \type
+{luajittex} binaries, the regular \type {luatex} libraries will be used.
+
+The \type {swiglib} loader function mentioned in previous sections load libraries
+in a special way: it changes dir to the specific path and then loads the library
+in the usual way. After that it returns to the path where it started out. After
+this, when the library needs additional libraries (and for instance graphicmagick
+needs a lot of them) it will first look on its own path (which is remembered).
+
+The \MKIV\ lookups are somewhat more robust in the sense that they first check
+for matches on engine specific paths. This comes in handy when the search
+patterns are too generic and one can match on for instance \type {luajittex}
+while \type {luatex} is used.
+
+\stopsection
+
+\startsection[title=Colofon]
+
+\starttabulate[|B|p|]
+\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR
+\NC version \NC \currentdate \NC \NR
+\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR
+\NC comment \NC the swiglib infrastructure is implemented by Luigi Scarso \NC \NR
+\stoptabulate
+
+\stopsection
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/templates/templates-mkiv.tex b/doc/context/sources/general/manuals/templates/templates-mkiv.tex
new file mode 100644
index 000000000..01f2c429e
--- /dev/null
+++ b/doc/context/sources/general/manuals/templates/templates-mkiv.tex
@@ -0,0 +1,283 @@
+% language=uk
+
+% author : Hans Hagen
+% copyright : PRAGMA ADE & ConTeXt Development Team
+% license : Creative Commons Attribution ShareAlike 4.0 International
+% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
+% origin : the ConTeXt distribution
+%
+% comment : Because this manual is distributed with TeX distributions it comes with a rather
+% liberal license. We try to adapt these documents to upgrades in the (sub)systems
+% that they describe. Using parts of the content otherwise can therefore conflict
+% with existing functionality and we cannot be held responsible for that. Many of
+% the manuals contain characteristic graphics and personal notes or examples that
+% make no sense when used out-of-context.
+
+\usemodule[art-01,abr-02]
+
+\definecolor[maincolor] [r=.4]
+\definecolor[extracolor][b=.4]
+
+\setupbodyfont
+ [10pt]
+
+\usesymbols
+ [cc]
+
+\setuptyping
+ [color=extracolor]
+
+\setuptype
+ [color=extracolor]
+
+\setuphead
+ [section]
+ [color=maincolor]
+
+\setupinteraction
+ [hidden]
+
+\startdocument
+ [metadata:author=Hans Hagen,
+ metadata:title=LMX Templates,
+ author=Hans Hagen,
+ affiliation=PRAGMA ADE,
+ location=Hasselt NL,
+ title=LMX Templates,
+ extra-1=LMX,
+ extra-2=TEMPLATES,
+ extra-3=HANS HAGEN,
+ support=www.contextgarden.net,
+ website=www.pragma-ade.nl]
+
+\startMPpage
+
+ StartPage;
+
+ numeric n, m ; n := 3 * 4 ; m := 4 * 4 ;
+ numeric w, h ; w := PaperWidth/n ; h := PaperHeight/m ;
+ numeric max ; max := 20 ;
+
+ for i=1 upto n :
+ for j=1 upto m :
+ fill
+ unitsquare
+ xysized (w,h)
+ shifted ((i-1)*w,(j-1)*h)
+ withcolor (.5[red,blue] randomized(.75,.75,.75))
+ ;
+ endfor ;
+ endfor ;
+
+ path p ; p := Page enlarged -5mm ;
+
+ pair a[] ; % <
+
+ a[1] := .80[lrcorner p,urcorner p] ;
+ a[2] := .50[llcorner p,ulcorner p] ;
+ a[3] := .20[lrcorner p,urcorner p] ;
+
+ pair b[] ; % \
+
+ b[1] := ulcorner p ;
+ b[2] := center p ;
+ b[3] := lrcorner p ;
+
+ path c[] ; % from < (xml) to \ (tex)
+
+ c[1] := a[1] .. b[1] ;
+ c[2] := a[2] .. b[2] ;
+ c[3] := a[3] .. b[3] ;
+
+ linecap := butt ;
+
+ numeric fraction ;
+
+ for i=1 step 1 until max :
+ fraction := i/max ;
+ draw
+ ((point fraction along c[1]) -- (point fraction along c[2]) -- (point fraction along c[3]))
+ withpen pencircle scaled 5mm
+ withcolor .75[(max+1-i)*green/n,i*yellow/max]
+ withtransparency (1,.5)
+ ;
+ endfor ;
+
+ draw
+ textext.rt("\ssbf{\documentvariable{extra-1}}")
+ xsized (7w)
+ shifted (.8w,3h)
+ withcolor white
+ ;
+
+ draw
+ textext.rt("\ssbf{\documentvariable{extra-2}}")
+ xsized (8w)
+ shifted (w,h)
+ withcolor white
+ ;
+
+ draw
+ textext.ulft("\ssbf{\documentvariable{extra-3}}")
+ rotated 90
+ ysized (5.9h)
+ shifted (PaperWidth-1.2w,PaperHeight/2+2.95h)
+ withcolor white
+ ;
+
+ StopPage;
+
+\stopMPpage
+
+\startsubject[title={Contents}]
+
+\placelist[section][criterium=all,interaction=all]
+
+\stopsubject
+
+\startsection [title={Introduction}]
+
+{\em This manual is not finished yet. The main reason is that what is described
+here is an afternoon experiment resulting in a dozen lines of \LUA\ glue code
+that builds upon an already existing mechanism. When users like this, I will
+extend the basic \LMX\ handler to suit the \TEX\ end better. There will also be
+also support for cache based and in||document templates.)}
+
+The acronym \type {lmx} stands for document that are a mix of \LUA\ and \XML\ and
+is just the three letters \type {xml} reversed. Such documents showed up pretty
+soon in \MKIV\ while I was exploring ways to present debugging and error
+information to users using \XML. As a consequence this is one of the older
+mechanisms available, although I doubt if users start looking for it when they
+start using \CONTEXT.
+
+Anyhow, because we also use \LMX\ for populating web pages, at some point I wondered
+if using the same approach for \TEX\ files made sense. I'm still not sure about it
+but who knows where this ends up. Currently code is shared but in the future we might
+end up with a variant that adds some more flexibility.
+
+\stopsection
+
+\startsection [title={How it works}]
+
+First of all, using this mechanism involves yet another kind of \type {mk}, so
+now we have:
+
+\starttabulate[|TB||]
+\HL
+\NC mkii \NC The old version of \CONTEXT, using \PDFTEX,\XETEX, etc. \NC \NR
+\HL
+\NC mkiv \NC The new version of \CONTEXT, using \LUATEX. \NC \NR
+\NC mkvi \NC Similar to \MKIV\ but with named macro parameters. \NC \NR
+\HL
+\NC mkix \NC A \MKIV\ file mixed with \LUA\ wrapped in \XML\ processing instructions. \NC \NR
+\NC mkxi \NC Similar to \MKIX\ but with named macro parameters. \NC \NR
+\HL
+\stoptabulate
+
+The nice thing about sticking to wrapping in angle brackets is that it plays nice
+with syntax highlighting. Before we show an example of such a mix, we first point
+out that loading (and thereby conversion) happens automatically. A \type {mkix} or
+\type {mkxi} file is just a regular \CONTEXT\ file. In the test suite there
+is a demo file that can be included like this:
+
+\starttyping
+\input lmxlike-001.mkxi
+\stoptyping
+
+This file is loaded and converted on the fly. No caching takes place, but in due time
+we can use the cache built into the \LMX\ handlers if needed. The template itself
+can be fed with variables in the \type {document} namespace:
+
+\starttyping
+\starttext
+
+ \startluacode
+ document.variables.text = "set"
+ \stopluacode
+
+ \input lmxlike-001.mkxi
+
+\stoptext
+\stoptyping
+
+Instead of a special suffix, you can also force conversion with the \type {macros}
+directive:
+
+\starttyping
+% macros=mkix
+\stoptyping
+
+Part of the mentioned looks as follows:
+
+\starttyping
+\bTABLE
+ <?lua for i=1,40 do ?>
+ \bTR
+ <?lua for j=1,5 do ?>
+ \bTD
+ cell (<?lua inject(i) ?>,<?lua inject(j)?>)
+ is <?lua inject(variables.text or "unset") ?>
+ \eTD
+ <?lua end ?>
+ \eTR
+ <?lua end ?>
+\eTABLE
+\stoptyping
+
+The \type {<?lua ... ?>} command is conceptually different from (say) \type
+{\ctxlua} in the sense that the later executes some \LUA\ code at that spot,
+while in a template a \LUA\ function is constructed out of the whole that gets
+executed. In fact, we use \LUA\ to construct an input file.
+
+For the moment we only mention the predefined \type {inject} command. There are
+some more but they make more sense for \XML\ and \HTML\ and in due time this will
+be decoupled so that we can have dedicated helpers. Even the \XML\ and \HTML\
+part is somewhat in flux.
+
+The previous example can of course also be done differently. It's a matter of
+taste and usage what method gets used:
+
+\starttyping
+\startluacode
+ context.bTABLE()
+ for i=1,40 do
+ context.bTR()
+ for j=1,5 do
+ context.bTD()
+ context("cell (%s,%s) is %s",i,j,document.variables.text or "unset")
+ context.eTD()
+ end
+ context.eTR()
+ end
+ context.eTABLE()
+\stopluacode
+\stoptyping
+
+The difference between a \MKIX\ and \MKXI\ file is the same as between a \MKIV\
+and \MKVI\ file: the way macros can be defined:
+
+\starttyping
+\def\testmacro#one#two{[#one,#two]}
+
+\testmacro{1}{2}
+\testmacro{one}{two}
+\testmacro{second}{first}
+\stoptyping
+
+In practice one will seldom need macro definitions in a template file but the
+possibility is provided.
+
+\stopsection
+
+\startsubject[title={Colofon}]
+
+\starttabulate[|B|p|]
+\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR
+\NC version \NC \currentdate \NC \NR
+\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR
+\NC copyright \NC \symbol[cc][cc-by-sa-nc] \NC \NR
+\stoptabulate
+
+\stopsubject
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/tiptrick/tiptrick.tex b/doc/context/sources/general/manuals/tiptrick/tiptrick.tex
new file mode 100644
index 000000000..54a785134
--- /dev/null
+++ b/doc/context/sources/general/manuals/tiptrick/tiptrick.tex
@@ -0,0 +1,117 @@
+% interface=en
+%
+% author: Hans Hagen - Pragma ADE - www.pragma-ade.com
+
+\setupbodyfont
+ [dejavu]
+
+\setuppapersize
+ [HD-]
+
+\setuplayout
+ [location=middle,
+ header=0pt,
+ footer=0pt,
+ backspace=2.25cm,
+ topspace=2.25cm,
+ width=middle,
+ height=middle]
+
+\setupcolors
+ [state=start]
+
+\startreusableMPgraphic{page}
+ StartPage ;
+ picture p ; path s ;
+ fill Page withcolor .5red ;
+ draw Page withpen pensquare scaled 2cm withcolor .75[.5red,white] ;
+ s := (Field[Text][Text] enlarged .5cm) squeezed (.1cm,.15cm) ;
+ fill s withcolor .75[.5red,white] ;
+ if false :
+ p := image (graphictext "\ss TIP" withfillcolor .2white ;) ;
+ else :
+ p := textext.raw("\ss TIP") ;
+ setbounds p to (boundingbox p rightenlarged -0.025bbwidth(p)) ;
+ fi ;
+ p := p xysized(PaperWidth-1cm,PaperHeight-1cm) ;
+ p := p shifted .5(bbwidth(Page)-bbwidth(p),bbheight(Page)-bbheight(p)) ;
+ draw p withcolor .2white ;
+ clip p to s ;
+ draw p withcolor .875[.5red,white] ; ;
+ StopPage ;
+\stopreusableMPgraphic
+
+\defineoverlay
+ [page]
+ [\reuseMPgraphic{page}]
+
+\setupbackgrounds
+ [page]
+ [background=page,
+ state=repeat]
+
+\definecolor[red][r=.5]
+
+\setuphead
+ [chapter]
+ [style=\tfb,
+ before=,
+ after={\blank[line]}]
+
+\setupblank
+ [halfline]
+
+% xml interface
+
+\startxmlsetups xml:tips
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:tip
+ \startstandardmakeup
+ \startnamedsection[title][title=\xmlfirst{#1}{/title}]
+ \xmlall{#1}{/(remark|command)}
+ \vfill
+ \stopnamedsection
+ \stopstandardmakeup
+\stopxmlsetups
+
+\startxmlsetups xml:remark
+ \blank
+ \xmlflush{#1}
+ \blank
+\stopxmlsetups
+
+\definehighlight
+ [command]
+ [style=mono,
+ color=red,
+ command=no]
+
+\startxmlsetups xml:command
+ \blank
+ \starthighlight[command]
+ \xmlflush{#1}
+ \stophighlight
+ \blank
+\stopxmlsetups
+
+\startxmlsetups xml:reference
+ \vfill
+ \hfill\strut see:\space
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:initialize
+ \xmlsetsetup {#1} {
+ tips|tip|remark|command|reference
+ } {xml:*}
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{main}{xml:initialize}
+
+\starttext
+
+ \xmlprocessfile{main}{tiptrick.xml}{}
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/tiptrick/tiptrick.xml b/doc/context/sources/general/manuals/tiptrick/tiptrick.xml
new file mode 100644
index 000000000..8b4a30011
--- /dev/null
+++ b/doc/context/sources/general/manuals/tiptrick/tiptrick.xml
@@ -0,0 +1,53 @@
+<?xml version='1.0'?>
+
+<!-- author: Hans Hagen - Pragma ADE - www.pragma-ade.com -->
+
+<!-- feel free to submit more tips -->
+
+<tips xmlns="www.pragma-ade.com/schemas/tip.rng">
+
+ <tip>
+ <title>Generating Formats</title>
+ <remark>for all languages:</remark>
+ <command>context --make --all</command>
+ <remark>only english interface:</remark>
+ <command>context --make en</command>
+ <remark>for plain tex:</remark>
+ <command>mtxrun --script plain --make</command>
+ <!-- reference>mtexexec.pdf</reference -->
+ </tip>
+
+ <tip>
+ <title>Updating</title>
+ <remark>when installed from the wiki:</remark>
+ <command>..../first-setup(.cmd)</command>
+ <remark>when downloaded from the website:</remark>
+ <command>cd ..../tex/texmf-context</command>
+ <command>wget http://www.pragma-ade.com/context/current/cont-tmf.zip</command>
+ <command>unzip cont-tmf.zip</command>
+ <command>mtxrun --generate</command>
+ <!-- reference>minstall.pdf</reference -->
+ </tip>
+
+ <tip>
+ <title>Generating Command Lists</title>
+ <remark>quick reference document of english and dutch commands:</remark>
+ <command>context --interface=nl --global --result=setup-nl x-set-12.mkiv</command>
+ <command>context --interface=en --global --result=setup-en x-set-12.mkiv</command>
+ </tip>
+
+ <tip>
+ <title>Module Documentation</title>
+ <remark>pretty printed, annotated module documentation:</remark>
+ <command>mtxrun --script modules syst-aux.mkiv</command>
+ </tip>
+
+ <tip>
+ <title>Listings</title>
+ <remark>verbatim listings of (ascii) files:</remark>
+ <command>context --extra=listing --bodyfont=8pt --scite somefile.tex</command>
+ <command>context --extra=listing --bodyfont=8pt --scite somefile.lua</command>
+ <command>context --extra=listing --bodyfont=8pt --scite somefile.xml</command>
+ </tip>
+
+</tips>
diff --git a/doc/context/sources/general/manuals/tools/tools-mkiv.tex b/doc/context/sources/general/manuals/tools/tools-mkiv.tex
new file mode 100644
index 000000000..2ac1e15f4
--- /dev/null
+++ b/doc/context/sources/general/manuals/tools/tools-mkiv.tex
@@ -0,0 +1,511 @@
+% language=uk
+
+% author : Hans Hagen
+% copyright : PRAGMA ADE & ConTeXt Development Team
+% license : Creative Commons Attribution ShareAlike 4.0 International
+% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
+% origin : the ConTeXt distribution
+%
+% comment : Because this manual is distributed with TeX distributions it comes with a rather
+% liberal license. We try to adapt these documents to upgrades in the (sub)systems
+% that they describe. Using parts of the content otherwise can therefore conflict
+% with existing functionality and we cannot be held responsible for that. Many of
+% the manuals contain characteristic graphics and personal notes or examples that
+% make no sense when used out-of-context.
+
+\usemodule[abr-02]
+
+\setuplayout
+ [width=middle,
+ height=middle,
+ backspace=2cm,
+ topspace=1cm,
+ footer=0pt,
+ bottomspace=2cm]
+
+\definecolor
+ [DocumentColor]
+ [r=.5]
+
+\setuptype
+ [color=DocumentColor]
+
+\setuptyping
+ [color=DocumentColor]
+
+\usetypescript
+ [iwona]
+
+\setupbodyfont
+ [iwona]
+
+\setuphead
+ [chapter]
+ [style=\bfc,
+ color=DocumentColor]
+
+\setuphead
+ [section]
+ [style=\bfb,
+ color=DocumentColor]
+
+\setupinteraction
+ [hidden]
+
+\setupwhitespace
+ [big]
+
+\setupheadertexts
+ []
+
+\setupheadertexts
+ []
+ [{\DocumentColor \type {luatools mtxrun context}\quad\pagenumber}]
+
+\usesymbols[cc]
+
+\def\sTEXMFSTART{\type{texmfstart}}
+\def\sLUATOOLS {\type{luatools}}
+\def\sMTXRUN {\type{mtxrun}}
+\def\sCONTEXT {\type{context}}
+\def\sKPSEWHICH {\type{kpsewhich}}
+\def\sMKTEXLSR {\type{mktexlsr}}
+\def\sXSLTPROC {\type{xsltproc}}
+
+\usemodule[narrowtt]
+
+\startdocument
+ [metadata:author=Hans Hagen,
+ metadata:title={Tools: luatools, mtxrun, context},
+ author=Hans Hagen,
+ affiliation=PRAGMA ADE,
+ location=Hasselt NL,
+ title=Tools,
+ extra-1=luatools,
+ extra-2=mtxrun,
+ extra-3=context,
+ support=www.contextgarden.net,
+ website=www.pragma-ade.nl]
+
+\startMPpage
+ StartPage ;
+ picture p ; p := image (
+ for i=1 upto 21 :
+ for j=1 upto 30 :
+ drawarrow (fullcircle rotated uniformdeviate 360) scaled 10 shifted (i*15,j*15) ;
+ endfor ;
+ endfor ;
+ ) ;
+ p := p ysized (bbheight(Page)-4mm) ;
+ fill Page enlarged 2mm withcolor \MPcolor{DocumentColor} ;
+ draw p shifted (center Page - center p) withpen pencircle scaled 2 withcolor .5white ;
+ numeric dx ; dx := bbwidth(Page)/21 ;
+ numeric dy ; dy := bbheight(Page)/30 ;
+ p := textext("\tt\bf\white\getvariable{document}{extra-1}") xsized(14*dx) ;
+ p := p shifted (-lrcorner p) shifted lrcorner Page shifted (-1dx,8dy) ;
+ draw p ;
+ p := textext("\tt\bf\white\getvariable{document}{extra-2}") xsized(14*dx) ;
+ p := p shifted (-lrcorner p) shifted lrcorner Page shifted (-1dx,5dy) ;
+ draw p ;
+ p := textext("\tt\bf\white\getvariable{document}{extra-3}") xsized(14*dx) ;
+ p := p shifted (-lrcorner p) shifted lrcorner Page shifted (-1dx,2dy) ;
+ draw p ;
+ setbounds currentpicture to Page ;
+ StopPage
+\stopMPpage
+
+\startsubject[title=Contents]
+
+\placelist[section][alternative=a]
+
+\stopsubject
+
+\startsection[title={Remark}]
+
+This manual is work in progress. Feel free to submit additions or corrections.
+Before you start reading, it is good to know that in order to get starting with
+\CONTEXT, the easiest way to do that is to download the standalone distribution
+from \type {contextgarden.net}. After that you only need to make sure that \type
+{luatex} is in your path. The main command you use is then \type {context} and
+normally it does all the magic it needs itself.
+
+\stopsection
+
+\startsection[title={Introduction}]
+
+Right from the start \CONTEXT\ came with programs that managed the process of
+\TEX-ing. Although you can perfectly well run \TEX\ directly, it is a fact that
+often multiple runs are needed as well as that registers need to be sorted.
+Therefore managing a job makes sense.
+
+First we had \TEXEXEC\ and \TEXUTIL, and both were written in \MODULA, and as
+this language was not supported on all platforms the programs were rewritten in
+\PERL. Following that a few more tools were shipped with \CONTEXT.
+
+When we moved on to \RUBY\ all the \PERL\ scripts were rewritten and when
+\CONTEXT\ \MKIV\ showed up, \LUA\ replaced \RUBY. As we use \LUATEX\ this means
+that currently the tools and the main program share the same language. For \MKII\
+scripts like \TEXEXEC\ will stay around but the idea is that there will be \LUA\
+alternatives for them as well.
+
+Because we shipped many scripts, and because the de facto standard \TEX\
+directory structure expects scripts to be in certain locations we not only ship
+tools but also some more generic scripts that locate and run these tools.
+
+\stopsection
+
+\startsection[title={The location}]
+
+Normally you don't need to know so many details about where the scripts
+are located but here they are:
+
+\starttyping
+<texroot>/scripts/context/perl
+<texroot>/scripts/context/ruby
+<texroot>/scripts/context/lua
+<texroot>/scripts/context/stubs
+\stoptyping
+
+This hierarchy was actually introduced because \CONTEXT\ was shipped with a bunch
+of tools. As mentioned, we nowadays focus on \LUA\ but we keep a few of the older
+scripts around in the \PERL\ and \RUBY\ paths.Now, if you're only using \CONTEXT\
+\MKIV, and this is highly recommended, you can forget about all but the \LUA\
+scripts.
+
+\stopsection
+
+\startsection[title={The traditional finder}]
+
+When you run scripts multiple times, and in the case of \CONTEXT\ they are even
+run inside other scripts, you want to minimize the startup time. Unfortunately
+the traditional way to locate a script, using \sKPSEWHICH, is not that fast,
+especially in a setup with many large trees Also, because not all tasks can be
+done with the traditional scripts (take format generation) we provided a runner
+that could deal with this: \sTEXMFSTART. As this script was also used in more
+complex workflows, it had several tasks:
+
+\startitemize[packed]
+\item locate scripts in the distribution and run them using the right
+ interpreter
+\item do this selectively, for instance identify the need for a run using
+ checksums for potentially changed files (handy for image conversion)
+\item pass information to child processes so that lookups are avoided
+\item choose a distribution among several installed versions (set the root
+ of the \TEX\ tree)
+\item change the working directory before running the script
+\item resolve paths and names on demand and launch programs with arguments
+ where names are expanded controlled by prefixes (handy for
+ \TEX-unware programs)
+\item locate and open documentation, mostly as part the help systems in
+ editors, but also handy for seeing what configuration file is used
+\item act as a \KPSEWHICH\ server cq.\ client (only used in special cases,
+ and using its own database)
+\stopitemize
+
+Of course there were the usual more obscure and undocumented features as
+well. The idea was to use this runner as follows:
+
+\starttyping
+texmfstart texexec <further arguments>
+texmfstart --tree <rootoftree> texexec <further arguments>
+\stoptyping
+
+These are just two ways of calling this program. As \sTEXMFSTART\ can initialize
+the environment as well, it is basically the only script that has to be present
+in the binary path. This is quite comfortable as this avoids conflicts in names
+between the called scripts and other installed programs.
+
+Of course calls like above can be wrapped in a shell script or batch file without
+penalty as long as \sTEXMFSTART\ itself is not wrapped in a caller script that
+applies other inefficient lookups. If you use the \CONTEXT\ minimals you can be
+sure that the most efficient method is chosen, but we've seen quite inefficient
+call chains elsewhere.
+
+In the \CONTEXT\ minimals this script has been replaced by the one we will
+discuss in the next section: \sMTXRUN\ but a stub is still provided.
+
+\stopsection
+
+\startsection[title={The current finder}]
+
+In \MKIV\ we went a step further and completely abandoned the traditional lookup
+methods and do everything in \LUA. As we want a clear separation between
+functionality we have two main controlling scripts: \sMTXRUN\ and \sLUATOOLS. The
+last name may look somewhat confusing but the name is just one on in a series.
+\footnote {We have \type {ctxtools}, \type {exatools}, \type {mpstools}, \type
+{mtxtools}, \type {pdftools}, \type {rlxtools}, \type {runtools}, \type
+{textools}, \type {tmftools} and \type {xmltools}. Most if their funtionality is
+already reimplemented.}
+
+In \MKIV\ the \sLUATOOLS\ program is nowadays seldom used. It's just a drop in
+for \sKPSEWHICH\ plus a bit more. In that respect it's rather dumb in that it
+does not use the database, but clever at the same time because it can make one
+based on the little information available when it runs. It can also be used to
+generate format files either or not using \LUA\ stubs but in practice this is not
+needed at all.
+
+For \CONTEXT\ users, the main invocation of this tool is when the \TEX\ tree is
+updated. For instance, after adding a font to the tree or after updating
+\CONTEXT, you need to run:
+
+\starttyping
+mtxrun --generate
+\stoptyping
+
+After that all tools will know where to find stuff and how to behave well within
+the tree. This is because they share the same code, mostly because they are
+started using \sMTXRUN. For instance, you process a file with:
+
+\starttyping
+mtxrun --script context <somefile>
+\stoptyping
+
+Because this happens often, there's also a shortcut:
+
+\starttyping
+context <somefile>
+\stoptyping
+
+But this does use \sMTXRUN\ as well. The help information of \sMTXRUN\ is rather
+minimalistic and if you have no clue what an option does, you probably never
+needed it anyway. Here we discuss a few options. We already saw that we can
+explicitly ask for a script:
+
+\starttyping
+mtxrun --script context <somefile>
+\stoptyping
+
+but
+
+\starttyping
+mtxrun context <somefile>
+\stoptyping
+
+also works. However, by using \type {--script} you limit te lookup to the valid
+\CONTEXT\ \MKIV\ scripts. In the \TEX\ tree these have names prefixed by \type
+{mtx-} and a lookup look for a plural as well. So, the next two lookups are
+equivalent:
+
+\starttyping
+mtxrun --script font
+mtxrun --script fonts
+\stoptyping
+
+Both will run \type {mtx-fonts.lua}. Actually, this is one of the scripts that
+you might need when your font database is somehow outdated and not updated
+automatically:
+
+\starttyping
+mtxrun --script fonts --reload --force
+\stoptyping
+
+Normally \sMTXRUN\ is all you need in order to run a script. However, there are a
+few more options:
+
+\ctxlua{os.execute("mtxrun > tools-mkiv-help.tmp")}
+
+\typefile[ntyping]{tools-mkiv-help.tmp}
+
+Don't worry,you only need those obscure features when you integrate \CONTEXT\ in
+for instance a web service or when you run large projects where runs and paths
+take special care.
+
+\stopsection
+
+\startsection[title={Updating}]
+
+There are two ways to update \CONTEXT\ \MKIV. When you manage your
+trees yourself or when you use for instance \TEXLIVE, you act as
+follows:
+
+\startitemize[packed]
+\item download the file cont-tmf.zip from \type {www.pragma-ade.com} or elsewhere
+\item unzip this file in a subtree, for instance \type {tex/texmf-local}
+\item run \type {mtxrun --generate}
+\item run \type {mtxrun --script font --reload}
+\item run \type {mtxrun --script context --make}
+\stopitemize
+
+Or shorter:
+
+\startitemize[packed]
+\item run \type {mtxrun --generate}
+\item run \type {mtxrun font --reload}
+\item run \type {context --make}
+\stopitemize
+
+Normally these commands are not even needed, but they are a nice test if your
+tree is still okay. To some extend \sCONTEXT\ is clever enough to decide if the
+databases need to be regenerated and|/|or a format needs to be remade and|/|or if
+a new font database is needed.
+
+Now, if you also want to run \MKII, you need to add:
+
+\startitemize[packed]
+\item run \type {mktexlsr}
+\item run \type {texexec --make}
+\stopitemize
+
+The question is, how to act when \sLUATOOLS\ and \sMTXRUN\ have been updated
+themselves? In that case, after unzipping the archive, you need to do the
+following:
+
+\startitemize[packed]
+\item run \type {luatools --selfupdate}
+\item run \type {mtxrun --selfupdate}
+\stopitemize
+
+For quite a while we shipped so called \CONTEXT\ minimals. These zip files
+contained only the resources and programs that made sense for running \CONTEXT.
+Nowadays the minimals are installed and synchronized via internet. \footnote
+{This project was triggered by Mojca Miklavec who is also charge of this bit of
+the \CONTEXT\ infrastructure. More information can be found at \type
+{contextgarden.net}.} You can just run the installer again and no additional
+commands are needed. In the console you will see several calls to \sMTXRUN\ and
+\sLUATOOLS\ fly by.
+
+\stopsection
+
+\startsection[title={The tools}]
+
+We only mention the tools here. The most important ones are \sCONTEXT\ and \type
+{fonts}. You can ask for a list of installed scripts with:
+
+\starttyping
+mtxrun --script
+\stoptyping
+
+On my machine this gives:
+
+\ctxlua{os.execute("mtxrun --script > tools-mkiv-help.tmp")}
+
+\typefile[ntyping]{tools-mkiv-help.tmp}
+
+The most important scripts are \type {mtx-fonts} and \type {mtx-context}. By
+default fonts are looked up by filename (the \type {file:} prefix before font
+names in \CONTEXT\ is default). But you can also lookup fonts by name (\type
+{name:}) or by specification (\type {spec:}). If you want to use these two
+methods, you need to generate a font database as mentioned in the previous
+section. You can also use the font tool to get information about the fonts
+installed on your system.
+
+\stopsection
+
+\startsection[title={Running \CONTEXT}]
+
+The \sCONTEXT\ tool is what you will use most as it manages your
+run.
+
+\ctxlua{os.execute("context > tools-mkiv-help.tmp")}
+
+\typefile[ntyping]{tools-mkiv-help.tmp}
+
+There are few exert options too:
+
+\ctxlua{os.execute("context --expert > tools-mkiv-help.tmp")}
+
+\typefile[ntyping]{tools-mkiv-help.tmp}
+
+You might as well forget about these unless you are one of the
+\CONTEXT\ developers.
+
+\stopsection
+
+\startsection[title={Prefixes}]
+
+A handy feature of \sMTXRUN\ (and as most features an inheritance of
+\sTEXMFSTART) is that it will resolve prefixed arguments. This can be of help
+when you run programs that are unaware of the \TEX\ tree but nevertheless need to
+locate files in it.
+
+\ctxlua{os.execute("mtxrun --prefixes > tools-mkiv-help.tmp")}
+
+\typefile[ntyping]{tools-mkiv-help.tmp}
+
+An example is:
+
+\starttyping
+mtxrun --execute xsltproc file:whatever.xsl file:whatever.xml
+\stoptyping
+
+The call to \sXSLTPROC\ will get two arguments, being the complete path to the
+files (given that it can be resolved). This permits you to organize the files in
+a similar was as \TEX\ files.
+
+\stopsection
+
+\startsection[title={Stubs}]
+
+As the tools are written in the \LUA\ language we need a \LUA\ interpreter and or
+course we use \LUATEX\ itself. On \UNIX\ we can copy \sLUATOOLS\ and \sMTXRUN\ to
+files in the binary path with the same name but without suffix. Starting them in
+another way is a waste of time, especially when \sKPSEWHICH\ is used to find
+then, something which is useless in \MKIV\ anyway. Just use these scripts
+directly as they are self contained.
+
+For \sCONTEXT\ and other scripts that we want convenient access to, stubs are
+needed, like:
+
+\starttyping
+#!/bin/sh
+mtxrun --script context "$@"
+\stoptyping
+
+This is also quite efficient as the \sCONTEXT\ script \type {mtx-context} is
+loaded in \sMTXRUN\ and uses the same database.
+
+On \WINDOWS\ you can copy the scripts as|-|is and associate the suffix with
+\LUATEX\ (or more precisely: \type {texlua}) but then all \LUA\ script will be
+run that way which is not what you might want.
+
+In \TEXLIVE\ stubs for starting scripts were introduced by Fabrice Popineau. Such
+a stub would start for instance \sTEXMFSTART, that is: it located the script
+(\PERL\ or \RUBY) in the \TEX\ tree and launched it with the right interpreter.
+Later we shipped pseudo binaries of \sTEXMFSTART: a \RUBY\ interpreter plus
+scripts wrapped into a self contained binary.
+
+For \MKIV\ we don't need such methods and started with simple batch files,
+similar to the \UNIX\ startup scripts. However, these have the disadvantage that
+they cannot be used in other batch files without using the \type {start} command.
+In \TEXLIVE\ this is taken care of by a small binary written bij T.M.\ Trzeciak
+so on \TEXLIVE\ 2009 we saw a call chain from \type {exe} to \type {cmd} to \type
+{lua} which is somewhat messy.
+
+This is why we now use an adapted and stripped down version of that program that
+is tuned for \sMTXRUN, \sLUATOOLS\ and \sCONTEXT. So, we moved from the original
+\type {cmd} based approach to an \type {exe} one.
+
+\starttyping
+mtxrun.dll
+mtxrun.exe
+\stoptyping
+
+You can copy \type {mtxrun.exe} to for instance \type {context.exe} and it will
+still use \sMTXRUN\ for locating the right script. It also takes care of mapping
+\sTEXMFSTART\ to \sMTXRUN. So we've removed the intermediate \type {cmd} step,
+can not run the script as any program, and most of all, we're as efficient as can
+be.
+
+Of course this program is only meaningful for the \CONTEXT\ approach to tools.
+
+It may all sound more complex than it is but once it works users will not notice
+those details. Als, in practice not that much has changed in running the tools
+between \MKII\ and \MKIV\ as we've seen no reason to change the methods.
+
+\stopsection
+
+\startsubject[title={Colofon}]
+
+\starttabulate[|B|p|]
+ \NC author \NC \documentvariable{author},
+ \documentvariable{affiliation},
+ \documentvariable{location} \NC \NR
+ \NC version \NC \currentdate \NC \NR
+ \NC website \NC \documentvariable{website} \endash\
+ \documentvariable{support} \NC \NR
+ \NC copyright \NC \symbol[cc][cc-by-sa-nc] \NC \NR
+\stoptabulate
+
+\stopsubject
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/units/units-mkiv.tex b/doc/context/sources/general/manuals/units/units-mkiv.tex
new file mode 100644
index 000000000..0d91c67df
--- /dev/null
+++ b/doc/context/sources/general/manuals/units/units-mkiv.tex
@@ -0,0 +1,538 @@
+% language=uk
+
+\usemodule[art-01,abr-02,physics-units]
+
+\definecolor[red] [darkred]
+\definecolor[green] [darkgreen]
+\definecolor[blue] [darkblue]
+\definecolor[yellow] [darkyellow]
+\definecolor[magenta][darkmagenta]
+\definecolor[cyan] [darkcyan]
+
+\definecolor[maincolor] [darkcyan]
+\definecolor[extracolor][darkmagenta]
+
+\setupbodyfont
+ [10pt]
+
+\setuptyping
+ [color=extracolor]
+
+\setuptype
+ [color=extracolor] % darkyellow
+
+% \setupnumbering
+% [alternative=doublesided]
+
+\setupinteraction
+ [hidden]
+
+\setuphead
+ [section]
+ [color=maincolor]
+
+\usesymbols[cc]
+
+\startdocument
+ [metadata:author=Hans Hagen,
+ metadata:title=Units,
+ author=Hans Hagen,
+ affiliation=PRAGMA ADE,
+ location=Hasselt NL,
+ title=Units,
+ extra=ConTeXt MkIV,
+ support=www.contextgarden.net,
+ website=www.pragma-ade.nl]
+
+\unexpanded\def\UnitsHack#1#2%
+ {\setbox\scratchbox\hbox{\bf\strut#1#2/}% kerning and such
+ \hbox to \wd\scratchbox{\bf\strut#1\hss/\hss#2}}
+
+\startMPpage
+
+ StartPage ;
+ fill Page enlarged 2mm withcolor \MPcolor{darkcyan} ;
+ pickup pencircle scaled 2mm ;
+ picture p, q, r ;
+ p := textext("\ssbf\WORD{\documentvariable{title}}") xsized (bbheight Page - 2cm) rotated 90 ;
+ q := textext("\ssbf\WORD{\documentvariable{author}}") ysized 1cm ;
+ r := textext("\ssbf\WORD{\documentvariable{extra}}") xsized bbwidth q ;
+ draw anchored.rt (p, center rightboundary Page shifted (-1cm, 0mm)) withcolor white ;
+ draw anchored.lft(q, ulcorner Page shifted ( 1cm, -84mm)) withcolor white ; % \MPcolor{darkred} ;
+ draw anchored.lft(r, ulcorner Page shifted ( 1cm,-108mm)) withcolor white ; % \MPcolor{darkred} ;
+ StopPage ;
+
+\stopMPpage
+
+% \page[empty] \setuppagenumber[start=1]
+
+\startsubject[title={Contents}]
+
+\placelist[section][criterium=all,interaction=all]
+
+\stopsubject
+
+\startsection[title={Introduction}]
+
+In \CONTEXT\ \MKII\ there is a module that implements consistent
+typesetting of units (quantities and dimensions). In \MKIV\ this
+functionality is now part of the physics core modules. This is
+also one of the mechanisms that got a new user interface: instead
+of using commands we now parse text. Thanks to those users who
+provided input we're more complete now that in \MKII. You can browse
+the mailing list archive to get some sense of history.
+
+\stopsection
+
+\startsection[title={The main command}]
+
+The core command is \type {\unit}. The argument to this command gets
+parsed and converted into a properly typeset dimension. Normally there
+will be a quantity in front.
+
+\starttabulate
+\NC \type{10 meter} \NC \unit{10 meter} \NC \NR
+\NC \type{10 meter per second} \NC \unit{10 meter per second} \NC \NR
+\NC \type{10 square meter per second} \NC \unit{10 square meter per second} \NC \NR
+\stoptabulate
+
+The parser knows about special cases, like synonyms:
+
+\starttabulate
+\NC \type{10 degree celsius} \NC \unit{10 degree celsius} \NC \NR
+\NC \type{10 degrees celsius} \NC \unit{10 degrees celsius} \NC \NR
+\NC \type{10 celsius} \NC \unit{10 celsius} \NC \NR
+\stoptabulate
+
+The units can be rather complex, for example:
+
+\startbuffer
+\unit{30 kilo pascal square meter / second kelvin}
+\stopbuffer
+
+\typebuffer
+
+This comes out as: \ignorespaces\getbuffer\removeunwantedspaces. Depending
+on the unit at had, recognition is quite flexible. The following variants
+all work out ok.
+
+\starttabulate
+\NC \type{10 kilogram} \NC \unit{10 kilogram} \NC \NR
+\NC \type{10 kilo gram} \NC \unit{10 kilo gram} \NC \NR
+\NC \type{10 k gram} \NC \unit{10 k gram} \NC \NR
+\NC \type{10 kilo g} \NC \unit{10 kilo g} \NC \NR
+\NC \type{10 k g} \NC \unit{10 k g} \NC \NR
+\NC \type{10 kg} \NC \unit{10 kg} \NC \NR
+\NC \type{10 kilog} \NC \unit{10 kilog} \NC \NR
+\NC \type{10 kgram} \NC \unit{10 kgram} \NC \NR
+\stoptabulate
+
+Of course being consistent makes sense, so normally you will use
+a consistent mix of short or long keywords.
+
+You can provide a qualifier that gets lowered and appended to
+the preceding unit.
+
+\startbuffer
+\unit{112 decibel (A)}
+\stopbuffer
+
+\typebuffer
+
+This gives: \ignorespaces\getbuffer\removeunwantedspaces. Combinations
+are also possible:
+
+\starttabulate
+\NC \type{5 watt per meter celsius} \NC \unit{5 watt per meter celsius} \NC \NR
+\NC \type{5 watt per meter degrees celsius} \NC \unit{5 watt per meter degrees celsius} \NC \NR
+\NC \type{5 watt per meter kelvin} \NC \unit{5 watt per meter kelvin} \NC \NR
+\NC \type{5 watt per meter per kelvin} \NC \unit{5 watt per meter per kelvin} \NC \NR
+\NC \type{10 arcminute} \NC \unit{10 arcminute} \NC \NR
+\NC \type{10 arcminute 20 arcsecond} \NC \unit{10 arcminute 20 arcsecond} \NC \NR
+\stoptabulate
+
+\stopsection
+
+\startsection[title={Extra units}]
+
+To some extent units can be tuned. You can for instance
+influence the spacing between a number and a unit:
+
+\startbuffer
+ \unit{35 kilogram per cubic meter}
+\setupunit[space=normal] \unit{35 kilogram per cubic meter}
+\setupunit[space=big] \unit{35 kilogram per cubic meter}
+\setupunit[space=medium] \unit{35 kilogram per cubic meter}
+\setupunit[space=small] \unit{35 kilogram per cubic meter}
+\setupunit[space=none] \unit{35 kilogram per cubic meter}
+\stopbuffer
+
+\typebuffer
+
+Of course no spacing looks rather bad:
+
+\startlines
+\getbuffer
+\stoplines
+
+Another parameter is \type {separator}. In order to demonstrate
+this we define an extra unit command:
+
+\startbuffer
+\defineunit[sunit][separator=small]
+\defineunit[nunit][separator=none]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We now have two more commands:
+
+\startbuffer
+\unit {35 kilogram cubic meter}
+\sunit{35 kilogram cubic meter}
+\nunit{35 kilogram cubic meter}
+\stopbuffer
+
+\typebuffer
+
+These three commands give different results:
+
+\startlines
+\getbuffer
+\stoplines
+
+Valid separators are \type {normal}, \type {big}, \type {medium},
+\type {small}, \type {none}. You can let units stand out by
+applying color or a specific style.
+
+\startbuffer
+\setupunit[style=\bi,color=maincolor]
+\unit{10 square meter per second}
+\stopbuffer
+
+\typebuffer
+
+Keep in mind that all defined units inherit from their parent
+definition unless they are set up themselves.
+
+\start \blank \getbuffer \blank \stop
+
+To some extent you can control rendering in text and math mode. As
+an example we define an extra instance.
+
+\startbuffer
+\defineunit[textunit][alternative=text]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+test \unit {10 cubic meter per second} test
+test \textunit{10 cubic meter per second} test
+test $\unit {10 cubic meter per second}$ test
+test $\textunit{10 cubic meter per second}$ test
+test 10 \unit {cubic meter per second} test
+test 10 \textunit{cubic meter per second} test
+test $10 \unit {cubic meter per second}$ test
+test $10 \textunit{cubic meter per second}$ test
+\stopbuffer
+
+\typebuffer
+
+\startlines
+\getbuffer
+\stoplines
+
+\stopsection
+
+\startsection[title={Labels}]
+
+The units, prefixes and operators are typeset using the label
+mechanism which means that they can be made to adapt to a language
+and|/|or adapted. Instead of language specific labels you can also
+introduce mappings that don't relate to a language at all. As an
+example we define some bogus mapping.
+
+\startbuffer
+\setupunittext
+ [whatever]
+ [meter=retem,
+ second=dnoces]
+
+\setupprefixtext
+ [whatever]
+ [kilo=olik]
+
+\setupoperatortext
+ [whatever]
+ [solidus={ rep }]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Such a mapping can be partial and the current language will
+be the default fallback and itselfs falls back on the English
+language mapping.
+
+\startbuffer
+\unit{10 km/s}
+\unit{10 Kilo Meter/s}
+\unit{10 kilo Meter/s}
+\unit{10 Kilo m/s}
+\unit{10 k Meter/s}
+\stopbuffer
+
+\typebuffer
+
+When we typeset this we get the normal rendering:
+
+\startlines
+\getbuffer
+\stoplines
+
+However, when we change the language parameter, we get
+a different result:
+
+\startlines
+\setupunit[language=whatever]\getbuffer
+\stoplines
+
+The alternative rendering is set up as follows:
+
+\starttyping
+\setupunit[language=whatever]
+\stoptyping
+
+You can also decide to use a special instance of units:
+
+\starttyping
+\defineunit[wunit][language=whatever]
+\stoptyping
+
+This will define the \type {\wunit} command and leave the original
+\type {\unit} command untouched.
+
+\stopsection
+
+\startsection[title={Digits}]
+
+In addition to units we have digits. These can be used independently
+but the same functionality is also integrated in the unit commands.
+The main purpose of this command is formatting in tables, of which
+we give an example below.
+
+\starttabulate[|l|r|]
+\NC \type{12,345.67 kilogram} \NC \unit{12,345.67 kilogram} \NR
+\NC \type{__,__1.23 kilogram} \NC \unit{__,__1.23 kilogram} \NR
+\NC \type{__,___.12 kilogram} \NC \unit{__,___.12 kilogram} \NR
+\NC \type{__,__1.== kilogram} \NC \unit{__,__1.== kilogram} \NR
+\NC \type{__,___:23 kilogram} \NC \unit{__,___:23 kilogram} \NR
+\stoptabulate
+
+The \type {_} character serves as placeholders. There are some
+assumptions to how numbers are constructed. In principe the input
+assumes a comma to separate thousands and a period to separate the
+fraction.
+
+\getbuffer
+
+You can swap periods and commas in the output. In fact there are a
+few methods available. For instance we can separate the thousands
+with a small space instead of a symbol.
+
+\startbuffer
+\starttabulate[|c|r|r|]
+\HL
+\NC 0 \NC \setupunit[method=0]\unit{00,000.10 kilogram}
+ \NC \setupunit[method=0]\unit{@@,@@0.10 kilogram} \NC \NR
+\NC 1 \NC \setupunit[method=1]\unit{00,000.10 kilogram}
+ \NC \setupunit[method=1]\unit{@@,@@0.10 kilogram} \NC \NR
+\NC 2 \NC \setupunit[method=2]\unit{00,000.10 kilogram}
+ \NC \setupunit[method=2]\unit{@@,@@0.10 kilogram} \NC \NR
+\NC 3 \NC \setupunit[method=3]\unit{00,000.10 kilogram}
+ \NC \setupunit[method=3]\unit{@@,@@0.10 kilogram} \NC \NR
+\NC 4 \NC \setupunit[method=4]\unit{00,000.10 kilogram}
+ \NC \setupunit[method=4]\unit{@@,@@0.10 kilogram} \NC \NR
+\NC 5 \NC \setupunit[method=5]\unit{00,000.10 kilogram}
+ \NC \setupunit[method=5]\unit{@@,@@0.10 kilogram} \NC \NR
+\NC 6 \NC \setupunit[method=6]\unit{00,000.10 kilogram}
+ \NC \setupunit[method=6]\unit{@@,@@0.10 kilogram} \NC \NR
+\HL
+\stoptabulate
+\stopbuffer
+
+\typebuffer % [bodyfont=9pt]
+
+\getbuffer
+
+The digit modes can be summarized as::
+
+\startitemize[n,packed]
+\item periods/comma
+\item commas/period
+\item thinmuskips/comma
+\item thinmuskips/period
+\item thickmuskips/comma
+\item thickmuskips/period
+\stopitemize
+
+You can reverse the order of commas and period in the input by
+setting the parameter \type {order} to \type {reverse}.
+
+The digit parser handles a bunch of special characters as
+well as different formats. We strongly suggest you to use
+the grouped call.
+
+\starttabulate[|l|l|l|]
+\NC \type{.} \NC , . \NC comma or period \NC \NR
+\NC \type{,} \NC , . \NC comma or period \NC \NR
+\NC \type{:} \NC \NC invisible period \NC \NR
+\NC \type{;} \NC \NC invisible comma \NC \NR
+\NC \type{_} \NC \NC invisible space \NC \NR
+\NC \type{/} \NC \NC invisible sign \NC \NR
+\NC \type{-} \NC $-$ \NC minus sign \NC \NR
+\NC \type{+} \NC $+$ \NC plus sign \NC \NR
+\NC \type{//} \NC \NC invisible high sign \NC \NR
+\NC \type{--} \NC $\negative$ \NC high minus sign \NC \NR
+\NC \type{++} \NC $\positive$ \NC high plus sign \NC \NR
+\NC \type{=} \NC $\zeroamount$ \NC zero padding \NC \NR
+\stoptabulate
+
+Let's give some examples:
+
+\starttabulate[|l|r|]
+\NC \type{1} \NC \ruledhbox{\strut\digits{1}} \NC \NR
+\NC \type{12} \NC \ruledhbox{\strut\digits{12}} \NC \NR
+\NC \type{12.34} \NC \ruledhbox{\strut\digits{12.34}} \NC \NR
+\NC \type{123,456} \NC \ruledhbox{\strut\digits{123,456}} \NC \NR
+\NC \type{123,456.78} \NC \ruledhbox{\strut\digits{123,456.78}} \NC \NR
+\NC \type{12,34} \NC \ruledhbox{\strut\digits{12,34}} \NC \NR
+\NC \type{.1234} \NC \ruledhbox{\strut\digits{.1234}} \NC \NR
+\NC \type{1234} \NC \ruledhbox{\strut\digits{1234}} \NC \NR
+\NC \type{123,456.78^9} \NC \ruledhbox{\strut\digits{123,456.78^9}} \NC \NR
+\NC \type{123,456.78e9} \NC \ruledhbox{\strut\digits{123,456.78e9}} \NC \NR
+\NC \type{/123,456.78e-9} \NC \ruledhbox{\strut\digits{/123,456.78e-9}} \NC \NR
+\NC \type{-123,456.78e-9} \NC \ruledhbox{\strut\digits{-123,456.78e-9}} \NC \NR
+\NC \type{+123,456.78e-9} \NC \ruledhbox{\strut\digits{+123,456.78e-9}} \NC \NR
+\NC \type{//123,456.78e-9} \NC \ruledhbox{\strut\digits{//123,456.78e-9}} \NC \NR
+\NC \type{--123,456.78e-9} \NC \ruledhbox{\strut\digits{--123,456.78e-9}} \NC \NR
+\NC \type{++123,456.78e-9} \NC \ruledhbox{\strut\digits{++123,456.78e-9}} \NC \NR
+\NC \type{___,___,123,456,789.00} \NC \ruledhbox{\strut\digits{___,___,123,456,789.00}} \NC \NR
+\NC \type{___,___,_12,345,678.==} \NC \ruledhbox{\strut\digits{___,___,_12,345,678.==}} \NC \NR
+\stoptabulate
+
+\stopsection
+
+\startsection[title={Adding units}]
+
+It is possible to add extra snippets. This is a two step process:
+first some snippet is defined, next a proper label is set up. In the
+next example we define a couple of \TEX\ dimensions:
+
+\startbuffer
+\registerunit
+ [unit]
+ [point=point,
+ basepoint=basepoint,
+ scaledpoint=scaledpoint,
+ didot=didot,
+ cicero=cicero]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Possible categories are: \type {prefix}, \type {unit}, \type {operator},
+\type {suffix}, \type {symbol},\type {packaged}. Next we define labels:
+
+\startbuffer
+\setupunittext
+ [point=pt,
+ basepoint=bp,
+ scaledpoint=sp,
+ didot=dd,
+ cicero=cc]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Now we can use use these:
+
+\startbuffer
+\unit{10 point / second}
+\stopbuffer
+
+\typebuffer
+
+Of course you can wonder what this means.
+
+\blank \getbuffer \blank
+
+When no label is defined the long name is used:
+
+\startbuffer
+\registerunit
+ [unit]
+ [page=page]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+This is used as:
+
+\startbuffer
+\unit{10 point / page}
+\stopbuffer
+
+\typebuffer
+
+Which gives:
+
+\blank \getbuffer \blank
+
+\stopsection
+
+\startsection[title={Built in keywords}]
+
+A given sequence of keywords is translated in an list of internal
+keywords. For instance \type {m}, \type {Meter} and \type {meter}
+all become \type {meter} and that one is used when resolving a
+label. In the next tables the right column mentions the internal
+keyword. The right column shows the Cased variant, but a lowercase
+one is built|-|in as well.
+
+The following prefixes are built|-|in:
+
+\showunits[prefixes]
+
+The following units are supported, including some combinations:
+
+\showunits[units]
+
+The amount of operators is small:
+
+\showunits[operators]
+
+There is also a small set of (names) suffixes:
+
+\showunits[suffixes]
+
+Some symbols get a special treatment:
+
+\showunits[symbols]
+
+These are also special:
+
+\showunits[packaged]
+
+\startsection[title={Colofon}]
+
+\starttabulate[|B|p|]
+\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR
+\NC version \NC \currentdate \NC \NR
+\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR
+\NC copyright \NC \symbol[cc][cc-by-sa-nc] \NC \NR
+\stoptabulate
+
+\stopsection
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/workflows/workflows-contents.tex b/doc/context/sources/general/manuals/workflows/workflows-contents.tex
new file mode 100644
index 000000000..a32f4737d
--- /dev/null
+++ b/doc/context/sources/general/manuals/workflows/workflows-contents.tex
@@ -0,0 +1,13 @@
+% language=uk
+
+\environment workflows-style
+
+\startcomponent workflows-contents
+
+\starttitle[title=Contents]
+
+ \placelist[chapter]
+
+\stoptitle
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/workflows/workflows-graphics.tex b/doc/context/sources/general/manuals/workflows/workflows-graphics.tex
new file mode 100644
index 000000000..55a8ad701
--- /dev/null
+++ b/doc/context/sources/general/manuals/workflows/workflows-graphics.tex
@@ -0,0 +1,157 @@
+% language=uk
+
+\environment workflows-style
+
+\startcomponent workflows-graphics
+
+\startchapter[title=Graphics]
+
+\startsection[title=Bad names]
+
+After many years of using \CONTEXT\ in workflows where large amounts of source files
+as well as graphics were involved we can safely say that it's hard for publishers to
+control the way these are named. This is probably due to the fact that in a
+click|-|and|-|point based desktop publishing workflow names don't matter as one stays on
+one machine, and names are only entered once (after that these names become abstractions and
+get cut and pasted). Proper consistent resource managament is simply not part of the flow.
+
+This means that you get names like:
+
+\starttyping
+foo_Bar_01_03-a.EPS
+foo__Bar-01a_03.eps
+foo__Bar-01a_03.eps
+foo BarA 01-03.eps
+\stoptyping
+
+Especially when a non proportional screen font is used multiple spaces can look
+like one. In fancy screen fonts upper and lowercase usage might get obscured. It
+really makes one wonder if copy|-|editing or adding labels to graphics isn't
+suffering from the same problem.
+
+Anyhow, as in an automated rendering workflow the rendering is often the last step you
+can imagine that when names get messed up it's that last step that gets blamed. It's not
+that hard to sanitize names of files on disk as well as in the files that refer to them,
+and we normally do that we have complete control. This is no option when all the resources
+are synchronzied from elsewhere. In that case the only way out is signaling potential
+issues. Say that in the source file there is a reference:
+
+\starttyping
+foo_Bar_01_03-a.EPS
+\stoptyping
+
+and that the graphic on disk has the same name, but for some reason after an update
+has become:
+
+\starttyping
+foo-Bar_01_03-a.EPS
+\stoptyping
+
+The old image is probably still there so the update is not reflected in the final
+product. This is not that uncommon when you deal with tens of thousands of files,
+many editors and graphic designers, and no strict filename policy.
+
+For this we provide the following tracing option:
+
+\starttyping
+\enabletrackers[graphics.lognames]
+\stoptyping
+
+This will put information in the log file about included graphics, like:
+
+\starttyping
+system > graphics > start names
+
+used graphic > asked : cow.pdf
+used graphic > comment : not found
+used graphic > asked : t:/sources/cow.pdf
+used graphic > format : pdf
+used graphic > found : t:/sources/cow.pdf
+used graphic > used : t:/sources/cow.pdf
+
+system > graphics > stop names
+\stoptyping
+
+You can also add information to the file itself:
+
+\starttyping
+\usemodule[s-figures-names]
+\stoptyping
+
+Of course that has to be done at the end of the document. Bad names are reported
+and suitable action can be taken.
+
+\stopsection
+
+\startsection[title=Downsampling]
+
+You can plug in you rown converter, here is an example:
+
+\starttyping
+\startluacode
+
+figures.converters.jpg = figures.converters.jpg or { }
+
+figures.converters.jpg["lowresjpg.pdf"] =
+ function(oldname,newname,resolution)
+ figures.programs.run (
+ [[gm]],
+ [[convert -geometry %nx%x%ny% -compress JPEG "%old%" "%new%"]],
+ {
+ old = old,
+ new = new,
+ nx = resolution or 300,
+ ny = resolution or 300,
+ }
+ )
+ end
+\stopluacode
+\stoptyping
+
+You can limit the search to a few types and set the resolution with:
+
+\starttyping
+\setupexternalfigures
+ [order={pdf,jpg},
+ resolution=100,
+ method=auto]
+\stoptyping
+
+And use it like:
+
+\starttyping
+\externalfigure[verybig.jpg][height=10cm]
+\stoptyping
+
+The second string passed to the \type {run} helper contains the arguments to the
+first one. The variables between percent signs get replaced by the variables in
+the tables passed as third argument.
+
+\stopsection
+
+\startsection[title=Trackers]
+
+If you want a lot of info you can say:
+
+\starttyping
+\enabletrackers[figures.*]
+\stoptyping
+
+But you can be more specific. With \type {graphics.locating} you will get some
+insight in where files are looked for. The \type {graphics.inclusion} tracker
+gives some more info about actual inclusion. The \type {graphics.bases} is kind
+of special and only makes sense when you use the graphic database options. The
+\type {graphics.conversion} and related tracker \type {graphics.programs} show if
+and how conversion of images takes place.
+
+The \type {graphics.lognames} will make sure that some extra information about
+used graphics is saved in the log file, while \type {graphics.usage} will produce
+a file \typ {<jobname>-figures-usage.lua} that contains information about found
+(or not found) images and the way they are used.
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
+
diff --git a/doc/context/sources/general/manuals/workflows/workflows-injectors.tex b/doc/context/sources/general/manuals/workflows/workflows-injectors.tex
new file mode 100644
index 000000000..daae11c82
--- /dev/null
+++ b/doc/context/sources/general/manuals/workflows/workflows-injectors.tex
@@ -0,0 +1,102 @@
+% language=uk
+
+\environment workflows-style
+
+\startcomponent workflows-injectors
+
+\startchapter[title={Injectors}]
+
+When you have no control over the source but need to manually tweak some aspects
+of the typesetting, like an occasional page break of column switch, you can use
+the injector mechanism. This mechanism is part of list and register building but
+can also be used elsewhere.
+
+\startbuffer[one]
+\startmixedcolumns[balance=yes]
+ \dotestinjector{test}line 1 \par
+ \dotestinjector{test}line 2 \par
+ \dotestinjector{test}line 3 \par
+ \dotestinjector{test}line 4 \par
+ \dotestinjector{test}line 5
+\stopmixedcolumns
+\stopbuffer
+
+\startbuffer[two]
+\startmixedcolumns[balance=yes]
+ \dotestinjector{test}line 1 \par
+ \dotestinjector{test}line 2 \par
+ \dotestinjector{test}line 3 \par
+ \dotestinjector{test}line 4 \par
+ \dotestinjector{test}line 5
+\stopmixedcolumns
+\stopbuffer
+
+We have two buffers:
+
+\typebuffer[one]
+
+and
+
+\typebuffer[two]
+
+When typeset these come out as:
+
+\blank \startpacked \bf \getbuffer[one] \stoppacked \blank
+
+and
+
+\blank \startpacked \bf \getbuffer[two] \stoppacked \blank
+
+We can enable (and show) the injectors with:
+
+\startbuffer
+\doactivateinjector{test} \showinjector
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Now we get:
+
+\blank \startpacked \bf \getbuffer[one] \stoppacked \blank
+
+and
+
+\blank \startpacked \bf \getbuffer[two] \stoppacked \blank
+
+The small numbers are injector points. These will of course change when we add
+more in|-|between. Let's add actions to some of the injection points:
+
+\startbuffer
+\setinjector[test][13][{\column}]
+\setinjector[test][17][{\column}]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+As expected we now get column breaks:
+
+\blank \startpacked \bf \getbuffer[one] \stoppacked \blank
+
+and
+
+\blank \startpacked \bf \getbuffer[two] \stoppacked \blank
+
+\stopchapter
+
+\stopcomponent
+
+% to be described:
+
+% \setinjector[register][3][\column]
+% \setinjector[list] [2][{\blank[3*big]}]
+
+% \starttext
+% \placelist[section][criterium=text]
+% \blank[3*big]
+% \placeregister[index][criterium=text]
+% \page
+% \startsection[title=Alpha] first \index{first} \stopsection
+% \startsection[title=Beta] second \index{second} \stopsection
+% \startsection[title=Gamma] third \index{third} \stopsection
+% \startsection[title=Delta] fourth \index{fourth} \stopsection
+% \stoptext
diff --git a/doc/context/sources/general/manuals/workflows/workflows-introduction.tex b/doc/context/sources/general/manuals/workflows/workflows-introduction.tex
new file mode 100644
index 000000000..a88640b27
--- /dev/null
+++ b/doc/context/sources/general/manuals/workflows/workflows-introduction.tex
@@ -0,0 +1,25 @@
+% language=uk
+
+\environment workflows-style
+
+\startcomponent workflows-introduction
+
+\startchapter[title=Introduction]
+
+This manual contains some information about features that can help you to manage
+workflows or \CONTEXT\ related processes. Because we use \CONTEXT\ ourselves all
+that we need ends up in the distribution. When you discover something workflow
+related that is not yet covered here, you can tell me. I simply forget about all
+there is, especially if it's made for projects. Don't expect this manual to be
+complete or extensive, it's just a goodie.
+
+\startlines
+\documentvariable{author},
+\documentvariable{affiliation}
+\documentvariable{location}
+\currentdate[month,year]
+\stoplines
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/workflows/workflows-mkiv.tex b/doc/context/sources/general/manuals/workflows/workflows-mkiv.tex
new file mode 100644
index 000000000..3820e04fa
--- /dev/null
+++ b/doc/context/sources/general/manuals/workflows/workflows-mkiv.tex
@@ -0,0 +1,32 @@
+\setupbackend[export=yes]
+
+\environment workflows-style
+
+\startdocument
+ [metadata:author=Hans Hagen,
+ metadata:title=Workflow support in context,
+ author=Hans Hagen,
+ affiliation=PRAGMA ADE,
+ location=Hasselt NL,
+ title=workflow,
+ extra=support in context,
+ support=www.contextgarden.net,
+ website=www.pragma-ade.nl]
+
+\component workflows-titlepage
+
+\startfrontmatter
+ \component workflows-contents
+ \component workflows-introduction
+\stopfrontmatter
+
+\startbodymatter
+ \component workflows-resources
+ \component workflows-graphics
+ \component workflows-suspects
+ \component workflows-injectors
+ \component workflows-xml
+ \component workflows-setups
+\stopbodymatter
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/workflows/workflows-resources.tex b/doc/context/sources/general/manuals/workflows/workflows-resources.tex
new file mode 100644
index 000000000..cbed64864
--- /dev/null
+++ b/doc/context/sources/general/manuals/workflows/workflows-resources.tex
@@ -0,0 +1,156 @@
+% language=uk
+
+\environment workflows-style
+
+\startcomponent workflows-resources
+
+\startchapter[title=Accessing resources]
+
+One of the benefits of \TEX\ is that you can use it in automated workflows
+where large quantities of data is involved. A document can consist of
+several files and normally also includes images. Of course there are styles
+involved too. At \PRAGMA\ normally put styles and fonts in:
+
+\starttyping
+/data/site/context/tex/texmf-project/tex/context/user/<project>/...
+/data/site/context/tex/texmf-fonts/data/<foundry>/<collection>/...
+\stoptyping
+
+alongside
+
+\starttyping
+/data/framework/...
+\stoptyping
+
+where the job management services are put, while we put resources in:
+
+\starttyping
+/data/resources/...
+\stoptyping
+
+The processing happens in:
+
+\starttyping
+/data/work/<uuid user space>/
+\stoptyping
+
+Putting styles (and resources like logos and common images) and fonts (if the
+project has specific ones not present in the distribution) in the \TEX\ tree
+makes sense because that is where such files are normally searched. Of course you
+need to keep the distributions file database upto|-|date after adding files there.
+
+Processing has to happen isolated from other runs so there we use unique
+locations. The services responsible for running also deal with regular cleanup
+of these temporary files.
+
+Resources are somewhat special. They can be stable, i.e.\ change seldom, but more
+often they are updated or extended periodically (or even daily). We're not
+talking of a few files here but of thousands. In one project we have 20 thousand
+resources, that can be combined into arbitrary books, and in another one, each
+chapter alone is about 400 \XML\ and image files. That means we can have 5000
+files per book and as we have at least 20 books, we end up with 100K files. In
+the first case accessing the resources is easy because there is a well defined
+structure (under our control) so we know exactly where each file sits in the
+resource tree. In the 100K case there is a deeper structure which is in itself
+predictable but because many authors are involved the references to these files
+are somewhat instable (and undefined). It is surprising to notice that publishers
+don't care about filenames (read: cannot control all the parties involved) which
+means that we have inconsist use of mixed case in filenames, and spaces,
+underscores and dashes creeping in. Because typesetting for paper is always at
+the end of the pipeline (which nowadays is mostly driven by (limitations) of web
+products) we need to have a robust and flexible lookup mechanism. It's a side
+effect of the click and point culture: if objects are associated (filename in
+source file with file on the system) anything you key in will work, and
+consistency completely depends on the user. And bad things then happen when files
+are copied, renamed, etc. In that stadium we can better be tolerant than try to
+get it fixed. \footnote {From what we normally receive we often conclude that
+copy|-|editing and image production companies don't impose any discipline or
+probably simply lack the tools and methods to control this. Some of our workflows
+had checkers and fixers, so that when we got 5000 new resources while only a few
+needed to be replaced we could filter the right ones. It was not uncommon to find
+duplicates for thousands of pictures: similar or older variants.}
+
+\starttyping
+foo.jpg
+bar/foo.jpg
+images/bar/foo.jpg
+images/foo.jpg
+\stoptyping
+
+The xml files have names like:
+
+\starttyping
+b-c.xml
+a/b-c.jpg
+a/b/b-c.jpg
+a/b/c/b-c.jpg
+\stoptyping
+
+So it's sort of a mess, especially if you add arbitrary casing to this. Of course
+one can argue that a wrong (relative) location is asking for problems, it's less
+an issue here because each image has a unique name. We could flatten the resource
+tree but having tens of thousands of files on one directory is asking for
+problems when you want to manage them.
+
+The typesetting (and related services) run on virtual machines. The three
+directories:
+
+\starttyping
+/data/site
+/data/resources
+/data/work
+\stoptyping
+
+are all mounted as nfs shares on a network storage. For the styles (and binaries)
+this is no big deal as normally these files are cached, but the resources are
+another story. Scanning the complete (mounted) resource tree each run is no
+option so there we use a special mechanism in \CONTEXT\ for locating files.
+
+Already early in the development of \MKIV\ one of the locating mechanisms was
+the following:
+
+\starttyping
+tree:////data/resources/foo/**/drawing.jpg
+tree:////data/resources/foo/**/Drawing.jpg
+\stoptyping
+
+Here the tree is scanned once per run, which is normally quite okay when there
+are not that many files and when the files reside on the machine itself. For a
+more high performance approach using network shares we have a different
+mechanism. This time it looks like this:
+
+\starttyping
+dirlist:/data/resources/**/drawing.jpg
+dirlist:/data/resources/**/Drawing.jpg
+dirlist:/data/resources/**/just/some/place/drawing.jpg
+dirlist:/data/resources/**/images/drawing.jpg
+dirlist:/data/resources/**/images/drawing.jpg?option=fileonly
+dirfile:/data/resources/**/images/drawing.jpg
+\stoptyping
+
+The first two lookups are wildcard. If there is a file with that name, it will be
+found. If there are more, the first hit is used. The second and third examples
+are more selective. Here the part after the \type {**} has to match too. So here
+we can deal with multiple files named \type {drawing.jpg}. The last two
+equivalent examples are more tolerant. If no explicit match is found, a lookup
+happens without being selective. The case of a name is ignored but when found, a
+name with the right case is used.
+
+You can hook a path into the resolver for source files, for example:
+
+\starttyping
+\usepath [dirfile://./resources/**]
+\setupexternalfigures[directory=dirfile://./resources/**]
+\stoptyping
+
+You need to make sure that file(name)s in that location don't override ones in
+the regular \TEX\ tree. These extra paths are only used for source file lookups
+so for instance font lookups are not affected.
+
+When you add, remove or move files the tree, you need to remove the \type
+{dirlist.*} files in the root because these are used for locating files. A new
+file will be generated automatically. Don't forget this!
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/workflows/workflows-setups.tex b/doc/context/sources/general/manuals/workflows/workflows-setups.tex
new file mode 100644
index 000000000..e9d120f7b
--- /dev/null
+++ b/doc/context/sources/general/manuals/workflows/workflows-setups.tex
@@ -0,0 +1,72 @@
+% language=uk
+
+\environment workflows-style
+
+\startcomponent workflows-setups
+
+\startchapter[title={Setups}]
+
+Setups are a powerful way to organize styles. They are basically macros but live
+in their own namespace. One advantage is that spaces in a setup are ignored so
+you can code without bothering about spurious spaces. Here is a trick that you
+can use when one style contains directives for multiple products:
+
+\startbuffer
+\startsetups tex:whatever
+ \fastsetup{tex:whatever:\documentvariable{stylevariant}}
+\stopsetups
+
+\startsetups tex:whatever:foo
+ FOO
+\stopsetups
+
+\startsetups tex:whatever:bar
+ BAR
+\stopsetups
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Here we define a main setup \type {tex:whatever} that gets expanded in one of two
+variants, controlled by a document variable.
+
+\startbuffer
+\setups{tex:whatever}
+
+\setupdocument
+ [stylevariant=foo]
+
+\setups{tex:whatever}
+
+\setupdocument
+ [stylevariant=bar]
+
+\setups{tex:whatever}
+\stopbuffer
+
+\typebuffer
+
+These lines result in:
+
+\getbuffer
+
+In a similar fashion you can define \XML\ setups that are used to render
+elements:
+
+\starttyping
+\startxmlsetups xml:whatever
+ \xmlsetup{#1}{xml:whatever:\documentvariable{stylevariant}}
+\stopxmlsetups
+
+\startxmlsetups xml:whatever:foo
+ FOO: \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:whatever:bar
+ BAR: \xmlflush{#1}
+\stopxmlsetups
+\stoptyping
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/workflows/workflows-style.tex b/doc/context/sources/general/manuals/workflows/workflows-style.tex
new file mode 100644
index 000000000..f29129fcd
--- /dev/null
+++ b/doc/context/sources/general/manuals/workflows/workflows-style.tex
@@ -0,0 +1,49 @@
+\startenvironment workflows-style
+
+\usemodule
+ [abr-03]
+
+\setupbodyfont
+ [bookman,11pt]
+
+\definecolor
+ [maincolor]
+ [s=.35]
+
+\setuplayout
+ [height=middle,
+ width=middle,
+ footer=0pt]
+
+\setupwhitespace
+ [big]
+
+\setuphead
+ [chapter]
+ [style=\bfc,
+ color=maincolor,
+ header=high]
+
+\setuphead
+ [section]
+ [style=\bfb,
+ color=maincolor]
+
+\setuptyping
+ [color=maincolor]
+
+\setuptype
+ [color=maincolor]
+
+\setupdocument
+ [metadata:author=<author>,
+ metadata:title=<title>,
+ author=<author>,
+ affiliation=<affiliation>,
+ location=<location>,
+ title=<title>,
+ extra=<extra>,
+ support=<support>,
+ website=<website>]
+
+\stopenvironment
diff --git a/doc/context/sources/general/manuals/workflows/workflows-suspects.tex b/doc/context/sources/general/manuals/workflows/workflows-suspects.tex
new file mode 100644
index 000000000..621fd6f59
--- /dev/null
+++ b/doc/context/sources/general/manuals/workflows/workflows-suspects.tex
@@ -0,0 +1,54 @@
+% language=uk
+
+\environment workflows-style
+
+\startcomponent workflows-suspects
+
+\startchapter[title={Suspects}]
+
+When many authors and editors are involved there is the danger of inconsistent
+spacing being applied. We're not only talking of the (often invisible in editing
+programs) nobreak spaces, but also spacing inside or outside quotations and
+before and after punctuation or around math.
+
+In \CONTEXT\ we have a built||in suspects checker that you can enable with the
+following command:
+
+\starttyping
+\enabletrackers[typesetters.suspects]
+\stoptyping
+
+The next table shows some identified suspects.
+
+\starttexdefinition ShowSample #1
+ \NC \type{#1}
+ \NC \enabletrackers[typesetters.suspects]#1\disabletrackers[typesetters.spacing]
+ \NC \NR
+\stoptexdefinition
+
+\starttabulate[|||][before=,after=]
+ \ShowSample{foo$x$}
+ \ShowSample{$x$bar}
+ \ShowSample{foo$x$bar}
+ \ShowSample{$f+o+o$:}
+ \ShowSample{;$f+o+o$}
+ \ShowSample{; bar}
+ \ShowSample{foo:bar}
+ \ShowSample{\quote{ foo }}
+ \ShowSample{\quote{bar }}
+ \ShowSample{\quote{ bar}}
+ \ShowSample{(foo )}
+ \ShowSample{\{foo \}}
+ \ShowSample{foo{\bf gnu}bar}
+ \ShowSample{foo{\it gnu}bar}
+ \ShowSample{foo$x^2$bar}
+ \ShowSample{foo\nobreakspace bar}
+\stoptabulate
+
+Of course this analysis is not perfect but we use it in final checking of complex
+documents that are generated automatically from \XML. \footnote {Think of math
+school books where each book is assembled from over a thousands files.}
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/workflows/workflows-titlepage.tex b/doc/context/sources/general/manuals/workflows/workflows-titlepage.tex
new file mode 100644
index 000000000..f184152b3
--- /dev/null
+++ b/doc/context/sources/general/manuals/workflows/workflows-titlepage.tex
@@ -0,0 +1,37 @@
+% language=uk
+
+\environment workflows-style
+
+\startcomponent workflows-titlepage
+
+\definefontfeature[LatinModernMonoVariable][default][liga=no]
+\definefont[LatinModernMonoVariable][LMTypewriterVarWd-Regular*LatinModernMonoVariable sa 1]
+
+\startMPpage
+
+ fill fullsquare xysized(PaperWidth,PaperHeight) withcolor .4white ;
+
+ draw image (
+ fill arrowhead fullcircle scaled .5 rotated 0 scaled 10 withcolor white ;
+ fill arrowhead fullcircle scaled .5 rotated 120 scaled 10 withcolor white ;
+ fill arrowhead fullcircle scaled .5 rotated 240 scaled 10 withcolor white ;
+ fill arrowhead fullcircle scaled .5 rotated 60 scaled 10 withcolor white ;
+ fill arrowhead fullcircle scaled .5 rotated 180 scaled 10 withcolor white ;
+ fill arrowhead fullcircle scaled .5 rotated 300 scaled 10 withcolor white ;
+ ) xsized (.9PaperWidth) shifted (0,.2PaperWidth) ;
+
+ draw image (
+ fill arrowhead fullcircle scaled .5 rotated 0 scaled 10 withcolor .4red withtransparency (1,.5) ;
+ fill arrowhead fullcircle scaled .5 rotated 120 scaled 10 withcolor .4green withtransparency (1,.5) ;
+ fill arrowhead fullcircle scaled .5 rotated 240 scaled 10 withcolor .4blue withtransparency (1,.5) ;
+ fill arrowhead fullcircle scaled .5 rotated 60 scaled 10 withcolor .4cyan withtransparency (1,.5) ;
+ fill arrowhead fullcircle scaled .5 rotated 180 scaled 10 withcolor .4magenta withtransparency (1,.5) ;
+ fill arrowhead fullcircle scaled .5 rotated 300 scaled 10 withcolor .4yellow withtransparency (1,.5) ;
+ ) xsized (.9PaperWidth) shifted (0,.2PaperWidth) ;
+
+ draw textext ("\LatinModernMonoVariable \documentvariable{title}") xsized (.9PaperWidth) shifted (0,-.425PaperWidth) withcolor white ;
+ draw textext ("\LatinModernMonoVariable \documentvariable{extra}") xsized (.9PaperWidth) shifted (0,-.575PaperWidth) withcolor white ;
+
+\stopMPpage
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/workflows/workflows-xml.tex b/doc/context/sources/general/manuals/workflows/workflows-xml.tex
new file mode 100644
index 000000000..0f29f5f55
--- /dev/null
+++ b/doc/context/sources/general/manuals/workflows/workflows-xml.tex
@@ -0,0 +1,96 @@
+% language=uk
+
+\environment workflows-style
+
+\startcomponent workflows-xml
+
+\startluacode
+ for i=1,10 do
+ local filename = string.formatters["temp-%02i.xml"](i)
+ local filedata = string.formatters["<?xml version='1.0'?><p>snippet %i</p>"](i)
+ io.savedata(filename,filedata)
+ end
+\stopluacode
+
+\startchapter[title={XML}]
+
+When you have an \XML\ project with many files involved, finding the right spot
+of something that went wrong can be a pain. In one of our project the production of
+some 50 books involves 60.000 \XML\ files and 20.000 images. Say that we have the
+following file:
+
+\startbuffer[demo]
+<?xml version='1.0'?>
+<document>
+ <include name="temp-01.xml"/> <include name="temp-02.xml"/>
+ <include name="temp-03.xml"/> <include name="temp-04.xml"/>
+ <include name="temp-05.xml"/> <include name="temp-06.xml"/>
+ <include name="temp-07.xml"/> <include name="temp-08.xml"/>
+ <include name="temp-09.xml"/> <include name="temp-10.xml"/>
+</document>
+\stopbuffer
+
+\typebuffer[demo]
+
+Before we process this file we will merge the content of the files defined
+as includes into it. When this happens the filename is automatically
+registered so it can be accessed later.
+
+\startbuffer
+\startxmlsetups xml:initialize
+ \xmlincludeoptions{#1}{include}{filename|name}{recurse,basename}
+ \xmlsetsetup{#1}{p|document}{xml:*}
+\stopxmlsetups
+
+\startxmlsetups xml:document
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:p
+ \inleftmargin{\infofont\xmlinclusion{#1}}
+ \xmlflush{#1}
+ \par
+\stopxmlsetups
+
+\xmlregistersetup{xml:initialize}
+
+\xmlprocessbuffer{main}{demo}{}
+\stopbuffer
+
+\typebuffer
+
+In this case we put the name of the file in the margin. Depending on when and how
+elements are flushed other solutions, like overlays, can be used.
+
+\startpacked
+\getbuffer
+\stoppacked
+
+At any moment you can see what the current node contains. The whole (merged)
+document is also available:
+
+\startbuffer
+\xmlshow{main}
+\stopbuffer
+
+\typebuffer
+
+A small font is used to typeset the (sub)tree:
+
+\blank \getbuffer \blank
+
+You can also save the tree:
+
+\startbuffer
+\xmlsave{main}{temp.xml}
+\stopbuffer
+
+\typebuffer \getbuffer
+
+This file looks like:
+
+\typefile{temp.xml}
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/xml/xml-mkiv-01.xml b/doc/context/sources/general/manuals/xml/xml-mkiv-01.xml
new file mode 100644
index 000000000..c2feac218
--- /dev/null
+++ b/doc/context/sources/general/manuals/xml/xml-mkiv-01.xml
@@ -0,0 +1,15 @@
+<name>Land Of Dreams</name>
+<tracks>
+ <track length="248">Dixie Flyer</track>
+ <track length="212">New Orleans Wins The War</track>
+ <track length="218">Four Eyes</track>
+ <track length="181">Falling In Love</track>
+ <track length="187">Something Special</track>
+ <track length="168">Bad News From Home</track>
+ <track length="207">Roll With The Punches</track>
+ <track length="209">Masterman And Baby J</track>
+ <track length="134">Follow The Flag</track>
+ <track length="246">I Want You To Hurt Like I Do</track>
+ <track length="248">It&apos;s Money That Matters</track>
+ <track length="156">Red Bandana</track>
+</tracks>
diff --git a/doc/context/sources/general/manuals/xml/xml-mkiv-02.xml b/doc/context/sources/general/manuals/xml/xml-mkiv-02.xml
new file mode 100644
index 000000000..997123ad6
--- /dev/null
+++ b/doc/context/sources/general/manuals/xml/xml-mkiv-02.xml
@@ -0,0 +1,15 @@
+<name>Bad Love</name>
+<tracks>
+ <track length="340">My Country</track>
+ <track length="295">Shame</track>
+ <track length="205">I&apos;m Dead (But I Don&apos;t Know It)</track>
+ <track length="213">Every Time It Rains</track>
+ <track length="206">The Great Nations of Europe</track>
+ <track length="220">The One You Love</track>
+ <track length="164">The World Isn&apos;t Fair</track>
+ <track length="264">Big Hat, No Cattle</track>
+ <track length="243">Better Off Dead</track>
+ <track length="236">I Miss You</track>
+ <track length="126">Going Home</track>
+ <track length="180">I Want Everyone To Like Me</track>
+</tracks>
diff --git a/doc/context/sources/general/manuals/xml/xml-mkiv.tex b/doc/context/sources/general/manuals/xml/xml-mkiv.tex
new file mode 100644
index 000000000..3933c0063
--- /dev/null
+++ b/doc/context/sources/general/manuals/xml/xml-mkiv.tex
@@ -0,0 +1,3812 @@
+% language=uk
+
+% to be checked:
+%
+% \Ux in index
+%
+% undocumented:
+%
+% \processXMLbuffer
+% \processxmlbuffer
+% \processxmlfile
+%
+% kind of special ... tricky explanation needed:
+%
+% \xmldirect
+
+\input lxml-ctx.mkiv
+
+\settrue \xmllshowtitle
+\setfalse\xmllshowwarning
+
+\usemodule[set-11]
+
+\loadsetups[i-en-xml.xml]
+
+% \definehspace[squad][1em plus .25em minus .25em]
+
+\usemodule[abr-02]
+
+\setuplayout
+ [location=middle,
+ marking=on,
+ backspace=20mm,
+ cutspace=20mm,
+ topspace=15mm,
+ header=15mm,
+ footer=15mm,
+ height=middle,
+ width=middle]
+
+\setuppagenumbering
+ [alternative=doublesided,
+ location=]
+
+\setupfootertexts
+ [][pagenumber]
+
+\setupheadertexts
+ [][chapter]
+
+\setupheader
+ [color=colortwo,
+ style=bold]
+
+\setupfooter
+ [color=colortwo,
+ style=bold]
+
+\setuphead
+ [chapter]
+ [page={yes,header,right},
+ header=empty,
+ style=\bfc]
+
+\setupsectionblock
+ [page={yes,header,right}]
+
+\starttexdefinition unexpanded section:chapter:number #1
+ \doifmode{*sectionnumber} {
+ \llap{<\enspace}#1\enspace>
+ }
+\stoptexdefinition
+
+\starttexdefinition unexpanded section:section:number #1
+ \doifmode{*sectionnumber} {
+ \llap{<<\enspace}#1\enspace>>
+ }
+\stoptexdefinition
+
+\starttexdefinition unexpanded section:subsection:number #1
+ \doifmode{*sectionnumber} {
+ \llap{<<<\enspace}#1\enspace>>>
+ }
+\stoptexdefinition
+
+\setuphead[chapter] [numbercolor=black,numbercommand=\texdefinition{section:chapter:number}]
+\setuphead[section] [numbercolor=black,numbercommand=\texdefinition{section:section:number}]
+\setuphead[subsection][numbercolor=black,numbercommand=\texdefinition{section:subsection:number}]
+
+\setuphead
+ [section]
+ [style=\bfa]
+
+\setuplist
+ [chapter]
+ [style=bold]
+
+\setupinteractionscreen
+ [option=doublesided]
+
+\setupalign
+ [tolerant,stretch]
+
+\setupwhitespace
+ [big]
+
+\setuptolerance
+ [tolerant]
+
+\doifelsemode {atpragma} {
+ \setupbodyfont[lucidaot,10pt]
+} {
+ \setupbodyfont[dejavu,10pt]
+}
+
+\definecolor[colorone] [b=.5]
+\definecolor[colortwo] [s=.3]
+\definecolor[colorthree][y=.5]
+
+\setuptype
+ [color=colorone]
+
+\setuptyping
+ [color=colorone]
+
+\setuphead
+ [lshowtitle]
+ [style=\tt,
+ color=colorone]
+
+\setuphead
+ [chapter,section]
+ [numbercolor=colortwo,
+ color=colorone]
+
+\definedescription
+ [xmlcmd]
+ [alternative=hanging,
+ width=line,
+ distance=1em,
+ margin=2em,
+ headstyle=monobold,
+ headcolor=colorone]
+
+\setupframedtext
+ [setuptext]
+ [framecolor=colorone,
+ rulethickness=1pt,
+ corner=round]
+
+\usemodule[punk]
+
+\usetypescript[punk]
+
+\definelayer
+ [page]
+ [width=\paperwidth,
+ height=\paperheight]
+
+\starttext
+
+\setuplayout[page]
+
+\startstandardmakeup
+ \startfontclass[none] % nil the current fontclass since it may append its features
+ \EnableRandomPunk
+ \setlayerframed
+ [page]
+ [width=\paperwidth,height=\paperheight,
+ background=color,backgroundcolor=colorone,backgroundoffset=1ex,frame=off]
+ {}
+ \definedfont[demo@punk at 18pt]
+ \setbox\scratchbox\vbox {
+ \hsize\dimexpr\paperwidth+2ex\relax
+ \setupinterlinespace
+ \baselineskip 1\baselineskip plus 1pt minus 1pt
+ \raggedcenter
+ \color[colortwo]{\dorecurse{1000}{XML }}
+ }
+ \setlayer
+ [page]
+ [preset=middle]
+ {\vsplit\scratchbox to \dimexpr\paperheight+2ex\relax}
+ \definedfont[demo@punk at 90pt]
+ \setstrut
+ \setlayerframed
+ [page]
+ [preset=rightbottom,offset=10mm]
+ [foregroundcolor=colorthree,align=flushright,offset=overlay,frame=off]
+ {Dealing\\with XML in\\Con\TeX t MkIV}
+ \definedfont[demo@punk at 18pt]
+ \setstrut
+ \setlayerframed
+ [page]
+ [preset=righttop,offset=10mm,x=3mm,rotation=90]
+ [foregroundcolor=colorthree,align=flushright,offset=overlay,frame=off]
+ {Hans Hagen, Pragma ADE, \currentdate}
+ \tightlayer[page]
+ \stopfontclass
+\stopstandardmakeup
+
+\setuplayout
+
+\startfrontmatter
+
+\starttitle[title=Contents]
+
+\placelist
+ [chapter,section]
+
+\stoptitle
+
+\startchapter[title={Introduction}]
+
+This manual presents the \MKIV\ way of dealing with \XML. Although the
+traditional \MKII\ streaming parser has a charming simplicity in its control, for
+complex documents the tree based \MKIV\ method is more convenient. It is for this
+reason that the old method has been removed from \MKIV. If you are familiar with
+\XML\ processing in \MKII, then you will have noticed that the \MKII\ commands
+have \type {XML} in their name. The \MKIV\ commands have a lowercase \type {xml}
+in their names. That way there is no danger for confusion or a mixup.
+
+You may wonder why we do these manipulations in \TEX\ and not use \XSLT\ (or
+other transformation methods) instead. The advantage of an integrated approach is
+that it simplifies usage. Think of not only processing the document, but also
+using \XML\ for managing resources in the same run. An \XSLT\ approach is just as
+verbose (after all, you still need to produce \TEX\ code) and probably less
+readable. In the case of \MKIV\ the integrated approach is also faster and gives
+us the option to manipulate content at runtime using \LUA. It has the additional
+advantage that to some extend we can handle a mix of \TEX\ and \XML\ because we
+know when we're doing one or the other.
+
+This manual is dedicated to Taco Hoekwater, one of the first \CONTEXT\ users, and
+also the first to use it for processing \XML. Who could have thought at that time
+that we would have a more convenient way of dealing with those angle brackets.
+The second version for this manual is dedicated to Thomas Schmitz, a power user
+who occasionally became victim of the evolving mechanisms.
+
+\blank
+
+\startlines
+Hans Hagen
+\PRAGMA
+Hasselt NL
+2008\endash2016
+\stoplines
+
+\stopchapter
+
+\stopfrontmatter
+
+\startbodymatter
+
+\startchapter[title={Setting up a converter}]
+
+\startsection[title={from structure to setup}]
+
+We use a very simple document structure for demonstrating how a converter is
+defined. In practice a mapping will be more complex, especially when we have a
+style with complex chapter openings using data coming from all kind of places,
+different styling of sections with the same name, selectively (out of order)
+flushed content, special formatting, etc.
+
+\typefile{manual-demo-1.xml}
+
+Say that this document is stored in the file \type {demo.xml}, then the following
+code can be used as starting point:
+
+\starttyping
+\startxmlsetups xml:demo:base
+ \xmlsetsetup{#1}{*}{-}
+ \xmlsetsetup{#1}{document|section|p}{xml:demo:*}
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{demo}{xml:demo:base}
+
+\startxmlsetups xml:demo:document
+ \starttitle[title={Contents}]
+ \placelist[chapter]
+ \stoptitle
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:demo:section
+ \startchapter[title=\xmlfirst{#1}{/title}]
+ \xmlfirst{#1}{/content}
+ \stopchapter
+\stopxmlsetups
+
+\startxmlsetups xml:demo:p
+ \xmlflush{#1}\endgraf
+\stopxmlsetups
+
+\xmlprocessfile{demo}{demo.xml}{}
+\stoptyping
+
+Watch out! These are not just setups, but specific \XML\ setups which get an
+argument passed (the \type {#1}). If for some reason your \XML\ processing fails,
+it might be that you mistakenly have used a normal setup definition. The argument
+\type {#1} represents the current node (element) and is a unique identifier. For
+instance a \type {<p>..</p>} can have an identifier {demo::5}. So, we can get
+something:
+
+\starttyping
+\xmlflush{demo::5}\endgraf
+\stoptyping
+
+but as well:
+
+\starttyping
+\xmlflush{demo::6}\endgraf
+\stoptyping
+
+Keep in mind that the references tor the actual nodes (elements) are
+abstractions, you never see those \type {<id>::<number>}'s, because we will use
+either the abstract \type {#1} (any node) or an explicit reference like \type
+{demo}. The previous setup when issued will be like:
+
+\starttyping
+\startchapter[title=\xmlfirst{demo::3}{/title}]
+ \xmlfirst{demo::4}{/content}
+\stopchapter
+\stoptyping
+
+Here the \type {title} is used to typeset the chapter title but also for an entry
+in the table of contents. At the moment the title is typeset the \XML\ node gets
+looked up and expanded in real text. However, for the list it gets stored for
+later use. One can argue that this is not needed for \XML, because one can just
+filter all the titles and use page references, but then one also looses the
+control one normally has over such titles. For instance it can be that some
+titles are rendered differently and for that we need to keep track of usage.
+Doing that with transformations or filtering is often more complex than leaving
+that to \TEX. As soon as the list gets typeset, the reference (\type {demo::#3})
+is used for the lookup. This is because by default the title is stored as given.
+So, as long as we make sure the \XML\ source is loaded before the table of
+contents is typeset we're ok. Later we will look into this in more detail, for
+now it's enough to know that in most cases the abstract \type {#1} reference will
+work out ok.
+
+Contrary to the style definitions this interface looks rather low level (with no
+optional arguments) and the main reason for this is that we want processing to be
+fast. So, the basic framework is:
+
+\starttyping
+\startxmlsetups xml:demo:base
+ % associate setups with elements
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{demo}{xml:demo:base}
+
+% define setups for matches
+
+\xmlprocessfile{demo}{demo.xml}{}
+\stoptyping
+
+In this example we mostly just flush the content of an element and in the case of
+a section we flush explicit child elements. The \type {#1} in the example code
+represents the current element. The line:
+
+\starttyping
+\xmlsetsetup{demo}{*}{-}
+\stoptyping
+
+sets the default for each element to \quote {just ignore it}. A \type {+} would
+make the default to always flush the content. This means that at this point we
+only handle:
+
+\starttyping
+<section>
+ <title>Some title</title>
+ <content>
+ <p>a paragraph of text</p>
+ </content>
+</section>
+\stoptyping
+
+In the next section we will deal with the slightly more complex itemize and
+figure placement. At first sight all these setups may look overkill but keep in
+mind that normally the number of elements is rather limited. The complexity is
+often in the style and having access to each snippet of content is actually
+quite handy for that.
+
+\stopsection
+
+\startsection[title={alternative solutions}]
+
+Dealing with an itemize is rather simple (as long as we forget about
+attributes that control the behaviour):
+
+\starttyping
+<itemize>
+ <item>first</item>
+ <item>second</item>
+</itemize>
+\stoptyping
+
+First we need to add \type {itemize} to the setup assignment (unless we've used
+the wildcard \type {*}):
+
+\starttyping
+\xmlsetsetup{demo}{document|section|p|itemize}{xml:demo:*}
+\stoptyping
+
+The setup can look like:
+
+\starttyping
+\startxmlsetups xml:demo:itemize
+ \startitemize
+ \xmlfilter{#1}{/item/command(xml:demo:itemize:item)}
+ \stopitemize
+\stopxmlsetups
+
+\startxmlsetups xml:demo:itemize:item
+ \startitem
+ \xmlflush{#1}
+ \stopitem
+\stopxmlsetups
+\stoptyping
+
+An alternative is to map item directly:
+
+\starttyping
+\xmlsetsetup{demo}{document|section|p|itemize|item}{xml:demo:*}
+\stoptyping
+
+and use:
+
+\starttyping
+\startxmlsetups xml:demo:itemize
+ \startitemize
+ \xmlflush{#1}
+ \stopitemize
+\stopxmlsetups
+
+\startxmlsetups xml:demo:item
+ \startitem
+ \xmlflush{#1}
+ \stopitem
+\stopxmlsetups
+\stoptyping
+
+Sometimes, a more local solution using filters and \type {/command(...)} makes more
+sense, especially when the \type {item} tag is used for other purposes as well.
+
+Explicit flushing with \type {command} is definitely the way to go when you have
+complex products. In one of our projects we compose math school books from many
+thousands of small \XML\ files, and from one source set several products are
+typeset. Within a book sections get done differently, content gets used, ignored
+or interpreted differently depending on the kind of content, so there is a
+constant checking of attributes that drive the rendering. In that a generic setup
+for a title element makes less sense than explicit ones for each case. (We're
+talking of huge amounts of files here, including multiple images on each rendered
+page.)
+
+When using \type {command} you can pass two arguments, the first is the setup for
+the match, the second one for the miss, as in:
+
+\starttyping
+\xmlfilter{#1}{/element/command(xml:true,xml:false)}
+\stoptyping
+
+Back to the example, this leaves us with dealing with the resources, like
+figures:
+
+\starttyping
+<resource type='figure'>
+ <caption>A picture of a cow.</caption>
+ <content><external file="cow.pdf"/></content>
+</resource>
+\stoptyping
+
+Here we can use a more restricted match:
+
+\starttyping
+\xmlsetsetup{demo}{resource[@type='figure']}{xml:demo:figure}
+\xmlsetsetup{demo}{external}{xml:demo:*}
+\stoptyping
+
+and the definitions:
+
+\starttyping
+\startxmlsetups xml:demo:figure
+ \placefigure
+ {\xmlfirst{#1}{/caption}}
+ {\xmlfirst{#1}{/content}}
+\stopxmlsetups
+
+\startxmlsetups xml:demo:external
+ \externalfigure[\xmlatt{#1}{file}]
+\stopxmlsetups
+\stoptyping
+
+At this point it is good to notice that \type {\xmlatt{#1}{file}} is passed as it
+is: a macro call. This means that when a macro like \type {\externalfigure} uses
+the first argument frequently without first storing its value, the lookup is done
+several times. A solution for this is:
+
+\starttyping
+\startxmlsetups xml:demo:external
+ \expanded{\externalfigure[\xmlatt{#1}{file}]}
+\stopxmlsetups
+\stoptyping
+
+Because the lookup is rather fast, normally there is no need to bother about this
+too much because internally \CONTEXT\ already makes sure such expansion happens
+only once.
+
+An alternative definition for placement is the following:
+
+\starttyping
+\xmlsetsetup{demo}{resource}{xml:demo:resource}
+\stoptyping
+
+with:
+
+\starttyping
+\startxmlsetups xml:demo:resource
+ \placefloat
+ [\xmlatt{#1}{type}]
+ {\xmlfirst{#1}{/caption}}
+ {\xmlfirst{#1}{/content}}
+\stopxmlsetups
+\stoptyping
+
+This way you can specify \type {table} as type too. Because you can define your
+own float types, more complex variants are also possible. In that case it makes
+sense to provide some default behaviour too:
+
+\starttyping
+\definefloat[figure-here][figure][default=here]
+\definefloat[figure-left][figure][default=left]
+\definefloat[table-here] [table] [default=here]
+\definefloat[table-left] [table] [default=left]
+
+\startxmlsetups xml:demo:resource
+ \placefloat
+ [\xmlattdef{#1}{type}{figure}-\xmlattdef{#1}{location}{here}]
+ {\xmlfirst{#1}{/caption}}
+ {\xmlfirst{#1}{/content}}
+\stopxmlsetups
+\stoptyping
+
+In this example we support two types and two locations. We default to a figure
+placed (when possible) at the current location.
+
+\stopsection
+
+\stopchapter
+
+\startchapter[title={Filtering content}]
+
+\startsection[title={\TEX\ versus \LUA}]
+
+It will not come as a surprise that we can access \XML\ files from \TEX\ as well
+as from \LUA. In fact there are two methods to deal with \XML\ in \LUA. First
+there are the low level \XML\ functions in the \type {xml} namespace. On top of
+those functions there is a set of functions in the \type {lxml} namespace that
+deals with \XML\ in a more \TEX ie way. Most of these have similar commands at
+the \TEX\ end.
+
+\startbuffer
+\startxmlsetups first:demo:one
+ \xmlfilter {#1} {artist/name[text()='Randy Newman']/..
+ /albums/album[position()=3]/command(first:demo:two)}
+\stopxmlsetups
+
+\startxmlsetups first:demo:two
+ \blank \start \tt
+ \xmldisplayverbatim{#1}
+ \stop \blank
+\stopxmlsetups
+
+\xmlprocessfile{demo}{music-collection.xml}{first:demo:one}
+\stopbuffer
+
+\typebuffer
+
+This gives the following snippet of verbatim \XML\ code. The indentation is
+conform the indentation in the whole \XML\ file. \footnote {The (probably
+outdated) \XML\ file contains the collection stores on my slimserver instance.
+You can use the \type {mtxrun --script flac} to generate such files.}
+
+\doifmodeelse {atpragma} {
+ \getbuffer
+} {
+ \typefile{xml-mkiv-01.xml}
+}
+
+An alternative written in \LUA\ looks as follows:
+
+\startbuffer
+\blank \start \tt \startluacode
+ local m = lxml.load("mine","music-collection.xml") -- m == lxml.id("mine")
+ local p = "artist/name[text()='Randy Newman']/../albums/album[position()=4]"
+ local l = lxml.filter(m,p) -- returns a list (with one entry)
+ lxml.displayverbatim(l[1])
+\stopluacode \stop \blank
+\stopbuffer
+
+\typebuffer
+
+This produces:
+
+\doifmodeelse {atpragma} {
+ \getbuffer
+} {
+ \typefile{xml-mkiv-02.xml}
+}
+
+You can use both methods mixed but in practice we will use the \TEX\ commands in
+regular styles and the mixture in modules, for instance in those dealing with
+\MATHML\ and cals tables. For complex matters you can write your own finalizers
+(the last action to be taken in a match) in \LUA\ and use them at the \TEX\ end.
+
+\stopsection
+
+\startsection[title={a few details}]
+
+In \CONTEXT\ setups are a rather common variant on macros (\TEX\ commands) but
+with their own namespace. An example of a setup is:
+
+\starttyping
+\startsetup doc:print
+ \setuppapersize[A4][A4]
+\stopsetup
+
+\startsetup doc:screen
+ \setuppapersize[S6][S4]
+\stopsetup
+\stoptyping
+
+Given the previous definitions, later on we can say something like:
+
+\starttyping
+\doifmodeelse {paper} {
+ \setup[doc:print]
+} {
+ \setup[doc:screen]
+}
+\stoptyping
+
+Another example is:
+
+\starttyping
+\startsetup[doc:header]
+ \marking[chapter]
+ \space
+ --
+ \space
+ \pagenumber
+\stopsetup
+\stoptyping
+
+in combination with:
+
+\starttyping
+\setupheadertexts[\setup{doc:header}]
+\stoptyping
+
+Here the advantage is that instead of ending up with an unreadable header
+definitions, we use a nicely formatted setup. An important property of setups and
+the reason why they were introduced long ago is that spaces and newlines are
+ignored in the definition. This means that we don't have to worry about so called
+spurious spaces but it also means that when we do want a space, we have to use
+the \type {\space} command.
+
+The only difference between setups and \XML\ setups is that the following ones
+get an argument (\type {#1}) that reflects the current node in the \XML\ tree.
+
+\stopsection
+
+\startsection[title={CDATA}]
+
+What to do with \type {CDATA}? There are a few methods at tle \LUA\ end for
+dealing with it but here we just mention how you can influence the rendering.
+There are four macros that play a role here:
+
+\starttyping
+\unexpanded\def\xmlcdataobeyedline {\obeyedline}
+\unexpanded\def\xmlcdataobeyedspace{\strut\obeyedspace}
+\unexpanded\def\xmlcdatabefore {\begingroup\tt}
+\unexpanded\def\xmlcdataafter {\endgroup}
+\stoptyping
+
+Technically you can overload them but beware of side effects. Normally you won't
+see much \type {CDATA} and whenever we do, it involves special data that needs
+very special treatment anyway.
+
+\stopsection
+
+\startsection[title={Entities}]
+
+As usual with any way of encoding documents you need escapes in order to encode
+the characters that are used in tagging the content, embedding comments, escaping
+special characters in strings (in programming languages), etc. In \XML\ this
+means that in order characters like \type {<} you need an escape like \type
+{&lt;} and in order then to encode an \type {&} you need \type {&amp;}.
+
+In a typesetting workflow using a programming language like \TEX, another problem
+shows up. There we have different special characters, like \type {$ $} for triggering
+math, but also the backslash, braces etc. Even one such special character is already
+enough to have yet another escaping mechanism at work.
+
+Ideally a user should not worry about these issues but it helps figuring out issues
+when you know what happens under the hood. Also it is good to know that in the
+code there are several ways to deal with these issues. Take the following document:
+
+\starttyping
+<text>
+ Here we have a bit of a &lt;&mess&gt;:
+
+ # &#35;
+ % &#37;
+ \ &#92;
+ { &#123;
+ | &#124;
+ } &#125;
+ ~ &#126;
+</text>
+\stoptyping
+
+When the file is read the \type {&lt;} entity will be replaced by \type {<} and
+the \type {&gt;} by \type {>}. The numeric entities will be replaced by the
+characters they refer to. The \type {&mess} is kind of special. We do preload
+a huge list of more or less standardized entities but \type {mess} is not in
+there. However, it is possible to have it defined in the document preamble, like:
+
+\starttyping
+<!DOCTYPE dummy SYSTEM "dummy.dtd" [
+ <!ENTITY mess "what a mess" >
+]>
+\stoptyping
+
+or even this:
+
+\starttyping
+<!DOCTYPE dummy SYSTEM "dummy.dtd" [
+ <!ENTITY mess "<p>what a mess</p>" >
+]>
+\stoptyping
+
+You can also define it in your document style using one of:
+
+\startxmlcmd {\cmdbasicsetup{xmlsetentity}}
+ replaces entity with name \cmdinternal {cd:name} by \cmdinternal {cd:text}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmltexentity}}
+ replaces entity with name \cmdinternal {cd:name} by \cmdinternal {cd:text}
+ typeset under a \TEX\ regime
+\stopxmlcmd
+
+Such a definition will always have a higher priority than the one defined
+in the document. Anyway, when the document is read in all entities are
+resolved and those that need a special treatment because they map to some
+text are stored in such a way that we can roundtrip them. As a consequence,
+as soon as the content gets pushed into \TEX, we need not only to intercept
+special characters but also have to make sure that the following works:
+
+\starttyping
+\xmltexentity {tex} {\TEX}
+\stoptyping
+
+Here the backslash starts a control sequence while in regular content a
+backslash is just that: a backslash.
+
+Special characters are really special when we have to move text around
+in a \TEX\ ecosystem.
+
+\starttyping
+<text>
+ <title>About #3</title>
+</text>
+\stoptyping
+
+If we map and define title as follows:
+
+\starttyping
+\startxmlsetup xml:title
+ \title{\xmlflush{#1}}
+\stopxmlsetup
+\stoptyping
+
+normally something \type {\xmlflush {id::123}} will be written to the
+auxiliary file and in most cases that is quite okay, but if we have this:
+
+\starttyping
+\setuphead[title][expansion=yes]
+\stoptyping
+
+then we don't want the \type {#} to end up as hash because later on \TEX\
+can get very confused about it because it sees some argument then in a
+probably unexpected way. This is solved by escaping the hash like this:
+
+\starttyping
+About \Ux{23}3
+\stoptyping
+
+The \type {\Ux} command will convert its hexadecimal argument into a
+character. Of course one then needs to typeset such a text under a \TEX\
+character regime but that is normally the case anyway.
+
+\stopsection
+
+\stopchapter
+
+\startchapter[title={Commands}]
+
+\startsection[title={nodes and lpaths}]
+
+The amount of commands available for manipulating the \XML\ file is rather large.
+Many of the commands cooperate with the already discussed setups, a fancy name
+for a collection of macro calls either or not mixed with text.
+
+Most of the commands are just shortcuts to \LUA\ calls, which means that the real
+work is done by \LUA. In fact, what happens is that we have a continuous transfer
+of control from \TEX\ to \LUA, where \LUA\ prints back either data (like element
+content or attribute values) or just invokes a setup whereby it passes a
+reference to the node resolved conform the path expression. The invoked setup
+itself might return control to \LUA\ again, etc.
+
+This sounds complicated but examples will show what we mean here. First we
+present the whole repertoire of commands. Because users can read the source code,
+they might uncover more commands, but only the ones discussed here are official.
+The commands are grouped in categories.
+
+In the following sections \cmdinternal {cd:node} means a reference to a node:
+this can be the identifier of the root (the loaded xml tree) or a reference to a
+node in that tree (often the result of some lookup. A \cmdinternal {cd:lpath} is
+a fancy name for a path expression (as with \XSLT) but resolved by \LUA.
+
+\stopsection
+
+\startsection[title={commands}]
+
+There are a lot of commands available but you probably can ignore most of them.
+We try to be complete which means that there is for instance \type {\xmlfirst} as
+well as \type {\xmllast} but you probably never need the last one. There are also
+commands that were used when testing this interface and we see no reason to
+remove them. Some obscure ones are used in modules and after a while even I often
+forget that they exist. To give you an idea of what commands are important we
+show their use in generating the \CONTEXT\ command definitions (\type
+{x-set-11.mkiv}) per Januari 2016:
+
+\startcolumns[n=2,balance=yes]
+\starttabulate[|l|r|]
+\NC \type {\xmlall} \NC 1 \NC \NR
+\NC \type {\xmlatt} \NC 23 \NC \NR
+\NC \type {\xmlattribute} \NC 1 \NC \NR
+\NC \type {\xmlcount} \NC 1 \NC \NR
+\NC \type {\xmldoif} \NC 2 \NC \NR
+\NC \type {\xmldoifelse} \NC 1 \NC \NR
+\NC \type {\xmlfilterlist} \NC 4 \NC \NR
+\NC \type {\xmlflush} \NC 5 \NC \NR
+\NC \type {\xmlinclude} \NC 1 \NC \NR
+\NC \type {\xmlloadonly} \NC 1 \NC \NR
+\NC \type {\xmlregisterdocumentsetup} \NC 1 \NC \NR
+\NC \type {\xmlsetsetup} \NC 1 \NC \NR
+\NC \type {\xmlsetup} \NC 4 \NC \NR
+\stoptabulate
+\stopcolumns
+
+As you can see filtering, flushing and accessing attributes score high. Below we show
+the statistics of a quite complex rendering (5 variants of schoolbooks: basic book,
+answers, teachers guide, worksheets, full blown version with extensive tracing).
+
+\startcolumns[n=2,balance=yes]
+\starttabulate[|l|r|]
+\NC \type {\xmladdindex} \NC 3 \NC \NR
+\NC \type {\xmlall} \NC 5 \NC \NR
+\NC \type {\xmlappendsetup} \NC 1 \NC \NR
+\NC \type {\xmlapplyselectors} \NC 1 \NC \NR
+\NC \type {\xmlatt} \NC 40 \NC \NR
+\NC \type {\xmlattdef} \NC 9 \NC \NR
+\NC \type {\xmlattribute} \NC 10 \NC \NR
+\NC \type {\xmlbadinclusions} \NC 3 \NC \NR
+\NC \type {\xmlconcat} \NC 3 \NC \NR
+\NC \type {\xmlcount} \NC 1 \NC \NR
+\NC \type {\xmldelete} \NC 11 \NC \NR
+\NC \type {\xmldoif} \NC 39 \NC \NR
+\NC \type {\xmldoifelse} \NC 28 \NC \NR
+\NC \type {\xmldoifelsetext} \NC 13 \NC \NR
+\NC \type {\xmldoifnot} \NC 2 \NC \NR
+\NC \type {\xmldoifnotselfempty} \NC 1 \NC \NR
+\NC \type {\xmlfilter} \NC 100 \NC \NR
+\NC \type {\xmlfirst} \NC 51 \NC \NR
+\NC \type {\xmlflush} \NC 69 \NC \NR
+\NC \type {\xmlflushcontext} \NC 2 \NC \NR
+\NC \type {\xmlinclude} \NC 1 \NC \NR
+\NC \type {\xmlincludeoptions} \NC 5 \NC \NR
+\NC \type {\xmlinclusion} \NC 16 \NC \NR
+\NC \type {\xmlinjector} \NC 1 \NC \NR
+\NC \type {\xmlloaddirectives} \NC 1 \NC \NR
+\NC \type {\xmlmapvalue} \NC 4 \NC \NR
+\NC \type {\xmlmatch} \NC 1 \NC \NR
+\NC \type {\xmlprependsetup} \NC 5 \NC \NR
+\NC \type {\xmlregisterdocumentsetup} \NC 2 \NC \NR
+\NC \type {\xmlregistersetup} \NC 1 \NC \NR
+\NC \type {\xmlremapnamespace} \NC 1 \NC \NR
+\NC \type {\xmlsetfunction} \NC 2 \NC \NR
+\NC \type {\xmlsetinjectors} \NC 2 \NC \NR
+\NC \type {\xmlsetsetup} \NC 11 \NC \NR
+\NC \type {\xmlsetup} \NC 76 \NC \NR
+\NC \type {\xmlstrip} \NC 1 \NC \NR
+\NC \type {\xmlstripanywhere} \NC 1 \NC \NR
+\NC \type {\xmltag} \NC 1 \NC \NR
+\NC \type {\xmltext} \NC 53 \NC \NR
+\NC \type {\xmlvalue} \NC 2 \NC \NR
+\stoptabulate
+\stopcolumns
+
+Here many more are used but this is an exceptional case. The top is again
+dominated by filtering, flushing and attribute consulting. The list can actually
+be smaller. For instance, the \type {\xmlcount} can just as well be \type
+{\xmlfilter} with a \type {count} finalizer. There are also some special ones,
+like the injectors, that are needed for finetuning the final result.
+
+\stopsection
+
+\startsection[title={loading}]
+
+\startxmlcmd {\cmdbasicsetup{xmlloadfile}}
+ loads the file \cmdinternal {cd:file} and registers it under \cmdinternal
+ {cd:name} and applies either given or standard \cmdinternal
+ {cd:xmlsetup} (alias: \type {\xmlload})
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlloadbuffer}}
+ loads the buffer \cmdinternal {cd:buffer} and registers it under
+ \cmdinternal {cd:name} and applies either given or standard
+ \cmdinternal {cd:xmlsetup}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlloaddata}}
+ loads \cmdinternal {cd:text} and registers it under \cmdinternal
+ {cd:name} and applies either given or standard \cmdinternal
+ {cd:xmlsetup}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlloadonly}}
+ loads \cmdinternal {cd:text} and registers it under \cmdinternal
+ {cd:name} and applies either given or standard \cmdinternal
+ {cd:xmlsetup} but doesn't flush the content
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlinclude}}
+ includes the file specified by attribute \cmdinternal {cd:name} of the
+ element located by \cmdinternal {cd:lpath} at node \cmdinternal {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlprocessfile}}
+ registers file \cmdinternal {cd:file} as \cmdinternal {cd:name} and
+ process the tree starting with \cmdinternal {cd:xmlsetup} (alias:
+ \type {\xmlprocess})
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlprocessbuffer}}
+ registers buffer \cmdinternal {cd:name} as \cmdinternal {cd:name} and process
+ the tree starting with \cmdinternal {cd:xmlsetup}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlprocessdata}}
+ registers \cmdinternal {cd:text} as \cmdinternal {cd:name} and process
+ the tree starting with \cmdinternal {cd:xmlsetup}
+\stopxmlcmd
+
+The initial setup defaults to \type {xml:process} that is defined
+as follows:
+
+\starttyping
+\startsetups xml:process
+ \xmlregistereddocumentsetups\xmldocument
+ \xmlmain\xmldocument
+\stopsetups
+\stoptyping
+
+First we apply the setups associated with the document (including common setups)
+and then we flush the whole document. The macro \type {\xmldocument} expands to
+the current document id. There is also \type {\xmlself} which expands to the
+current node number (\type {#1} in setups).
+
+\startxmlcmd {\cmdbasicsetup{xmlmain}}
+ returns the whole document
+\stopxmlcmd
+
+Normally such a flush will trigger a chain reaction of setups associated with the
+child elements.
+
+\stopsection
+
+\startsection[title={saving}]
+
+\startxmlcmd {\cmdbasicsetup{xmlsave}}
+ saves the given node \cmdinternal {cd:node} in the file \cmdinternal {cd:file}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmltofile}}
+ saves the match of \cmdinternal {cd:lpath} in the file \cmdinternal {cd:file}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmltobuffer}}
+ saves the match of \cmdinternal {cd:lpath} in the buffer \cmdinternal {cd:buffer}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmltobufferverbose}}
+ saves the match of \cmdinternal {cd:lpath} verbatim in the buffer \cmdinternal
+ {cd:buffer}
+\stopxmlcmd
+
+% \startxmlcmd {\cmdbasicsetup{xmltoparameters}}
+% converts the match of \cmdinternal {cd:lpath} to key|/|values (for tracing)
+% \stopxmlcmd
+
+The next command is only needed when you have messed with the tree using
+\LUA\ code.
+
+\startxmlcmd {\cmdbasicsetup{xmladdindex}}
+ (re)indexes a tree
+\stopxmlcmd
+
+The following macros are only used in special situations and are not really meant
+for users.
+
+\startxmlcmd {\cmdbasicsetup{xmlraw}}
+ flush the content if \cmdinternal {cd:node} with original entities
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{startxmlraw}}
+ flush the wrapped content with original entities
+\stopxmlcmd
+
+\stopsection
+
+\startsection[title={flushing data}]
+
+When we flush an element, the associated \XML\ setups are expanded. The most
+straightforward way to flush an element is the following. Keep in mind that the
+returned values itself can trigger setups and therefore flushes.
+
+\startxmlcmd {\cmdbasicsetup{xmlflush}}
+ returns all nodes under \cmdinternal {cd:node}
+\stopxmlcmd
+
+You can restrict flushing by using commands that accept a specification.
+
+\startxmlcmd {\cmdbasicsetup{xmltext}}
+ returns the text of the matching \cmdinternal {cd:lpath} under \cmdinternal
+ {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlpure}}
+ returns the text of the matching \cmdinternal {cd:lpath} under \cmdinternal
+ {cd:node} without \type {\Ux} escaped special \TEX\ characters
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlflushtext}}
+ returns the text of the \cmdinternal {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlflushpure}}
+ returns the text of the \cmdinternal {cd:node} without \type {\Ux} escaped
+ special \TEX\ characters
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlnonspace}}
+ returns the text of the matching \cmdinternal {cd:lpath} under \cmdinternal
+ {cd:node} without embedded spaces
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlall}}
+ returns all nodes under \cmdinternal {cd:node} that matches \cmdinternal
+ {cd:lpath}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmllastmatch}}
+ returns all nodes found in the last match
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlfirst}}
+ returns the first node under \cmdinternal {cd:node} that matches \cmdinternal
+ {cd:lpath}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmllast}}
+ returns the last node under \cmdinternal {cd:node} that matches \cmdinternal
+ {cd:lpath}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlfilter}}
+ at a match of \cmdinternal {cd:lpath} a given filter \type {filter} is applied
+ and the result is returned
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlsnippet}}
+ returns the \cmdinternal {cd:number}\high{th} element under \cmdinternal
+ {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlposition}}
+ returns the \cmdinternal {cd:number}\high{th} match of \cmdinternal
+ {cd:lpath} at node \cmdinternal {cd:node}; a negative number starts at the
+ end (alias: \type {\xmlindex})
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlelement}}
+ returns the \cmdinternal {cd:number}\high{th} child of node \cmdinternal {cd:node};
+ a negative number starts at the end
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlpos}}
+ returns the index (position) in the parent node of \cmdinternal {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlconcat}}
+ returns the sequence of nodes that match \cmdinternal {cd:lpath} at
+ \cmdinternal {cd:node} whereby \cmdinternal {cd:text} is put between each
+ match
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlconcatrange}}
+ returns the \cmdinternal {cd:first}\high {th} upto \cmdinternal
+ {cd:last}\high {th} of nodes that match \cmdinternal {cd:lpath} at
+ \cmdinternal {cd:node} whereby \cmdinternal {cd:text} is put between each
+ match
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlcommand}}
+ apply the given \cmdinternal {cd:xmlsetup} to each match of \cmdinternal
+ {cd:lpath} at node \cmdinternal {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlstrip}}
+ remove leading and trailing spaces from nodes under \cmdinternal {cd:node}
+ that match \cmdinternal {cd:lpath}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlstripped}}
+ remove leading and trailing spaces from nodes under \cmdinternal {cd:node}
+ that match \cmdinternal {cd:lpath} and return the content afterwards
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlstripnolines}}
+ remove leading and trailing spaces as well as collapse embedded spaces
+ from nodes under \cmdinternal {cd:node} that match \cmdinternal {cd:lpath}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlstrippednolines}}
+ remove leading and trailing spaces as well as collapse embedded spaces from
+ nodes under \cmdinternal {cd:node} that match \cmdinternal {cd:lpath} and
+ return the content afterwards
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlverbatim}}
+ flushes the content verbatim code (without any wrapping, i.e. no fonts
+ are selected and such)
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlinlineverbatim}}
+ return the content of the node as inline verbatim code; no further
+ interpretation (expansion) takes place and spaces are honoured; it uses the
+ following wrapper
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{startxmlinlineverbatim}}
+ wraps inline verbatim mode using the environment specified (a prefix \type
+ {xml:} is added to the environment name)
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldisplayverbatim}}
+ return the content of the node as display verbatim code; no further
+ interpretation (expansion) takes place and leading and trailing spaces and
+ newlines are treated special; it uses the following wrapper
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{startxmldisplayverbatim}}
+ wraps the content in display verbatim using the environment specified (a prefix
+ \type {xml:} is added to the environment name)
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlprettyprint}}
+ pretty print (with colors) the node \cmdinternal {cd:node}; use the \CONTEXT\
+ \SCITE\ lexers when available (\type {\usemodule [scite]})
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlflushspacewise}}
+ flush node \cmdinternal {cd:node} obeying spaces and newlines
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlflushlinewise}}
+ flush node \cmdinternal {cd:node} obeying newlines
+\stopxmlcmd
+
+\stopsection
+
+\startsection[title={information}]
+
+The following commands return strings. Normally these are used in tests.
+
+\startxmlcmd {\cmdbasicsetup{xmlname}}
+ returns the complete name (including namespace prefix) of the
+ given \cmdinternal {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlnamespace}}
+ returns the namespace of the given \cmdinternal {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmltag}}
+ returns the tag of the element, without namespace prefix
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlcount}}
+ returns the number of matches of \cmdinternal {cd:lpath} at node \cmdinternal
+ {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlatt}}
+ returns the value of attribute \cmdinternal {cd:name} or empty if no such
+ attribute exists
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlattdef}}
+ returns the value of attribute \cmdinternal {cd:name} or \cmdinternal
+ {cd:string} if no such attribute exists
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlrefatt}}
+ returns the value of attribute \cmdinternal {cd:name} or empty if no such
+ attribute exists; a leading \type {#} is removed (nicer for tex)
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlchainatt}}
+ returns the value of attribute \cmdinternal {cd:name} or empty if no such
+ attribute exists; backtracks till a match is found
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlchainattdef}}
+ returns the value of attribute \cmdinternal {cd:name} or \cmdinternal
+ {cd:string} if no such attribute exists; backtracks till a match is found
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlattribute}}
+ finds a first match for \cmdinternal {cd:lpath} at \cmdinternal {cd:node} and
+ returns the value of attribute \cmdinternal {cd:name} or empty if no such
+ attribute exists
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlattributedef}}
+ finds a first match for \cmdinternal {cd:lpath} at \cmdinternal {cd:node} and
+ returns the value of attribute \cmdinternal {cd:name} or \cmdinternal
+ {cd:text} if no such attribute exists
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmllastatt}}
+ returns the last attribute found (this avoids a lookup)
+\stopxmlcmd
+
+\stopsection
+
+\startsection[title={manipulation}]
+
+You can use \LUA\ code to manipulate the tree and it makes no sense to duplicate
+this in \TEX. In the future we might provide an interface to some of this
+functionality. Keep in mind that manipuating the tree might have side effects as
+we maintain several indices into the tree that also needs to be updated then.
+
+\stopsection
+
+\startsection[title={integration}]
+
+If you write a module that deals with \XML, for instance processing cals tables,
+then you need ways to control specific behaviour. For instance, you might want to
+add a background to the table. Such directives are collected in \XML\ files and
+can be loaded on demand.
+
+\startxmlcmd {\cmdbasicsetup{xmlloaddirectives}}
+ loads \CONTEXT\ directives from \cmdinternal {cd:file} that will get
+ interpreted when processing documents
+\stopxmlcmd
+
+A directives definition file looks as follows:
+
+\starttyping
+<?xml version="1.0" standalone="yes"?>
+
+<directives>
+ <directive attribute='id' value="100"
+ setup="cdx:100"/>
+ <directive attribute='id' value="101"
+ setup="cdx:101"/>
+ <directive attribute='cdx' value="colors" element="cals:table"
+ setup="cdx:cals:table:colors"/>
+ <directive attribute='cdx' value="vertical" element="cals:table"
+ setup="cdx:cals:table:vertical"/>
+ <directive attribute='cdx' value="noframe" element="cals:table"
+ setup="cdx:cals:table:noframe"/>
+ <directive attribute='cdx' value="*" element="cals:table"
+ setup="cdx:cals:table:*"/>
+</directives>
+\stoptyping
+
+Examples of usage can be found in \type {x-cals.mkiv}. The directive is triggered
+by an attribute. Instead of a setup you can specify a setup to be applied before
+and after the node gets flushed.
+
+\startxmlcmd {\cmdbasicsetup{xmldirectives}}
+ apply the setups directive associated with the node
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldirectivesbefore}}
+ apply the before directives associated with the node
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldirectivesafter}}
+ apply the after directives associated with the node
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlinstalldirective}}
+ defines a directive that hooks into a handler
+\stopxmlcmd
+
+Normally a directive will be put in the \XML\ file, for instance as:
+
+\starttyping
+<?context-mathml-directive minus reduction yes ?>
+\stoptyping
+
+Here the \type {mathml} is the general class of directives and \type {minus} a
+subclass, in our case a specific element.
+
+\stopsection
+
+\startsection[title={setups}]
+
+The basic building blocks of \XML\ processing are setups. These are just
+collections of macros that are expanded. These setups get one argument passed
+(\type {#1}):
+
+\starttyping
+\startxmlsetups somedoc:somesetup
+ \xmlflush{#1}
+\stopxmlsetups
+\stoptyping
+
+This argument is normally a number that internally refers to a specific node in
+the \XML\ tree. The user should see it as an abstract reference and not depend on
+its numeric property. Just think of it as \quote {the current node}. You can (and
+probably will) call such setups using:
+
+\startxmlcmd {\cmdbasicsetup{xmlsetup}}
+ expands setup \cmdinternal {cd:setup} and pass \cmdinternal {cd:node} as
+ argument
+\stopxmlcmd
+
+However, in most cases the setups are associated to specific elements,
+something that users of \XSLT\ might recognize as templates.
+
+\startxmlcmd {\cmdbasicsetup{xmlsetfunction}}
+ associates function \cmdinternal {cd:luafunction} to the elements in
+ namespace \cmdinternal {cd:name} that match \cmdinternal {cd:lpath}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlsetsetup}}
+ associates setups \cmdinternal {cd:setup} (\TEX\ code) with the matching
+ nodes of \cmdinternal {cd:lpath} or root \cmdinternal {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlprependsetup}}
+ pushes \cmdinternal {cd:setup} to the front of global list of setups
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlappendsetup}}
+ adds \cmdinternal {cd:setup} to the global list of setups to be applied
+ (alias: \type{\xmlregistersetup})
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlbeforesetup}}
+ pushes \cmdinternal {cd:setup} into the global list of setups; the
+ last setup is the position
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlaftersetup}}
+ adds \cmdinternal {cd:setup} to the global list of setups; the last setup
+ is the position
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlremovesetup}}
+ removes \cmdinternal {cd:setup} from the global list of setups
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlprependdocumentsetup}}
+ pushes \cmdinternal {cd:setup} to the front of list of setups to be applied
+ to \cmdinternal {cd:name}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlappenddocumentsetup}}
+ adds \cmdinternal {cd:setup} to the list of setups to be applied to
+ \cmdinternal {cd:name} (you can also use the alias: \type
+ {\xmlregisterdocumentsetup})
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlbeforedocumentsetup}}
+ pushes \cmdinternal {cd:setup} into the setups to be applied to \cmdinternal
+ {cd:name}; the last setup is the position
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlafterdocumentsetup}}
+ adds \cmdinternal {cd:setup} to the setups to be applied to \cmdinternal
+ {cd:name}; the last setup is the position
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlremovedocumentsetup}}
+ removes \cmdinternal {cd:setup} from the global list of setups to be applied
+ to \cmdinternal {cd:name}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlresetsetups}}
+ removes all global setups
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlresetdocumentsetups}}
+ removes all setups from the \cmdinternal {cd:name} specific list of setups to
+ be applied
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlflushdocumentsetups}{setup}}
+ applies \cmdinternal {cd:setup} (can be a list) to \cmdinternal {cd:name}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlregisteredsetups}}
+ applies all global setups to the current document
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlregistereddocumentsetups}}
+ applies all document specific \cmdinternal {cd:setup} to document
+ \cmdinternal {cd:name}
+\stopxmlcmd
+
+\stopsection
+
+\startsection[title={testing}]
+
+The following test macros all take a \cmdinternal {cd:node} as first argument
+and an \cmdinternal {cd:lpath} as second:
+
+\startxmlcmd {\cmdbasicsetup{xmldoif}}
+ expands to \cmdinternal {cd:true} when \cmdinternal {cd:lpath} matches at
+ node \cmdinternal {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldoifnot}}
+ expands to \cmdinternal {cd:true} when \cmdinternal {cd:lpath} does not match
+ at node \cmdinternal {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldoifelse}}
+ expands to \cmdinternal {cd:true} when \cmdinternal {cd:lpath} matches at
+ node \cmdinternal {cd:node} and to \cmdinternal {cd:false} otherwise
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldoiftext}}
+ expands to \cmdinternal {cd:true} when the node matching \cmdinternal
+ {cd:lpath} at node \cmdinternal {cd:node} has some content
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldoifnottext}}
+ expands to \cmdinternal {cd:true} when the node matching \cmdinternal
+ {cd:lpath} at node \cmdinternal {cd:node} has no content
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldoifelsetext}}
+ expands to \cmdinternal {cd:true} when the node matching \cmdinternal
+ {cd:lpath} at node \cmdinternal {cd:node} has content and to \cmdinternal
+ {cd:false} otherwise
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldoifelseempty}}
+ expands to \cmdinternal {cd:true} when the node matching \cmdinternal
+ {cd:lpath} at node \cmdinternal {cd:node} is empty and to \cmdinternal
+ {cd:false} otherwise
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldoifelseselfempty}}
+ expands to \cmdinternal {cd:true} when the node is empty and to \cmdinternal
+ {cd:false} otherwise
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldoifselfempty}}
+ expands to \cmdinternal {cd:true} when \cmdinternal {cd:node} is empty
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldoifnotselfempty}}
+ expands to \cmdinternal {cd:true} when \cmdinternal {cd:node} is not empty
+\stopxmlcmd
+
+\stopsection
+
+\startsection[title={initialization}]
+
+The general setup command (not to be confused with setups) that deals with the
+\MKIV\ tree handler is \type {\setupxml}. There are currently only a few options.
+
+\cmdfullsetup{setupxml}
+
+When you set \type {default} to \cmdinternal {cd:text} elements with no setup
+assigned will end up as text. When set to \type {hidden} such elements will be
+hidden. You can apply the default yourself using:
+
+\startxmlcmd {\cmdbasicsetup{xmldefaulttotext}}
+ presets the tree with root \cmdinternal {cd:node} to the handlers set up with
+ \type {\setupxml} option \cmdinternal{default}
+\stopxmlcmd
+
+You can set \type {compress} to \type {yes} in which case comment is stripped
+from the tree when the file is read.
+
+\startxmlcmd {\cmdbasicsetup{xmlregisterns}}
+ associates an internal namespace (like \type {mml}) with one given in the
+ document as \URL\ (like mathml)
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlremapname}}
+ changes the namespace and tag of the matching elements
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlremapnamespace}}
+ replaces all references to the given namespace to a new one (applied
+ recursively)
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlchecknamespace}}
+ sets the namespace of the matching elements unless a namespace is already set
+\stopxmlcmd
+
+\stopsection
+
+\startsection[title={helpers}]
+
+Often an attribute will determine the rendering and this may result in many
+tests. Especially when we have multiple attributes that control the output such
+tests can become rather extensive and redundant because one gets $n\times m$ or
+more such tests.
+
+Therefore we have a convenient way to map attributes onto for instance strings or
+commands.
+
+\startxmlcmd {\cmdbasicsetup{xmlmapvalue}}
+ associate a \cmdinternal {cd:text} with a \cmdinternal {cd:category} and
+ \cmdinternal {cd:name} (alias: \type{\xmlmapval})
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlvalue}}
+ expand the value associated with a \cmdinternal {cd:category} and
+ \cmdinternal {cd:name} and if not resolved, expand to the \cmdinternal
+ {cd:text} (alias: \type{\xmlval})
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmldoifelsevalue}}
+ associate a \cmdinternal {cd:text} with a \cmdinternal {cd:category} and
+ \cmdinternal {cd:name}
+\stopxmlcmd
+
+This is used as follows. We define a couple of mappings in the same category:
+
+\starttyping
+\xmlmapvalue{emph}{bold} {\bf}
+\xmlmapvalue{emph}{italic}{\it}
+\stoptyping
+
+Assuming that we have associated the following setup with the \type {emph}
+element, we can say (with \type {#1} being the current element):
+
+\starttyping
+\startxmlsetups demo:emph
+ \begingroup
+ \xmlvalue{emph}{\xmlatt{#1}{type}}{}
+ \endgroup
+\stopxmlsetups
+\stoptyping
+
+In this case we have no default. The \type {type} attribute triggers the actions,
+as in:
+
+\starttyping
+normal <emph type='bold'>bold</emph> normal
+\stoptyping
+
+This mechanism is not really bound to elements and attributes so you can use this
+mechanism for other purposes as well.
+
+\stopsection
+
+\stopchapter
+
+\startchapter[title={Expressions and filters}]
+
+\startsection[title={path expressions}]
+
+In the previous chapters we used \cmdinternal {cd:lpath} expressions, which are a variant
+on \type {xpath} expressions as in \XSLT\ but in this case more geared towards
+usage in \TEX. This mechanisms will be extended when demands are there.
+
+A path is a sequence of matches. A simple path expression is:
+
+\starttyping
+a/b/c/d
+\stoptyping
+
+Here each \type {/} goes one level deeper. We can go backwards in a lookup with
+\type {..}:
+
+\starttyping
+a/b/../d
+\stoptyping
+
+We can also combine lookups, as in:
+
+\starttyping
+a/(b|c)/d
+\stoptyping
+
+A negated lookup is preceded by a \type {!}:
+
+\starttyping
+a/(b|c)/!d
+\stoptyping
+
+A wildcard is specified with a \type {*}:
+
+\starttyping
+a/(b|c)/!d/e/*/f
+\stoptyping
+
+In addition to these tag based lookups we can use attributes:
+
+\starttyping
+a/(b|c)/!d/e/*/f[@type=whatever]
+\stoptyping
+
+An \type {@} as first character means that we are dealing with an attribute.
+Within the square brackets there can be boolean expressions:
+
+\starttyping
+a/(b|c)/!d/e/*/f[@type=whatever and @id>100]
+\stoptyping
+
+You can use functions as in:
+
+\starttyping
+a/(b|c)/!d/e/*/f[something(text()) == "oeps"]
+\stoptyping
+
+There are a couple of predefined functions:
+
+\starttabulate[|l|l|p|]
+\NC \type{rootposition} \type{order} \NC number \NC the index of the matched root element (kind of special) \NC \NR
+\NC \type{position} \NC number \NC the current index of the matched element in the match list \NC \NR
+\NC \type{match} \NC number \NC the current index of the matched element sub list with the same parent \NC \NR
+\NC \type{first} \NC number \NC \NC \NR
+\NC \type{last} \NC number \NC \NC \NR
+\NC \type{index} \NC number \NC the current index of the matched element in its parent list \NC \NR
+\NC \type{firstindex} \NC number \NC \NC \NR
+\NC \type{lastindex} \NC number \NC \NC \NR
+\NC \type{element} \NC number \NC the element's index \NC \NR
+\NC \type{firstelement} \NC number \NC \NC \NR
+\NC \type{lastelement} \NC number \NC \NC \NR
+\NC \type{text} \NC string \NC the textual representation of the matched element \NC \NR
+\NC \type{content} \NC table \NC the node of the matched element \NC \NR
+\NC \type{name} \NC string \NC the full name of the matched element: namespace and tag \NC \NR
+\NC \type{namespace} \type{ns} \NC string \NC the namespace of the matched element \NC \NR
+\NC \type{tag} \NC string \NC the tag of the matched element \NC \NR
+\NC \type{attribute} \NC string \NC the value of the attribute with the given name of the matched element \NC \NR
+\stoptabulate
+
+There are fundamental differences between \type {position}, \type {match} and
+\type {index}. Each step results in a new list of matches. The \type {position}
+is the index in this new (possibly intermediate) list. The \type {match} is also
+an index in this list but related to the specific match of element names. The
+\type {index} refers to the location in the parent element.
+
+Say that we have:
+
+\starttyping
+<collection>
+ <resources>
+ <manual>
+ <screen>.1.</screen>
+ <paper>.1.</paper>
+ </manual>
+ <manual>
+ <paper>.2.</paper>
+ <screen>.2.</screen>
+ </manual>
+ <resources>
+ <resources>
+ <manual>
+ <screen>.3.</screen>
+ <paper>.3.</paper>
+ </manual>
+ <resources>
+<collection>
+\stoptyping
+
+The following then applies:
+
+\starttabulate[|l|l|]
+\NC \type {collection/resources/manual[position()==1]/paper} \NC \type{.1.} \NC \NR
+\NC \type {collection/resources/manual[match()==1]/paper} \NC \type{.1.} \type{.3.} \NC \NR
+\NC \type {collection/resources/manual/paper[index()==1]} \NC \type{.2.} \NC \NR
+\stoptabulate
+
+In most cases the \type {position} test is more restrictive than the \type
+{match} test.
+
+You can pass your own functions too. Such functions are defined in the the \type
+{xml.expressions} namespace. We have defined a few shortcuts:
+
+\starttabulate[|l|l|]
+\NC \type {find(str,pattern)} \NC \type{string.find} \NC \NR
+\NC \type {contains(str)} \NC \type{string.find} \NC \NR
+\NC \type {oneof(str,...)} \NC is \type{str} in list \NC \NR
+\NC \type {upper(str)} \NC \type{characters.upper} \NC \NR
+\NC \type {lower(str)} \NC \type{characters.lower} \NC \NR
+\NC \type {number(str)} \NC \type{tonumber} \NC \NR
+\NC \type {boolean(str)} \NC \type{toboolean} \NC \NR
+\NC \type {idstring(str)} \NC removes leading hash \NC \NR
+\NC \type {name(index)} \NC full tag name \NC \NR
+\NC \type {tag(index)} \NC tag name \NC \NR
+\NC \type {namespace(index)} \NC namespace of tag \NC \NR
+\NC \type {text(index)} \NC content \NC \NR
+\NC \type {error(str)} \NC quit and show error \NC \NR
+\NC \type {quit()} \NC quit \NC \NR
+\NC \type {print()} \NC print message \NC \NR
+\NC \type {count(pattern)} \NC number of matches \NC \NR
+\NC \type {child(pattern)} \NC take child that matches \NC \NR
+\stoptabulate
+
+
+You can also use normal \LUA\ functions as long as you make sure that you pass
+the right arguments. There are a few predefined variables available inside such
+functions.
+
+\starttabulate[|Tl|l|p|]
+\NC \type{list} \NC table \NC the list of matches \NC \NR
+\NC \type{l} \NC number \NC the current index in the list of matches \NC \NR
+\NC \type{ll} \NC element \NC the current element that matched \NC \NR
+\NC \type{order} \NC number \NC the position of the root of the path \NC \NR
+\stoptabulate
+
+The given expression between \type {[]} is converted to a \LUA\ expression so you
+can use the usual operators:
+
+\starttyping
+== ~= <= >= < > not and or ()
+\stoptyping
+
+In addition, \type {=} equals \type {==} and \type {!=} is the same as \type
+{~=}. If you mess up the expression, you quite likely get a \LUA\ error message.
+
+\stopsection
+
+\startsection[title={functions as filters}]
+
+At the \LUA\ end a whole \cmdinternal {cd:lpath} expression results in a (set of) node(s)
+with its environment, but that is hardly usable in \TEX. Think of code like:
+
+\starttyping
+for e in xml.collected(xml.load('text.xml'),"title") do
+ -- e = the element that matched
+end
+\stoptyping
+
+The older variant is still supported but you can best use the previous variant.
+
+\starttyping
+for r, d, k in xml.elements(xml.load('text.xml'),"title") do
+ -- r = root of the title element
+ -- d = data table
+ -- k = index in data table
+end
+\stoptyping
+
+Here \type {d[k]} points to the \type {title} element and in this case all titles
+in the tree pass by. In practice this kind of code is encapsulated in function
+calls, like those returning elements one by one, or returning the first or last
+match. The result is then fed back into \TEX, possibly after being altered by an
+associated setup. We've seen the wrappers to such functions already in a previous
+chapter.
+
+In addition to the previously discussed expressions, one can add so called
+filters to the expression, for instance:
+
+\starttyping
+a/(b|c)/!d/e/text()
+\stoptyping
+
+In a filter, the last part of the \cmdinternal {cd:lpath} expression is a
+function call. The previous example returns the text of each element \type {e}
+that results from matching the expression. When running \TEX\ the following
+functions are available. Some are also available when using pure \LUA. In \TEX\
+you can often use one of the macros like \type {\xmlfirst} instead of a \type
+{\xmlfilter} with finalizer \type {first()}. The filter can be somewhat faster
+but that is hardly noticeable.
+
+\starttabulate[|l|l|p|]
+\NC \type {context()} \NC string \NC the serialized text with \TEX\ catcode regime \NC \NR
+%NC \type {ctxtext()} \NC string \NC \NC \NR
+\NC \type {function()} \NC string \NC depends on the function \NC \NR
+%
+\NC \type {name()} \NC string \NC the (remapped) namespace \NC \NR
+\NC \type {tag()} \NC string \NC the name of the element \NC \NR
+\NC \type {tags()} \NC list \NC the names of the element \NC \NR
+%
+\NC \type {text()} \NC string \NC the serialized text \NC \NR
+\NC \type {upper()} \NC string \NC the serialized text uppercased \NC \NR
+\NC \type {lower()} \NC string \NC the serialized text lowercased \NC \NR
+\NC \type {stripped()} \NC string \NC the serialized text stripped \NC \NR
+\NC \type {lettered()} \NC string \NC the serialized text only letters (cf. \UNICODE) \NC \NR
+%
+\NC \type {count()} \NC number \NC the number of matches \NC \NR
+\NC \type {index()} \NC number \NC the matched index in the current path \NC \NR
+\NC \type {match()} \NC number \NC the matched index in the preceding path \NC \NR
+%
+%NC \type {lowerall()} \NC string \NC \NC \NR
+%NC \type {upperall()} \NC string \NC \NC \NR
+%
+\NC \type {attribute(name)} \NC content \NC returns the attribute with the given name \NC \NR
+\NC \type {chainattribute(name)} \NC content \NC sidem, but backtracks till one is found \NC \NR
+\NC \type {command(name)} \NC content \NC expands the setup with the given name for each found element \NC \NR
+\NC \type {position(n)} \NC content \NC processes the \type {n}\high{th} instance of the found element \NC \NR
+\NC \type {all()} \NC content \NC processes all instances of the found element \NC \NR
+%NC \type {default} \NC content \NC all \NC \NR
+\NC \type {reverse()} \NC content \NC idem in reverse order \NC \NR
+\NC \type {first()} \NC content \NC processes the first instance of the found element \NC \NR
+\NC \type {last()} \NC content \NC processes the last instance of the found element \NC \NR
+\NC \type {concat(...)} \NC content \NC concatinates the match \NC \NC \NR
+\NC \type {concatrange(from,to,...)} \NC content \NC concatinates a range of matches \NC \NC \NR
+\stoptabulate
+
+The extra arguments of the concatinators are: \type {separator} (string), \type
+{lastseparator} (string) and \type {textonly} (a boolean).
+
+These filters are in fact \LUA\ functions which means that if needed more of them
+can be added. Indeed this happens in some of the \XML\ related \MKIV\ modules,
+for instance in the \MATHML\ processor.
+
+\stopsection
+
+\startsection[title={example}]
+
+The number of commands is rather large and if you want to avoid them this is
+often possible. Take for instance:
+
+\starttyping
+\xmlall{#1}{/a/b[position()>3]}
+\stoptyping
+
+Alternatively you can use:
+
+\starttyping
+\xmlfilter{#1}{/a/b[position()>3]/all()}
+\stoptyping
+
+and actually this is also faster as internally it avoids a function call. Of
+course in practice this is hardly measurable.
+
+In previous examples we've already seen quite some expressions, and it might be
+good to point out that the syntax is modelled after \XSLT\ but is not quite the
+same. The reason is that we started with a rather minimal system and have already
+styles in use that depend on compatibility.
+
+\starttyping
+namespace:// axis node(set) [expr 1]..[expr n] / ... / filter
+\stoptyping
+
+When we are inside a \CONTEXT\ run, the namespace is \type {tex}. Hoewever, if
+you want not to print back to \TEX\ you need to be more explicit. Say that we
+typeset examns and have a (not that logical) structure like:
+
+\starttyping
+<question>
+ <text>...</text>
+ <answer>
+ <item>one</item>
+ <item>two</item>
+ <item>three</item>
+ </answer>
+ <alternative>
+ <condition>true</condition>
+ <score>1</score>
+ </alternative>
+ <alternative>
+ <condition>false</condition>
+ <score>0</score>
+ </alternative>
+ <alternative>
+ <condition>true</condition>
+ <score>2</score>
+ </alternative>
+</question>
+\stoptyping
+
+Say that we typeset the questions with:
+
+\starttyping
+\startxmlsetups question
+ \blank
+ score: \xmlfunction{#1}{totalscore}
+ \blank
+ \xmlfirst{#1}{text}
+ \startitemize
+ \xmlfilter{#1}{/answer/item/command(answer:item)}
+ \stopitemize
+ \endgraf
+ \blank
+\stopxmlsetups
+\stoptyping
+
+Each item in the answer results in a call to:
+
+\starttyping
+\startxmlsetups answer:item
+ \startitem
+ \xmlflush{#1}
+ \endgraf
+ \xmlfilter{#1}{../../alternative[position()=rootposition()]/
+ condition/command(answer:condition)}
+ \stopitem
+\stopxmlsetups
+\stoptyping
+
+\starttyping
+\startxmlsetups answer:condition
+ \endgraf
+ condition: \xmlflush{#1}
+ \endgraf
+\stopxmlsetups
+\stoptyping
+
+Now, there are two rather special filters here. The first one involves
+calculating the total score. As we look forward we use a function to deal with
+this.
+
+\starttyping
+\startluacode
+function xml.functions.totalscore(root)
+ local score = 0
+ for e in xml.collected(root,"/alternative") do
+ score = score + xml.filter(e,"xml:///score/number()") or 0
+ end
+ tex.write(score)
+end
+\stopluacode
+\stoptyping
+
+Watch how we use the namespace to keep the results at the \LUA\ end.
+
+The second special trick shown here is to limit a match using the current
+position of the root (\type {#}) match.
+
+As you can see, a path expression can be more than just filtering a few nodes. At
+the end of this manual you will find a bunch of examples.
+
+\stopsection
+
+\startsection[title={tables}]
+
+If you want to know how the internal \XML\ tables look you can print such a
+table:
+
+\starttyping
+print(table.serialize(e))
+\stoptyping
+
+This produces for instance:
+
+% s = xml.convert("<document><demo label='whatever'>some text</demo></document>")
+% print(table.serialize(xml.filter(s,"demo")[1]))
+
+\starttyping
+t={
+ ["at"]={
+ ["label"]="whatever",
+ },
+ ["dt"]={ "some text" },
+ ["ns"]="",
+ ["rn"]="",
+ ["tg"]="demo",
+}
+\stoptyping
+
+The \type {rn} entry is the renamed namespace (when renaming is applied). If you
+see tags like \type {@pi@} this means that we don't have an element, but (in this
+case) a processing instruction.
+
+\starttabulate[|l|p|]
+\NC \type {@rt@} \NC the root element \NC \NR
+\NC \type {@dd@} \NC document definition \NC \NR
+\NC \type {@cm@} \NC comment, like \type {<!-- whatever -->} \NC \NR
+\NC \type {@cd@} \NC so called \type {CDATA} \NC \NR
+\NC \type {@pi@} \NC processing instruction, like \type {<?whatever we want ?>} \NC \NR
+\stoptabulate
+
+There are many ways to deal with the content, but in the perspective of \TEX\
+only a few matter.
+
+\starttabulate[|l|p|]
+\NC \type {xml.sprint(e)} \NC print the content to \TEX\ and apply setups if needed \NC \NR
+\NC \type {xml.tprint(e)} \NC print the content to \TEX\ (serialize elements verbose) \NC \NR
+\NC \type {xml.cprint(e)} \NC print the content to \TEX\ (used for special content) \NC \NR
+\stoptabulate
+
+Keep in mind that anything low level that you uncover is not part of the official
+interface unless mentioned in this manual.
+
+\stopsection
+
+\stopchapter
+
+\startchapter[title={Tips and tricks}]
+
+\startsection[title={tracing}]
+
+It can be hard to debug code as much happens kind of behind the screens.
+Therefore we have a couple of tracing options. Of course you can typeset some
+status information, using for instance:
+
+\startxmlcmd {\cmdbasicsetup{xmlshow}}
+ typeset the tree given by \cmdinternal {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlinfo}}
+ typeset the name if the element given by \cmdinternal {cd:node}
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlpath}}
+ returns the complete path (including namespace prefix and index) of the
+ given \cmdinternal {cd:node}
+\stopxmlcmd
+
+\startbuffer[demo]
+<?xml version "1.0"?>
+<document>
+ <section>
+ <content>
+ <p>first</p>
+ <p><b>second</b></p>
+ </content>
+ </section>
+ <section>
+ <content>
+ <p><b>third</b></p>
+ <p>fourth</p>
+ </content>
+ </section>
+</document>
+\stopbuffer
+
+Say that we have the following \XML:
+
+\typebuffer[demo]
+
+and the next definitions:
+
+\startbuffer
+\startxmlsetups xml:demo:base
+ \xmlsetsetup{#1}{p|b}{xml:demo:*}
+\stopxmlsetups
+
+\startxmlsetups xml:demo:p
+ \xmlflush{#1}
+ \par
+\stopxmlsetups
+
+\startxmlsetups xml:demo:b
+ \par
+ \xmlpath{#1} : \xmlflush{#1}
+ \par
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{example-10}{xml:demo:base}
+
+\xmlprocessbuffer{example-10}{demo}{}
+\stopbuffer
+
+\typebuffer
+
+This will give us:
+
+\blank \startpacked \getbuffer \stoppacked \blank
+
+If you use \type {\xmlshow} you will get a complete subtree which can
+be handy for tracing but can also lead to large documents.
+
+We also have a bunch of trackers that can be enabled, like:
+
+\starttyping
+\enabletrackers[xml.show,xml.parse]
+\stoptyping
+
+The full list (currently) is:
+
+\starttabulate[|lT|p|]
+\NC xml.entities \NC show what entities are seen and replaced \NC \NR
+\NC xml.path \NC show the result of parsing an lpath expression \NC \NR
+\NC xml.parse \NC show stepwise resolving of expressions \NC \NR
+\NC xml.profile \NC report all parsed lpath expressions (in the log) \NC \NR
+\NC xml.remap \NC show what namespaces are remapped \NC \NR
+\NC lxml.access \NC report errors with respect to resolving (symbolic) nodes \NC \NR
+\NC lxml.comments \NC show the comments that are encountered (if at all) \NC \NR
+\NC lxml.loading \NC show what files are loaded and converted \NC \NR
+\NC lxml.setups \NC show what setups are being associated to elements \NC \NR
+\stoptabulate
+
+In one of our workflows we produce books from \XML\ where the (educational)
+content is organized in many small files. Each book has about 5~chapters and each
+chapter is made of sections that contain text, exercises, resources, etc.\ and so
+the document is assembled from thousands of files (don't worry, runtime inclusion
+is pretty fast). In order to see where in the sources content resides we can
+trace the filename.
+
+\startxmlcmd {\cmdbasicsetup{xmlinclusion}}
+ returns the file where the node comes from
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlinclusions}}
+ returns the list of files where the node comes from
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlbadinclusions}}
+ returns a list of files that were not included due to some problem
+\stopxmlcmd
+
+Of course you have to make sure that these names end up somewhere visible, for
+instance in the margin.
+
+\stopsection
+
+\startsection[title={expansion}]
+
+For novice users the concept of expansion might sound frightening and to some
+extend it is. However, it is important enough to spend some words on it here.
+
+It is good to realize that most setups are sort of immediate. When one setup is
+issued, it can call another one and so on. Normally you won't notice that but
+there are cases where that can be a problem. In \TEX\ you can define a macro,
+take for instance:
+
+\starttyping
+\startxmlsetups xml:foo
+ \def\foobar{\xmlfirst{#1}{/bar}}
+\stopxmlsetups
+\stoptyping
+
+you store the reference top node \type {bar} in \type {\foobar} maybe for later use. In
+this case the content is not yet fetched, it will be done when \type {\foobar} is
+called.
+
+\starttyping
+\startxmlsetups xml:foo
+ \edef\foobar{\xmlfirst{#1}{/bar}}
+\stopxmlsetups
+\stoptyping
+
+Here the content of \type {bar} becomes the body of the macro. But what if
+\type {bar} itself contains elements that also contain elements. When there
+is a setup for \type {bar} it will be triggered and so on.
+
+When that setup looks like:
+
+\starttyping
+\startxmlsetups xml:bar
+ \def\barfoo{\xmlflush{#1}}
+\stopxmlsetups
+\stoptyping
+
+Here we get something like:
+
+\starttyping
+\foobar => {\def\barfoo{...}}
+\stoptyping
+
+When \type {\barfoo} is not defined we get an error and when it is known and expands
+to something weird we might also get an error.
+
+Especially when you don't know what content can show up, this can result in errors
+when an expansion fails, for example because some macro being used is not defined.
+To prevent this we can define a macro:
+
+\starttyping
+\starttexdefinition unexpanded xml:bar:macro #1
+ \def\barfoo{\xmlflush{#1}}
+\stoptexdefinition
+
+\startxmlsetups xml:bar
+ \texdefinition{xml:bar:macro}{#1}
+\stopxmlsetups
+\stoptyping
+
+The setup \type {xml:bar} will still expand but the replacement text now is just the
+call to the macro, think of:
+
+\starttyping
+\foobar => {\texdefinition{xml:bar:macro}{#1}}
+\stoptyping
+
+But this is often not needed, most \CONTEXT\ commands can handle the expansions
+quite well but it's good to know that there is a way out. So, now to some
+examples. Imagine that we have an \XML\ file that looks as follows:
+
+\starttyping
+<?xml version='1.0' ?>
+<demo>
+ <chapter>
+ <title>Some <em>short</em> title</title>
+ <content>
+ zeta
+ <index>
+ <key>zeta</key>
+ <content>zeta again</content>
+ </index>
+ alpha
+ <index>
+ <key>alpha</key>
+ <content>alpha <em>again</em></content>
+ </index>
+ gamma
+ <index>
+ <key>gamma</key>
+ <content>gamma</content>
+ </index>
+ beta
+ <index>
+ <key>beta</key>
+ <content>beta</content>
+ </index>
+ delta
+ <index>
+ <key>delta</key>
+ <content>delta</content>
+ </index>
+ done!
+ </content>
+ </chapter>
+</demo>
+\stoptyping
+
+There are a few structure related elements here: a chapter (with its list entry)
+and some index entries. Both are multipass related and therefore travel around.
+This means that when we let data end up in the auxiliary file, we need to make
+sure that we end up with either expanded data (i.e.\ no references to the \XML\
+tree) or with robust forward and backward references to elements in the tree.
+
+Here we discuss three approaches (and more may show up later): pushing \XML\ into
+the auxiliary file and using references to elements either or not with an
+associated setup. We control the variants with a switch.
+
+\starttyping
+\newcount\TestMode
+
+\TestMode=0 % expansion=xml
+\TestMode=1 % expansion=yes, index, setup
+\TestMode=2 % expansion=yes
+\stoptyping
+
+We apply a couple of setups:
+
+\starttyping
+\startxmlsetups xml:mysetups
+ \xmlsetsetup{\xmldocument}{demo|index|content|chapter|title|em}{xml:*}
+\stopxmlsetups
+
+\xmlregistersetup{xml:mysetups}
+\stoptyping
+
+The main document is processed with:
+
+\starttyping
+\startxmlsetups xml:demo
+ \xmlflush{#1}
+ \subject{contents}
+ \placelist[chapter][criterium=all]
+ \subject{index}
+ \placeregister[index][criterium=all]
+ \page % else buffer is forgotten when placing header
+\stopxmlsetups
+\stoptyping
+
+First we show three alternative ways to deal with the chapter. The first case
+expands the \XML\ reference so that we have an \XML\ stream in the auxiliary
+file. This stream is processed as a small independent subfile when needed. The
+second case registers a reference to the current element (\type {#1}). This means
+that we have access to all data of this element, like attributes, title and
+content. What happens depends on the given setup. The third variant does the same
+but here the setup is part of the reference.
+
+\starttyping
+\startxmlsetups xml:chapter
+ \ifcase \TestMode
+ % xml code travels around
+ \setuphead[chapter][expansion=xml]
+ \startchapter[title=eh: \xmltext{#1}{title}]
+ \xmlfirst{#1}{content}
+ \stopchapter
+ \or
+ % index is used for access via setup
+ \setuphead[chapter][expansion=yes,xmlsetup=xml:title:flush]
+ \startchapter[title=\xmlgetindex{#1}]
+ \xmlfirst{#1}{content}
+ \stopchapter
+ \or
+ % tex call to xml using index is used
+ \setuphead[chapter][expansion=yes]
+ \startchapter[title=hm: \xmlreference{#1}{xml:title:flush}]
+ \xmlfirst{#1}{content}
+ \stopchapter
+ \fi
+\stopxmlsetups
+
+\startxmlsetups xml:title:flush
+ \xmltext{#1}{title}
+\stopxmlsetups
+\stoptyping
+
+We need to deal with emphasis and the content of the chapter.
+
+\starttyping
+\startxmlsetups xml:em
+ \begingroup\em\xmlflush{#1}\endgroup
+\stopxmlsetups
+
+\startxmlsetups xml:content
+ \xmlflush{#1}
+\stopxmlsetups
+\stoptyping
+
+A similar approach is followed with the index entries. Watch how we use the
+numbered entries variant (in this case we could also have used just \type
+{entries} and \type {keys}).
+
+\starttyping
+\startxmlsetups xml:index
+ \ifcase \TestMode
+ \setupregister[index][expansion=xml,xmlsetup=]
+ \setstructurepageregister
+ [index]
+ [entries:1=\xmlfirst{#1}{content},
+ keys:1=\xmltext{#1}{key}]
+ \or
+ \setupregister[index][expansion=yes,xmlsetup=xml:index:flush]
+ \setstructurepageregister
+ [index]
+ [entries:1=\xmlgetindex{#1},
+ keys:1=\xmltext{#1}{key}]
+ \or
+ \setupregister[index][expansion=yes,xmlsetup=]
+ \setstructurepageregister
+ [index]
+ [entries:1=\xmlreference{#1}{xml:index:flush},
+ keys:1=\xmltext{#1}{key}]
+ \fi
+\stopxmlsetups
+
+\startxmlsetups xml:index:flush
+ \xmlfirst{#1}{content}
+\stopxmlsetups
+\stoptyping
+
+Instead of this flush, you can use the predefined setup \type {xml:flush}
+unless it is overloaded by you.
+
+The file is processed by:
+
+\starttyping
+\starttext
+ \xmlprocessfile{main}{test.xml}{}
+\stoptext
+\stoptyping
+
+We don't show the result here. If you're curious what the output is, you can test
+it yourself. In that case it also makes sense to peek into the \type {test.tuc}
+file to see how the information travels around. The \type {metadata} fields carry
+information about how to process the data.
+
+The first case, the \XML\ expansion one, is somewhat special in the sense that
+internally we use small pseudo files. You can control the rendering by tweaking
+the following setups:
+
+\starttyping
+\startxmlsetups xml:ctx:sectionentry
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:ctx:registerentry
+ \xmlflush{#1}
+\stopxmlsetups
+\stoptyping
+
+{\em When these methods work out okay the other structural elements will be
+dealt with in a similar way.}
+
+\stopsection
+
+\startsection[title={special cases}]
+
+Normally the content will be flushed under a special (so called) catcode regime.
+This means that characters that have a special meaning in \TEX\ will have no such
+meaning in an \XML\ file. If you want content to be treated as \TEX\ code, you can
+use one of the following:
+
+\startxmlcmd {\cmdbasicsetup{xmlflushcontext}}
+ flush the given \cmdinternal {cd:node} using the \TEX\ character
+ interpretation scheme
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlcontext}}
+ flush the match of \cmdinternal {cd:lpath} for the given \cmdinternal
+ {cd:node} using the \TEX\ character interpretation scheme
+\stopxmlcmd
+
+We use this in cases like:
+
+\starttyping
+....
+ \xmlsetsetup {#1} {
+ tm|texformula|
+ } {xml:*}
+....
+
+\startxmlsetups xml:tm
+ \mathematics{\xmlflushcontext{#1}}
+\stopxmlsetups
+
+\startxmlsetups xml:texformula
+ \placeformula\startformula\xmlflushcontext{#1}\stopformula
+\stopxmlsetups
+\stoptyping
+
+\stopsection
+
+\startsection[title={collecting}]
+
+Say that your document has
+
+\starttyping
+<table>
+ <tr>
+ <td>foo</td>
+ <td>bar<td>
+ </tr>
+</table>
+\stoptyping
+
+And that you need to convert that to \TEX\ speak like:
+
+\starttyping
+\bTABLE
+ \bTR
+ \bTD foo \eTD
+ \bTD bar \eTD
+ \eTR
+\eTABLE
+\stoptyping
+
+A simple mapping is:
+
+\starttyping
+\startxmlsetups xml:table
+ \bTABLE \xmlflush{#1} \eTABLE
+\stopxmlsetups
+\startxmlsetups xml:tr
+ \bTR \xmlflush{#1} \eTR
+\stopxmlsetups
+\startxmlsetups xml:td
+ \bTD \xmlflush{#1} \eTD
+\stopxmlsetups
+\stoptyping
+
+The \type {\bTD} command is a so called delimited command which means that it
+picks up its argument by looking for an \type {\eTD}. For the simple case here
+this works quite well because the flush is inside the pair. This is not the case
+in the following variant:
+
+\starttyping
+\startxmlsetups xml:td:start
+ \bTD
+\stopxmlsetups
+\startxmlsetups xml:td:stop
+ \eTD
+\stopxmlsetups
+\startxmlsetups xml:td
+ \xmlsetup{#1}{xml:td:start}
+ \xmlflush{#1}
+ \xmlsetup{#1}{xml:td:stop}
+\stopxmlsetups
+\stoptyping
+
+When for some reason \TEX\ gets confused you can revert to a mechanism that
+collects content.
+
+\starttyping
+\startxmlsetups xml:td:start
+ \startcollect
+ \bTD
+ \stopcollect
+\stopxmlsetups
+\startxmlsetups xml:td:stop
+ \startcollect
+ \eTD
+ \stopcollect
+\stopxmlsetups
+\startxmlsetups xml:td
+ \startcollecting
+ \xmlsetup{#1}{xml:td:start}
+ \xmlflush{#1}
+ \xmlsetup{#1}{xml:td:stop}
+ \stopcollecting
+\stopxmlsetups
+\stoptyping
+
+You can even implement solutions that effectively do this:
+
+\starttyping
+\startcollecting
+ \startcollect \bTABLE \stopcollect
+ \startcollect \bTR \stopcollect
+ \startcollect \bTD \stopcollect
+ \startcollect foo\stopcollect
+ \startcollect \eTD \stopcollect
+ \startcollect \bTD \stopcollect
+ \startcollect bar\stopcollect
+ \startcollect \eTD \stopcollect
+ \startcollect \eTR \stopcollect
+ \startcollect \eTABLE \stopcollect
+\stopcollecting
+\stoptyping
+
+Of course you only need to go that complex when the situation demands it. Here is
+another weird one:
+
+\starttyping
+\startcollecting
+ \startcollect \setupsomething[\stopcollect
+ \startcollect foo=\stopcollect
+ \startcollect FOO,\stopcollect
+ \startcollect bar=\stopcollect
+ \startcollect BAR,\stopcollect
+ \startcollect ]\stopcollect
+\stopcollecting
+\stoptyping
+
+\stopsection
+
+\startsection[title={selectors and injectors}]
+
+This section describes a bit special feature, one that we needed for a project
+where we could not touch the original content but could add specific sections for
+our own purpose. Hopefully the example demonstrates its useability.
+
+\enabletrackers[lxml.selectors]
+
+\startbuffer[foo]
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?context-directive message info 1: this is a demo file ?>
+<?context-message-directive info 2: this is a demo file ?>
+
+<one>
+ <two>
+ <?context-select begin t1 t2 t3 ?>
+ <three>
+ t1 t2 t3
+ <?context-directive injector crlf t1 ?>
+ t1 t2 t3
+ </three>
+ <?context-select end ?>
+ <?context-select begin t4 ?>
+ <four>
+ t4
+ </four>
+ <?context-select end ?>
+ <?context-select begin t8 ?>
+ <four>
+ t8.0
+ t8.0
+ </four>
+ <?context-select end ?>
+ <?context-include begin t4 ?>
+ <!--
+ <three>
+ t4.t3
+ <?context-directive injector crlf t1 ?>
+ t4.t3
+ </three>
+ -->
+ <three>
+ t3
+ <?context-directive injector crlf t1 ?>
+ t3
+ </three>
+ <?context-include end ?>
+ <?context-select begin t8 ?>
+ <four>
+ t8.1
+ t8.1
+ </four>
+ <?context-select end ?>
+ <?context-select begin t8 ?>
+ <four>
+ t8.2
+ t8.2
+ </four>
+ <?context-select end ?>
+ <?context-select begin t4 ?>
+ <four>
+ t4
+ t4
+ </four>
+ <?context-select end ?>
+ <?context-directive injector page t7 t8 ?>
+ foo
+ <?context-directive injector blank t1 ?>
+ bar
+ <?context-directive injector page t7 t8 ?>
+ bar
+ </two>
+</one>
+\stopbuffer
+
+\typebuffer[foo]
+
+First we show how to plug in a directive. Processing instructions like the
+following are normally ignored by an \XML\ processor, unless they make sense
+to it.
+
+\starttyping
+<?context-directive message info 1: this is a demo file ?>
+<?context-message-directive info 2: this is a demo file ?>
+\stoptyping
+
+We can define a message handler as follows:
+
+\startbuffer
+\def\MyMessage#1#2#3{\writestatus{#1}{#2 #3}}
+
+\xmlinstalldirective{message}{MyMessage}
+\stopbuffer
+
+\typebuffer \getbuffer
+
+When this file is processed you will see this on the console:
+
+\starttyping
+info > 1: this is a demo file
+info > 2: this is a demo file
+\stoptyping
+
+The file has some sections that can be used or ignored. The recipe for
+obeying \type {t1} and \type {t4} is the following:
+
+\startbuffer
+\xmlsetinjectors[t1]
+\xmlsetinjectors[t4]
+
+\startxmlsetups xml:initialize
+ \xmlapplyselectors{#1}
+ \xmlsetsetup {#1} {
+ one|two|three|four
+ } {xml:*}
+\stopxmlsetups
+
+\xmlregistersetup{xml:initialize}
+
+\startxmlsetups xml:one
+ [ONE \xmlflush{#1} ONE]
+\stopxmlsetups
+
+\startxmlsetups xml:two
+ [TWO \xmlflush{#1} TWO]
+\stopxmlsetups
+
+\startxmlsetups xml:three
+ [THREE \xmlflush{#1} THREE]
+\stopxmlsetups
+
+\startxmlsetups xml:four
+ [FOUR \xmlflush{#1} FOUR]
+\stopxmlsetups
+\stopbuffer
+
+\typebuffer \getbuffer
+
+This typesets:
+
+\startnarrower
+\xmlprocessbuffer{main}{foo}{}
+\stopnarrower
+
+The include coding is kind of special: it permits adding content (in a comment)
+and ignoring the rest so that we indeed can add something without interfering
+with the original. Of course in a normal workflow such messy solutions are
+not needed, but alas, often workflows are not that clean, especially when one
+has no real control over the source.
+
+\startxmlcmd {\cmdbasicsetup{xmlsetinjectors}}
+ enables a list of injectors that will be used
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlresetinjectors}}
+ resets the list of injectors
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlinjector}}
+ expands an injection (command); normally this one is only used
+ (in some setup) or for testing
+\stopxmlcmd
+
+\startxmlcmd {\cmdbasicsetup{xmlapplyselectors}}
+ analyze the tree \cmdinternal {cd:node} for marked sections that
+ will be injected
+\stopxmlcmd
+
+We have some injections predefined:
+
+\starttyping
+\startsetups xml:directive:injector:page
+ \page
+\stopsetups
+
+\startsetups xml:directive:injector:column
+ \column
+\stopsetups
+
+\startsetups xml:directive:injector:blank
+ \blank
+\stopsetups
+\stoptyping
+
+In the example we see:
+
+\starttyping
+<?context-directive injector page t7 t8 ?>
+\stoptyping
+
+When we set \type {\xmlsetinjector[t7]} a pagebreak will injected in that spot.
+Tags like \type {t7}, \type {t8} etc.\ can represent versions.
+
+\stopsection
+
+\startsection[title=preprocessing]
+
+% local match = lpeg.match
+% local replacer = lpeg.replacer("BAD TITLE:","<bold>BAD TITLE:</bold>")
+%
+% function lxml.preprocessor(data,settings)
+% return match(replacer,data)
+% end
+
+\startbuffer[pre-code]
+\startluacode
+ function lxml.preprocessor(data,settings)
+ return string.find(data,"BAD TITLE:")
+ and string.gsub(data,"BAD TITLE:","<bold>BAD TITLE:</bold>")
+ or data
+ end
+\stopluacode
+\stopbuffer
+
+\startbuffer[pre-xml]
+\startxmlsetups pre:demo:initialize
+ \xmlsetsetup{#1}{*}{pre:demo:*}
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{pre:demo}{pre:demo:initialize}
+
+\startxmlsetups pre:demo:root
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups pre:demo:bold
+ \begingroup\bf\xmlflush{#1}\endgroup
+\stopxmlsetups
+
+\starttext
+ \xmlprocessbuffer{pre:demo}{demo}{}
+\stoptext
+\stopbuffer
+
+Say that you have the following \XML\ setup:
+
+\typebuffer[pre-xml]
+
+and that (such things happen) the input looks like this:
+
+\startbuffer[demo]
+<root>
+BAD TITLE: crap crap crap ...
+
+BAD TITLE: crap crap crap ...
+</root>
+\stopbuffer
+
+\typebuffer[demo]
+
+You can then clean up these \type {BAD TITLE}'s as follows:
+
+\typebuffer[pre-code]
+
+and get as result:
+
+\start \getbuffer[pre-code,pre-xml] \stop
+
+The preprocessor function gets as second argument the current settings, an d
+the field \type {currentresource} can be used to limit the actions to
+specific resources, in our case it's \type {buffer: demo}. Afterwards you can
+reset the proprocessor with:
+
+\startluacode
+lxml.preprocessor = nil
+\stopluacode
+
+Future versions might give some more control over preprocessors. For now consider
+it to be a quick hack.
+
+\stopsection
+
+\stopchapter
+
+\startchapter[title={Lookups using lpaths}]
+
+\startsection[title={introduction}]
+
+There is not that much system in the following examples. They resulted from tests
+with different documents. The current implementation evolved out of the
+experimental code. For instance, I decided to add the multiple expressions in row
+handling after a few email exchanges with Jean|-|Michel Huffen.
+
+One of the main differences between the way \XSLT\ resolves a path and our way is
+the anchor. Take:
+
+\starttyping
+/something
+something
+\stoptyping
+
+The first one anchors in the current (!) element so it will only consider direct
+children. The second one does a deep lookup and looks at the descendants as well.
+Furthermore we have a few extra shortcuts like \type {**} in \type {a/**/b} which
+represents all descendants.
+
+The expressions (between square brackets) has to be valid \LUA\ and some
+preprocessing is done to resolve the built in functions. So, you might use code
+like:
+
+\starttyping
+my_lpeg_expression:match(text()) == "whatever"
+\stoptyping
+
+given that \type {my_lpeg_expression} is known. In the examples below we use the
+visualizer to show the steps. Some are shown more than once as part of a set.
+
+\stopsection
+
+\startsection[title={special cases}]
+
+\xmllshow{}
+\xmllshow{*}
+\xmllshow{.}
+\xmllshow{/}
+
+\stopsection
+
+\startsection[title={wildcards}]
+
+\xmllshow{*}
+\xmllshow{*:*}
+\xmllshow{/*}
+\xmllshow{/*:*}
+\xmllshow{*/*}
+\xmllshow{*:*/*:*}
+
+\xmllshow{a/*}
+\xmllshow{a/*:*}
+\xmllshow{/a/*}
+\xmllshow{/a/*:*}
+
+\xmllshow{/*}
+\xmllshow{/**}
+\xmllshow{/***}
+
+\stopsection
+
+\startsection[title={multiple steps}]
+
+\xmllshow{answer}
+\xmllshow{answer/test/*}
+\xmllshow{answer/test/child::}
+\xmllshow{answer/*}
+\xmllshow{answer/*[tag()='p' and position()=1 and text()!='']}
+
+\stopsection
+
+\startsection[title={pitfals}]
+
+\xmllshow{[oneof(lower(@encoding),'tex','context','ctx')]}
+\xmllshow{.[oneof(lower(@encoding),'tex','context','ctx')]}
+
+\stopsection
+
+\startsection[title={more special cases}]
+
+\xmllshow{**}
+\xmllshow{*}
+\xmllshow{..}
+\xmllshow{.}
+\xmllshow{//}
+\xmllshow{/}
+
+\xmllshow{**/}
+\xmllshow{**/*}
+\xmllshow{**/.}
+\xmllshow{**//}
+
+\xmllshow{*/}
+\xmllshow{*/*}
+\xmllshow{*/.}
+\xmllshow{*//}
+
+\xmllshow{/**/}
+\xmllshow{/**/*}
+\xmllshow{/**/.}
+\xmllshow{/**//}
+
+\xmllshow{/*/}
+\xmllshow{/*/*}
+\xmllshow{/*/.}
+\xmllshow{/*//}
+
+\xmllshow{./}
+\xmllshow{./*}
+\xmllshow{./.}
+\xmllshow{.//}
+
+\xmllshow{../}
+\xmllshow{../*}
+\xmllshow{../.}
+\xmllshow{..//}
+
+\stopsection
+
+\startsection[title={more wildcards}]
+
+\xmllshow{one//two}
+\xmllshow{one/*/two}
+\xmllshow{one/**/two}
+\xmllshow{one/***/two}
+\xmllshow{one/x//two}
+\xmllshow{one//x/two}
+\xmllshow{//x/two}
+
+\stopsection
+
+\startsection[title={special axis}]
+
+\xmllshow{descendant::whocares/ancestor::whoknows}
+\xmllshow{descendant::whocares/ancestor::whoknows/parent::}
+\xmllshow{descendant::whocares/ancestor::}
+\xmllshow{child::something/child::whatever/child::whocares}
+\xmllshow{child::something/child::whatever/child::whocares|whoknows}
+\xmllshow{child::something/child::whatever/child::(whocares|whoknows)}
+\xmllshow{child::something/child::whatever/child::!(whocares|whoknows)}
+\xmllshow{child::something/child::whatever/child::(whocares)}
+\xmllshow{child::something/child::whatever/child::(whocares)[position()>2]}
+\xmllshow{child::something/child::whatever[position()>2][position()=1]}
+\xmllshow{child::something/child::whatever[whocares][whocaresnot]}
+\xmllshow{child::something/child::whatever[whocares][not(whocaresnot)]}
+\xmllshow{child::something/child::whatever/self::whatever}
+
+There is also \type {last-match::} that starts with the last found set of nodes.
+This can save some runtime when you do lots of tests combined with a same check
+afterwards.
+
+\stopsection
+
+\startsection[title={some more examples}]
+
+\xmllshow{/something/whatever}
+\xmllshow{something/whatever}
+\xmllshow{/**/whocares}
+\xmllshow{whoknows/whocares}
+\xmllshow{whoknows}
+\xmllshow{whocares[contains(text(),'f') or contains(text(),'g')]}
+\xmllshow{whocares/first()}
+\xmllshow{whocares/last()}
+\xmllshow{whatever/all()}
+\xmllshow{whocares/position(2)}
+\xmllshow{whocares/position(-2)}
+\xmllshow{whocares[1]}
+\xmllshow{whocares[-1]}
+\xmllshow{whocares[2]}
+\xmllshow{whocares[-2]}
+\xmllshow{whatever[3]/attribute(id)}
+\xmllshow{whatever[2]/attribute('id')}
+\xmllshow{whatever[3]/text()}
+\xmllshow{/whocares/first()}
+\xmllshow{/whocares/last()}
+
+\xmllshow{xml://whatever/all()}
+\xmllshow{whatever/all()}
+\xmllshow{//whocares}
+\xmllshow{..[2]}
+\xmllshow{../*[2]}
+
+\xmllshow{/(whocares|whocaresnot)}
+\xmllshow{/!(whocares|whocaresnot)}
+\xmllshow{/!whocares}
+
+\xmllshow{/interface/command/command(xml:setups:register)}
+\xmllshow{/interface/command[@name='xxx']/command(xml:setups:typeset)}
+\xmllshow{/arguments/*}
+\xmllshow{/sequence/first()}
+\xmllshow{/arguments/text()}
+\xmllshow{/sequence/variable/first()}
+\xmllshow{/interface/define[@name='xxx']/first()}
+\xmllshow{/parameter/command(xml:setups:parameter:measure)}
+
+\xmllshow{/(*:library|figurelibrary)/*:figure/*:label}
+\xmllshow{/(*:library|figurelibrary)/figure/*:label}
+\xmllshow{/(*:library|figurelibrary)/figure/label}
+\xmllshow{/(*:library|figurelibrary)/figure:*/label}
+
+\xmlshow {whatever//br[tag(1)='br']}
+
+\stopsection
+
+\stopchapter
+
+\startchapter[title=Examples]
+
+\startsection[title=attribute chains]
+
+In \CSS, when an attribute is not present, the parent element is checked, and when
+not found again, the lookup follows the chain till a match is found or the root is
+reached. The following example demonstrates how such a chain lookup works.
+
+\startbuffer[test]
+<something mine="1" test="one" more="alpha">
+ <whatever mine="2" test="two">
+ <whocares mine="3">
+ <!-- this is a test -->
+ </whocares>
+ </whatever>
+</something>
+\stopbuffer
+
+\typebuffer[test]
+
+We apply the following setups to this tree:
+
+\startbuffer[setups]
+\startxmlsetups xml:common
+ [
+ \xmlchainatt{#1}{mine},
+ \xmlchainatt{#1}{test},
+ \xmlchainatt{#1}{more},
+ \xmlchainatt{#1}{none}
+ ]\par
+\stopxmlsetups
+
+\startxmlsetups xml:something
+ something: \xmlsetup{#1}{xml:common}
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:whatever
+ whatever: \xmlsetup{#1}{xml:common}
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:whocares
+ whocares: \xmlsetup{#1}{xml:common}
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:mysetups
+ \xmlsetsetup{#1}{something|whatever|whocares}{xml:*}
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{example-1}{xml:mysetups}
+
+\xmlprocessbuffer{example-1}{test}{}
+\stopbuffer
+
+\typebuffer[setups]
+
+This gives:
+
+\start
+ \getbuffer[setups]
+\stop
+
+\stopsection
+
+\startsection[title=conditional setups]
+
+Say that we have this code:
+
+\starttyping
+\xmldoifelse {#1} {/what[@a='1']} {
+ \xmlfilter {#1} {/what/command('xml:yes')}
+} {
+ \xmlfilter {#1} {/what/command('xml:nop')}
+}
+\stoptyping
+
+Here we first determine if there is a child \type {what} with attribute \type {a}
+set to \type {1}. Depending on the outcome again we check the child nodes for
+being named \type {what}. A faster solution which also takes less code is this:
+
+\starttyping
+\xmlfilter {#1} {/what[@a='1']/command('xml:yes','xml:nop')}
+\stoptyping
+
+\stopsection
+
+\startsection[title=manipulating]
+
+Assume that we have the following \XML\ data:
+
+\startbuffer[test]
+<A>
+ <B>right</B>
+ <B>wrong</B>
+</A>
+\stopbuffer
+
+\typebuffer[test]
+
+But, instead of \type {right} we want to see \type {okay}. We can do that with a
+finalizer:
+
+\startbuffer
+\startluacode
+local rehash = {
+ ["right"] = "okay",
+}
+
+function xml.finalizers.tex.Okayed(collected,what)
+ for i=1,#collected do
+ if what == "all" then
+ local str = xml.text(collected[i])
+ context(rehash[str] or str)
+ else
+ context(str)
+ end
+ end
+end
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startxmlsetups xml:A
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:B
+ (It's \xmlfilter{#1}{./Okayed("all")})
+\stopxmlsetups
+
+\startxmlsetups xml:testsetups
+ \xmlsetsetup{#1}{A|B}{xml:*}
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{example-2}{xml:testsetups}
+\xmlprocessbuffer{example-2}{test}{}
+\stopbuffer
+
+\typebuffer
+
+The result is: \start \inlinebuffer \stop
+
+\stopsection
+
+\startsection[title=cross referencing]
+
+A rather common way to add cross references to \XML\ files is to borrow the
+asymmetrical id's from \HTML. This means that one cannot simply use a value
+of (say) \type {href} to locate an \type {id}. The next example came up on
+the \CONTEXT\ mailing list.
+
+\startbuffer[test]
+<doc>
+ <p>Text
+ <a href="#fn1" class="footnoteref" id="fnref1"><sup>1</sup></a> and
+ <a href="#fn2" class="footnoteref" id="fnref2"><sup>2</sup></a>
+ </p>
+ <div class="footnotes">
+ <hr />
+ <ol>
+ <li id="fn1"><p>A footnote.<a href="#fnref1">↩</a></p></li>
+ <li id="fn2"><p>A second footnote.<a href="#fnref2">↩</a></p></li>
+ </ol>
+ </div>
+</doc>
+\stopbuffer
+
+\typebuffer[test]
+
+We give two variants for dealing with such references. The first solution does
+lookups and depending on the size of the file can be somewhat inefficient.
+
+\startbuffer
+\startxmlsetups xml:doc
+ \blank
+ \xmlflush{#1}
+ \blank
+\stopxmlsetups
+
+\startxmlsetups xml:p
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:footnote
+ (variant 1)\footnote
+ {\xmlfirst
+ {example-3-1}
+ {div[@class='footnotes']/ol/li[@id='\xmlrefatt{#1}{href}']}}
+\stopxmlsetups
+
+\startxmlsetups xml:initialize
+ \xmlsetsetup{#1}{p|doc}{xml:*}
+ \xmlsetsetup{#1}{a[@class='footnoteref']}{xml:footnote}
+ \xmlsetsetup{#1}{div[@class='footnotes']}{xml:nothing}
+\stopxmlsetups
+
+\xmlresetdocumentsetups{*}
+\xmlregisterdocumentsetup{example-3-1}{xml:initialize}
+
+\xmlprocessbuffer{example-3-1}{test}{}
+\stopbuffer
+
+\typebuffer
+
+This will typeset two footnotes.
+
+\getbuffer
+
+The second variant collects the references so that the time spend on lookups is
+less.
+
+\startbuffer
+\startxmlsetups xml:doc
+ \blank
+ \xmlflush{#1}
+ \blank
+\stopxmlsetups
+
+\startxmlsetups xml:p
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startluacode
+ userdata.notes = {}
+\stopluacode
+
+\startxmlsetups xml:collectnotes
+ \ctxlua{userdata.notes['\xmlrefatt{#1}{id}'] = '#1'}
+\stopxmlsetups
+
+\startxmlsetups xml:footnote
+ (variant 2)\footnote
+ {\xmlflush
+ {\cldcontext{userdata.notes['\xmlrefatt{#1}{href}']}}}
+\stopxmlsetups
+
+\startxmlsetups xml:initialize
+ \xmlsetsetup{#1}{p|doc}{xml:*}
+ \xmlsetsetup{#1}{a[@class='footnoteref']}{xml:footnote}
+ \xmlfilter{#1}{div[@class='footnotes']/ol/li/command(xml:collectnotes)}
+ \xmlsetsetup{#1}{div[@class='footnotes']}{}
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{example-3-2}{xml:initialize}
+
+\xmlprocessbuffer{example-3-2}{test}{}
+\stopbuffer
+
+\typebuffer
+
+This will again typeset two footnotes:
+
+\getbuffer
+
+\stopsection
+
+\startsection[title=mapping values]
+
+One way to process options \type {frame} in the example below is to map the
+values to values known by \CONTEXT.
+
+\startbuffer[test]
+<a>
+ <nattable frame="on">
+ <tr><td>#1</td><td>#2</td><td>#3</td><td>#4</td></tr>
+ <tr><td>#5</td><td>#6</td><td>#7</td><td>#8</td></tr>
+ </nattable>
+ <nattable frame="off">
+ <tr><td>#1</td><td>#2</td><td>#3</td><td>#4</td></tr>
+ <tr><td>#5</td><td>#6</td><td>#7</td><td>#8</td></tr>
+ </nattable>
+ <nattable frame="no">
+ <tr><td>#1</td><td>#2</td><td>#3</td><td>#4</td></tr>
+ <tr><td>#5</td><td>#6</td><td>#7</td><td>#8</td></tr>
+ </nattable>
+</a>
+\stopbuffer
+
+\typebuffer[test]
+
+\startbuffer
+\startxmlsetups xml:a
+ \xmlflush{#1}
+\stopxmlsetups
+
+\xmlmapvalue {nattable:frame} {on} {on}
+\xmlmapvalue {nattable:frame} {yes} {on}
+\xmlmapvalue {nattable:frame} {off} {off}
+\xmlmapvalue {nattable:frame} {no} {off}
+
+\startxmlsetups xml:nattable
+ \startplacetable[title=#1]
+ \setupTABLE[frame=\xmlval{nattable:frame}{\xmlatt{#1}{frame}}{on}]%
+ \bTABLE
+ \xmlflush{#1}
+ \eTABLE
+ \stopplacetable
+\stopxmlsetups
+
+\startxmlsetups xml:tr
+ \bTR
+ \xmlflush{#1}
+ \eTR
+\stopxmlsetups
+
+\startxmlsetups xml:td
+ \bTD
+ \xmlflush{#1}
+ \eTD
+\stopxmlsetups
+
+\startxmlsetups xml:testsetups
+ \xmlsetsetup{example-4}{a|nattable|tr|td|}{xml:*}
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{example-4}{xml:testsetups}
+
+\xmlprocessbuffer{example-4}{test}{}
+\stopbuffer
+
+The \type {\xmlmapvalue} mechanism is rather efficient and involves a minimum
+of testing.
+
+\typebuffer
+
+We get:
+
+\getbuffer
+
+\stopsection
+
+\startsection[title=using \LUA]
+
+In this example we demonstrate how you can delegate rendering to \LUA. We
+will construct a so called extreme table. The input is:
+
+\startbuffer[demo]
+<?xml version="1.0" encoding="utf-8"?>
+
+<a>
+ <b> <c>1</c> <d>Text</d> </b>
+ <b> <c>2</c> <d>More text</d> </b>
+ <b> <c>2</c> <d>Even more text</d> </b>
+ <b> <c>2</c> <d>And more</d> </b>
+ <b> <c>3</c> <d>And even more</d> </b>
+ <b> <c>2</c> <d>The last text</d> </b>
+</a>
+\stopbuffer
+
+\typebuffer[demo]
+
+The processor code is:
+
+\startbuffer[process]
+\startxmlsetups xml:test_setups
+ \xmlsetsetup{#1}{a|b|c|d}{xml:*}
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{example-5}{xml:test_setups}
+
+\xmlprocessbuffer{example-5}{demo}{}
+\stopbuffer
+
+\typebuffer
+
+We color a sequence of the same titles (numbers here) differently. The first
+solution remembers the last title:
+
+\startbuffer
+\startxmlsetups xml:a
+ \startembeddedxtable
+ \xmlflush{#1}
+ \stopembeddedxtable
+\stopxmlsetups
+
+\startxmlsetups xml:b
+ \xmlfunction{#1}{test_ba}
+\stopxmlsetups
+
+\startluacode
+local lasttitle = nil
+
+function xml.functions.test_ba(t)
+ local title = xml.text(t, "/c")
+ local content = xml.text(t, "/d")
+ context.startxrow()
+ context.startxcell {
+ background = "color",
+ backgroundcolor = lasttitle == title and "colorone" or "colortwo",
+ foregroundstyle = "bold",
+ foregroundcolor = "white",
+ }
+ context(title)
+ lasttitle = title
+ context.stopxcell()
+ context.startxcell()
+ context(content)
+ context.stopxcell()
+ context.stopxrow()
+end
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+The \type {embeddedxtable} environment is needed because the table is picked up
+as argument.
+
+\startlinecorrection \getbuffer[process] \stoplinecorrection
+
+The second implemetation remembers what titles are already processed so here we
+can color the last one too.
+
+\startbuffer
+\startxmlsetups xml:a
+ \ctxlua{xml.functions.reset_bb()}
+ \startembeddedxtable
+ \xmlflush{#1}
+ \stopembeddedxtable
+\stopxmlsetups
+
+\startxmlsetups xml:b
+ \xmlfunction{#1}{test_bb}
+\stopxmlsetups
+
+\startluacode
+local titles
+
+function xml.functions.reset_bb(t)
+ titles = { }
+end
+
+function xml.functions.test_bb(t)
+ local title = xml.text(t, "/c")
+ local content = xml.text(t, "/d")
+ context.startxrow()
+ context.startxcell {
+ background = "color",
+ backgroundcolor = titles[title] and "colorone" or "colortwo",
+ foregroundstyle = "bold",
+ foregroundcolor = "white",
+ }
+ context(title)
+ titles[title] = true
+ context.stopxcell()
+ context.startxcell()
+ context(content)
+ context.stopxcell()
+ context.stopxrow()
+end
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startlinecorrection \getbuffer[process] \stoplinecorrection
+
+A solution without any state variable is given below.
+
+\startbuffer
+\startxmlsetups xml:a
+ \startembeddedxtable
+ \xmlflush{#1}
+ \stopembeddedxtable
+\stopxmlsetups
+
+\startxmlsetups xml:b
+ \xmlfunction{#1}{test_bc}
+\stopxmlsetups
+
+\startluacode
+function xml.functions.test_bc(t)
+ local title = xml.text(t, "/c")
+ local content = xml.text(t, "/d")
+ context.startxrow()
+ local okay = xml.text(t,"./preceding-sibling::/[-1]") == title
+ context.startxcell {
+ background = "color",
+ backgroundcolor = okay and "colorone" or "colortwo",
+ foregroundstyle = "bold",
+ foregroundcolor = "white",
+ }
+ context(title)
+ context.stopxcell()
+ context.startxcell()
+ context(content)
+ context.stopxcell()
+ context.stopxrow()
+end
+\stopluacode
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startlinecorrection \getbuffer[process] \stoplinecorrection
+
+Here is a solution that delegates even more to \LUA. The previous variants were
+actually not that safe with repect to special characters and didn't handle
+nested elements either but the next one does.
+
+\startbuffer[demo]
+<?xml version="1.0" encoding="utf-8"?>
+
+<a>
+ <b> <c>#1</c> <d>Text</d> </b>
+ <b> <c>#2</c> <d>More text</d> </b>
+ <b> <c>#2</c> <d>Even more text</d> </b>
+ <b> <c>#2</c> <d>And more</d> </b>
+ <b> <c>#3</c> <d>And even more</d> </b>
+ <b> <c>#2</c> <d>Something <i>nested</i> </d> </b>
+</a>
+\stopbuffer
+
+\typebuffer[demo]
+
+We also need to map the \type {i} element.
+
+\startbuffer
+\startxmlsetups xml:a
+ \starttexcode
+ \xmlfunction{#1}{test_a}
+ \stoptexcode
+\stopxmlsetups
+
+\startxmlsetups xml:c
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:d
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups xml:i
+ {\em\xmlflush{#1}}
+\stopxmlsetups
+
+\startluacode
+function xml.functions.test_a(t)
+ context.startxtable()
+ local previous = false
+ for b in xml.collected(lxml.getid(t),"/b") do
+ context.startxrow()
+ local current = xml.text(b,"/c")
+ context.startxcell {
+ background = "color",
+ backgroundcolor = (previous == current) and "colorone" or "colortwo",
+ foregroundstyle = "bold",
+ foregroundcolor = "white",
+ }
+ lxml.first(b,"/c")
+ context.stopxcell()
+ context.startxcell()
+ lxml.first(b,"/d")
+ context.stopxcell()
+ previous = current
+ context.stopxrow()
+ end
+ context.stopxtable()
+end
+\stopluacode
+
+\startxmlsetups xml:test_setups
+ \xmlsetsetup{#1}{a|b|c|d|i}{xml:*}
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{example-5}{xml:test_setups}
+
+\xmlprocessbuffer{example-5}{demo}{}
+\stopbuffer
+
+\typebuffer
+
+\startlinecorrection \getbuffer \stoplinecorrection
+
+The question is, do we really need \LUA ? Often we don't, apart maybe from an
+occasional special finalizer. A pure \TEX\ solution is given next:
+
+\startbuffer
+\startxmlsetups xml:a
+ \glet\MyPreviousTitle\empty
+ \glet\MyCurrentTitle \empty
+ \startembeddedxtable
+ \xmlflush{#1}
+ \stopembeddedxtable
+\stopxmlsetups
+
+\startxmlsetups xml:b
+ \startxrow
+ \xmlflush{#1}
+ \stopxrow
+\stopxmlsetups
+
+\startxmlsetups xml:c
+ \xdef\MyCurrentTitle{\xmltext{#1}{.}}
+ \doifelse {\MyPreviousTitle} {\MyCurrentTitle} {
+ \startxcell
+ [background=color,
+ backgroundcolor=colorone,
+ foregroundstyle=bold,
+ foregroundcolor=white]
+ } {
+ \glet\MyPreviousTitle\MyCurrentTitle
+ \startxcell
+ [background=color,
+ backgroundcolor=colortwo,
+ foregroundstyle=bold,
+ foregroundcolor=white]
+ }
+ \xmlflush{#1}
+ \stopxcell
+\stopxmlsetups
+
+\startxmlsetups xml:d
+ \startxcell
+ \xmlflush{#1}
+ \stopxcell
+\stopxmlsetups
+
+\startxmlsetups xml:i
+ {\em\xmlflush{#1}}
+\stopxmlsetups
+
+\startxmlsetups xml:test_setups
+ \xmlsetsetup{#1}{*}{xml:*}
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{example-5}{xml:test_setups}
+
+\xmlprocessbuffer{example-5}{demo}{}
+\stopbuffer
+
+\typebuffer
+
+\startlinecorrection \getbuffer \stoplinecorrection
+
+You can even save a few lines of code:
+
+\starttyping
+\startxmlsetups xml:c
+ \xdef\MyCurrentTitle{\xmltext{#1}{.}}
+ \startxcell
+ [background=color,
+ backgroundcolor=color\ifx\MyPreviousTitle\MyCurrentTitle one\else two\fi,
+ foregroundstyle=bold,
+ foregroundcolor=white]
+ \xmlflush{#1}
+ \stopxcell
+ \glet\MyPreviousTitle\MyCurrentTitle
+\stopxmlsetups
+\stoptyping
+
+Or if you prefer:
+
+\starttyping
+\startxmlsetups xml:c
+ \xdef\MyCurrentTitle{\xmltext{#1}{.}}
+ \doifelse {\MyPreviousTitle} {\MyCurrentTitle} {
+ \xmlsetup{#1}{xml:c:one}
+ } {
+ \xmlsetup{#1}{xml:c:two}
+ }
+\stopxmlsetups
+
+\startxmlsetups xml:c:one
+ \startxcell
+ [background=color,
+ backgroundcolor=colorone,
+ foregroundstyle=bold,
+ foregroundcolor=white]
+ \xmlflush{#1}
+ \stopxcell
+\stopxmlsetups
+
+\startxmlsetups xml:c:two
+ \startxcell
+ [background=color,
+ backgroundcolor=colortwo,
+ foregroundstyle=bold,
+ foregroundcolor=white]
+ \xmlflush{#1}
+ \stopxcell
+ \global\let\MyPreviousTitle\MyCurrentTitle
+\stopxmlsetups
+\stoptyping
+
+These examples demonstrate that it doesn't hurt to know a little bit of \TEX\
+programming: defining macros and basic comparisons can come in handy. There are
+examples in the test suite, you can peek in the source code, you can consult
+the wiki or you can just ask on the list.
+
+\stopsection
+
+\startsection[title=last match]
+
+For the next example we use the following \XML\ input:
+
+\startbuffer[demo]
+<?xml version "1.0"?>
+<document>
+ <section id="1">
+ <content>
+ <p>first</p>
+ <p>second</p>
+ </content>
+ </section>
+ <section id="2">
+ <content>
+ <p>third</p>
+ <p>fourth</p>
+ </content>
+ </section>
+</document>
+\stopbuffer
+
+\typebuffer[demo]
+
+If you check if some element is present and then act accordingly, you can
+end up with doing the same lookup twice. Although it might sound inefficient,
+in practice it's often not measureable.
+
+\startbuffer
+\startxmlsetups xml:demo:document
+ \type{\xmlall{#1}{/section[@id='2']/content/p}}\par
+ \xmldoif{#1}{/section[@id='2']/content/p} {
+ \xmlall{#1}{/section[@id='2']/content/p}
+ }
+ \type{\xmllastmatch}\par
+ \xmldoif{#1}{/section[@id='2']/content/p} {
+ \xmllastmatch
+ }
+ \type{\xmlall{#1}{last-match::}}\par
+ \xmldoif{#1}{/section[@id='2']/content/p} {
+ \xmlall{#1}{last-match::}
+ }
+ \type{\xmlfilter{#1}{last-match::/command(xml:demo:p)}}\par
+ \xmldoif{#1}{/section[@id='2']/content/p} {
+ \xmlfilter{#1}{last-match::/command(xml:demo:p)}
+ }
+\stopxmlsetups
+
+\startxmlsetups xml:demo:p
+ \quad\xmlflush{#1}\endgraf
+\stopxmlsetups
+
+\startxmlsetups xml:demo:base
+ \xmlsetsetup{#1}{document|p}{xml:demo:*}
+\stopxmlsetups
+
+\xmlregisterdocumentsetup{example-6}{xml:demo:base}
+
+\xmlprocessbuffer{example-6}{demo}{}
+\stopbuffer
+
+\typebuffer
+
+In the second check we just flush the last match, so effective we do an \type
+{\xmlall} here. The third and fourth alternatives demonstrate how we can use
+\type {last-match} as axis. The gain is 10\% or more on the lookup but of course
+typesetting often takes relatively more time than the lookup.
+
+\startpacked
+\getbuffer
+\stoppacked
+
+\stopsection
+
+\stopchapter
+
+\stopbodymatter
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/xtables/xtables-mkiv.tex b/doc/context/sources/general/manuals/xtables/xtables-mkiv.tex
new file mode 100644
index 000000000..a41282622
--- /dev/null
+++ b/doc/context/sources/general/manuals/xtables/xtables-mkiv.tex
@@ -0,0 +1,1235 @@
+% language=uk
+
+% author : Hans Hagen
+% copyright : PRAGMA ADE & ConTeXt Development Team
+% license : Creative Commons Attribution ShareAlike 4.0 International
+% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
+% origin : the ConTeXt distribution
+%
+% comment : Because this manual is distributed with TeX distributions it comes with a rather
+% liberal license. We try to adapt these documents to upgrades in the (sub)systems
+% that they describe. Using parts of the content otherwise can therefore conflict
+% with existing functionality and we cannot be held responsible for that. Many of
+% the manuals contain characteristic graphics and personal notes or examples that
+% make no sense when used out-of-context.
+
+\usemodule[art-01,abr-02]
+
+\definecolor[red] [darkred]
+\definecolor[green] [darkgreen]
+\definecolor[blue] [darkblue]
+\definecolor[yellow] [darkyellow]
+\definecolor[magenta][darkmagenta]
+\definecolor[cyan] [darkcyan]
+
+\setupexternalfigures
+ [location={local,default}]
+
+\setupbodyfont
+ [10pt]
+
+\setuptyping
+ [color=darkyellow]
+
+\setuptype
+ [color=darkcyan]
+
+% \setupnumbering
+% [alternative=doublesided]
+
+\setuphead
+ [section]
+ [color=darkmagenta]
+
+\setupinteraction
+ [hidden]
+
+\startdocument
+ [metadata:author=Hans Hagen,
+ metadata:title=Extreme Tables,
+ author=Hans Hagen,
+ affiliation=PRAGMA ADE,
+ location=Hasselt NL,
+ title=Extreme Tables,
+ extra=ConTeXt MkIV,
+ support=www.contextgarden.net,
+ website=www.pragma-ade.nl]
+
+\startMPpage
+
+ StartPage ;
+ fill Page enlarged 2mm withcolor magenta/4 ;
+ pickup pencircle scaled 2mm ;
+ numeric n ; n := bbheight Page ;
+ forever :
+ n := n / 1.5 ;
+ draw bottomboundary Page shifted (0, n) withcolor 2yellow/3 withtransparency (1,0.5) ;
+ draw topboundary Page shifted (0,-n) withcolor 2yellow/3 withtransparency (1,0.5) ;
+ exitif n < 2cm ;
+ endfor ;
+ numeric n ; n := bbheight Page ;
+ forever :
+ n := n / 1.5 ;
+ draw leftboundary Page shifted ( n,0) withcolor 2cyan/3 withtransparency (1,0.5) ;
+ draw rightboundary Page shifted (-n,0) withcolor 2cyan/3 withtransparency (1,0.5) ;
+ exitif n < 2cm ;
+ endfor ;
+ picture p, q, r ;
+ p := textext("\ssbf\WORD{\documentvariable{title}}") xsized (bbheight Page - 2cm) rotated 90 ;
+ q := textext("\ssbf\WORD{\documentvariable{author}}") ysized 1cm ;
+ r := textext("\ssbf\WORD{\documentvariable{extra}}") xsized bbwidth q ;
+ draw anchored.rt (p, center rightboundary Page shifted (-1cm,0cm)) withcolor white ;
+ draw anchored.bot(q, center bottomboundary Page shifted ( 1cm,4.4cm)) withcolor white ;
+ draw anchored.bot(r, center bottomboundary Page shifted ( 1cm,2.8cm)) withcolor white ;
+ StopPage ;
+
+\stopMPpage
+
+% \page[empty] \setuppagenumber[start=1]
+
+\startsubject[title={Contents}]
+
+\placelist[section][criterium=all,interaction=all]
+
+\stopsubject
+
+\startsection[title={Introduction}]
+
+This is a short introduction to yet another table mechanism built in \CONTEXT. It
+is a variant of the so called natural tables but it has a different
+configuration. Also, the implementation is completely different. The reason for
+writing it is that in one of our projects we had to write styles for documents
+that had tables spanning 30 or more pages and apart from memory constraints this
+is quite a challenge for the other mechanisms, if only because splitting them
+into successive floats is not possible due to limitations of \TEX. The extreme
+table mechanism can handle pretty large tables and split them too. As each cell
+is basically a \type {\framed} and as we need to do two passes over the table,
+this mechanism is not the fastest but it is some two times faster than the
+natural tables mechanism, and in most cases can be used instead.
+
+\stopsection
+
+\startsection[title={The structure}]
+
+The structure of the tables is summarized here. There can be the usual head, body
+and foot specifications and we also support the optional header in following
+pages.
+
+\starttyping
+\definextable [tag] | [tag][parent]
+\setupxtable [settings] | [tag][settings]
+
+\startxtable[tag|settings]
+ \startxtablehead|next|body|foot[tag|settings]
+ \startxrowgroup[tag|settings]
+ \startxrow[settings]
+ \startxcellgroup[tag|settings]
+ \startxcell[settings] ... \stopxcell
+ \stopxcellgroup
+ \stopxrow
+ \startxrowgroup
+ \stopxtablehead|next|body|foot
+\stopxtable
+\stoptyping
+
+Contrary to what you might expect, the definition command defines a new set of
+command. You don't need to use this in order to set up a new settings
+environment. Settings and definitions can inherit so you can build a chain of
+parent|-|child settings. The grouping is nothing more than a switch to a new set
+of settings.
+
+\stopsection
+
+\startsection[title={Direct control}]
+
+A simple table with just frames is defined as follows:
+
+\startbuffer
+\startxtable
+ \startxrow
+ \startxcell one \stopxcell
+ \startxcell two \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha \stopxcell
+ \startxcell beta \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+You can pass parameters for tuning the table:
+
+\startbuffer
+\startxtable[offset=1cm]
+ \startxrow
+ \startxcell one \stopxcell
+ \startxcell two \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha \stopxcell
+ \startxcell beta \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+You can (for as much as they make sense) use the same settings as the \type
+{\framed} command, as long as you keep in mind that messing with the frame
+related offsets can have side effects.
+
+\stopsection
+
+\startsection[title={Sets of settings}]
+
+Instead of directly passing settings you can use a predefined set. Of course you
+can also combine these methods.
+
+\startbuffer
+\definextable
+ [myxtable]
+
+\definextable
+ [myxtable:important]
+ [myxtable]
+
+\setupxtable
+ [myxtable]
+ [width=4cm,
+ foregroundcolor=red]
+
+\setupxtable
+ [myxtable:important]
+ [background=color,
+ backgroundcolor=red,
+ foregroundcolor=white]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We can use these settings in table. Although it is not really needed to define a
+set beforehand (i.e.\ you can just use the setup command) it is cleaner and more
+efficient too.
+
+\startbuffer
+\startxtable[myxtable]
+ \startxrow[foregroundcolor=green]
+ \startxcell one \stopxcell
+ \startxcell two \stopxcell
+ \startxcellgroup[foregroundcolor=blue]
+ \startxcell tree \stopxcell
+ \startxcell four \stopxcell
+ \stopxcellgroup
+ \stopxrow
+ \startxrow
+ \startxcell alpha \stopxcell
+ \startxcell beta \stopxcell
+ \startxcellgroup[myxtable:important]
+ \startxcell gamma \stopxcell
+ \startxcell delta \stopxcell
+ \stopxcellgroup
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+The overhead of (chained) settings is quite acceptable and it helps to keep the
+source of the table uncluttered from specific settings.
+
+\stopsection
+
+\startsection[title={Defining}]
+
+If needed you can define your own encapsulating commands. The following example
+demonstrates this:
+
+\startbuffer
+\definextable[mytable]
+\stopbuffer
+
+\getbuffer \typebuffer
+
+We now can use the \type{mytable} wrapper:
+
+\startbuffer
+\startmytable[height=4cm,width=8cm,align={middle,lohi}]
+ \startxrow
+ \startxcell test \stopxcell
+ \stopxrow
+\stopmytable
+\stopbuffer
+
+\typebuffer
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+One drawback of using buffers is that they don't play well in macro definitions.
+In that case you need to use the following wrapper:
+
+\startbuffer
+\starttexdefinition MyTable #1#2#3#4
+ \startembeddedxtable
+ \startxrow
+ \startxcell #1 \stopxcell
+ \startxcell #2 \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell #3 \stopxcell
+ \startxcell #4 \stopxcell
+ \stopxrow
+ \stopembeddedxtable
+\stoptexdefinition
+\stopbuffer
+
+\typebuffer \getbuffer
+
+This macro is used as any other macro with arguments:
+
+\startbuffer
+\MyTable{one}{two}{three}{four}
+\stopbuffer
+
+\typebuffer
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+\stopsection
+
+\startsection[title={Stretching}]
+
+If you don't give the width of a cell, the widest natural size will be taken.
+Otherwise the given width applies to the whole column.
+
+\startbuffer
+\startxtable
+ \startxrow
+ \startxcell[width=1cm] one \stopxcell
+ \startxcell[width=2cm] two \stopxcell
+ \startxcell[width=3cm] tree \stopxcell
+ \startxcell[width=4cm] four \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha \stopxcell
+ \startxcell beta \stopxcell
+ \startxcell gamma \stopxcell
+ \startxcell delta \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+You can let the cells stretch so that the whole width of the text area is taken.
+
+\startbuffer[one]
+\startxtable[option=stretch]
+ \startxrow
+ \startxcell[width=1cm] one \stopxcell
+ \startxcell[width=2cm] two \stopxcell
+ \startxcell[width=3cm] tree \stopxcell
+ \startxcell[width=4cm] four \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha \stopxcell
+ \startxcell beta \stopxcell
+ \startxcell gamma \stopxcell
+ \startxcell delta \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer[one]
+
+The available left over space is equally distributed among the cells.
+
+\startlinecorrection[blank] \getbuffer[one] \stoplinecorrection
+
+\startbuffer[two]
+\startxtable[option={stretch,width}]
+ \startxrow
+ \startxcell[width=1cm] one \stopxcell
+ \startxcell[width=2cm] two \stopxcell
+ \startxcell[width=3cm] tree \stopxcell
+ \startxcell[width=4cm] four \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha \stopxcell
+ \startxcell beta \stopxcell
+ \startxcell gamma \stopxcell
+ \startxcell delta \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+An alternative is to distribute the space proportionally:
+
+\typebuffer[two]
+
+\startlinecorrection[blank] \getbuffer[two] \stoplinecorrection
+
+Just to stress the difference we show both alongside now:
+
+\startlinecorrection[blank]
+ \getbuffer[one]
+ \blank
+ \getbuffer[two]
+\stoplinecorrection
+
+You can specify the width of a cell with each cell but need to keep into mind
+that that value is then used for the whole column:
+
+\startbuffer
+\startxtable
+ \startxrow
+ \startxcell[width=1em] one \stopxcell
+ \startxcell[width=2em] two \stopxcell
+ \startxcell[width=3em] tree \stopxcell
+ \startxcell[width=4em] four \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha \stopxcell
+ \startxcell beta \stopxcell
+ \startxcell gamma \stopxcell
+ \startxcell delta \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+You can enforce that larger columns win via the \type {option} parameter:
+
+\startbuffer
+\startxtable[option=max]
+ \startxrow
+ \startxcell[width=1em] one \stopxcell
+ \startxcell[width=2em] two \stopxcell
+ \startxcell[width=3em] tree \stopxcell
+ \startxcell[width=4em] four \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha \stopxcell
+ \startxcell beta \stopxcell
+ \startxcell gamma \stopxcell
+ \startxcell delta \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+\stopsection
+
+\startsection[title={Spacing}]
+
+It is possible to separate the cells by horizontal and/or vertical space. As an
+example we create a setup.
+
+\startbuffer
+\setupxtable
+ [myztable]
+ [option=stretch,
+ foregroundcolor=blue,
+ columndistance=10pt,
+ leftmargindistance=20pt,
+ rightmargindistance=30pt]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+You can use the \type {textwidth} parameter to set a specific maximum width. We
+now apply the previous settings to an extreme table:
+
+\startbuffer
+\startxtable[myztable]
+ \startxrow
+ \startxcell[width=1cm] one \stopxcell
+ \startxcell[width=2cm,distance=5pt] two \stopxcell
+ \startxcell[width=3cm] tree \stopxcell
+ \startxcell[width=4cm] four \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell[width=1cm] alpha \stopxcell
+ \startxcell[width=2cm] beta \stopxcell
+ \startxcell[width=3cm] gamma \stopxcell
+ \startxcell[width=4cm] delta \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer
+
+As you can see here, we can still locally overload the settings but keep in mind
+that these apply to the whole column then, not to the specific cell.
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+Vertical spacing is (currently) setup differently, i.e.\ as an argument to the
+\type {\blank} command.
+
+\startbuffer
+\startxtable[spaceinbetween=medium]
+ \startxrow
+ \startxcell one \stopxcell
+ \startxcell two \stopxcell
+ \startxcell tree \stopxcell
+ \startxcell four \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha \stopxcell
+ \startxcell beta \stopxcell
+ \startxcell gamma \stopxcell
+ \startxcell delta \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer
+
+Specifying spacing this way improves consistency with the rest of the document
+spacing.
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+\stopsection
+
+\startsection[title={Spanning}]
+
+Of course we can span cells horizontally as well as vertically. Future versions
+might provide more advanced options but the basics work okay.
+
+\startbuffer
+\startxtable
+ \startxrow
+ \startxcell one \stopxcell
+ \startxcell[nx=2] two + three \stopxcell
+ \startxcell four \stopxcell
+ \startxcell five \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell[nx=3] alpha + beta + gamma \stopxcell
+ \startxcell[nx=2] delta + epsilon \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer
+
+This spans a few cells horizontally:
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+The next example gives a span in two directions:
+
+\startbuffer
+\startxtable
+ \startxrow
+ \startxcell alpha 1 \stopxcell
+ \startxcell beta 1 \stopxcell
+ \startxcell gamma 1 \stopxcell
+ \startxcell delta 1 \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha 2 \stopxcell
+ \startxcell[nx=2,ny=2] whatever \stopxcell
+ \startxcell delta 2 \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha 3 \stopxcell
+ \startxcell delta 3 \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha 4 \stopxcell
+ \startxcell beta 4 \stopxcell
+ \startxcell gamma 4 \stopxcell
+ \startxcell delta 4 \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer
+
+Of course, spanning is always a compromise but the best fit found by this
+mechanism takes natural width, given width and available space into account.
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+\stopsection
+
+\startsection[title={Partitioning}]
+
+You can partition a table as follows:
+
+\startbuffer
+\startxtable
+ \startxtablehead
+ \startxrow
+ \startxcell head one \stopxcell
+ \startxcell head two \stopxcell
+ \startxcell head tree \stopxcell
+ \startxcell head four \stopxcell
+ \stopxrow
+ \stopxtablehead
+ \startxtablenext
+ \startxrow
+ \startxcell next one \stopxcell
+ \startxcell next two \stopxcell
+ \startxcell next tree \stopxcell
+ \startxcell next four \stopxcell
+ \stopxrow
+ \stopxtablenext
+ \startxtablebody
+ \startxrow
+ \startxcell body one \stopxcell
+ \startxcell body two \stopxcell
+ \startxcell body tree \stopxcell
+ \startxcell body four \stopxcell
+ \stopxrow
+ \stopxtablebody
+ \startxtablefoot
+ \startxrow
+ \startxcell foot one \stopxcell
+ \startxcell foot two \stopxcell
+ \startxcell foot tree \stopxcell
+ \startxcell foot four \stopxcell
+ \stopxrow
+ \stopxtablefoot
+\stopxtable
+\stopbuffer
+
+\typebuffer
+
+There can be multiple such partitions and they are collected in head, next, body
+and foot groups. Normally the header ends up at the beginning and the footer at
+the end. When a table is split, the first page gets the header and the following
+pages the next one.
+
+You can let headers and footers be repeated by setting the \type {header}
+and|/|or \type {footer} parameters to \type {repeat}.
+
+\starttyping
+\setupxtable
+ [split=yes,
+ header=repeat,
+ footer=repeat]
+\stoptyping
+
+The table can be flushed in the running text but also in successive
+floats. Given that the table is in a buffer:
+
+\starttyping
+\placetable[here,split]{A big table.}{\getbuffer}
+\stoptyping
+
+When you specify \type {split} as \type {yes} the caption is taken into account
+when calculating the available space.
+
+There are actually three different split methods. The \type {yes} option works in
+text mode as well as in floats, but in text mode no headers and footers get
+repeated. If you want that feature in a text flush you have to set \type {split}
+to \type {repeat} as well.
+
+You can keep rows together by passing a \type {samepage} directive. This
+parameter can get the values \type {before}, \type {after} and \type {both}.
+
+\starttyping
+\startxtable[split=yes]
+ \startxrow \startxcell \tttf .01. \stopxcell \stopxrow
+ \startxrow \startxcell \tttf .... \stopxcell \stopxrow
+ \startxrow \startxcell \tttf \red .21. \stopxcell \stopxrow
+ \startxrow[samepage=both] \startxcell \tttf \red .22. \stopxcell \stopxrow
+ \startxrow[samepage=both] \startxcell \tttf \red .23. \stopxcell \stopxrow
+ \startxrow \startxcell \tttf .... \stopxcell \stopxrow
+ \startxrow \startxcell \tttf .99. \stopxcell \stopxrow
+\stopxtable
+\stoptyping
+
+\stopsection
+
+\startsection[title={Options}]
+
+On the average a table will come out okay but you need to keep in mind that when
+(complex) spans are used the results can be less that optimal. However, as
+normally one pays attention to creating tables, the amount of control provided
+often makes it possible to get what you want.
+
+In the following situations, the first cell width is determined by the span. It
+is possible to make a more clever analyzer but we need to keep in mind that in
+the same column there can be entries that span a different amount of columns. Not
+only would that be inefficient but it would also be rather unpredictable unless
+you know exactly what happens deep down. The following two examples demonstrate
+default behaviour.
+
+\startbuffer
+\startxtable
+ \startxrow
+ \startxcell[nx=3]
+ 1/2/3
+ \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell 1 \stopxcell
+ \startxcell 2 \stopxcell
+ \startxcell 3 \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startxtable
+ \startxrow
+ \startxcell[nx=3]
+ 1 / 2 / 3
+ \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell 1 \stopxcell
+ \startxcell 2 \stopxcell
+ \startxcell 3 \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+In practice you will set the width of the columns, as in:
+
+\startbuffer
+\startxtable
+ \startxrow
+ \startxcell[nx=3]
+ 1/2/3
+ \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell[width=\dimexpr\textwidth/3] 1 \stopxcell
+ \startxcell[width=\dimexpr\textwidth/3] 2 \stopxcell
+ \startxcell[width=\dimexpr\textwidth/3] 3 \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+But, if you want you can control the enforced width by setting an option:
+
+\startbuffer
+\startxtable
+ \startxrow
+ \startxcell[nx=3,option=tight]
+ 1/2/3
+ \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell 1 \stopxcell
+ \startxcell 2 \stopxcell
+ \startxcell 3 \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startxtable
+ \startxrow
+ \startxcell[nx=3,option=tight]
+ 1 / 2 / 3
+ \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell 1 \stopxcell
+ \startxcell 2 \stopxcell
+ \startxcell 3 \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+There is also a global setting:
+
+\startbuffer
+\startxtable[option=tight]
+ \startxrow
+ \startxcell[nx=3]
+ 1/2/3
+ \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell 1 \stopxcell
+ \startxcell 2 \stopxcell
+ \startxcell 3 \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\stopsection
+
+\startsection[title={Nesting}]
+
+Extreme tables can be nested but you need to keep an eye on inheritance here as
+the inner table uses the settings from the encapsulating cell. The widths and
+heights of the inner table default to \type {fit}. We could cook up a more
+complex nesting model but this one is easy to follow.
+
+\startbuffer
+\startxtable
+ \startxrow
+ \startxcell[offset=0pt]
+ \startxtable[background=color,backgroundcolor=green,
+ foregroundcolor=white,offset=1ex]
+ \startxrow
+ \startxcell[width=1cm] one \stopxcell
+ \startxcell[width=2cm] two \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell[width=3cm] alpha \stopxcell
+ \startxcell[width=4cm] beta \stopxcell
+ \stopxrow
+ \stopxtable
+ \stopxcell
+ \startxcell two \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha \stopxcell
+ \startxcell
+ \startxtable[background=color,backgroundcolor=red,
+ foregroundcolor=white]
+ \startxrow
+ \startxcell one \stopxcell
+ \startxcell two \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha \stopxcell
+ \startxcell beta \stopxcell
+ \stopxrow
+ \stopxtable
+ \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer
+
+Here we just manipulate the offset a bit.
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+\stopsection
+
+\startsection[title={Buffers}]
+
+When you don't want to clutter your document source too much buffers can be if
+help:
+
+\startbuffer
+\startbuffer[test]
+\startxtable
+ \startxrow
+ \startxcell[width=1cm] one \stopxcell
+ \startxcell[width=2cm] two \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell alpha \stopxcell
+ \startxcell beta \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+\stopbuffer
+
+\typebuffer \getbuffer
+
+One way of getting this table typeset is to say:
+
+\starttyping
+\getbuffer[test]
+\stoptyping
+
+Normally this is quite okay. However, internally extreme tables become also
+buffers. If you don't like the overhead of this double buffering you can use the
+following command:
+
+\starttyping
+\processxtablebuffer[test]
+\stoptyping
+
+This can save you some memory and runtime, but don't expect miracles. Also, this
+way of processing does not support nested tables (unless \type {{}} is used).
+
+\stopsection
+
+\startsection[title={XML}]
+
+The following example demonstrates that we can use this mechanism in \XML\ too.
+The example was provided by Thomas Schmitz. First we show how a table looks like
+in \XML:
+
+\startbuffer[test]
+<table>
+ <tablerow>
+ <tablecell>
+ One
+ </tablecell>
+ <tablecell>
+ Two
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <b>Three</b>
+ </tablecell>
+ <tablecell>
+ Four
+ </tablecell>
+ </tablerow>
+</table>
+\stopbuffer
+
+\typebuffer[test]
+
+We need to map these elements to setups:
+
+\startbuffer
+\startxmlsetups xml:testsetups
+ \xmlsetsetup{main}{b|table|tablerow|tablecell}{xml:*}
+\stopxmlsetups
+
+\xmlregistersetup{xml:testsetups}
+\stopbuffer
+
+\typebuffer \getbuffer
+
+The setups themselves are rather simple as we don't capture any attributes.
+
+\startbuffer
+\startxmlsetups xml:b
+ \bold{\xmlflush{#1}}
+\stopxmlsetups
+
+\startxmlsetups xml:table
+ \startembeddedxtable
+ \xmlflush{#1}
+ \stopembeddedxtable
+\stopxmlsetups
+
+\startxmlsetups xml:tablerow
+ \startxrow
+ \xmlflush{#1}
+ \stopxrow
+\stopxmlsetups
+
+\startxmlsetups xml:tablecell
+ \startxcell
+ \xmlflush{#1}
+ \stopxcell
+\stopxmlsetups
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We now process the example. Of course it will also work for files.
+
+\startbuffer
+ \xmlprocessbuffer{main}{test}{}
+\stopbuffer
+
+\typebuffer
+
+The result is:
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+\stopsection
+
+\startsection[title={Natural tables}]
+
+For the impatient a small additional module is provided that remaps the natural
+table commands onto extreme tables:
+
+\startbuffer
+\usemodule[ntb-to-xtb]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+After that:
+
+\startbuffer
+\bTABLE
+ \bTR
+ \bTD[background=color,backgroundcolor=red] one \eTD
+ \bTD[width=2cm] two \eTD
+ \eTR
+ \bTR
+ \bTD[width=5cm] alpha \eTD
+ \bTD[background=color,backgroundcolor=yellow] beta \eTD
+ \eTR
+\eTABLE
+\stopbuffer
+\stopbuffer
+
+\typebuffer
+
+Will come out as:
+
+\startlinecorrection[blank]
+\getbuffer
+\stoplinecorrection
+
+You can restore and remap the commands with the following helpers:
+
+\starttyping
+\restoreTABLEfromxtable
+\mapTABLEtoxtable
+\stoptyping
+
+Of course not all functionality of the natural tables maps onto similar
+functionality of extreme tables, but on the average the result will look rather
+similar.
+
+\stopsection
+
+\startsection[title={Colofon}]
+
+\starttabulate[|B|p|]
+\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR
+\NC version \NC \currentdate \NC \NR
+\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR
+\NC copyright \NC \symbol[cc][cc-by-sa-nc] \NC \NR
+\stoptabulate
+
+\stopsection
+
+\startsection[title={Examples}]
+
+On the following pages we show some examples of (experimental) features. For this
+we will use the usual quotes from Ward, Tufte and Davis etc.\ that you can find
+in the distribution.
+
+\page
+
+\startbuffer
+\startxtable[bodyfont=6pt]
+ \startxrow
+ \startxcell \input ward \stopxcell
+ \startxcell \input tufte \stopxcell
+ \startxcell \input davis \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startxtable[bodyfont=6pt,option=width]
+ \startxrow
+ \startxcell \input ward \stopxcell
+ \startxcell \input tufte \stopxcell
+ \startxcell \input davis \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\page
+
+\startbuffer
+\startxtable[bodyfont=6pt]
+ \startxrow
+ \startxcell \externalfigure[cow.pdf][width=3cm] \stopxcell
+ \startxcell \input tufte \stopxcell
+ \startxcell \input davis \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startxtable[bodyfont=6pt,option=width]
+ \startxrow
+ \startxcell \externalfigure[cow.pdf][width=3cm] \stopxcell
+ \startxcell \input tufte \stopxcell
+ \startxcell \input davis \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\page
+
+\startbuffer
+\startxtable[option=stretch]
+ \startxrow
+ \startxcell bla \stopxcell
+ \startxcell bla bla \stopxcell
+ \startxcell bla bla bla \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startxtable[option={stretch,width}]
+ \startxrow
+ \startxcell bla \stopxcell
+ \startxcell bla bla \stopxcell
+ \startxcell bla bla bla \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\page
+
+\startbuffer
+\setupxtable[suffix][align=middle,foregroundcolor=red]
+\setupxtable[blabla][foregroundstyle=slanted]
+\setupxtable[crap] [foregroundcolor=blue]
+\setupxtable[bold] [crap][foregroundstyle=bold]
+
+\startxtable % [frame=off]
+ \startxtablehead
+ \startxrow[bold]
+ \startxcell[suffix] head a \stopxcell
+ \startxcell[blabla] head b \stopxcell
+ \startxcell head c \stopxcell
+ \stopxrow
+ \stopxtablehead
+ \startxtablebody
+ \startxrow
+ \startxcell[suffix][ny=2] cell a 1 \stopxcell
+ \startxcell cell b 1 \stopxcell
+ \startxcell cell c 1 \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell cell b 2 \stopxcell
+ \startxcell cell c 2 \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell[suffix] cell a 3 \stopxcell
+ \startxcell cell b 3 \stopxcell
+ \startxcell cell c 3 \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell[suffix] cell a 4 \stopxcell
+ \startxcell cell b 4 \stopxcell
+ \startxcell cell c 4 \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell[suffix] cell a 5 \stopxcell
+ \startxcell cell b 5 \stopxcell
+ \startxcell cell c 5 \stopxcell
+ \stopxrow
+ \stopxtablebody
+\stopxtable
+\stopbuffer
+
+\typebuffer \start \getbuffer \stop
+
+\page
+
+\startbuffer
+\startxtable[option=stretch]
+ \startxrow
+ \startxcell[option=fixed] first cell \stopxcell
+ \startxcell 101 \stopxcell
+ \startxcell 102 \stopxcell
+ \startxcell 103 \stopxcell
+ \stopxrow
+ \startxrow
+ \startxcell 2\high{nd} cell \stopxcell
+ \startxcell a \stopxcell
+ \startxcell b \stopxcell
+ \startxcell c \stopxcell
+ \stopxrow
+\stopxtable
+\stopbuffer
+
+\typebuffer \start \getbuffer \stop
+
+\page
+
+\startbuffer[demo]
+\startxtable
+\startxrow
+ \startxcell[demo][nx=4] 1 / 2 / 3 / 4 \stopxcell
+\stopxrow
+\startxrow
+ \startxcell[demo][nx=3] 1 / 2 / 3 \stopxcell
+ \startxcell 4 \stopxcell
+\stopxrow
+\startxrow
+ \startxcell 1 \stopxcell
+ \startxcell[demo][nx=3] 2 / 3 / 4 \stopxcell
+\stopxrow
+\startxrow
+ \startxcell[demo][nx=2] 1 / 2 \stopxcell
+ \startxcell 3 \stopxcell
+ \startxcell 4 \stopxcell
+\stopxrow
+\startxrow
+ \startxcell 1 \stopxcell
+ \startxcell[demo][nx=2] 2 / 3 \stopxcell
+ \startxcell 4 \stopxcell
+\stopxrow
+\startxrow
+ \startxcell 1 \stopxcell
+ \startxcell 2 \stopxcell
+ \startxcell[demo][nx=2] 3 / 4 \stopxcell
+\stopxrow
+\startxrow
+ \startxcell[demo][nx=2] 1 / 2 \stopxcell
+ \startxcell[demo][nx=2] 3 / 4 \stopxcell
+\stopxrow
+\startxrow
+ \startxcell 1 \stopxcell
+ \startxcell 2 \stopxcell
+ \startxcell 3 \stopxcell
+ \startxcell 4 \stopxcell
+\stopxrow
+\stopxtable
+\stopbuffer
+
+\startbuffer[tight]
+\setupxtable[demo][option=tight]
+\stopbuffer
+
+\startbuffer[normal]
+\setupxtable[demo][option=]
+\stopbuffer
+
+\typebuffer[demo]
+
+\page
+
+\typebuffer[tight] \start \getbuffer[tight,demo] \stop
+\typebuffer[normal] \start \getbuffer[normal,demo] \stop
+
+% \ruledhbox{\getbuffer[normal,demo]}
+
+\stopdocument
diff --git a/doc/context/sources/general/mathml/mathml/envexamp.tex b/doc/context/sources/general/mathml/mathml/envexamp.tex
new file mode 100644
index 000000000..99bc72b8a
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/envexamp.tex
@@ -0,0 +1,291 @@
+\startenvironment envexamp
+
+% this is an old style. only slightly updated to mkiv
+
+\usemodule[abr-02,mathml]
+
+\setupdocument % defaults
+ [color=darkred,
+ columns=2,
+ title=MathML in \ConTeXt]
+
+\startmode[atpragma]
+ \setupbodyfont[lucidanova]
+\stopmode
+
+\startnotmode[atpragma]
+ \setupbodyfont[palatino]
+\stopnotmode
+
+\setupbodyfont
+ [10pt]
+
+\definepapersize
+ [mml]
+ [width=20cm,
+ height=20cm]
+
+\setuppapersize
+ [mml]
+ [mml]
+
+\definecolor[lightgray] [s=.85]
+\definecolor[pagegray] [s=.8]
+\definecolor[mediumgray][s=.5]
+\definecolor[darkgray] [s=.4]
+\definecolor[darkred] [r=.65]
+\definecolor[darkgreen] [g=.65]
+\definecolor[darkblue] [b=.65]
+\definecolor[darkyellow][r=.65,g=.65]
+
+\definepalet
+ [XMLcolorpretty]
+ [ prettyone=darkred,
+ prettytwo=darkgreen,
+ prettythree=darkblue,
+ prettyfour=darkgray]
+
+\definecolor
+ [maincolor]
+ [\documentvariable{color}]
+
+\setuptyping
+ [option=XML]
+
+\setupwhitespace
+ [big]
+
+\setupinteraction
+ [state=start,
+ menu=on,
+ color=maincolor,
+ contrastcolor=maincolor]
+
+\setuplayout
+ [backspace=1cm,
+ topspace=1cm,
+ bottomspace=7.5mm,
+ header=0pt,
+ footer=0pt,
+ bottomdistance=.5cm,
+ bottom=1cm,
+ height=17cm,
+ width=middle]
+
+\defineoverlay [mmlpage] [\uniqueMPgraphic{mmlpage}]
+\defineoverlay [mmltitle] [\uniqueMPgraphic{mmltitle}]
+\defineoverlay [formula] [\uniqueMPgraphic{formula}]
+
+\startuseMPgraphic{mml}
+ z1 = llcorner Page ;
+ z2 = .5[lrcorner Page,urcorner Page] ;
+ z3 = ulcorner Page ;
+ fill
+ Page
+ withcolor \MPcolor{lightgray} ;
+ fill
+ z1 shifted (1cm,0) --
+ z2 shifted (0,-.5cm) --
+ lrcorner Page -- cycle
+ withcolor \MPcolor{pagegray} ;
+ fill
+ z3 shifted (1cm,0) --
+ z2 shifted (0,+.5cm) --
+ urcorner Page -- cycle
+ withcolor \MPcolor{pagegray} ;
+\stopuseMPgraphic
+
+\startuniqueMPgraphic{mmlpage}
+ StartPage ;
+ \includeMPgraphic{mml}
+ fill
+ llcorner Page --
+ .5[lrcorner Page,urcorner Page] --
+ ulcorner Page -- cycle
+ withcolor \MPcolor{pagegray} ;
+ Page := Page enlarged -.5cm ;
+ StopPage ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{mmltitle}
+ StartPage ;
+ \includeMPgraphic{mml}
+ fill z1--z2--z3--cycle withcolor \MPcolor{maincolor} ;
+ picture p ;
+ p := textext("\documentvariable{title}") ;
+ p := p xsized (.75length(z2-z1)) ;
+ p := p rotatedaround(center p, angle z2) ;
+ p := p shifted -center p shifted .5[z1,z2] ;
+ p := p shifted ((unitvector(.5[z1,z2]) rotated 90)*1cm) ;
+ draw p withcolor \MPcolor{lightgray} ;
+ Page := Page enlarged -.5cm ;
+ StopPage ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{formula}
+ draw
+ OverlayBox
+ withpen pensquare scaled 2mm
+ withcolor \MPcolor{lightgray} ;
+ fill
+ OverlayBox
+ withcolor \MPcolor{mediumgray} ;
+\stopuniqueMPgraphic
+
+\setupbottom
+ [style=bold,
+ color=darkgray]
+
+\setuplist
+ [section]
+ [alternative=a,
+ interaction=all,
+ pagenumber=no,
+ width=0pt,
+ style=\bfb,
+ color=darkgray,
+ contrastcolor=darkgray,
+ before={\blank[2*big]},
+ after={\blank\startcolumns[n=5]\placelist[subsection]\stopcolumns}]
+
+\setuplist
+ [subsection]
+ [alternative=f,
+ interaction=all]
+
+\setuphead
+ [section]
+ [page=yes,
+ style=\bfd,
+ color=darkgray,
+ number=no,
+ after={\blank[2*big]\startcolumns[n=5]\placelist[subsection]\stopcolumns\page}]
+
+\setuphead
+ [subsection]
+ [after=,
+ placehead=empty]
+
+\setuphead
+ [subject]
+ [style=\bfb,
+ color=darkgray,
+ after={\blank[2*big]}]
+
+\setupinteractionmenu
+ [bottom]
+ [state=start,
+ frame=off,
+ left=\hskip3cm,
+ middle=\quad]
+
+\startinteractionmenu[bottom]
+ \startbut [content] content \stopbut
+ \startbut [colofon] colofon \stopbut
+ \startbut [index] index \stopbut
+ \startbut [PreviousJump] go back \stopbut
+ \startbut [previouspage] \bfa-- \stopbut
+ \startbut [nextpage] \bfa+ \stopbut
+ \hfill
+ \starttxt
+ \color[darkgray]{\markcontent{\getmarking[section]: }\getmarking[subsection]\removemarkedcontent}
+ \stoptxt
+\stopinteractionmenu
+
+\starttexdefinition unexpanded ShowFormula #1#2#3
+ \showXMLformula{\rawstructurelistuservariable{filename}.xml}
+\stoptexdefinition
+
+\starttexdefinition unexpanded showXMLformula #1
+ \framed [
+ strut=no,
+ background=formula,
+ foregroundcolor=white,
+ frame=off,align=normal,
+ width=\hsize
+ ] {
+ \vbox {
+ \processXMLfile{#1}\endgraf
+ }
+ }
+\stoptexdefinition
+
+\starttexdefinition unexpanded showXMLsample #1
+ \page
+ \bgroup
+ \startbaselinecorrection
+ \showXMLformula{#1.xml}
+ \stopbaselinecorrection
+ \startsubsection[reference=#1,title=#1,marking=#1][filename=#1]
+ \switchtobodyfont
+ [8pt]
+ \startcolumns[balance=no,n=\getvariable{document}{columns}]
+ \typefile{#1.xml}
+ \stopcolumns
+ \vfill
+ \page
+ \stopsubsection
+ \egroup
+\stoptexdefinition
+
+\startsetups[document:start]
+
+ \setupbackgrounds
+ [page]
+ [background=mmltitle]
+
+ \startstandardmakeup
+ \setupalign[left]
+ \bgroup
+ \darkgray \bfd \setupinterlinespace
+ Examples \vfill
+ Hans Hagen\par
+ PRAGMA ADE\par
+ \vskip-\dp\strutbox
+ \vskip-1cm
+ \egroup
+ \vskip\dp\strutbox
+ \vskip1pt
+ \stopstandardmakeup
+
+ \setupbackgrounds
+ [page]
+ [background=mmlpage]
+
+ \startsubject[reference=content,title={Content}]
+ \placelist[section]
+ \stopsubject
+
+ \startsubject[reference=colofon,titlr={Colofon}]
+ \getbuffer[colofon]
+ \stopsubject
+
+\stopsetups
+
+\startsetups[document:stop]
+
+ \page
+
+ \pagereference[index]
+
+ \setuplist
+ [section]
+ [alternative=a,
+ before={\testpage[5]},
+ after={\blank[medium]\placelist[subsection]}]
+
+ \setuplist
+ [subsection]
+ [alternative=vertical,
+ before=\startbaselinecorrection,
+ after=\stopbaselinecorrection\blank,
+ color=,
+ contrastcolor=,
+ command=\ShowFormula,
+ interaction=all]
+
+ \placelist[section][criterium=text]
+
+\stopsetups
+
+\stopenvironment
diff --git a/doc/context/sources/general/mathml/mathml/mmlexamp.tex b/doc/context/sources/general/mathml/mathml/mmlexamp.tex
new file mode 100644
index 000000000..0f488b61c
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/mmlexamp.tex
@@ -0,0 +1,107 @@
+% engine=luatex language=uk
+
+\environment envexamp
+
+\startbuffer[colofon]
+
+This document shows a few formulas coded in \MATHML\ and typeset by \CONTEXT. The
+examples are taken from an old copy of \quote {Handbook of Chemistry and Physics}
+as well as \quote {Wiskunde voor het HBO (R.~van Asselt et al.)}. We assume no
+responsibility for the coding being 100\% all correct.
+
+These examples are typeset using the default settings. There are several ways to
+influence the look and feel of a formula. Details on how to process \MATHML\ can
+be found in the \XML\ related documentation that comes with \CONTEXT.
+
+You can get more information on \CONTEXT\ at our website, in \TEX\ usergroup
+publications and in (the archives of) the \CONTEXT\ mailing list.
+
+\blank[2*big]
+
+\startlines
+Hans Hagen
+Hasselt, January 2001 / June 2008 / June 2015
+\goto{www.pragma-ade.com}[url(http://www.pragma-ade.com)]
+\stoplines
+
+\stopbuffer
+
+\startdocument
+ [color=darkred,
+ columns=2,
+ title=MathML in \ConTeXt]
+
+\section{Derivatives}
+
+\showXMLsample {pc-d-001}
+\showXMLsample {pc-d-002}
+\showXMLsample {pc-d-003}
+\showXMLsample {pc-d-004}
+\showXMLsample {pc-d-005}
+\showXMLsample {pc-d-006}
+\showXMLsample {pc-d-007}
+\showXMLsample {pc-d-008}
+\showXMLsample {pc-d-009}
+\showXMLsample {pc-d-010}
+\showXMLsample {pc-d-011}
+\showXMLsample {pc-d-043}
+\showXMLsample {pc-d-051}
+
+\section{Integrals}
+
+\showXMLsample {pc-i-022}
+\showXMLsample {pc-i-380}
+
+\section{Series}
+
+\showXMLsample {pc-s-001}
+\showXMLsample {pc-s-002}
+\showXMLsample {pc-s-003}
+\showXMLsample {wh-s-001}
+\showXMLsample {wh-s-002}
+
+\section{Logs}
+
+\showXMLsample {wh-l-001}
+\showXMLsample {wh-l-002}
+\showXMLsample {wh-l-003}
+\showXMLsample {wh-l-004}
+
+\section{Goniometrics}
+
+\showXMLsample {wh-g-001}
+\showXMLsample {wh-g-002}
+\showXMLsample {wh-g-003}
+\showXMLsample {wh-g-004}
+\showXMLsample {wh-g-005}
+\showXMLsample {wh-g-006}
+\showXMLsample {wh-g-007}
+\showXMLsample {wh-g-008}
+\showXMLsample {wh-g-009}
+\showXMLsample {wh-g-010}
+\showXMLsample {wh-g-011}
+\showXMLsample {wh-g-012}
+\showXMLsample {wh-g-013}
+\showXMLsample {wh-g-014}
+\showXMLsample {wh-g-015}
+\showXMLsample {wh-g-016}
+
+% \section{Openmath}
+
+% \showXMLsample {openmath-1001}
+% \showXMLsample {openmath-1002}
+% \showXMLsample {openmath-1003}
+% \showXMLsample {openmath-1004}
+% \showXMLsample {openmath-1005}
+% \showXMLsample {openmath-1006}
+
+% \showXMLsample {openmath-2001}
+% \showXMLsample {openmath-2002}
+% \showXMLsample {openmath-2003}
+% \showXMLsample {openmath-2004}
+% \showXMLsample {openmath-2005}
+% \showXMLsample {openmath-2006}
+% \showXMLsample {openmath-2007}
+% \showXMLsample {openmath-2008}
+
+\stopdocument
diff --git a/doc/context/sources/general/mathml/mathml/mmlprime.tex b/doc/context/sources/general/mathml/mathml/mmlprime.tex
new file mode 100644
index 000000000..a336c6c41
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/mmlprime.tex
@@ -0,0 +1,6036 @@
+% language=uk
+
+% \setupbackend[export=yes]
+
+\usemodule[abr-02,mathml,math-coverage,asciimath]
+
+% \enabletrackers[xml.entities]
+
+% \showframe
+
+\setupindenting
+ [medium,next,yes]
+
+\setupinteraction
+ [state=start,
+ color=,
+ style=]
+
+\placebookmarks
+ [chapter,section]
+
+% was: \doifelsemode {atpragma} { } { }
+
+\doifelsefontpresent {LucidaBrightOT.otf} {
+ \setupbodyfont[lucidaot,10pt]
+ \definefontsynonym[NiceBold][Handwriting]
+} {
+ \setupbodyfont[pagella,11pt]
+ \definefontsynonym[NiceBold][SerifBold]
+}
+
+\definefont[ChapterFont][NiceBold*default at 32pt]
+\definefont[SectionFont][NiceBold*default sa 1.2]
+\definefont[FormulaFont][NiceBold*default sa 1.0]
+
+\setuplayout
+ [topspace=15mm,
+ backspace=15mm,
+ header=10mm,
+ headerdistance=5mm,
+ footer=10mm,
+ footerdistance=5mm,
+ width=middle,
+ height=middle]
+
+\setuppagenumbering
+ [alternative=doublesided]
+
+\setuphead
+ [chapter]
+ [alternative=middle,
+ number=no,
+ style=ChapterFont,
+ color=darkred,
+ after={\blank[3*big]},
+ header=high,
+ footer=startofchapter]
+
+\setuphead
+ [section]
+ [command=\SectionCommand,
+ style=SectionFont,
+ textcolor=darkred,
+ after={\blank[big]}]
+
+\setuphead
+ [subsection]
+ [command=\SubSectionCommand,
+ style=SectionFont,
+ textcolor=darkred,
+ after={\blank[big]}]
+
+\unexpanded\def\SectionCommand#1#2%
+ {\darkblue<--\enspace\ifconditional\headshownumber\enspace#1\quad\fi#2\enspace-->}
+
+\unexpanded\def\SubSectionCommand#1#2%
+ {\darkblue<?\enspace\ifconditional\headshownumber#1\quad\fi#2\enspace ?>}
+
+\setuplayout
+ [style=\hw]
+
+\setuppagenumbering
+ [color=darkblue]
+
+\setupheader
+ [color=darkblue]
+
+\setupfooter
+ [color=darkblue]
+
+\setuplinewidth
+ [1pt]
+
+\setuptabulate
+ [rulecolor=darkblue]
+
+\setuptables
+ [rulecolor=darkblue]
+
+\setupfootertexts
+ [chapter]
+
+\definetext
+ [startofchapter]
+ [footer][pagenumber]
+
+\definestartstop
+ [mmlelement]
+ [style=\it]
+
+\definestartstop
+ [attvalue]
+ [style=\it]
+
+\definestartstop
+ [entity]
+ [style=\it,
+ left=\textampersand,
+ right=;]
+
+\setuplist
+ [chapter]
+ [interaction=all,
+ alternative=b,
+ aligntitle=yes,
+ textstyle=bold,
+ numberstyle=bold,
+ textcolor=darkblue,
+ numbercolor=darkblue,
+ after=\blank]
+
+\setuplist
+ [section]
+ [interaction=all,
+ alternative=b,
+ maxwidth=.8\hsize,
+ aligntitle=yes]
+
+\definetabulate
+ [directives]
+ [| T l | T l | T l | l |]
+
+\definetabulate
+ [attributes]
+ [| T l | T l | l | l |]
+
+\definetabulate
+ [mathmlattributes]
+ [| B l w(2.5cm) T CT{darkred} | T l | c | p |]
+
+\starttabulatehead[mathmlattributes]
+ \FL
+\stoptabulatehead
+
+\starttabulatetail[mathmlattributes]
+ \LL
+\stoptabulatetail
+
+\starttexdefinition unexpanded ExampleLine #1
+ \noindentation % \dontleavehmode
+ \type[color=darkblue]{#1}\quad\quad\asciimath{#1}
+ \blank[big]
+\stoptexdefinition
+
+
+\setupformulas
+ [way=bytext]
+
+% isolated content
+
+\startbuffer[derivates]
+ \showXMLfile {derivate}{pc-d-001}
+ \showXMLfile {derivate}{pc-d-002}
+ \showXMLfile {derivate}{pc-d-003}
+ \showXMLfile {derivate}{pc-d-004}
+ \showXMLfile {derivate}{pc-d-005}
+ \showXMLfile {derivate}{pc-d-006}
+ \showXMLfile {derivate}{pc-d-007}
+ \showXMLfile {derivate}{pc-d-008}
+ \showXMLfile {derivate}{pc-d-009}
+ \showXMLfile {derivate}{pc-d-010}
+ \showXMLfile {derivate}{pc-d-011}
+ \showXMLfile {derivate}{pc-d-043}
+ %showXMLfile {derivate}{pc-d-051}
+\stopbuffer
+
+\startbuffer[integrals]
+ \showXMLfile {integral}{pc-i-022}
+ \showXMLfile {integral}{pc-i-061}
+ \showXMLfile {integral}{pc-i-380}
+\stopbuffer
+
+\startbuffer[series]
+ \showXMLfile {serie}{pc-s-001}
+ \showXMLfile {serie}{pc-s-002}
+ \showXMLfile {serie}{pc-s-003}
+ \showXMLfile {serie}{wh-s-001}
+ \showXMLfile {serie}{wh-s-002}
+\stopbuffer
+
+\startbuffer[logs]
+ \showXMLfile {log}{wh-l-001}
+ \showXMLfile {log}{wh-l-002}
+ \showXMLfile {log}{wh-l-003}
+ \showXMLfile {log}{wh-l-004}
+\stopbuffer
+
+\startbuffer[goniometrics]
+ \showXMLfile {gonio}{wh-g-001}
+ \showXMLfile {gonio}{wh-g-002}
+ \showXMLfile {gonio}{wh-g-003}
+ \showXMLfile {gonio}{wh-g-004}
+ \showXMLfile {gonio}{wh-g-005}
+ \showXMLfile {gonio}{wh-g-006}
+ \showXMLfile {gonio}{wh-g-007}
+ \showXMLfile {gonio}{wh-g-008}
+ \showXMLfile {gonio}{wh-g-009}
+ \showXMLfile {gonio}{wh-g-010}
+ \showXMLfile {gonio}{wh-g-011}
+ \showXMLfile {gonio}{wh-g-012}
+ \showXMLfile {gonio}{wh-g-013}
+ \showXMLfile {gonio}{wh-g-014}
+ \showXMLfile {gonio}{wh-g-015}
+ \showXMLfile {gonio}{wh-g-016}
+\stopbuffer
+
+\startbuffer[statistics]
+ \showXMLfile {statistic}{wh-o-001}
+ \showXMLfile {statistic}{wh-o-002}
+ \showXMLfile {statistic}{wh-o-003}
+\stopbuffer
+
+\startbuffer[matrices]
+ \showXMLfile {matrix}{wh-m-001}
+ \showXMLfile {matrix}{wh-m-002}
+\stopbuffer
+
+% buffers voor de presentational MathML attributes
+
+\startbuffer[mi-mn]
+ \startmathmlattributes
+ \NC mi, mn \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC dir \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC mathsize \NC -- \NC \NC\NR
+ \NC \NC mathvariant \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mo]
+ \startmathmlattributes
+ \NC mo \NC accent \NC -- \NC \NC\NR
+ \NC \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC dir \NC -- \NC \NC\NR
+ \NC \NC fence \NC -- \NC \NC\NR
+ \NC \NC form \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC largeop \NC -- \NC \NC\NR
+ \NC \NC lspace \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC mathsize \NC -- \NC \NC\NR
+ \NC \NC mathvariant \NC -- \NC \NC\NR
+ \NC \NC maxsize \NC + \NC If stretchy is true, this attribute specifies the maximum size of the operator. Allowed values are: \quote{infinity} or an arbitrary length. \NC\NR
+ \NC \NC minsize \NC -- \NC \NC\NR
+ \NC \NC movablelimits \NC -- \NC \NC\NR
+ \NC \NC rspace \NC -- \NC \NC\NR
+ \NC \NC separator \NC -- \NC \NC\NR
+ \NC \NC stretchy \NC -- \NC \NC\NR
+ \NC \NC symmetric \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mrow]
+ \startmathmlattributes
+ \NC mrow \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC dir \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[msub]
+ \startmathmlattributes
+ \NC msub \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC subscriptshift \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[msup]
+ \startmathmlattributes
+ \NC msup \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC superscriptshift \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[msubsup]
+ \startmathmlattributes
+ \NC msubsup \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC subscriptshift \NC -- \NC \NC\NR
+ \NC \NC superscriptshift \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mfrac]
+ \startmathmlattributes
+ \NC mfrac \NC bevelled \NC + \NC Specifies the way the fraction is displayed. If true, the fraction line is bevelled, which means that numerator and denominator are displayed side by side and separated by a slash (/). \NC\NR
+ \NC \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC denomalign \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC linethickness \NC + \NC The thickness of the horizontal fraction line. The default value is medium, but thin, thick, and other values can be set. \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC numalign \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mfenced]
+ \startmathmlattributes
+ \NC mfenced \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC close \NC + \NC A string for the closing delimiter. The default value is \quote{)} and any white space is trimmed. \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC open \NC + \NC A string for the opening delimiter. The default value is \quote{(} and any white space is trimmed. \NC\NR
+ \NC \NC separators \NC + \NC A sequence of zero or more characters to be used for different separators, optionally divided by white space, which is ignored. The default value is \quote{,}. \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[msqrt-mroot]
+ \startmathmlattributes
+ \NC msqrt, mroot \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mtext]
+ \startmathmlattributes
+ \NC mtext \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC dir \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC mathsize \NC -- \NC \NC\NR
+ \NC \NC mathvariant \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mover]
+ \startmathmlattributes
+ \NC mover \NC accent \NC -- \NC \NC\NR
+ \NC \NC align \NC -- \NC \NC\NR
+ \NC \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[munder]
+ \startmathmlattributes
+ \NC munder \NC accentunder \NC -- \NC \NC\NR
+ \NC \NC align \NC -- \NC \NC\NR
+ \NC \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[munderover]
+ \startmathmlattributes
+ \NC munderover \NC accent \NC -- \NC \NC\NR
+ \NC \NC accentunder \NC -- \NC \NC\NR
+ \NC \NC align \NC -- \NC \NC\NR
+ \NC \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[ms]
+ \startmathmlattributes
+ \NC ms \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC dir \NC -- \NC \NC\NR
+ \NC \NC lquote \NC + \NC The opening quote character (depends on dir) to enclose the content. The default value is \type{"}. \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC mathsize \NC -- \NC \NC\NR
+ \NC \NC mathvariant \NC -- \NC \NC\NR
+ \NC \NC rquote \NC + \NC The closing quote mark (depends on dir) to enclose the content. The default value is \type{"}. \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[menclose]
+ \startmathmlattributes
+ \NC menclose \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC notation \NC + \NC A list of notations, separated by white space, to apply to the child elements. The symbols are each drawn as if the others are not present, and therefore may overlap. Supported values are:
+ longdiv, actuarial, radiacal, box downdiagonalstrike, roundedbox updiagonalstrike, circle verticalstrike horizontalstrike, right bottom horizontalstrike, etc. \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[merror]
+ \startmathmlattributes
+ \NC merror \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mmultiscripts]
+ \startmathmlattributes
+ \NC mmultiscripts \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC subscriptshift \NC -- \NC \NC\NR
+ \NC \NC superscriptshift \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mspace]
+ \startmathmlattributes
+ \NC mspace \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC depth \NC -- \NC \NC\NR
+ \NC \NC height \NC -- \NC \NC\NR
+ \NC \NC linebreak \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC spacing \NC -- \NC The desired width of the space. \NC\NR % AFO: bestaat attribuut echt?
+ \NC \NC width \NC -- \NC The desired width of the space. \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mphantom]
+ \startmathmlattributes
+ \NC mphantom \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mpadded]
+ \startmathmlattributes
+ \NC mpadded \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC depth \NC -- \NC \NC\NR
+ \NC \NC height \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC lspace \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC voffset \NC -- \NC \NC\NR
+ \NC \NC width \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mtable]
+ \startmathmlattributes
+ \NC mtable \NC align \NC -- \NC \NC\NR
+ \NC \NC alignmentscope \NC -- \NC \NC\NR
+ \NC \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC columnalign \NC + \NC Specifies the horizontal alignment of the cells. Multiple values separated by space are allowed and apply to the corresponding columns (e.g. \type{columnalign="left right center"}). Possible values are: left, center (default) and right. \NC\NR
+ \NC \NC columnlines \NC -- \NC \NC\NR
+ \NC \NC columnspacing \NC + \NC Specifies the space between table columns. \NC\NR
+ \NC \NC columnwidth \NC -- \NC \NC\NR
+ \NC \NC displaystyle \NC -- \NC \NC\NR
+ \NC \NC equalcolumns \NC -- \NC \NC\NR
+ \NC \NC equalrows \NC -- \NC \NC\NR
+ \NC \NC frame \NC -- \NC \NC\NR
+ \NC \NC framespacing \NC -- \NC \NC\NR
+ \NC \NC groupalign \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC + \NC The background color. \NC\NR
+ \NC \NC mathcolor \NC + \NC The text color. \NC\NR
+ \NC \NC minlabelspacing \NC -- \NC \NC\NR
+ \NC \NC rowalign \NC -- \NC \NC\NR
+ \NC \NC rowlines \NC -- \NC \NC\NR
+ \NC \NC rowspacing \NC + \NC Specifies the space between table rows. \NC\NR
+ \NC \NC side \NC -- \NC \NC\NR
+ \NC \NC width \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mtr-mlabeledtr]
+ \startmathmlattributes
+ \NC mtr, labeledtr \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC columnalign \NC + \NC Overrides the horizontal alignment of cells specified by <mtable> for this row. \NC\NR
+ \NC \NC groupalign \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC + \NC The background color. \NC\NR
+ \NC \NC mathcolor \NC + \NC The text color. \NC\NR
+ \NC \NC rowalign \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mtd]
+ \startmathmlattributes
+ \NC mtd \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC columnalign \NC -- \NC \NC\NR
+ \NC \NC columnspan \NC -- \NC \NC\NR
+ \NC \NC frame \NC -- \NC Specifies whether the cell gets a frame. \NC\NR % AFO: wordt niet genoemd in Mozilla overview
+ \NC \NC groupalign \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC mathcolor \NC -- \NC \NC\NR
+ \NC \NC rowalign \NC -- \NC \NC\NR
+ \NC \NC rowspan \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[malignmark]
+ \startmathmlattributes
+ \NC malignmark \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC edge \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mglyph]
+ \startmathmlattributes
+ \NC mglyph \NC alt \NC + \NC This attribute defines the alternative text describing the image. \NC\NR
+ \NC \NC class, id, style \NC -- \NC \NC\NR
+ \NC \NC height \NC -- \NC \NC\NR
+ \NC \NC href \NC -- \NC \NC\NR
+ \NC \NC mathbackground \NC -- \NC \NC\NR
+ \NC \NC src \NC -- \NC \NC\NR
+ \NC \NC valign \NC -- \NC \NC\NR
+ \NC \NC width \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+\startbuffer[mstyle]
+ \startmathmlattributes
+ \NC mstyle \NC dir \NC -- \NC \NC\NR
+ \NC \NC decimalpoint \NC -- \NC \NC\NR
+ \NC \NC displaystyle \NC -- \NC \NC\NR
+ \NC \NC infixlinebreakstyle \NC -- \NC \NC\NR
+ \NC \NC scriptlevel \NC + \NC Controls mostly the font-size. The higher the scriptlevel, the smaller the font size. This attribute accepts a non-negative integer, as well as a \quote{+} or a \quote{--} sign, which increments or decrements the current value. \NC\NR
+ \NC \NC scriptminsize \NC -- \NC \NC\NR
+ \NC \NC scriptsizemultiplier \NC -- \NC \NC\NR
+ \stopmathmlattributes
+\stopbuffer
+
+% some helpers
+
+\startxmlsetups xml:mmlprime
+ \xmlsetsetup {\xmldocument} {document} {xml:mmlprime:document}
+ \xmlsetsetup {\xmldocument} {textref} {xml:mmlprime:textref}
+\stopxmlsetups
+
+\xmlregistersetup{xml:mmlprime}
+
+\startxmlsetups xml:mmlprime:document
+ \blank \start
+ \xmlflush{#1}
+ \stop \blank
+\stopxmlsetups
+
+\startxmlsetups xml:mmlprime:textref
+ \in {\xmlflush{#1}} [\xmlatt{#1}{label}]
+\stopxmlsetups
+
+% redefine to use lua and mkiv xml instead of slower mkii
+
+\startluacode
+ local gsub = string.gsub
+ local mapping = {
+ [";"] = "{{\\darkblue\\string;}}",
+ ["&"] = "{{\\ttsl\\darkblue\\string&}}", -- otherwise "et"
+ ["/"] = "{{\\darkblue\\string/}}",
+ ["<"] = "{{\\darkblue\\string<}}",
+ [">"] = "{{\\darkblue\\string>}}",
+ }
+ function document.filterxmltitlestuff(name)
+ local data = io.loaddata(name) or ""
+ data = gsub(data,"<math[^>]*>","<math>")
+ data = gsub(data,"[%s ]+"," ")
+ data = gsub(data,"(.)",mapping)
+ context(data)
+ end
+\stopluacode
+
+\starttexdefinition unexpanded showXMLfileA #1#2
+ \ignorespaces
+ \ctxlua{document.filterxmltitlestuff("#2.xml")}
+ \removeunwantedspaces
+ \space
+ \ignorespaces
+\stoptexdefinition
+
+\startluacode
+ function document.filenumber(str)
+ context(string.match(str,"([1-9][0-9]*)$"))
+ end
+\stopluacode
+
+\starttexdefinition unexpanded showXMLfileB #1#2
+ \bgroup
+ \setuplabeltext[formula=#1\space]
+ \setnumber[formula][\ctxlua{document.filenumber("#2")}]
+ \decrementnumber[formula]
+ \placeformula
+ \startformula
+ \processxmlfile{#2.xml}
+ \stopformula
+ \egroup
+ \typefile{#2.xml}
+ \page[bigpreference]
+\stoptexdefinition
+
+\startsetups showexamples
+
+ \setupformulas
+ [left=,
+ right=,
+ location=left,
+ numberstyle=FormulaFont,
+ numbercolor=darkblue]
+
+ \resetnumber[formula]
+
+ \let\showXMLfile\showXMLfileB
+
+\stopsetups
+
+\startsetups TitlePageBackground
+ \setbox\scratchbox=\vbox to \paperheight {
+ \hsize\paperwidth
+ \definedfont[NiceBold*default at 7pt]
+ \setupinterlinespace
+ \let\showXMLfile\showXMLfileA
+ \baselineskip=1\baselineskip plus 1pt
+ \getbuffer[derivates]
+ \getbuffer[integrals]
+ \getbuffer[series]
+ \getbuffer[logs]
+ \getbuffer[goniometrics]
+ \getbuffer[statistics]
+ \getbuffer[matrices]
+ }
+ \setbox\scratchbox=\vsplit\scratchbox to \paperheight
+ \vbox to \paperheight {
+ \unvbox\scratchbox
+ \vskip-.2ex
+ }
+\stopsetups
+
+\defineoverlay
+ [titlepage]
+ [\directsetup{TitlePageBackground}]
+
+\settaggedmetadata
+ [title={MathML},
+ author={Hans Hagen},
+ version={January 2001 / June 2008 / June 2011},
+ copyright={PRAGMA ADE, Hasselt, NL},
+ url={www.pragma-ade.com / www.pragma-ade.nl}]
+
+\starttext
+
+\setupbackgrounds
+ [page]
+ [background={foreground,titlepage}]
+
+\startelement[ignore]
+
+ \startstandardmakeup[footerstate=none,doublesided=no,page=]
+ \setupalign[left]
+ \definefont[BigFont][RegularBold at 108pt]
+ \definefont[MedFont][RegularBold at 48pt]
+ \vfill
+ \BigFont \darkred MathML \par
+ \vskip6pt
+ \MedFont \darkred HANS HAGEN \par
+ \stopstandardmakeup
+
+\stopelement
+
+\setupbackgrounds
+ [page]
+ [background=]
+
+\startelement[ignore]
+
+ \startstandardmakeup[footerstate=none,doublesided=no,page=]
+ \startpacked
+ Hans Hagen \par
+ Hassel NL \par
+ \goto{www.pragma-ade.com}[url(http://www.pragma-ade.com)] \par
+ January 2001 /
+ June 2008 /
+ June 2011 /
+ February 2015\par
+ \stoppacked
+ \vfill
+ % More changes and additions can be expected when there is a definitive
+ % version of the \MATHML~3 specification and more correct testsuite. One
+ % thing we need to look into is the nesting model dealing with ()
+ % discussed in the spec.
+ \blank
+ \start
+ \starttabulate
+ \NC \color[darkblue]{copyright} \EQ PRAGMA ADE, Hasselt, NL \NC \NR
+ \NC \color[darkblue]{version} \EQ \currentdate \NC \NR
+ \NC \color[darkblue]{renderer} \EQ \doifmodeelse{mkiv}{version 1 / mkiv}{\doifsetupselse{mmc:apply:start}{version 2}{version 3} / mkii} \NC \NR
+ \stoptabulate
+ \stop
+ \stopstandardmakeup
+
+\stopelement
+
+\startfrontmatter
+
+\starttitle[title={Table of Contents}]
+
+\startmixedcolumns[n=3,separator=rule,rulecolor=darkblue,rulethickness=1pt,blank={line,fixed},balance=no]
+ \placelist[chapter,section]
+\stopmixedcolumns
+
+\stoptitle
+
+\startchapter[title={introduction}]
+
+It is a well known fact that \TEX\ can do a pretty good job on typesetting math.
+This is one reason why many scientific articles, papers and books are typeset
+using \TEX. However, in these days of triumphing angle brackets, coding in \TEX\
+looks more and more out of place.
+
+From the point of view of an author, coding in \TEX\ is quite natural, given that
+some time is spent on reading the manuals. This is because not only the natural
+flow of the definition suits the way mathematicians think, but also because the
+author has quite some control over the way his thoughts end up on paper. It will
+be no surprise that switching to a more restricted way of coding, which also
+demands more keystrokes, is not beforehand considered to be better.
+
+There are however circumstances that one wants to share formulas (or
+formula||like specifications) between several applications, one of which is a
+typesetting engine. In that case, a bit more work now, later saves you some
+headaches due to keeping the different source documents in sync.
+
+The moment coding math in \XML\ is discussed, those in favour stress that coding
+can be eased by using appropriate editors. Here we encounter a dilemma. For
+optimal usage, one should code in terms of content, that is, the principles that
+are expressed in a formula. Editors are not that strong in this area, and if they
+would be, editing would be not that much different from traditionally editing
+formulas: just keying in ideas using code that at first sight looks obscure. A
+more graphical oriented editor can help authors to compose formulas, but the
+underlaying coding will mainly be in terms of placing glyphs and boxes, and as a
+result the code will hardly be usable in other applications.
+
+So either we code in terms of concepts, which permits sharing code among
+applications, and poses strong limitations on the influence of authors on the
+visual appearance. Or we use an interactive editor to fine tune the appearance of
+a formula and take for granted that reuse will be minimal or suboptimal.
+
+In the following chapters we will discuss the mathematical language \MATHML\ in
+the perspective of typography. As a typesetting vehicle, we have used \CONTEXT.
+However, the principles introduced here and the examples that we provide are
+independent of \CONTEXT. For a more formal exploration we recommend the \MATHML\
+specification.
+
+This document is dedicated to all those \CONTEXT\ users who like typesetting
+math. I'm sure that my father, who was a math teacher, would have liked
+proofreading this document. His absence was compensated by Tobias Burnus, Wang
+Lei, Ton Otten, and later members of the \CONTEXT\ mailing list who carefully
+read the text, corrected the errors in my math, tested the functionality, and
+made suggestions. Any remaining errors are mine.
+
+When we started supporting \MATHML\ we were under the impression that it would be
+accepted and take of fast, but we were wrong. It toke much more than a decade for
+instance to see browsers support rendering. Being involved in typesetting
+educational content from \XML\ files, we could use this subsystem ourselves, and
+this was useful in the sense that we ran into lots of contradicting and
+suboptimal \MATHML\ code. However, the most interesting application has always
+been in the math4all project, where we went from \TEX\ math, via content \MATHML\
+and open math to presentational \MATHML. Nowadays web usage drives the coding and
+limitations in other programs (and rendering) are sometimes compensated by coding
+and our renderer then has to be able to recover nicely. Thanks to the enormous
+productivity of the main math4all author Frits Spijkers and the careful checking
+by my collegue Ton Otten, we could always keep op well. Development and support
+of the \CONTEXT\ typesetting system is mostly done without any commercial
+benefits and the amount of free time that we spend on it and especially its more
+obscure properties like \MATHML\ is compensated by flexible and tolerant users
+like them.
+
+One problem is that our own usage of \MATHML\ changes over time. Some of our
+projects demand the use of this standard but at the same time the used sources
+need to satisfy other needs, for instance rendering on the web. For some 15 years
+now the changing demands and quality have made us oscillate between (often
+suboptimal) solutions that deal with the suboptimal code that comes from
+compromises. For instance the mentioned project is now using a mixture of
+\MATHML\ and so called \ASCII math because that is the only way the enormous
+amount of math code can be rendered on the web. And even there we need to bend
+the rules, for instance to compensate for missing features or cultural
+differences. Eventually I will rewrite the rendering from scratch but I need time
+and a very good reason for that.
+
+This version of the manual is produced by \CONTEXT\ \MKIV\ and is also used as
+testcase. The version rendered at \PRAGMA\ uses the Lucida Bright fonts. These
+can be bought at \goto {www.tug.org} [url(http://{www.tug.org})] for a reasonable
+low price and are really worth the money.
+
+\startlines
+Hans Hagen
+PRAGMA ADE
+Hasselt NL
+2001 \emdash\ \currentdate[year]
+\stoplines
+
+\stopchapter
+
+\stopfrontmatter
+
+\startbodymatter
+
+\startchapter[title={What is \MATHML}]
+
+\startsection[title={backgrounds}]
+
+\MATHML\ showed up in the evolving vacuum between structural \SGML\ markup and
+presentational \HTML. Both \SGML\ and \HTML\ can be recognized by angle brackets.
+The disadvantage of \SGML\ was that it was so open ended, that general tools
+could hardly be developed. \HTML\ on the other hand was easy to use and became
+extremely popular and users as well as software vendors quickly spoiled the
+original ideas and created a mess. \SGML\ never became really popular, but thanks
+to \HTML\ people became accustomed to that kind of notation. So, when \XML\ came
+around as a more restricted cousin of \SGML, the world was kind of ready for it.
+It cannot be denied that by some clever marketing many of today's users think
+that they use something new and modern, while we are actually dealing with
+something from the early days of computing. A main benefit of \XML\ is that it
+brought the ideas behind \SGML\ (and medium neutral coding in general) to the
+users and at the same time made a major cleanup of \HTML\ possible.
+
+About the same time, \MATHML\ was defined, both to bring math to the \WWW, and to
+provide a way of coding math that will stimulate sharing the same code between
+different applications. At the end of 2000, the \MATHML\ version~2 draft became a
+recommendation. In the process of rewriting the interpreter for \CONTEXT\ \MKIV\
+mid 2008 a draft of \MATHML\ version~3 has been used.
+
+Now, imagine that we want to present a document on the internet using a format
+like \HTML, either for viewing or for being spoken. Converting text and graphics
+is, given proper source coding, seldom a problem, but converting formulas into
+some angle bracket representation is more tricky. A way out of this is \MATHML's
+presentational markup.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mi> a </mi>
+ <mo> + </mo>
+ <mi> b </mi>
+ <mo> = </mo>
+ <mi> c </mi>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer
+
+This simple formula, when coded in \TEX, looks like:
+
+\starttyping
+$$ a + b = c $$
+\stoptyping
+
+In presentational \MATHML\ we get:
+
+\typebuffer
+
+In presentational \MATHML, we use mostly begintags (\type {<mi>}) and end tags
+(\type {</mi>}). The \mmlelement {mrow} element is the basic building block of a
+formula. The \mmlelement {mi} element specifies a math identifier and \mmlelement
+{mo} is used for operators. In the process of typesetting, both are subjected to
+interpretation in order to get the best visualization.
+
+Converting \TEX\ code directly or indirectly, using printable output or even
+in||memory produced math lists, has been one of the driving forces behind
+presentational \MATHML\ and other math related \DTD's like \EUROMATH. One may
+wonder if there are sound and valid reasons for going the opposite way. You can
+imagine that a converter from \TEX\ to \MATHML\ produces \mmlelement {menclose},
+\mmlelement {mspace}, \mmlelement {mstyle} and other elements that can have many
+spacing related attributes, but I wonder if any author is willing to think in
+those quantities. Visual editors of course are good candidates for producing
+presentational \MATHML.
+
+But wouldn't it be more efficient if we could express ideas and concepts in such
+a way that they could be handled by a broad range of applications, including a
+typesetting engine? This is why, in addition to presentational \MATHML, there is
+also content \MATHML. The previous formula, when coded in such a way, looks like:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <plus/>
+ <ci> a </ci>
+ <ci> b </ci>
+ </apply>
+ <ci> c </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\typebuffer
+
+This way of defining a formula resembles the so called polish (or stackwise)
+notation. Opposite to presentational markup, here a typesetting engine has to
+find out in what order and what way the content has to be presented. This may
+seem a disadvantage, but in practice implementing content markup is not that
+complicated. The big advantage is that, once we know how to typeset a concept,
+\TEX\ can do a good job, while in presentational markup much hard coded spacing
+can spoil everything. One can of course ignore specific elements, but it is more
+safe to start from less and enhance, than to leave away something with unknown
+quantities.
+
+Instead of using hard coded operators as in presentational \MATHML, content
+markup uses empty elements like \type {<plus/>}. Many operators and functions are
+predefined but one can also define his own; in \MATHML~3 this is further extended
+by adopting \OPENMATH\ as variant.
+
+Of course the main question to be answered now is to what extent the author can
+influence the appearance of a formula defined in content markup. Content markup
+has the advantage that the results can be more consistent, but taking away all
+control is counterproductive. The \MATHML\ level~2 draft mentions that this level
+covers most of the pre university math. If so, that is a proper starting point,
+but especially educational math often has to be typeset in such ways that it
+serves its purpose. Also, (re|)|using the formulas in other applications
+(simulators and alike) is useful in an educational setting, so content markup is
+quite suitable.
+
+How do we combine the advantages of content markup with the wish of an author to
+control the visual output and at the same time get an as high as possible typeset
+result. There are several ways to accomplish this. One is to include in the
+document source both the content markup and the \TEX\ specific code.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <semantics>
+ <apply> <eq/>
+ <apply> <plus/>
+ <ci> a </ci>
+ <ci> b </ci>
+ </apply>
+ </apply>
+ <ci> c </ci>
+ <annotation encoding="TeX">a+b=c</annotation>
+ </semantics>
+</math>
+\stopbuffer
+
+\typebuffer
+
+The \mmlelement {annotation} element is one of the few that is permitted inside
+the \mmlelement {math} element. In this example, we embed pure \TEX\ code, which,
+when enabled is typeset in math mode. It will be clear that for a simple formula
+like this one, such redundant coding is not needed, but one can imagine more
+complicated formulas. Because we want to limit the amount of work, we prefer just
+content markup. \blank {\it Remark: Some characters, fillers or whatever may not
+show up. This is due to the fact that the relevant tables for \CONTEXT\ \MKIV\
+are defined stepwise. In due time most relevant symbols will be accessible.}
+
+\stopsection
+
+\startsection[title={two methods}]
+
+The best way to learn \MATHML\ is to key in formulas, so that is what we did as
+soon as we started adding \MATHML\ support to \CONTEXT. In some areas, \MATHML\
+provides much detail (many functions are represented by elements) while in other
+areas one has to fall back on the more generic function element or a full
+description. Compare the following definitions:
+
+\startbuffer[a]
+<document>
+ <math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <sin/> <ci> x </ci> </apply>
+ </math>
+ <math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow> <mi> sin </mi> <mi> x </mi> </mrow>
+ </math>
+</document>
+\stopbuffer
+
+\typebuffer[a]
+
+We prefer the first definition because it is more structured and gives more
+control over the result. There is only one \quote {unknown} quantity, $x$, and
+from the encapsulating element \mmlelement {ci} we know that it is an identifier.
+
+\processxmlbuffer[a]
+
+In the content example, from the \mmlelement {apply} \mmlelement {sin} we can
+deduce that the following argument is an operand, either an \mmlelement {apply},
+or a \mmlelement {ci} or \mmlelement {cn}. In the presentational alternative, the
+following elements can be braces, a math identifier, a row, a sequence of
+identifiers and operators, etc. There, the look and feel is hard coded.
+
+\startbuffer[b]
+<?context-mathml-directive function reduction no ?>
+\stopbuffer
+
+\typebuffer[b]
+
+This directive, either issued in the \XML\ file, or set in the style file,
+changes the appearance of the function, but only in content markup. It is because
+of this feature, that we favour content markup.
+
+\processxmlbuffer[b,a]
+
+Does this mean that we can cover everything with content markup? The answer to
+this is still unclear. Consider the following definition.
+
+\processxmlfile {pc-i-380.xml}
+
+Here we combine several cases in one formula by using $\pm$ and $\mp$ symbols.
+Because we only have \mmlelement {plus} and \mmlelement {minus} elements, we have
+to revert to the generic function element \mmlelement {fn}. We show the complete
+definition of this formula.
+
+\typefile {pc-i-380.xml}
+
+The \MATHML\ parser and typesetting engine have to know how to handle these
+special cases, because the visualization depends on the function (or operator).
+Here both composed signs are treated like the plus and minus signs, but in other
+cases an embraced argument may be needed.
+
+\stopsection
+
+\stopchapter
+
+\startchapter[title={Presentational markup}]
+
+\startsection[title=Introduction]
+
+If a document contains presentational \MATHML, there is a good chance that the
+code is output by an editor. Here we will discuss the presentation elements that
+make sense for users when they want to manually code presentational \MATHML. In
+this chapter we show the default rendering, later we will discuss options.
+
+Although much is permitted, we advise to keep the code as simple as possible,
+because then \TEX\ can do a rather good job on interpreting and typesetting it.
+Just let \TEX\ take care of the spacing.
+
+\stopsection
+
+\startsection[title={mi, mn, mo}]
+
+Presentational markup comes down to pasting boxes together in math specific ways.
+The basic building blocks are these three character elements.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mi> x </mi> <mo> = </mo> <mn> 5 </mn>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\starttabulate[||||]
+\HL
+\NC \mmlelement {mi} \NC identifier \NC normally typeset in an italic font \NC \NR
+\NC \mmlelement {mn} \NC number \NC normally typeset in a normal font \NC \NR
+\NC \mmlelement {mo} \NC operator \NC surrounded by specific spacing \NC \NR
+\HL
+\stoptabulate
+
+Because numbers are taken from an upright font, special numbers are taken care of
+automatically. Here are some from the \MATHML\ specification:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mn> 2 </mn> <mtext>&nbsp;&nbsp;</mtext>
+ <mn> 0.123 </mn> <mtext>&nbsp;&nbsp;</mtext>
+ <mn> 0,000,000 </mn> <mtext>&nbsp;&nbsp;</mtext>
+ <mn> 2.1e10 </mn> <mtext>&nbsp;&nbsp;</mtext>
+ <mn> 0xFFeF </mn> <mtext>&nbsp;&nbsp;</mtext>
+ <mn> MCMLXIX </mn> <mtext>&nbsp;&nbsp;</mtext>
+ <mn> twenty one </mn> <mtext>&nbsp;&nbsp;</mtext>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+Special characters can be accessed by their \UNICODE\ point or by a corresponding
+entity. For some reason there is quite some duplication in entities, but we don't
+bother too much about it because after all \UNICODE\ math (which has its own
+peculiarities) is the way to go. The specification has this somewhat strange
+formula definition:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mn> 2 </mn>
+ <mo> + </mo>
+ <mrow>
+ <mn> 3</mn>
+ <mo> &InvisibleTimes; </mo>
+ <mi> &ImaginaryI; </mi>
+ </mrow>
+ </mrow>
+ <mfrac>
+ <mn> 1 </mn>
+ <mn> 2 </mn>
+ </mfrac>
+ <mi> &pi; </mi>
+ <mi> &ExponentialE; </mi>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+And:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfrac>
+ <mo> &DifferentialD; </mo>
+ <mrow>
+ <mo> &DifferentialD; </mo>
+ <mi> x </mi>
+ </mrow>
+ </mfrac>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+Visualizing the \mmlelement {mo} element involved some heuristics. For instance
+the size of fences depends on what they fence. In the following case you see how
+we can influence this. For practical pusposes we only support size~1.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mo> ( </mo> <mi> x </mi> <mo> ) </mo>
+ </mrow>
+ <mtext> or </mtext>
+ <mrow>
+ <mo maxsize="1"> ( </mo> <mi> x </mi> <mo> ) </mo>
+ </mrow>
+ <mtext> or </mtext>
+ <mrow>
+ <mo maxsize="1" > ( </mo>
+ <mfrac> <mn> 1 </mn> <mn> 2 </mn> </mfrac>
+ <mo stretchy="false"> ) </mo>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[mi-mn]
+
+\getbuffer[mo]
+
+\stopsection
+
+\startsection[title={mrow}]
+
+The previous example demonstrated the use of \mmlelement {mrow}, the element that
+is used to communicate the larger building blocks. Although this element from the
+perspective of typesetting is not always needed, by using it, the structure of
+the formula in the document source is more clear. There is some messy magic going
+on when we try to fake fenced expressions.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow> <mi> x </mi> <mo> &geq; </mo> <mn> 2 </mn> </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mi> y </mi> <mo> &gt; </mo> <mn> 4 </mn>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mo> &lt; </mo> <mi> x </mi> <mo> &gt; </mo>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mi> a </mi> <mo> &lt; </mo> <mi> b </mi> <mo> &lt; </mo> <mi> c </mi>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+Spacing between a sign and the following token is taken care of automatically by
+\TEX:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mo> - </mo>
+ <mn> 1 </mn>
+ <mo> - </mo>
+ <mn> 1 </mn>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[mrow]
+
+\stopsection
+
+\startsection[title={msup, msub, msubsup}]
+
+Where in content markup super and subscript are absent and derived from the
+context, in presentational markup they are quite present.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <msup>
+ <msub> <mi> x </mi> <mn> 1 </mn> </msub>
+ <mn> 2 </mn>
+ </msup>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <msubsup>
+ <mi> x </mi>
+ <mn> 1 </mn>
+ <mn> 2 </mn>
+ </msubsup>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+Watch the difference between both definitions and appearances. You can influence
+the default behaviour with processing instructions.
+
+\getbuffer[msub]
+
+\getbuffer[msup]
+
+\getbuffer[msubsup]
+
+\stopsection
+
+\startsection[title={mfrac}]
+
+Addition, subtraction and multiplication is hard coded using the \mmlelement {mo}
+element with $+$, $-$, and $\times$ (or nothing). You can use $/$ for division,
+but for more complicated formulas you have to fall back on fraction building.
+This is why \MATHML\ provides the \mmlelement {mfrac}.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfrac>
+ <mrow> <mi> x </mi> <mo> + </mo> <mn> 1 </mn> </mrow>
+ <mrow> <mi> y </mi> <mo> + </mo> <mn> 1 </mn> </mrow>
+ </mfrac>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+You can change the width of the rule, but this is generally a bad idea. For
+special purposes you can set the line thickness to zero.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfrac linethickness="0">
+ <mrow> <mi> x </mi> <mo> &geq; </mo> <mn> 2 </mn> </mrow>
+ <mrow> <mi> y </mi> <mo> &leq; </mo> <mn> 4 </mn> </mrow>
+ </mfrac>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+A different kind of rendering is also possible, as shown in the following
+example.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfrac bevelled="true">
+ <mfrac>
+ <mi> x </mi> <mn> 2 </mn>
+ <mi> y </mi> <mn> 4 </mn>
+ </mfrac>
+ <mfrac>
+ <mi> x </mi> <mn> 2 </mn>
+ <mi> y </mi> <mn> 4 </mn>
+ </mfrac>
+ </mfrac>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[mfrac]
+
+\stopsection
+
+\startsection[title={mfenced}]
+
+Braces are used to visually group sub||expressions. In presentational \MATHML\
+you can either hard code braces, or use the \mmlelement {mfenced} element to
+generate delimiters automatically. In \CONTEXT, as much as possible, the
+operators and identifiers are interpreted, and when recognized treated according
+to their nature.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfenced> <mi> a </mi> <mi> b </mi> <mn> 1 </mn> </mfenced>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The fencing symbols adapt their size to the content. Their dimensions also depend
+on the way math fonts are defined. The standard \TEX\ fonts will give the same
+height of braces around $x$ and $y$, but in other fonts the $y$ may invoke
+slightly larger ones.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfenced open="[" close=")" separators=",">
+ <mn> 0 </mn> <mn> 1 </mn>
+ </mfenced>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The separators adapt their size to the fenced content too, just like the fences.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfenced open="[" close="]" separators="|">
+ <mfrac> <mn> 1 </mn> <mi> x </mi> </mfrac>
+ <mfrac> <mn> 1 </mn> <mi> y </mi> </mfrac>
+ <mfrac> <mn> 1 </mn> <mi> z </mi> </mfrac>
+ </mfenced>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfenced>
+ <mrow> <mn> 1 </mn> <mo> + </mo> <mi> x </mi> </mrow>
+ </mfenced>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfenced open="{" close="" separators="|+-">
+ <mn> 1 </mn> <mn> 2 </mn> <mn> 3 </mn> <mn> 4 </mn>
+ </mfenced>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfenced open="a" close="e" separators="bcd">
+ <mn> 1 </mn> <mn> 2 </mn> <mn> 3 </mn> <mn> 4 </mn>
+ </mfenced>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[mfenced]
+
+\stopsection
+
+\startsection[title={msqrt, mroot}]
+
+The shape and size of roots, integrals, sums and products can depend on the size
+of the content.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <msqrt>
+ <mi> b </mi>
+ </msqrt>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mroot>
+ <mi> b </mi>
+ <mn> 2 </mn>
+ </mroot>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mroot>
+ <mfrac> <mn> 1 </mn> <mi> b </mi> </mfrac>
+ <mn> 2 </mn>
+ </mroot>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mroot>
+ <mfrac>
+ <mn> 1 </mn>
+ <mrow> <mi> a </mi> <mo> + </mo> <mi> b </mi> </mrow>
+ </mfrac>
+ <mn> 3 </mn>
+ </mroot>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[msqrt-mroot]
+
+\stopsection
+
+\startsection[title={mtext}]
+
+If you put text in a \mmlelement {mi} element, it will come out rather ugly. This
+is due to the fact that identifiers are (at least in \TEX) not subjected to the
+kerning that is normally used in text. Therefore, when you want to add some text
+to a formula, you should use the \mmlelement {mtext} element.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfrac>
+ <mi> Some Text </mi>
+ <mtext> Some Text </mtext>
+ </mfrac>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+As with all elements, leading and trailing spaces are ignored. If you really want
+a space in front or at the end, you should use one of the space tokens other than
+the ascii spacing tokens. You can also use entities like \type {&nbsp;}.
+
+\getbuffer[mtext]
+
+\stopsection
+
+\startsection[title={mover, munder, munderover}]
+
+Not all formulas are math and spacing and font rules may differ per discipline.
+The following formula reflects a chemical reaction.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mrow>
+ <mn> 2 </mn>
+ <msub> <mtext> H </mtext> <mn> 2 </mn> </msub>
+ </mrow>
+ <mo> + </mo>
+ <msub> <mtext> O </mtext> <mn> 2 </mn> </msub>
+ <munder>
+ <mo> &RightArrow; </mo>
+ <mtext> explosion </mtext>
+ </munder>
+ <mrow>
+ <mn> 2 </mn>
+ <msub> <mtext> H </mtext> <mn> 2 </mn> </msub>
+ <mtext> O </mtext>
+ </mrow>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The \mmlelement {munder}, \mmlelement {mover} and \mmlelement {munderover}
+elements can be used to put symbols and text or formulas on top of each other.
+When applicable, the symbols will stretch themselves to span the natural size of
+the text or formula.
+
+The following examples demonstrate how the relevant components of this threesome
+are defined.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mi> x </mi>
+ <munder>
+ <mo> &RightArrow; </mo>
+ <mtext> maps to </mtext>
+ </munder>
+ <mi> y </mi>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mi> x </mi>
+ <munder>
+ <mtext> maps to </mtext>
+ <mo> &RightArrow; </mo>
+ </munder>
+ <mi> y </mi>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mi> x </mi>
+ <mover>
+ <mtext> maps to </mtext>
+ <mo> &RightArrow; </mo>
+ </mover>
+ <mi> y </mi>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mi> x </mi>
+ <mover>
+ <mo> &RightArrow; </mo>
+ <mtext> maps to </mtext>
+ </mover>
+ <mi> y </mi>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <munderover>
+ <mi> &int; </mi>
+ <mn> 1 </mn>
+ <mi> &infin; </mi>
+ </munderover>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mover> <mi> x </mi> <mo> &#x2C6; </mo> </mover> <mo>+</mo>
+ <mover> <mi> x </mi> <mo> &#x5E; </mo> </mover> <mo>+</mo>
+ <mover> <mi> x </mi> <mo> &Hat; </mo> </mover>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[munder]
+
+\getbuffer[mover]
+
+\getbuffer[munderover]
+
+\stopsection
+
+\startsection[title={ms}]
+
+This is a bit weird element. It behaves like \mmlelement {mtext} but puts quotes
+around the text.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfrac>
+ <ms> Some Text </ms>
+ <mtext> Some Text </mtext>
+ </mfrac>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+You can specify the left and right boundary characters, either directly or
+(preferably) using entities like \type {&quot;}.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <ms lquote="+" rquote="+"> A Famous Quotation </ms>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[ms]
+
+\stopsection
+
+\startsection[title={menclose}]
+
+This element is implemented but it is such a weird element that it's probably
+seldom used.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <menclose notation="longdiv"><mn>123</mn></menclose>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <menclose notation="actuarial"><mn>123</mn></menclose>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <menclose notation="radical"><mn>123</mn></menclose>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+A bit more complex example (taken from the specification) demonstrates where
+those somewhat strange rendering options are good for:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mtable columnspacing="0pt" rowspacing="0pt">
+ <mtr>
+ <mtd></mtd>
+ <mtd columnalign="right"><mn>10</mn></mtd>
+ </mtr>
+ <mtr>
+ <mtd columnalign="right"><mn>131</mn></mtd>
+ <mtd columnalign="right">
+ <menclose notation="longdiv"><mn>1413</mn></menclose>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd></mtd>
+ <mtd columnalign="right">
+ <mrow>
+ <munder>
+ <mn>131</mn>
+ <mo>&UnderBar;</mo>
+ </munder>
+ <mphantom><mn>3</mn></mphantom>
+ </mrow>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd></mtd>
+ <mtd columnalign="right"><mn>103</mn></mtd>
+ </mtr>
+ </mtable>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+In \MATHML~3 a few more notations showed up and to some extend we support them.
+We assume that the previously mentioned variants are always applied to the
+content first.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <menclose notation="box downdiagonalstrike">
+ <mtext>whatever</mtext>
+ </menclose>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <menclose notation="roundedbox updiagonalstrike">
+ <mtext>whatever</mtext>
+ </menclose>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <menclose notation="circle verticalstrike horizontalstrike">
+ <mtext>whatever</mtext>
+ </menclose>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <menclose notation="left top verticalstrike">
+ <mtext>whatever</mtext>
+ </menclose>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <menclose notation="right bottom horizontalstrike">
+ <mtext>whatever</mtext>
+ </menclose>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <menclose notation="radical right bottom horizontalstrike">
+ <mtext>whatever</mtext>
+ </menclose>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <menclose notation="right bottom horizontalstrike radical">
+ <mtext>whatever</mtext>
+ </menclose>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The graphics are drawn at runtime by \METAPOST. Currently we don't combine them
+into one which would be more efficient in terms of output (not so much in
+runtime). You can define additional variants; as an example we show one of the
+solutions:
+
+\startbuffer
+\startuseMPgraphic{mml:enclose:box}
+ draw OverlayBox
+ withpen pencircle scaled (ExHeight/10) ;
+\stopuseMPgraphic
+
+\defineoverlay [mml:enclose:box] [\useMPgraphic{mml:enclose:box}]
+\stopbuffer
+
+\getbuffer \typebuffer
+
+You can roll out your own:
+
+\startbuffer
+\startuseMPgraphic{mml:enclose:mybox}
+ draw OverlayBox enlarged (ExHeight/5)
+ withpen pencircle scaled (ExHeight/10) ;
+\stopuseMPgraphic
+
+\defineoverlay [mml:enclose:mybox] [\useMPgraphic{mml:enclose:mybox}]
+\stopbuffer
+
+\getbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <menclose notation="mybox">
+ <mtext>whatever</mtext>
+ </menclose>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[menclose]
+
+\stopsection
+
+\startsection[title={merror}]
+
+There is not much chance that this element will end up in a math textbook, unless
+the typeset output of programs is part of the story.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <merror>
+ <mtext> Are you kidding? &ThickSpace; </mtext>
+ <mfrac>
+ <mrow> <mn> 1 </mn> <mo> + </mo> <mi> x </mi> </mrow>
+ <mn> 0 </mn>
+ </mfrac>
+ </merror>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[merror]
+
+\stopsection
+
+\startsection[title={mmultiscripts, mprescripts}]
+
+This element is one of the less obvious ones. The next two examples are taken
+from the specification. The \mmlelement {multiscripts} element takes an odd
+number of arguments. The second and successive child elements alternate between
+sub- and superscript. The empty element \mmlelement {none} |<|a dedicated element
+\mmlelement {mnone} would have been a better choice|>| serves as a placeholder.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mmultiscripts>
+ <mi> R </mi>
+ <mi> i </mi>
+ <none/>
+ <none/>
+ <mi> j </mi>
+ <mi> k </mi>
+ <none/>
+ <mi> l </mi>
+ <none/>
+ </mmultiscripts>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The \mmlelement {mmultiscripts} element can also be used to attach prescripts to
+a symbol. The next example demonstrates this. The empty \mmlelement {prescripts}
+element signals the start of the prescripts section.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mmultiscripts>
+ <mi> Qb </mi>
+ <mn> 4 </mn>
+ <none/>
+ <mprescripts/>
+ <mn> 427 </mn>
+ <none/>
+ </mmultiscripts>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[mmultiscripts]
+
+\stopsection
+
+\startsection[title={mspace}]
+
+Currently not all functionality of the \mmlelement {mspace} element is
+implemented. Over time we will see what support is needed and makes sense,
+especially since this command can spoil things. We only support the units that
+make sense, so units in terms of pixels |<|a rather persistent oversight in
+drafts|>| are kindly ignored.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <?context-mathml-directive mspace option test ?>
+ <mrow>
+ <mtext> use </mtext> <mspace width="1em" />
+ <mtext> me </mtext> <mspace width="1ex" />
+ <mtext> with </mtext> <mspace width="10pt"/>
+ <mtext> care </mtext>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+As you can see here, spaces inside a \type {mtext} matter too! The next example
+is more tight.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <?context-mathml-directive mspace option test ?>
+ <mrow>
+ <mtext>use</mtext> <mspace width="1em" />
+ <mtext>me</mtext> <mspace width="1ex" />
+ <mtext>with</mtext> <mspace width="10pt"/>
+ <mtext>care</mtext>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+You can also pass a sample text:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mfrac>
+ <mi> 44 </mi>
+ <mfrac>
+ <mrow>
+ <mn> 11 </mn> <mn> 22 </mn> <mn> 33 </mn>
+ </mrow>
+ <mrow>
+ <mn> 11 </mn> <mspace spacing="22"/> <mn> 33 </mn>
+ </mrow>
+ </mfrac>
+ </mfrac>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[mspace]
+
+\stopsection
+
+\startsection[title={mphantom}]
+
+A phantom element hides its content but still takes its space. A phantom element
+can contain other elements.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mtext> who is afraid of </mtext> <mspace width=".5em" />
+ <mphantom> phantom </mphantom> <mspace width=".5em" />
+ <mtext> elements </mtext>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[mphantom]
+
+\stopsection
+
+\startsection[title={mpadded}]
+
+As with a few other elements, we first have to see some practical usage for this,
+before we could implement the functionality needed.
+
+\getbuffer[mpadded]
+
+\stopsection
+
+\startsection[title={mtable, mtr, mtd, mlabeledtr}]
+
+As soon as you want to represent a matrix or other more complicated composed
+constructs, you end up with spacing problems. This is when tables come into view.
+Because presentational elements have no deep knowledge about their content,
+tables made with presentational \MATHML\ will in most cases look worse than those
+that result from content markup.
+
+We have implemented tables on top of the normal \XML\ (\HTML) based table support
+in \CONTEXT, also known as natural tables. Depending on the needs, support for
+the \mmlelement {mtable} element will be extended.
+
+The \mmlelement {mtable} element takes a lot of attributes. When no attributes
+are given, we assume that a matrix is wanted, and typeset the content
+accordingly.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mo> ( </mo>
+ <mtable>
+ <mtr>
+ <mtd> <msub> <mi> x </mi> <mn> 1,1 </mn> </msub> </mtd>
+ <mtd> <mn> 1 </mn> </mtd>
+ <mtd> <mn> 0 </mn> </mtd>
+ </mtr>
+ <mtr>
+ <mtd> <mn> 0 </mn> </mtd>
+ <mtd> <msub> <mi> x </mi> <mn> 2,2 </mn> </msub> </mtd>
+ <mtd> <mn> 1 </mn> </mtd>
+ </mtr>
+ <mtr>
+ <mtd> <mn> 0 </mn> </mtd>
+ <mtd> <mn> 1 </mn> </mtd>
+ <mtd> <msub> <mi> x </mi> <mn> 3,3 </mn> </msub> </mtd>
+ </mtr>
+ </mtable>
+ <mo> ) </mo>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mtable columnalign="left center right">
+ <mtr>
+ <mtd frame="solid"> <mn> 100 </mn> </mtd>
+ <mtd > <mn> 100 </mn> </mtd>
+ <mtd > <mn> 100 </mn> </mtd>
+ </mtr>
+ <mtr>
+ <mtd > <mn> 10 </mn> </mtd>
+ <mtd frame="solid"> <mn> 10 </mn> </mtd>
+ <mtd > <mn> 10 </mn> </mtd>
+ </mtr>
+ <mtr>
+ <mtd > <mn> 1 </mn> </mtd>
+ <mtd > <mn> 1 </mn> </mtd>
+ <mtd frame="solid"> <mn> 1 </mn> </mtd>
+ </mtr>
+ </mtable>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+A special case is the labeled row \mmlelement {mlabeledtr}. This one is meant for
+numbering equations. However, in a properly formatted document there is probably
+some encapsulating structure that takes care of this. Therefore we discard the
+first child element. We show an example taken from the specification.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mtable>
+ <mlabeledtr>
+ <mtd>crap</mtd>
+ <mtd>
+ <mrow>
+ <mi>E</mi>
+ <mo>=</mo>
+ <mrow>
+ <mi>m</mi>
+ <mi>&it;</mi>
+ <msup>
+ <mi>c</mi>
+ <mn>2</mn>
+ </msup>
+ </mrow>
+ </mrow>
+ </mtd>
+ </mlabeledtr>
+ </mtable>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+Although the underlying table mechanism can provide all the support needed (and
+even more), not all attributes are yet implemented. We will make a useful
+selection.
+
+\starttabulate[|l|l|]
+\HL
+\NC columnalign \NC keyword: left center (middle) right \NC \NR
+\NC columnspacing \NC a meaningful dimension \NC \NR
+\NC rowspacing \NC a meaningful dimension \NC \NR
+\NC frame \NC keyword: none (off) solid (on) \NC \NR
+\NC color \NC a named color identifier \NC \NR
+\NC background \NC a named color identifier \NC \NR
+\HL
+\stoptabulate
+
+We only support properly named colors as back- and foreground colors. The normal
+\CONTEXT\ color mapping mechanism can be used to remap colors. This permits
+(read: forces) a consistent usage of colors. If you use named backgrounds
+\unknown\ the sky is the limit.
+
+\getbuffer[mtable]
+
+\getbuffer[mtd]
+
+\getbuffer[mtr-mlabeledtr]
+
+\stopsection
+
+\startsection[title={mcolumn}]
+
+This element is new in \MATHML~3 and is kind of special in the sense that the
+content is analyzed. It would have made more sense just to provide some proper
+structure instead since it's intended use is rather well defined.
+
+Because it is not much fun to implement such a messy element we only support it
+partially and add what comes on our way. Here are a few examples (more or less
+taken from the reference).
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mcolumn>
+ <mn>12</mn>
+ <mrow> <mo>&times;</mo> <mn>12</mn> </mrow>
+ <mline spacing="000"/>
+ <mn>24</mn>
+ <mrow> <mn>12</mn> <mspace spacing="0"/> </mrow>
+ <mline spacing="000"/>
+ <mn>144</mn>
+ </mcolumn>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mcolumn>
+ <mn>123</mn>
+ <mrow> <mn>456</mn> <mo>+</mo> </mrow>
+ <mline spacing="000+"/>
+ <mn>579</mn>
+ </mcolumn>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mcolumn>
+ <mn>1,23</mn>
+ <mrow> <mn>4,56</mn> <mo>+</mo> </mrow>
+ <mline spacing="0,00+"/>
+ <mn>5,79</mn>
+ </mcolumn>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mcolumn>
+ <mstyle mathsize="71%">
+ <menclose notation="bottom"> <mn>10</mn> </menclose>
+ </mstyle>
+ <mn>52</mn>
+ <mrow> <mo>&minus;</mo> <mn>7</mn> </mrow>
+ <mline spacing="45"/>
+ <mn>45</mn>
+ </mcolumn>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+Similar effects can be accomplished with the \mmlelement {mtable}
+element.
+
+\stopsection
+
+\startsection[title={malignmark, maligngroup}]
+
+This element is used in tables and is not yet implemented, first because I still
+have to unravel its exact usage, but second, because it is about the ugliest
+piece of \MATHML\ markup you will encounter.
+
+% AFO: http://www.w3.org/TR/2007/WD-MathML3-20071005/chapter3.html#presm.malign
+
+\getbuffer[malignmark]
+
+\stopsection
+
+\startsection[title={mglyph}]
+
+This element is for those who want to violate the ideas of general markup by
+popping in his or her own glyphs. Of course one should use entities, even if they
+have to be defined.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <mrow>
+ <mi> <mglyph fontfamily="Serif" index="65" alt="The Letter A"/></mi>
+ <mo> + </mo>
+ <mi> <mglyph fontfamily="Serif" index="66" alt="The Letter B"/></mi>
+ <mo> = </mo>
+ <mi> <mglyph fontfamily="Serif" index="67" alt="The Letter C"/></mi>
+ </mrow>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\getbuffer[mglyph]
+
+\stopsection
+
+\startsection[title={mstyle}]
+
+This element is implemented but not yet discussed since we want more control over
+its misuse.
+
+\getbuffer[mstyle]
+
+\stopsection
+
+\startsection[title={afterword}]
+
+You may have noticed that we prefer content \MATHML\ over presentational \MATHML.
+So, unless you're already tired of any math coded in angle brackets, we invite
+you to read the next chapter too.
+
+\stopsection
+
+\stopchapter
+
+\startchapter[title={Content markup}]
+
+\startsection[title={introduction}]
+
+In this chapter we will discuss the \MATHML\ elements from the point of view of
+typesetting. We will not pay attention to other rendering techniques, like speech
+generation. Some elements take attributes and those often make more sense for
+other applications than for a typesetting engine like \TEX, which has a strong
+math engine that knows how to handle math.
+
+One of the most prominent changes in \MATHML~3 is support for an \OPENMATH\ like
+coding. Here the \mmlelement {csymbol} takes the place of the empty element as
+first argument of an \mmlelement {apply}. There are more symbols in \OPENMATH\
+then we supported in the interpreter, but in due time (depending on demand) we
+will add more. At the time of writing this the draft was really a draft which
+made it hard to grasp all the implications for rendering so we probably need to
+overhaul the code sometime in the future.
+
+Another change is the usage of \mmlelement {apply} that has been delegated to
+\mmlelement {bind}. One may wonder why this hadn't happen before. For the moment
+we treat the \mmlelement {bind} as if it were an \mmlelement {apply}.
+
+\stopsection
+
+\startsection[title={apply}]
+
+If you are dealing with rather ordinary math, you will only need a subset of
+content \MATHML. For this reason we will start with the most common elements.
+When you key in \XML\ directly, you will encounter the \mmlelement {apply}
+element quite often, even in a relatively short formula like the following.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <minus/>
+ <cn> 1 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+In most cases the \mmlelement {apply} element is followed by a specification
+disguised as an empty element.
+
+Later we will see more complex examples but here we already show the different
+ways of encoding. First we show the traditional \MATHML~2 method:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <forall/>
+ <bvar> <ci>x</ci> </bvar>
+ <apply> <geq/>
+ <ci>x</ci>
+ <cn>4</cn>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+This is now called \quote {pragmatic} \MATHML. Using symbols and \mmlelement
+{bind} this becomes \quote {strict} \MATHML:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="3.0">
+ <bind> <csymbol cd="quant1">forall</csymbol>
+ <bvar> <ci>x</ci> </bvar>
+ <apply> <csymbol cd="relation1">geq</csymbol>
+ <ci>x</ci>
+ <cn>4</cn>
+ </apply>
+ </bind>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={ci, cn, sep}]
+
+These elements are used to specify identifiers and numbers. Both elements can
+be made more explicit by using attributes.
+
+\startattributes
+\HL
+\NC type \NC set \NC use a representation appropriate for sets \NC \NR
+\NC \NC vector \NC mark this element as vector \NC \NR
+\NC \NC function \NC consider this element to be a function \NC \NR
+\NC \NC fn \NC idem \NC \NR
+\HL
+\stopattributes
+
+When \attvalue {set} is specified, a blackboard symbol is used when available.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <in/>
+ <ci> x </ci>
+ <ci type="set"> N </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The \attvalue {function} specification makes sense when the \mmlelement {ci}
+element is used in for instance a differential equation.
+
+\startattributes
+\HL
+\NC type \NC integer \NC a whole number with an optional base \NC \NR
+\NC \NC logical \NC a boolean constant \NC \NR
+\NC \NC rational \NC a real number \NC \NR
+\NC \NC complex-cartesian \NC a complex number in $x+iy$ notation \NC \NR
+\NC \NC complex \NC idem \NC \NR
+\NC \NC complex-polar \NC a complex number in polar notation \unknown \NC \NR
+\HL
+\stopattributes
+
+You're lucky when your document uses decimal notation, otherwise you will end up
+with long specs if you want to be clear in what numbers are used.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <plus/>
+ <cn type="integer" base="16"> 1A2C </cn>
+ <cn type="integer" base="16"> 0101 </cn>
+ </apply>
+ <cn type="integer" base="16"> 1B2D </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+Complex numbers have two components. These are separated by the \mmlelement {sep}
+element. In the following example we see that instead of using a \mmlelement {ci}
+with set specifier, the empty element \mmlelement {complexes} can be used. We
+will see some more of those later.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <in/>
+ <cn type="complex"> 2 <sep/> 5 </cn>
+ <complexes/>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={eq, neq, gt, lt, geq, leq}]
+
+Expressions, and especially those with \mmlelement {eq} are typical for math.
+Because such expressions can be quite large, there are provisions for proper
+alignment.
+
+\starttabulate[||c||c|] % we want inline math
+\HL
+\NC lt \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><lt/> <ci>a</ci><ci>b</ci></apply></math>} \NC
+ leq \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><leq/><ci>a</ci><ci>b</ci></apply></math>} \NC \NR
+\NC eq \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><eq/> <ci>a</ci><ci>b</ci></apply></math>} \NC
+ neq \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><neq/><ci>a</ci><ci>b</ci></apply></math>} \NC \NR
+\NC gt \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><gt/> <ci>a</ci><ci>b</ci></apply></math>} \NC
+ geq \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><geq/><ci>a</ci><ci>b</ci></apply></math>} \NC \NR
+\HL
+\stoptabulate
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <leq/>
+ <ci> a </ci>
+ <ci> b </ci>
+ <ci> c </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={equivalent, approx, implies}]
+
+Equivalence, approximations, and implications are handled like \mmlelement {eq}
+and alike and have their own symbols.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <equivalent/>
+ <apply> <plus/> <ci> a </ci> <ci> b </ci> </apply>
+ <apply> <plus/> <ci> b </ci> <ci> a </ci> </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+This document is typeset with \LUATEX\ built upon \TEX\ version $3.14159$, and
+given that \TEX\ is written by a mathematician, it will be no surprise that:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <approx/>
+ <cn> 3.14159 </cn>
+ <pi/>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <implies/>
+ <apply> <eq/>
+ <apply> <plus/>
+ <ci> x </ci>
+ <cn> 4 </cn>
+ </apply>
+ <cn> 9 </cn>
+ </apply>
+ <apply> <eq/>
+ <ci> x </ci>
+ <cn> 5 </cn>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={minus, plus}]
+
+Addition and subtraction are main building blocks of math so you will meet them
+often.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <minus/>
+ <cn> 37 </cn>
+ <ci> x </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+In most cases there will be more than one argument to take care of, but
+especially \mmlelement {minus} will be used with one argument too. Although \typ
+{<cn> -37 </cn>} is valid, using \mmlelement {minus} is sometimes more clear.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <minus/>
+ <cn> 37 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+You should pay attention to combinations of \mmlelement {plus} and \mmlelement
+{minus}. Opposite to presentational \MATHML, in content markup you don't think
+and code sequential.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <plus/>
+ <apply> <minus/>
+ <ci> x </ci>
+ </apply>
+ <cn> 37 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+In \MATHML~3 we can also be more vebose:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="3.0">
+ <apply> <csymbol cd="arith1">plus</csymbol>
+ <ci>a</ci>
+ <ci>x</ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={times}]
+
+Multiplication is another top ten element. Although \type {3p} as content of the
+\mmlelement {ci} element would have rendered the next example as well, you really
+should split off the number and mark it as \mmlelement {cn}. When this is done
+consistently, we can comfortably change the font of numbers independent of the
+font used for displaying identifiers.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <times/>
+ <cn> 3 </cn>
+ <ci> p </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+In a following chapter we will see how we can add multiplication signs between
+variables and constants.
+
+\stopsection
+
+\startsection[title={divide}]
+
+When typeset, a division is characterized by a horizontal rule. Some elements,
+like the differential element \mmlelement {diff}, generate their own division.
+
+\processxmlfile{pc-s-001.xml}
+
+This example also demonstrates how to mix \mmlelement {plus} and \mmlelement
+{minus}.
+
+\typefile{pc-s-001.xml}
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply><divide/>
+ <apply><minus/>
+ <apply><minus/><ci>b</ci></apply>
+ <apply><minus/><ci>b</ci></apply>
+ <apply><root/> <ci>a</ci></apply>
+ </apply>
+ <apply><minus/>
+ <apply><minus/><ci>b</ci><ci>b</ci></apply>
+ <apply><minus/><ci>b</ci></apply>
+ <apply><root/> <ci>a</ci></apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={power}]
+
+In presentational \MATHML\ you think in super- and subscripts, but in content
+\MATHML\ these elements are not available. There you need to think in terms of
+\mmlelement {power}.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <plus/>
+ <apply> <power/>
+ <ci> x </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <power/>
+ <apply> <sin/>
+ <ci> x </ci>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The \mmlelement {power} element is clever enough to determine where the
+superscript should go. In the case of the sinus function, by default it will go
+after the function identifier.
+
+\stopsection
+
+\startsection[title={root, degree}]
+
+If you study math related \DTD's |<|these are the formal descriptions for \SGML\
+or \XML\ element collections|>| you will notice that there are not that many
+elements that demand a special kind of typography: differential equations,
+limits, integrals and roots are the most distinctive ones.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <root/>
+ <degree> 3 </degree>
+ <ci> 64 </ci>
+ </apply>
+ <cn> 4 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+Contrary to \mmlelement {power}, the \mmlelement {root} element uses a
+specialized child element to denote the degree. The positive consequence of this
+is that there cannot be a misunderstanding about what role the child element
+plays, while in for instance \mmlelement {power} you need to know that the second
+child element denotes the degree.
+
+\stopsection
+
+\startsection[title={sin, cos, tan, cot, scs, sec, \unknown}]
+
+All members of the family of goniometric functions are available as empty
+element. When needed, their argument is surrounded by braces. They all behave the
+same.
+
+\starttabulate[|||||]
+\HL
+\NC sin \NC arcsin \NC sinh \NC arcsinh \NC \NR
+\NC cos \NC arccos \NC cosh \NC arccosh \NC \NR
+\NC tan \NC arctan \NC tanh \NC arctanh \NC \NR
+\NC cot \NC arccot \NC coth \NC arccoth \NC \NR
+\NC csc \NC arccsc \NC csch \NC arccsch \NC \NR
+\NC sec \NC arcsec \NC sech \NC arcsech \NC \NR
+\HL
+\stoptabulate
+
+These functions are normally typeset in a non italic (often roman) font shape.
+
+\processxmlfile{wh-g-001.xml}
+
+By default the typesetting engine will minimize the number of braces that
+surrounds the argument of a function.
+
+\typefile{wh-g-001.xml}
+
+You can specify $\pi$ as an entity \type {&pi;} or as empty element \mmlelement
+{pi}. In many cases it is up to your taste which one you use. There are many
+symbols that are only available as entity, so in some respect there is no real
+reason to treat $\pi$ different.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <cos/>
+ <pi/>
+ </apply>
+ <apply> <minus/>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={log, ln, exp}]
+
+The \mmlelement {log} and \mmlelement {ln} are typeset similar to the previously
+discussed goniometric functions. The \mmlelement {exp} element is a special case
+of \mmlelement {power}. The constant $e$ can be specified with \mmlelement
+{exponentiale}.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <approx/>
+ <apply> <ln/>
+ <apply> <plus/>
+ <exponentiale/>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <cn> 1.55 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <exp/>
+ <cn> 2 </cn>
+ </apply>
+ <cn> 7.3890560989307 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={quotient, rem}]
+
+The result of a division can be a rational number, so $\frac{5}{4}$ is equivalent
+to $1.25$ and $1.25 \times 4$ gives~$5$. An integer division will give~$1$ with a
+remainder~$2$. Many computer languages provide a \type {div} and \type {mod}
+function, and since \MATHML\ is also meant for computation, it provides similar
+concepts, represented by the elements \mmlelement {quotient} and \mmlelement
+{rem}. The representation of \mmlelement {quotient} is rather undefined, but the
+next one is among the recommended alternatives.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <quotient/>
+ <ci> a </ci>
+ <ci> b </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={factorial}]
+
+Showing the representation of a factorial is rather dull, so we will use a few
+more elements as well as a processing instruction to illustrate the usage of
+\mmlelement {factorial}.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <?context-mathml-directive times symbol yes ?>
+ <apply> <eq/>
+ <apply> <factorial/>
+ <ci> n </ci>
+ </apply>
+ <apply> <times/>
+ <ci> n </ci>
+ <apply> <minus/> <ci> n </ci> <cn> 1 </cn> </apply>
+ <apply> <minus/> <ci> n </ci> <cn> 2 </cn> </apply>
+ <csymbol definitionUrl="cdots"/>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The processing instruction is responsible for the placement of the $\times$
+symbols.
+
+\stopsection
+
+\startsection[title={min, max, gcd, lcm}]
+
+These functions can handle more than two arguments. When typeset, these are
+separated by commas.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <ci> z </ci>
+ <apply> <min/>
+ <apply> <plus/> <ci> x </ci> <ci> y </ci> </apply>
+ <apply> <times/> <cn> 2 </cn> <ci> x </ci> </apply>
+ <apply> <divide/> <cn> 1 </cn> <ci> y </ci> </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={and, or, xor, not}]
+
+Logical expressions can be defined using these elements. The operations are
+represented by symbols and braces are applied when needed.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <and/>
+ <cn type="integer" base="2"> 1001 </cn>
+ <cn type="integer" base="2"> 0101 </cn>
+ </apply>
+ <cn type="integer" base="2"> 0001 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={set, bvar}]
+
+The appearance of a \mmlelement {set} depends on the presence of the child
+element \mmlelement {bvar}. In its simplest form, a set is represented as a list.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <neq/>
+ <set>
+ <cn> 1 </cn>
+ <cn> 4 </cn>
+ <cn> 8 </cn>
+ </set>
+ <emptyset/>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+A set can be distinguished from a vector by its curly braces. The simplest case
+is just a comma separated list. The next example demonstrates the declarative
+case. Without doubt, there will be other alternatives.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <set>
+ <bvar><ci> x </ci></bvar>
+ <condition>
+ <apply> <lt/>
+ <cn> 2 </cn>
+ <ci> x </ci>
+ <cn> 8 </cn>
+ </apply>
+ </condition>
+ </set>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={list}]
+
+This element is used in different contexts. When used as a top level element, a
+list is typeset as follows.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <list>
+ <cn> 1 </cn>
+ <cn> 1 </cn>
+ <cn> 3 </cn>
+ </list>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+When used in a context like \mmlelement {partialdiff}, the list specification
+becomes a subscript.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <partialdiff/>
+ <list>
+ <cn> 1 </cn>
+ <cn> 1 </cn>
+ <cn> 3 </cn>
+ </list>
+ <ci type="fn"> f </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The function specification in this formula (which is taken from the specs) can
+also be specified as \typ {<fn> <ci> f </ci> </fn>} (which is more clear).
+
+\stopsection
+
+\startsection[title={union, intersect, \unknown}]
+
+There is a large number of set operators, each represented by a distinctive
+symbol.
+
+\starttabulate[||c||c|] % we want in line math
+\HL
+\NC union \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><union/> <ci>U</ci><ci>V</ci></apply></math>} \NC
+ \NC \NC \NR
+\NC intersect \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><intersect/> <ci>U</ci><ci>V</ci></apply></math>} \NC
+ \NC \NC \NR
+\NC in \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><in/> <ci>U</ci><ci>V</ci></apply></math>} \NC
+ notin \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><notin/> <ci>U</ci><ci>V</ci></apply></math>} \NC \NR
+\NC subset \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><subset/> <ci>U</ci><ci>V</ci></apply></math>} \NC
+ notsubset \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><notsubset/> <ci>U</ci><ci>V</ci></apply></math>} \NC \NR
+\NC prsubset \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><prsubset/> <ci>U</ci><ci>V</ci></apply></math>} \NC
+ notprsubset \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><notprsubset/><ci>U</ci><ci>V</ci></apply></math>} \NC \NR
+\NC setdiff \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><apply><setdiff/> <ci>U</ci><ci>V</ci></apply></math>} \NC
+ \NC \NC \NR
+\HL
+\stoptabulate
+
+These operators are applied as follows:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <union/>
+ <ci> U </ci>
+ <ci> V </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={conjugate, arg, real, imaginary}]
+
+The visual representation of \mmlelement {conjugate} is a horizontal bar with a
+width matching the width of the expression.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <conjugate/>
+ <apply> <plus/>
+ <ci> x </ci>
+ <apply> <times/>
+ <cn> &ImaginaryI; </cn>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The \mmlelement {arg}, \mmlelement {real} and \mmlelement {imaginary} elements
+trigger the following appearance.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <arg/>
+ <apply> <plus/>
+ <ci> x </ci>
+ <apply> <times/>
+ <cn> &ImaginaryI; </cn>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <real/>
+ <apply> <plus/>
+ <ci> x </ci>
+ <apply> <times/>
+ <cn> &ImaginaryI; </cn>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <imaginaryi/>
+ <apply> <plus/>
+ <ci> x </ci>
+ <apply> <times/>
+ <cn> &ImaginaryI; </cn>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer
+
+\stopsection
+
+\startsection[title={abs, floor, ceiling}]
+
+There are a couple of functions that turn numbers into positive or rounded ones.
+In computer languages names are used, but in math we use special boundary
+characters.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <abs/> <cn> -5 </cn> </apply>
+ <cn> 5 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <floor/> <cn> 5.5 </cn> </apply>
+ <cn> 5 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <ceiling/> <cn> 5.5 </cn> </apply>
+ <cn> 6 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={interval}]
+
+An interval is visualized as: \xmldata {<math xmlns="http://www.w3c.org/mathml"
+version="2.0"> <interval> <cn> 1 </cn> <cn> 10 </cn> </interval> </math>}. The
+\mmlelement {interval} element is a container element and has a begin and endtag.
+You can specify the closure as attribute:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <interval closure="open-closed">
+ <ci> a </ci>
+ <ci> b </ci>
+ </interval>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The following closures are supported:
+
+\starttabulate[|||]
+\HL
+\NC open \NC \xmldata {<math xmlns="http://www.w3c.org/mathml" version="2.0"> <interval closure="open"> <ci>
+ a </ci> <ci> b </ci> </interval> </math>} \NC \NR
+\NC closed \NC \xmldata {<math xmlns="http://www.w3c.org/mathml" version="2.0"> <interval closure="closed"> <ci>
+ a </ci> <ci> b </ci> </interval> </math>} \NC \NR
+\NC open-closed \NC \xmldata {<math xmlns="http://www.w3c.org/mathml" version="2.0"> <interval closure="open-closed"> <ci>
+ a </ci> <ci> b </ci> </interval> </math>} \NC \NR
+\NC closed-open \NC \xmldata {<math xmlns="http://www.w3c.org/mathml" version="2.0"> <interval closure="closed-open"> <ci>
+ a </ci> <ci> b </ci> </interval> </math>} \NC \NR
+\HL
+\stoptabulate
+
+In strict \MATHML\ we use symbols instead of attributes to define the openess:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="3.0">
+ <apply> <csymbol cd="interval1">interval_oo</csymbol>
+ <ci>a</ci>
+ <ci>x</ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="3.0">
+ <apply> <csymbol cd="interval1">interval_cc</csymbol>
+ <ci>a</ci>
+ <ci>x</ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={inverse}]
+
+This operator is applied to a function. The following example demonstrates that
+this is one of the few cases (if not the only one) where the first element
+following an \mmlelement {apply} begintag is an \mmlelement {apply} itself.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply>
+ <apply> <inverse/> <sin/> </apply>
+ <ci> x </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={reln}]
+
+This element is a left||over from the first \MATHML\ specification and its usage
+is no longer advocated. Its current functionality matches the functionality of
+\mmlelement {apply}.
+
+\stopsection
+
+\startsection[title={cartesianproduct, vectorproduct, scalarproduct, outerproduct}]
+
+The context of the formula will often provide information of what kind of
+multiplication is meant, but using different symbols to represent the kind of
+product certainly helps.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <cartesianproduct/>
+ <ci> a </ci>
+ <ci> b </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+We have:
+
+\starttabulate[|||]
+\HL
+\NC cartesian \NC \xmldata {<math xmlns="http://www.w3c.org/mathml" version="2.0"> <apply> <cartesianproduct/> <ci>
+ a </ci> <ci> b </ci> </apply> </math>} \NC \NR
+\NC vector \NC \xmldata {<math xmlns="http://www.w3c.org/mathml" version="2.0"> <apply> <vectorproduct/> <ci>
+ a </ci> <ci> b </ci> </apply> </math>} \NC \NR
+\NC scalar \NC \xmldata {<math xmlns="http://www.w3c.org/mathml" version="2.0"> <apply> <scalarproduct/> <ci>
+ a </ci> <ci> b </ci> </apply> </math>} \NC \NR
+\NC outer \NC \xmldata {<math xmlns="http://www.w3c.org/mathml" version="2.0"> <apply> <outerproduct/> <ci>
+ a </ci> <ci> b </ci> </apply> </math>} \NC \NR
+\HL
+\stoptabulate
+
+\stopsection
+
+\startsection[title={sum, product, limit, lowlimit, uplimit, bvar}]
+
+Sums, products and limits have a distinctive look, especially when they have
+upper and lower limits attached. Unfortunately there is no way to specify the
+$x_i$ in content \MATHML. In the next chapter we will see how we can handle that.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <sum/>
+ <bvar> <ci> i </ci> </bvar>
+ <lowlimit> <cn> 1 </cn> </lowlimit>
+ <uplimit> <ci> n </ci> </uplimit>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <ci> x </ci>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+When we omit the limits, the \mmlelement {bvar} is still typeset.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <product/>
+ <bvar>
+ <ci> i </ci>
+ </bvar>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <ci> x </ci>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+You can specify the condition under which the function is applied.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <product/>
+ <bvar>
+ <ci> x </ci>
+ </bvar>
+ <condition>
+ <apply> <in/>
+ <ci> x </ci>
+ <ci type="set"> R </ci>
+ </apply>
+ </condition>
+ <apply> <ci type="fn"> f </ci>
+ <ci> x </ci>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <limit/>
+ <bvar>
+ <ci> x </ci>
+ </bvar>
+ <lowlimit>
+ <cn> 0 </cn>
+ </lowlimit>
+ <apply> <sin/>
+ <ci> x </ci>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={int, diff, partialdiff, bvar, degree}]
+
+These elements reach a high level of abstraction. The best way to learn how to
+use them is to carefully study some examples.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <diff/>
+ <bvar> <ci> a </ci> </bvar>
+ <apply> <int/>
+ <lowlimit> <ci> p </ci> </lowlimit>
+ <uplimit> <ci> q </ci> </uplimit>
+ <bvar> <ci> x </ci> </bvar>
+ <apply>
+ <fn> <ci> f </ci> </fn>
+ <ci> x </ci>
+ <ci> a </ci>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The \mmlelement {bvar} element is essential, since it is used to automatically
+generate some of the components that make up the visual appearance of the
+formula. If you look at the formal specification of these elements, you will
+notice that the appearance may depend on your definition. How the formula shows
+up, depends not only on the \mmlelement {bvar} element, but also on the optional
+\mmlelement {degree} element within.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <diff/>
+ <ci> f </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <diff/>
+ <bvar>
+ <ci> x </ci>
+ <degree> <cn> 2 </cn> </degree>
+ </bvar>
+ <apply> <fn> <ci> f </ci> </fn>
+ <ci> x </ci>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <partialdiff/>
+ <bvar>
+ <degree> <cn> 2 </cn> </degree>
+ <ci> x </ci>
+ </bvar>
+ <bvar> <ci> y </ci> </bvar>
+ <bvar> <ci> x </ci> </bvar>
+ <degree> <cn> 4 </cn> </degree>
+ <ci type="fn"> f </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <partialdiff/>
+ <bvar>
+ <ci> x </ci> <degree> <ci> m </ci> </degree>
+ </bvar>
+ <bvar>
+ <ci> y </ci> <degree> <ci> n </ci> </degree>
+ </bvar>
+ <degree> <ci> k </ci> </degree>
+ <apply> <ci type="fn"> f </ci>
+ <ci> x </ci>
+ <ci> y </ci>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <partialdiff/>
+ <bvar>
+ <ci> x </ci> <degree> <ci> m </ci> </degree>
+ </bvar>
+ <bvar>
+ <ci> y </ci> <degree> <ci> n </ci> </degree>
+ </bvar>
+ <apply> <ci type="fn"> f </ci>
+ <ci> x </ci>
+ <ci> y </ci>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+When a degree is not specified, it is deduced from the context, but since this is
+not 100\% robust, you can best be complete in your specification.
+
+These examples are taken from the \MATHML\ specification. In the example document
+that comes with this manual you can find a couple more.
+
+\stopsection
+
+\startsection[title={fn}]
+
+There are a lot of predefined functions and operators. If you want to introduce a
+new one, the \mmlelement {fn} element can be used. In the following example we
+have turned the $\pm$ and $\mp$ symbols into (coupled) operators.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <times/>
+ <apply> <fn> <ci> &plusminus; </ci> </fn>
+ <ci> x </ci>
+ <cn> 1 </cn>
+ </apply>
+ <apply> <fn> <ci> &minusplus; </ci> </fn>
+ <ci> x </ci>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <apply> <power/>
+ <ci> x </ci>
+ <cn> 2 </cn>
+ </apply>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The typeset result depends on the presence of a handler, which in this case
+happens to be true.
+
+\stopsection
+
+\startsection[title={matrix, matrixrow}]
+
+A matrix is one of the building blocks of linear algebra and therefore both
+presentational and content \MATHML\ have dedicated elements for defining it.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <matrix>
+ <matrixrow> <cn> 23 </cn> <cn> 87 </cn> <ci> c </ci> </matrixrow>
+ <matrixrow> <cn> 41 </cn> <ci> b </ci> <cn> 33 </cn> </matrixrow>
+ <matrixrow> <ci> a </ci> <cn> 65 </cn> <cn> 16 </cn> </matrixrow>
+ </matrix>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={vector}]
+
+We make a difference between a vector specification and a vector variable. A
+specification is presented as a list:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <vector>
+ <ci> x </ci>
+ <ci> y </ci>
+ </vector>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+When the \mmlelement {vector} element has one child element, we use a right arrow
+to identify the variable as vector.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <vectorproduct/>
+ <vector> <ci> A </ci> </vector>
+ <vector> <ci> B </ci> </vector>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={grad, curl, ident, divergence}]
+
+These elements expand into named functions, but we can imagine that in the future
+a more appropriate visualization will be provided as an option.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <neq/>
+ <apply> <grad/> <ci> A </ci> </apply>
+ <apply> <curl/> <ci> B </ci> </apply>
+ <apply> <ident/> <ci> C </ci> </apply>
+ <apply> <divergence/> <ci> D </ci> </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={lambda, bvar}]
+
+The lambda specification of a function needs a \mmlelement {bvar} element. The
+visualization can be influenced with processing instructions as described in a
+later chapter.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <lambda>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <sin/>
+ <apply> <minus/>
+ <ci> x </ci>
+ <apply> <divide/>
+ <ci> x </ci>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ </lambda>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={piecewise, piece, otherwise}]
+
+There are not so many elements that deal with combinations of formulas or
+conditions. The \mmlelement {piecewise} is the only real selector available. The
+following example defines how the state of~$n$ depends on the state of~$x$.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <ci> n </ci>
+ <piecewise>
+ <piece>
+ <apply> <minus/>
+ <cn> 1 </cn>
+ </apply>
+ <apply> <lt/>
+ <ci> x </ci>
+ <cn> 0 </cn>
+ </apply>
+ </piece>
+ <piece>
+ <cn> 1 </cn>
+ <apply> <gt/>
+ <ci> x </ci>
+ <cn> 0 </cn>
+ </apply>
+ </piece>
+ <otherwise>
+ <cn> 0 </cn>
+ </otherwise>
+ </piecewise>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+We could have used a third \mmlelement {piece} instead of (optional) \mmlelement
+{otherwise}.
+
+\stopsection
+
+\startsection[title={forall, exists, condition}]
+
+Conditions are often used in combination with elements like \mmlelement {forall}.
+There are several ways to convert and combine them in formulas and environments,
+so you may expect more alternatives in the future.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <forall/>
+ <bvar> <ci> x </ci> </bvar>
+ <condition>
+ <apply> <lt/>
+ <ci> x </ci>
+ <cn> 9 </cn>
+ </apply>
+ </condition>
+ <apply> <lt/>
+ <ci> x </ci>
+ <cn> 10 </cn>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The next example is taken from the specifications with a few small changes.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <forall/>
+ <bvar> <ci> x </ci> </bvar>
+ <condition>
+ <apply> <in/>
+ <ci> x </ci>
+ <ci type="set"> N </ci>
+ </apply>
+ </condition>
+ <apply> <exists/>
+ <bvar> <ci> p </ci> </bvar>
+ <bvar> <ci> q </ci> </bvar>
+ <condition>
+ <apply> <and/>
+ <apply> <in/>
+ <ci> p </ci>
+ <ci type="set"> P </ci>
+ </apply>
+ <apply> <in/>
+ <ci> q </ci>
+ <ci type="set"> P </ci>
+ </apply>
+ <apply> <eq/>
+ <apply> <plus/> <ci> p </ci> <ci> q </ci> </apply>
+ <apply> <times/> <cn> 2 </cn> <ci> x </ci> </apply>
+ </apply>
+ </apply>
+ </condition>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={factorof, tendsto}]
+
+The \mmlelement {factorof} element is applied to its two child elements and
+contrary to most functions, the symbol is placed between the elements instead of
+in front.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <factorof/>
+ <ci> a </ci>
+ <ci> b </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The same is true for the \mmlelement {tendsto} element.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <tendsto/>
+ <ci> a </ci>
+ <ci> b </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={compose}]
+
+This is a nasty element since it has to take care of braces in special ways and
+therefore has to analyse its child elements.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <compose/>
+ <ci type="fn"> f </ci>
+ <ci type="fn"> g </ci>
+ <ci type="fn"> h </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply>
+ <apply> <compose/>
+ <fn> <ci> f </ci> </fn>
+ <fn> <ci> g </ci> </fn>
+ </apply>
+ <ci> x </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={laplacian}]
+
+A laplacian function is typeset using a $\nabla$ (nabla) symbol.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <laplacian/>
+ <ci> x </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={mean, sdev, variance, median, mode}]
+
+When statistics shows up in math text books, the \mmlelement {sum} element is
+likely to show up, probably in combination with the for statistics meaningful
+symbolic representation of variables. The mean value of a series of observations
+is defined as:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <mean/>
+ <ci> x </ci>
+ </apply>
+ <apply> <divide/>
+ <apply> <sum/>
+ <ci> x </ci>
+ </apply>
+ <ci> n </ci>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+or more beautiful:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <mean/>
+ <ci> x </ci>
+ </apply>
+ <apply> <times/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <ci> n </ci>
+ </apply>
+ <apply> <sum/>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+Of course this definition is not that perfect, but we will present a better
+alternative in the chapter on combined markup. The definition of the standard
+deviation is more complicated:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <approx/>
+ <apply> <sdev/>
+ <ci> x </ci>
+ </apply>
+ <apply> <root/>
+ <apply> <divide/>
+ <apply> <sum/>
+ <apply> <power/>
+ <apply> <minus/>
+ <ci> x </ci>
+ <apply> <mean/>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <ci> n </ci>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The next example demonstrates the usage of the \mmlelement {variance} in its own
+definition.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <variance/>
+ <ci> x </ci>
+ </apply>
+ <apply> <approx/>
+ <apply> <mean/>
+ <apply> <power/>
+ <apply> <minus/>
+ <ci> x </ci>
+ <apply> <mean/>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <minus/>
+ <ci> n </ci>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+ <apply> <sum/>
+ <apply> <power/>
+ <apply> <minus/>
+ <ci> x </ci>
+ <apply> <mean/>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+The \mmlelement {median} and \mmlelement {mode} of a series of observations have
+no special symbols and are presented as is.
+
+\stopsection
+
+\startsection[title={moment, momentabout, degree}]
+
+Because \MATHML\ is used for a wide range of applications, there can be
+information in a definition that does not end up in print but is only used in
+some cases. This is illustrated in the next example.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <moment/>
+ <degree>
+ <cn> 3 </cn>
+ </degree>
+ <momentabout>
+ <ci> p </ci>
+ </momentabout>
+ <ci> X </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={determinant, transpose}]
+
+These two (and the following) are used to manipulate matrices, either or not in a
+symbolic way. A simple determinant or transpose looks like:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <determinant/>
+ <ci type="matrix"> A </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <transpose/>
+ <ci type="matrix"> A </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+When the \mmlelement {determinant} element is applied to a full blown matrix, the
+braces are omitted and replaced by the vertical bars.
+
+\processxmlfile{wh-m-002.xml} \typefile{wh-m-002.xml}
+
+\stopsection
+
+\startsection[title={selector}]
+
+The \mmlelement {selector} element can be used to index a matrix cell or
+variable. This element honors the braces.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <selector/>
+ <matrix>
+ <matrixrow> <cn> 1 </cn> <cn> 2 </cn> </matrixrow>
+ <matrixrow> <cn> 3 </cn> <cn> 4 </cn> </matrixrow>
+ </matrix>
+ <cn> 1 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+A more common usage of the selector is the following:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <selector/>
+ <ci> x </ci>
+ <ci> i </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+It is possible to pass a comma separated list of indices:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <selector/>
+ <ci> x </ci> <cn> 1,2 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+If you want to have a more verbose index, you can use the \mmlelement {csymbol}
+element, flagged with text encoding.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <selector/>
+ <ci> x </ci>
+ <csymbol encoding="text"> max </csymbol>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={card}]
+
+A cardinality is visualized using vertical bars.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <card/>
+ <ci> A </ci>
+ </apply>
+ <ci> 5 </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={domain, codomain, image}]
+
+The next couple of examples are taken from the \MATHML\ specification and
+demonstrate the usage of the not that spectacular domain related elements.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <domain/>
+ <fn> <ci> f </ci> </fn>
+ </apply>
+ <reals/>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+These are typically situations where the \mmlelement {fn} element may show up.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <codomain/>
+ <fn> <ci> f </ci> </fn>
+ </apply>
+ <rationals/>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+This example from the \MATHML\ specification demonstrates a typical usage of the
+\mmlelement {image} element. As with the previous two, it is applied to a
+function, in this case the predefined \mmlelement {sin}.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <image/>
+ <sin/>
+ </apply>
+ <interval>
+ <cn> -1 </cn>
+ <cn> 1 </cn>
+ </interval>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={domainofapplication}]
+
+This is another seldom used element. Actually, this element is a further
+specification of the outer level applied function.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <int/>
+ <domainofapplication>
+ <ci> C </ci>
+ </domainofapplication>
+ <ci> f </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={semantics, annotation, annotation-xml}]
+
+We will never know what Albert Einstein would have thought about \MATHML. But we
+do know for sure that coding one of his famous findings in \XML\ takes much more
+tokens that it takes in \TEX.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <semantics>
+ <apply> <eq/>
+ <ci> e </ci>
+ <apply> <times/>
+ <ci> m </ci>
+ <apply> <power/>
+ <ci> c </ci>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ <annotation encoding="tex">
+ e = m c^2
+ </annotation>
+ </semantics>
+</math>
+\stopbuffer
+
+Within a \mmlelement {semantics} element there can be many \mmlelement
+{annotation} elements. When using \CONTEXT, the elements that can be identified
+as being encoded in \TEX\ will be treated as such. Currently, the related
+\mmlelement {annotation-xml} element is ignored.
+
+\processxmlbuffer \typebuffer
+
+Another variant that we support is called \quote {calcmath} which is an efficient
+way to enter school math. The syntax resembles the one used in advanced
+calculators.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <semantics>
+ <annotation encoding="calcmath">
+ x = sqrt(sin(x) + cos(c))
+ </annotation>
+ </semantics>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={integers, reals, ...}]
+
+Sets of numbers are characterized with special (often blackboard) symbols. These
+symbols are not always available.
+
+\starttabulate[|||] % we want in line math
+\HL
+\NC integers \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><integers/> </math>} \NC \NR
+\NC reals \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><reals/> </math>} \NC \NR
+\NC rationals \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><rationals/> </math>} \NC \NR
+\NC naturalnumbers \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><naturalnumbers/></math>} \NC \NR
+\NC complexes \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><complexes/> </math>} \NC \NR
+\NC primes \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><primes/> </math>} \NC \NR
+\HL
+\stoptabulate
+
+\stopsection
+
+\startsection[title={pi, imaginaryi, exponentiale}]
+
+Being a greek character, $\pi$ is a distinctive character. In most math documents
+the imaginary~$i$ and exponential~$e$ are typeset as any math identifier.
+
+\starttabulate[|||] % we want in line math
+\HL
+\NC pi \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><pi/> </math>} \NC \NR
+\NC imaginaryi \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><imaginaryi/> </math>} \NC \NR
+\NC exponentiale \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><exponentiale/></math>} \NC \NR
+\HL
+\stoptabulate
+
+\stopsection
+
+\startsection[title={eulergamma, infinity, emptyset}]
+
+There are a couple of more special tokens. As with the other ones, they can be
+changed by reassigning the corresponding entities.
+
+\starttabulate[|||] % we want in line math
+\HL
+\NC eulergamma \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><eulergamma/></math>} \NC \NR
+\NC infinity \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><infinity/> </math>} \NC \NR
+\NC emptyset \NC \xmldata{<math xmlns="http://www.w3c.org/mathml" version="2.0"><emptyset/> </math>} \NC \NR
+\HL
+\stoptabulate
+
+\stopsection
+
+\startsection[title={notanumber}]
+
+Because \MATHML\ is used for more purposes than typesetting, there are a couple
+of elements that do not make much sense in print. One of these is \mmlelement
+{notanumber}, which is issued by programs as error code or string.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <divide/>
+ <ci> x </ci>
+ <cn> 0 </cn>
+ </apply>
+ <notanumber/>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={true, false}]
+
+When assigning to a boolean variable, or in boolean expressions one can use~$0$
+or~$1$ to identify the states, but if you want to be more verbose, you can use
+these elements.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <equivalent/>
+ <cn type="integer" base="2"> 1 </cn>
+ <true/>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={declare}]
+
+Reusing definitions would be a nice feature, but for the moment the formal
+specification of this element does not give us the freedom to use it the way we
+want.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <declare>
+ <ci> A </ci>
+ <vector>
+ <ci> a </ci>
+ <ci> b </ci>
+ <ci> c </ci>
+ </vector>
+ </declare>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={csymbol}]
+
+This element will be implemented as soon as we have an application for it.
+
+\stopsection
+
+\stopchapter
+
+\startchapter[title={Mixed markup}]
+
+\startsection[title={introduction}]
+
+The advantage of presentational markup is that you can build complicated formulas
+using super- and subscripts and other elements. The drawback is that the look and
+feel is rather fixed and cannot easily be adapted to the purpose that the
+document serves. Take for instance the difference between
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <log/>
+ <logbase> <cn> 2 </cn> </logbase>
+ <ci> x </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer
+
+and
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <?context-mathml-directive log location left ?>
+ <apply> <log/>
+ <logbase> <cn> 2 </cn> </logbase>
+ <ci> x </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer
+
+Both formulas were defined in content \MATHML, so no explicit super- and
+subscripts were used. In the next chapter we will see how to achieve such
+different appearances.
+
+There are situations where content \MATHML\ is not rich enough to achieve the
+desired output. This omission in content \MATHML\ forces us to fall back on
+presentational markup.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <ci> <msub> <mi> P </mi> <mi> 1 </mi> </msub> </ci>
+ <ci> <msub> <mi> P </mi> <mi> 2 </mi> </msub> </ci>
+ <apply> <approx/>
+ <cn> 1.01 </cn>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer
+
+Here we used presentational elements inside a content \mmlelement {ci} element.
+We could have omitted the outer \mmlelement {ci} element, but since the content
+\MATHML\ parser may base its decisions on the content elements it finds, it is
+best to keep the outer element there.
+
+\typebuffer
+
+The lack of an index element can be quite prominent. For instance, when in an
+expose about rendering we want to explore the mapping from coordinates in user
+space to those in device space, we use the following formula.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <vector>
+ <ci> <msub> <mi> D </mi> <mi> x </mi> </msub> </ci>
+ <ci> <msub> <mi> D </mi> <mi> y </mi> </msub> </ci>
+ <cn> 1 </cn>
+ </vector>
+ <apply> <times/>
+ <vector>
+ <ci> <msub> <mi> U </mi> <mi> x </mi> </msub> </ci>
+ <ci> <msub> <mi> U </mi> <mi> y </mi> </msub> </ci>
+ <cn> 1 </cn>
+ </vector>
+ <matrix>
+ <matrixrow>
+ <ci> <msub> <mi> s </mi> <mi> x </mi> </msub> </ci>
+ <ci> <msub> <mi> r </mi> <mi> x </mi> </msub> </ci>
+ <cn> 0 </cn>
+ </matrixrow>
+ <matrixrow>
+ <ci> <msub> <mi> r </mi> <mi> y </mi> </msub> </ci>
+ <ci> <msub> <mi> s </mi> <mi> y </mi> </msub> </ci>
+ <cn> 0 </cn>
+ </matrixrow>
+ <matrixrow>
+ <ci> <msub> <mi> t </mi> <mi> x </mi> </msub> </ci>
+ <ci> <msub> <mi> t </mi> <mi> y </mi> </msub> </ci>
+ <cn> 1 </cn>
+ </matrixrow>
+ </matrix>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+Again, the \mmlelement {msub} element provides a way out, as in the next
+examples, which are adapted versions of formulas we used when demonstrating the
+statistics related elements.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <mean/>
+ <ci> x </ci>
+ </apply>
+ <apply> <times/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <ci> n </ci>
+ </apply>
+ <apply> <sum/>
+ <bvar> <ci> i </ci> </bvar>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <mean/>
+ <ci> x </ci>
+ </apply>
+ <apply> <times/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <ci> n </ci>
+ </apply>
+ <apply> <sum/>
+ <bvar> <ci> i </ci> </bvar>
+ <lowlimit> <cn> 1 </cn> </lowlimit>
+ <uplimit> <cn> n </cn> </uplimit>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <mean/>
+ <ci> x </ci>
+ </apply>
+ <apply> <times/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <ci> n </ci>
+ </apply>
+ <apply> <sum/>
+ <bvar> <ci> i </ci> </bvar>
+ <lowlimit> <cn> 1 </cn> </lowlimit>
+ <uplimit> <cn> n </cn> </uplimit>
+ <ci> <msub> <mi> x </mi> <mi> i </mi> </msub> </ci>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+You can also use a selector for indexing, so in practice we can avoid the mixed
+mode:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <vector>
+ <apply> <selector/> <ci> D </ci> <ci> x </ci> </apply>
+ <apply> <selector/> <ci> D </ci> <ci> y </ci> </apply>
+ <cn> 1 </cn>
+ </vector>
+ <apply> <times/>
+ <vector>
+ <apply> <selector/> <ci> U </ci> <ci> x </ci> </apply>
+ <apply> <selector/> <ci> U </ci> <ci> y </ci> </apply>
+ <cn> 1 </cn>
+ </vector>
+ <matrix>
+ <matrixrow>
+ <apply> <selector/> <ci> s </ci> <ci> x </ci> </apply>
+ <apply> <selector/> <ci> r </ci> <ci> x </ci> </apply>
+ <cn> 0 </cn>
+ </matrixrow>
+ <matrixrow>
+ <apply> <selector/> <ci> s </ci> <ci> y </ci> </apply>
+ <apply> <selector/> <ci> r </ci> <ci> y </ci> </apply>
+ <cn> 0 </cn>
+ </matrixrow>
+ <matrixrow>
+ <apply> <selector/> <ci> t </ci> <ci> x </ci> </apply>
+ <apply> <selector/> <ci> t </ci> <ci> y </ci> </apply>
+ <cn> 1 </cn>
+ </matrixrow>
+ </matrix>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\stopchapter
+
+\startchapter[title={Directives}]
+
+Some elements can be tuned by changing their attributes. Especially when formulas
+are defined by a team of people or when they are taken from a repository, there
+is a good chance that inconsistencies will show up.
+
+In \CONTEXT, you can influence the appearance by setting the typesetting
+parameters of (classes of) elements. You can do this either by adding processing
+instructions, or by using the \CONTEXT\ command \type {\setupMMLappearance}.
+Although the first method is more in the spirit of \XML, the second method is
+more efficient and consistent. As a processing instruction, a directive looks
+like:
+
+\starttyping
+<?context-mathml-directive element key value ?>
+\stoptyping
+
+This is equivalent to the \CONTEXT\ command:
+
+\starttyping
+\setupMMLappearance [element] [key=value]
+\stoptyping
+
+Some settings concern a group of elements, in which case a group classification
+(like \type {sign}) is used.
+
+\startsection[title={scripts}]
+
+By default, nested super- and subscripts are kind of isolated from each other. If
+you want a combined script, there is the \mmlelement {msubsup}. You can however
+force combinations with a directive.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <msup>
+ <msub> <mi> x </mi> <mn> 1 </mn> </msub>
+ <mn> 2 </mn>
+ </msup>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<?context-mathml-directive scripts alternative b ?>
+
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <msup>
+ <msub> <mi> x </mi> <mn> 1 </mn> </msub>
+ <mn> 2 </mn>
+ </msup>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={sign}]
+
+The core element of \MATHML\ is \mmlelement {apply}. Even simple formulas will
+often have more than one (nested) \mmlelement {apply}. The most robust way to
+handle nested formulas is to use braces around each sub formula. No matter how
+robust this is, when presented in print we want to use as less braces as
+possible. The next example shows addition as well as subtraction.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <plus/>
+ <cn> 7 </cn>
+ <cn> 5 </cn>
+ <apply> <minus/>
+ <cn> 3 </cn>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+In principle subtraction is adding negated numbers, so it would have been natural
+to have just an addition (\mmlelement {plus}) and negation operator. However,
+\MATHML\ provides both a \mmlelement {plus} and \mmlelement {minus} operator,
+where the latter can be used as a negation. So in fact we have:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <?context-mathml-directive sign reduction no ?>
+ <apply> <plus/>
+ <cn> 7 </cn>
+ <cn> 5 </cn>
+ <apply> <minus/>
+ <cn> 3 </cn>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer
+
+Now imagine that a teacher wants to stress this negation in the way presented
+here, using parentheses. Since all the examples shown here are typeset directly
+from the \MATHML\ source, you may expect a solution, so here it is:
+
+\typebuffer
+
+By default signs are reduced, but one can disable that at the document and|/|or
+formula level using a processing instruction at the top of the formula. There are
+of course circumstances where the parentheses cannot be left out.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <plus/>
+ <ci> a </ci>
+ <apply> <plus/> <ci> b </ci> <ci> c </ci> </apply>
+ <ci> d </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <minus/>
+ <ci> a </ci>
+ <apply> <minus/> <ci> b </ci> <ci> c </ci> </apply>
+ <ci> d </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <plus/>
+ <ci> a </ci>
+ <apply> <minus/> <ci> b </ci> <ci> c </ci> </apply>
+ <ci> d </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <minus/>
+ <ci> a </ci>
+ <apply> <plus/> <ci> b </ci> <ci> c </ci> </apply>
+ <ci> d </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+Another place where parentheses are not needed is the following:
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <minus/>
+ <apply> <exp/>
+ <cn> 3 </cn>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\typebuffer
+
+This means that the interpreter of this kind of \MATHML\ has to analyze child
+elements in order to choose the right way to typeset the formula. The output will
+look like:
+
+\processxmlbuffer
+
+By default, as less braces as possible are used. As demonstrated, a special case
+is when \mmlelement {plus} and \mmlelement {minus} have one sub element to deal
+with. If you really want many braces there, you can turn off sign reduction.
+
+\startdirectives
+\HL
+\NC sign \NC reduction \NC yes \NC use as less braces as possible \NC \NR
+\NC \NC \NC no \NC always use braces \NC \NR
+\HL
+\stopdirectives
+
+We will demonstrate these alternatives with an example.
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <plus/>
+ <ci> a </ci>
+ <apply> <sin/>
+ <ci> b </ci>
+ </apply>
+ <apply> <power/>
+ <ci> c </ci>
+ <cn> 5 </cn>
+ </apply>
+ <apply> <power/>
+ <apply> <sin/>
+ <ci> d </ci>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ <ci> e </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer[a]
+
+We need quite some code to encode this formula.
+
+\typebuffer[a]
+
+\startbuffer[b]
+<?context-mathml-directive power reduction no ?>
+\stopbuffer
+
+With power reduction turned off, we get:
+
+\processxmlbuffer[b,a]
+
+As directive we used:
+
+\typebuffer[b]
+
+The following example illustrates that we should be careful in coding such
+formulas; here the \mmlelement {power} is applied to the argument of \mmlelement
+{sin}.
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <plus/>
+ <ci> a </ci>
+ <apply> <sin/>
+ <ci> b </ci>
+ </apply>
+ <apply> <power/>
+ <ci> c </ci>
+ <cn> 5 </cn>
+ </apply>
+ <apply> <sin/>
+ <apply> <power/>
+ <ci> d </ci>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <ci> e </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+\stopsection
+
+\startsection[title={divide}]
+
+Divisions can be very space consuming but there is a way out: using a forward
+slash symbol. You can set the level at which this will take place. By default,
+fractions are typeset in the traditional way.
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <plus/>
+ <cn> 1 </cn>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\startbuffer[b]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <plus/>
+ <cn> 1 </cn>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <plus/>
+ <cn> 1 </cn>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer[a] \typebuffer[a]
+\processxmlbuffer[b] \typebuffer[b]
+
+\startbuffer[c]
+<?context-mathml-directive divide level 1 ?>
+\stopbuffer
+
+\processxmlbuffer[c,a] \processxmlbuffer[c,b] \typebuffer[c]
+
+\startbuffer[c]
+<?context-mathml-directive divide level 2 ?>
+\stopbuffer
+
+\processxmlbuffer[c,a] \processxmlbuffer[c,b] \typebuffer[c]
+
+\stopsection
+
+\startsection[title={relation}]
+
+You should keep in mind that (at least level 2) content \MATHML\ is not that rich
+in terms of presenting your ideas in a visually attractive way. On the other
+hand, because the content is highly structured, some intelligence can be applied
+when typesetting them. By default, a relation is not vertically aligned but
+typeset horizontally.
+
+If an application just needs raw formulas, definitions like the following are all
+right.
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <apply> <plus/>
+ <ci> a </ci>
+ <ci> b </ci>
+ <ci> c </ci>
+ </apply>
+ <apply> <plus/>
+ <ci> d </ci>
+ <ci> e </ci>
+ </apply>
+ <apply> <plus/>
+ <ci> f </ci>
+ <ci> g </ci>
+ <ci> h </ci>
+ <ci> i </ci>
+ </apply>
+ <cn> 123 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\typebuffer[a]
+
+The typeset result will bring no surprises:
+
+\processxmlbuffer[a]
+
+But, do we want to show a formula that way? And what happens with much longer
+formulas? You can influence the appearance with processing instructions.
+
+\startdirectives
+\HL
+\NC relation \NC align \NC no \NC don't align relations \NC \NR
+\NC \NC \NC left \NC align all relations left \NC \NR
+\NC \NC \NC right \NC align all relations right \NC \NR
+\NC \NC \NC first \NC place the leftmost relation left \NC \NR
+\NC \NC \NC last \NC place the rightmost relation right \NC \NR
+\HL
+\stopdirectives
+
+The next couple of formulas demonstrate in what way the previously defined
+formula is influenced by the processing instructions.
+
+\startbuffer[b]
+<?context-mathml-directive relation align left ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive relation align right ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive relation align first ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive relation align last ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\stopsection
+
+\startsection[title={base}]
+
+When in a document several number systems are used, it can make sense to mention
+the base of the number. There are several ways to identify the base.
+
+\startdirectives
+\HL
+\NC base \NC symbol \NC numbers \NC a (decimal) number \NC \NR
+\NC \NC \NC characters \NC one character \NC \NR
+\NC \NC \NC text \NC a mnemonic \NC \NR
+\NC \NC \NC no \NC no symbol \NC \NR
+\HL
+\stopdirectives
+
+By default, when specified, a base is identified as number.
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <cn type="integer" base="8"> 1427 </cn>
+</math>
+\stopbuffer
+
+\typebuffer[a]
+
+\startbuffer[b]
+<?context-mathml-directive base symbol numbers ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive base symbol characters ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive base symbol text ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\stopsection
+
+\startsection[title={function}]
+
+There is a whole bunch of functions available as empty element, like \mmlelement
+{sin} and \mmlelement {log}. When a function is applied to a function, braces
+make not much sense and placement is therefore disabled.
+
+\startdirectives
+\HL
+\NC function \NC reduction \NC yes \NC chain functions without braces \NC \NR
+\NC \NC \NC no \NC put braces around nested functions \NC \NR
+\HL
+\stopdirectives
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <sin/> <ci> x </ci> </apply>
+</math>
+\stopbuffer
+
+\typebuffer[a]
+
+\startbuffer[b]
+<?context-mathml-directive function reduction yes ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive function reduction no ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\stopsection
+
+\startsection[title={limits}]
+
+When limits are placed on top of the limitation symbol, this generally looks
+better than when they are placed alongside. You can also influence limit
+placement per element. This feature is available for \mmlelement{int},
+\mmlelement {sum}, \mmlelement {product} and \mmlelement {limit}.
+
+\startdirectives
+\HL
+\NC limit \NC location \NC top \NC place limits on top of the symbols \NC \NR
+\NC \NC \NC right \NC attached limits as super/subscripts \NC \NR
+\HL
+\stopdirectives
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <int/>
+ <bvar> <ci> x </ci> </bvar>
+ <lowlimit> <cn> 0 </cn> </lowlimit>
+ <uplimit> <cn> 1 </cn> </uplimit>
+ </apply>
+</math>
+\stopbuffer
+
+\typebuffer[a]
+
+\startbuffer[b]
+<?context-mathml-directive int location top ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive int location right ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\stopsection
+
+\startsection[title={declare}]
+
+Currently declarations are not supposed to end up in print. By default we typeset
+a message, but you can as well completely hide declarations.
+
+\startdirectives
+\HL
+\NC declare \NC state \NC start \NC show declarations \NC \NR
+\NC \NC \NC stop \NC ignore (hide) declarations \NC \NR
+\HL
+\stopdirectives
+
+\stopsection
+
+\startsection[title={lambda}]
+
+There is more than one way to visualize a lambda function. As with some other
+settings, changing the appearance can best take place at the document level.
+
+\startdirectives
+\HL
+\NC lambda \NC alternative \NC b \NC show lambda as arrow \NC \NR
+\NC \NC \NC a \NC show lambda as set \NC \NR
+\HL
+\stopdirectives
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <lambda>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <log/>
+ <ci> x </ci>
+ </apply>
+ </lambda>
+</math>
+\stopbuffer
+
+\typebuffer[a]
+
+\startbuffer[b]
+<?context-mathml-directive lambda alternative a ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive lambda alternative b ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\stopsection
+
+\startsection[title={power}]
+
+Taking the power of a function looks clumsy when braces are put around the
+function. Therefore, by default, the power is applied to the function symbol
+instead of the whole function.
+
+\startdirectives
+\HL
+\NC power \NC reduction \NC yes \NC attach symbol to function symbol \NC \NR
+\NC \NC \NC no \NC attach symbol to function argument \NC \NR
+\HL
+\stopdirectives
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <power/>
+ <apply> <ln/>
+ <ci> x </ci>
+ </apply>
+ <cn> 3 </cn>
+ </apply>
+</math>
+\stopbuffer
+
+\typebuffer[a]
+
+\startbuffer[b]
+<?context-mathml-directive power reduction yes ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive power reduction no ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\stopsection
+
+\startsection[title={diff}]
+
+Covering all kind of differential formulas is not trivial. Currently we support
+two locations for the operand (function). By default the operand is placed above
+the division line.
+
+\startdirectives
+\HL
+\NC diff \NC location \NC top \NC put the operand in the fraction \NC \NR
+\NC \NC \NC right \NC put the operand after the fraction \NC \NR
+\HL
+\stopdirectives
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <diff/>
+ <bvar>
+ <ci> x </ci>
+ <degree> <cn> 2 </cn> </degree>
+ </bvar>
+ <apply> <fn> <ci> f </ci> </fn>
+ <apply> <plus/>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <ci> x </ci>
+ </apply>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\typebuffer[a]
+
+\startbuffer[b]
+<?context-mathml-directive diff location top ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive diff location right ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\stopsection
+
+\startsection[title={vector}]
+
+Depending on the complication of a vector or on the available space, you may wish
+to typeset a vector horizontally or vertically. By default a vector is typeset
+horizontally.
+
+\startdirectives
+\HL
+\NC vector \NC direction \NC horizontal \NC put vector elements alongside \NC \NR
+\NC \NC \NC vertical \NC stack vector elements \NC \NR
+\HL
+\stopdirectives
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <vector>
+ <ci> x </ci>
+ <ci> y </ci>
+ <ci> z </ci>
+ </vector>
+ <vector>
+ <cn> 1 </cn>
+ <cn> 0 </cn>
+ <cn> 1 </cn>
+ </vector>
+ </apply>
+</math>
+\stopbuffer
+
+\typebuffer[a]
+
+\startbuffer[b]
+<?context-mathml-directive vector direction horizontal ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive vector direction vertical ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\stopsection
+
+\startsection[title={times}]
+
+Depending on the audience, a multiplication sign is implicit (absent) or
+represented by a regular times symbol or a dot.
+
+\startdirectives
+\HL
+\NC times \NC symbol \NC no \NC don't add a symbol \NC \NR
+\NC \NC \NC yes \NC separate operands by a times ($\times$) \NC \NR
+\NC \NC \NC dot \NC separate operands by a dot ($\cdot$)\NC \NR
+\NC auto \NC symbol \NC no \NC don't check for succesive numbers \NC \NR
+\NC \NC \NC yes \NC separate succesive numbers by a times ($\times$) \NC \NR
+\NC \NC \NC dot \NC separate succesive numbers by a dot ($\cdot$)\NC \NR
+\HL
+\stopdirectives
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <plus/>
+ <ci> x </ci>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <ci> x </ci>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\typebuffer[a]
+
+\startbuffer[b]
+<?context-mathml-directive times symbol no ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive times symbol yes ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive times symbol dot ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\stopsection
+
+\startsection[title={log}]
+
+The location of a logbase depends on tradition and|/|or preference, which is why
+we offer a few alternatives: as pre superscript (in the right top corner before
+the symbol) or as post subscript (in the lower left corner after the symbol).
+
+\startdirectives
+\HL
+\NC log \NC location \NC right \NC place logbase at the right top \NC \NR
+\NC \NC \NC left \NC place logbase at the lower left \NC \NR
+\HL
+\stopdirectives
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <log/>
+ <logbase>
+ <ci> 3 </ci>
+ </logbase>
+ <apply> <plus/>
+ <ci> x </ci>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+</math>
+\stopbuffer
+
+\typebuffer[a]
+
+\startbuffer[b]
+<?context-mathml-directive log location right ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive log location left ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\stopsection
+
+\startsection[title={polar}]
+
+For polar notation we provide several renderings:
+
+\startdirectives
+\HL
+\NC polar \NC alternative \NC a \NC explicit polar notation \NC \NR
+\NC \NC \NC b \NC exponential power notation \NC \NR
+\NC \NC \NC c \NC exponential function notation \NC \NR
+\HL
+\stopdirectives
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <cn type="polar"> 2 <sep/> <pi/> </cn>
+</math>
+\stopbuffer
+
+\typebuffer[a]
+
+\startbuffer[b]
+<?context-mathml-directive polar alternative a ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive polar alternative b ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive polar alternative c ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\stopsection
+
+\startsection[title={e-notation}]
+
+Depending on the context, you may want to typeset the number \type {1.23e4} not
+as this sequence, but using a multiplier construct. As with the \mmlelement
+{times}, we support both multiplication symbols.
+
+\startdirectives
+\HL
+\NC enotation \NC symbol \NC no \NC no interpretation \NC \NR
+\NC \NC \NC yes \NC split exponent, using $\times$ \NC \NR
+\NC \NC \NC dot \NC split exponent, using $\cdot$ \NC \NR
+\HL
+\stopdirectives
+
+\startbuffer[a]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <cn type="e-notation">10<sep/>23</cn>
+</math>
+\stopbuffer
+
+\typebuffer[a]
+
+\startbuffer[b]
+<?context-mathml-directive enotation symbol no ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive enotation symbol yes ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\startbuffer[b]
+<?context-mathml-directive enotation symbol dot ?>
+\stopbuffer
+
+\processxmlbuffer[b,a] \typebuffer[b]
+
+\stopsection
+
+\stopchapter
+
+\startchapter[title={Typesetting modes}]
+
+Math can be typeset inline or display. In order not to widen up the text of a
+paragraph too much, inline math is typeset more cramped. Since \MATHML\ does
+provide just a general purpose \mmlelement {math} element we have to provide the
+information needed using other elements. Consider the following text.
+
+\startbuffer
+<document>
+To what extent is math supposed to reflect the truth and nothing but
+the truth? Consider the simple expression
+ <math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <cn> 10 </cn>
+ <apply> <plus/>
+ <cn> 3 </cn>
+ <cn> 7 </cn>
+ </apply>
+ </apply>
+ </math>. Many readers will consider this the truth, but then,
+can we assume that the decimal notation is used?
+
+<formula>
+ <math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <cn> 10 </cn>
+ <apply> <plus/>
+ <cn> 3 </cn>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ </math>
+</formula>
+
+In many elementary math books, you can find expressions like the
+previous. Because in our daily life we use the decimal numbering system,
+we can safely assume that
+ <math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <ci> x </ci>
+ <cn> 7 </cn>
+ </apply>
+ </math>. But, without explicitly mentioning this boundary condition,
+more solutions are correct.
+
+<formula label="octal" sublabel="a">
+ <math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <cn> 10 </cn>
+ <apply> <plus/>
+ <cn> 3 </cn>
+ <cn> 5 </cn>
+ </apply>
+ </apply>
+ </math>
+</formula>
+
+In <textref label="octal">formula</textref> we see an at first sight
+wrong formula. But, if we tell you that octal numbers are used, your
+opinion may change instantly. A rather clean way out of this confusion
+is to extend the notation of numbers by explicitly mentioning the base.
+
+<subformula label="octal base" sublabel="b">
+ <math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <eq/>
+ <cn type="integer" base="8"> 10 </cn>
+ <apply> <plus/>
+ <cn type="integer" base="8"> 3 </cn>
+ <cn type="integer" base="8"> 5 </cn>
+ </apply>
+ </apply>
+ </math>
+</subformula>
+
+Of course, when a whole document is in octal notation, a proper
+introduction is better than annotated numbers as used in <textref
+label="octal base">formula</textref>.
+</document>
+\stopbuffer
+
+\blank \startnarrower \processxmlbuffer \stopnarrower \blank
+
+In terms of \XML\ this can look like:
+
+\typebuffer
+
+Math that is part of the text flow is automatically handled as inline math. If
+needed you can encapsulate the code in an \mmlelement {imath} environment.
+Display math is recognized as such when it is a separate paragraph, but since
+this is more a \TEX\ feature than an \XML\ one, you should encapsulate display
+math either in a \mmlelement {dmath} element or in a \mmlelement {formula} or
+\mmlelement {subformula} element.
+
+For a while you can use attribute \type {mode} with values \type {display} or
+\type {inline}. Recent \MATHML\ specifications provide the \type {display}
+attribute with values \type {block} or \type {inline}. We support both.
+
+\stopchapter
+
+\startchapter[title={Getting started}]
+
+A comfortable way to get accustomed to \MATHML\ is to make small documents of the
+following form:
+
+\starttyping
+\usemodule[mathml]
+
+\starttext
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <cos/>
+ <ci> x </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer
+
+\stoptext
+\stoptyping
+
+As you see, we can mix \MATHML\ with normal \TEX\ code. A document like this is
+processed in the normal way using the \type {context} command. If you also want
+to see the original code, you can say:
+
+\starttyping
+\usemodule[mathml]
+
+\starttext
+
+\startbuffer
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <cos/>
+ <ci> x </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\processxmlbuffer
+
+\typebuffer
+
+\stoptext
+\stoptyping
+
+Like \TEX\ and \METAPOST\ code, buffers can contain \MATHML\ code. The advantage
+of this method is that we only have to key in the data once. It also permits you
+to experiment with processing instructions.
+
+\starttyping
+\startbuffer[mml]
+<math xmlns="http://www.w3c.org/mathml" version="2.0">
+ <apply> <log/>
+ <logbase> <cn> 3.5 </cn> </logbase>
+ <ci> x </ci>
+ </apply>
+</math>
+\stopbuffer
+
+\startbuffer[pi]
+ <?context-mathml-directive log location right ?>
+\stopbuffer
+
+\processxmlbuffer[pi,mml]
+
+\startbuffer[pi]
+ <?context-mathml-directive log location left ?>
+\stopbuffer
+
+\processxmlbuffer[pi,mml]
+\stoptyping
+
+If you like coding your documents in \TEX\ but want to experiment with \MATHML,
+combining both languages in the way demonstrated here may be an option. When you
+provide enough structure in your \TEX\ code, converting a document to \XML\ is
+then not that hard to do. Where coding directly in \XML\ is kind of annoying,
+coding \MATHML\ is less cumbersome, because you can structure your formulas
+pretty well, especially since the fragments are small so that proper indentation
+is possible.
+
+\stopchapter
+
+\startchapter[title={Bidi}]
+
+Support for bidirectional math is not entirely trivial as it demands a font that
+supports it. When they were released, the stix fonts were not that useable and
+Khaled Hosny turned them into the xits fonts that are now quite complete and
+useable in an \OPENTYPE\ and \UNICODE\ environment. He also added support for
+right to left math.
+
+Normally you will only use that in a right to left typeset document, in which
+case you have a setup like this:
+
+\starttyping
+\setuptobodyfont
+ [xitsbidi]
+
+\setupalign
+ [r2l]
+
+\setupmathematics
+ [align=r2l]
+
+\starttext
+
+Some text.
+
+\startformula \sqrt{ف^2\over 4ب} \stopformula
+
+Some more text
+
+\stoptext
+\stoptyping
+
+As \MATHML\ has no global settings you need to control it specifically. At some
+point we might decide to provide some global flags but that depends on how the
+general bidi layout machinery evolves. Here we just stick to an example:
+
+\startbuffer[test]
+<math xmlns="http://www.w3.org/1998/Math/MathML" dir="rtl">
+ <msqrt>
+ <mfrac>
+ <msup><mi>ف</mi><mn>2</mn></sup>
+ <mrow><mn>4</mn><mi>ب</mi></mrow>
+ </mfrac>
+ </msqrt>
+</math>
+\stopbuffer
+
+\typebuffer[test]
+
+\start
+ \switchtobodyfont[xitsbidi]
+ \xmlprocessbuffer{main}{test}{}
+ \par
+\stop
+
+The order of input is still rather left to right which makes sense as we're sort
+of structuring the math input.
+
+\stopchapter
+
+\startchapter[title={OpenMath}]
+
+Because \OPENMATH\ is now a subset of \MATHML\ we can to some extend also support
+this coding. We do a straightforward remapping to content \MATHML\ so any
+rendering that is supported there is also supported in the equivalent \OPENMATH\
+code.
+
+\startbuffer
+<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">
+ <OMA> <OMS cd="relation1" name="eq"/>
+ <OMV name="y"/>
+ <OMA> <OMS cd="arith1" name="minus"/>
+ <OMA> <OMV name="f"/>
+ <OMV name="x"/>
+ </OMA>
+ <OMA> <OMV name="f"/>
+ <OMA> <OMS cd="arith1" name="minus"/>
+ <OMV name="x"/>
+ <OMI>1</OMI>
+ </OMA>
+ </OMA>
+ </OMA>
+ </OMA>
+</OMOBJ>
+\stopbuffer
+
+\processxmlbuffer \typebuffer
+
+Because in practice we may use a mixture of math encodings this can come in handy
+because it saves conversion of the \XML\ source.
+
+\stopchapter
+
+\startchapter[title={CalcMath}]
+
+We support two types of annotation markup: \TEX\ (\type {tex}) and what we call
+\quote {calculator math} (\type {calcmath}). The second type is also available
+directly. Inline calcmath is coded using the \mmlelement{icm} element.
+
+\startbuffer
+<document>
+ This is an inline formula <icm>sin(x^2+1/x)</icm> just to demonstrate
+ the idea of calculator math.
+</document>
+\stopbuffer
+
+\blank \noindentation \processxmlbuffer \typebuffer
+
+If one edits the \XML\ file directly this can type quite some coding. For more
+complex formulas one can revert to content \MATHML, or when interactivity is
+needed to \OPENMATH.
+
+The argument that one should use a dedicated editor for math instead is not that
+convincing for authors who have to key on lots of small snippets of math. And one
+can always transform this code in its more bloated variant. The calcmath
+converter is dedicated to Frits Spijkers, author of Dutch math schoolbooks and
+fluent in all those math encodings methods we force upon him. The code resembles
+that used in the calculators at schools and we used it in projects with computer
+aided feedback where students had to key in math. When there is demand for this
+input method we will provide more details.
+
+\stopchapter
+
+\startchapter[title={AsciiMath}]
+
+A few years back we included some basic support for \ASCIIMATH\ as a proof of
+concept not knowing that one day we were forced to fully support it in a project.
+In one of our projects \CONTEXT\ is the backend for generating math books for
+high school math. Input is \XML\ and math is coded in presentational \MATHML. We
+should say \quotation {was coded}, because in the Spring of 2014 another party in
+the project (the one responsible for the web part) converted the \MATHML\ into
+\ASCIIMATH\ on behalve of their web authoring tool.
+
+Where we would have chosen to use the \MATHML\ annotation attribute, they had
+chosen to flatten the structured \MATHML\ into less structured \ASCIIMATH. And
+there was no way back. We're talking of tens of thousands of files here.
+\footnote {Around the same time Google decided to drop native \MATHML\ support
+from Chrome so one might wonder why \MATHML\ was developed in the first place.}
+
+On the web \ASCIIMATH\ is mostly interpreted by MathJax's \JAVASCRIPT\ in
+combination with \CSS. Since we didn't want to depend on a \JAVASCRIPT\
+conversion in \CONTEXT\ we started to completely rewrite our \ASCIIMATH\ module.
+We also needed a bit more control in order to meet specific demands of the
+publisher, like formatting numbers, support for characters not in the normal
+repertoire, checking and tracing, and the speed of rendering had not to be
+affected.
+
+If you invoke the \ASCIIMATH\ module with \typ {\usemodule [asciimath]} the
+command \type {\asciimath{...}} is available for testing purposes. Within the
+curly brackets you can type an \ASCIIMATH\ expression.
+
+Normally an \ASCIIMATH\ expression in \XML|/|\HTML\ is enclosed by back-quotes:
+
+\startbuffer
+`x^2`
+\stopbuffer
+
+\typebuffer
+
+But we rather stick to the \XML\ like coding:
+
+\startbuffer
+<am>x^2</am>
+\stopbuffer
+
+\typebuffer
+
+This is equivalent to the \TEX\ command:
+
+\asciimath{x^2}
+
+The interpretation of such a formula is no problem. But let's give a few examples
+where \ASCIIMATH\ lacks structure or needs a (sometimes bizar) interpretation to
+obtain adequate rendering:
+
+\noindentation Behaviour of superscripts and subscripts depends on operator that
+preceeds a number or variable:
+
+\starttabulate
+\FL
+\NC \type{`sin^-1(x)`} \NC \asciimath{sin^-1(x)} \NC \NR
+\NC \type{`sin^+1(x)`} \NC \asciimath{sin^+1(x)} \NC \NR
+\LL
+\stoptabulate
+
+\noindentation A script can be either one character or a number made from more
+characters:
+
+\starttabulate
+\FL
+\NC \type{`int_a^b f(x)`} \NC \asciimath{int_a^b f(x)} \NC \NR
+\NC \type{`int_aa^bb f(x)`} \NC \asciimath{int_aa^bb f(x)} \NC \NR
+\NC \type{`int_1000^2000 f(x)`} \NC \asciimath{int_1000^2000 f(x)} \NC \NR
+\LL
+\stoptabulate
+
+\noindentation Behaviour of operator depends on character, where some characters
+have special meaning:
+
+\starttabulate
+\FL
+\NC \type{`d/dx`} \NC \asciimath{d/dx} \NC \NR
+\NC \type{`q/qx`} \NC \asciimath{q/qx} \NC \NR
+\LL
+\stoptabulate
+
+\noindentation Behaviour of the curly brackets is somewhat peculiar because at
+times they are not used for grouping anymore:
+
+\starttabulate
+\FL
+\NC \type{`{a/b}/{d/c}`} \NC \asciimath{{a/b}/{d/c}} \NC \NR
+\NC \type{`{a/b}//{d/c}`} \NC \asciimath{{a/b}//{d/c}} \NC \NR
+\LL
+\stoptabulate
+
+\noindentation Behaviour depends on sequence of scripts (solved in \CONTEXT):
+
+\starttabulate
+\FL
+\NC \type{`int_0^1 f(x)dx`} \NC \asciimath{int_0^1 f(x)dx} \NC \NR
+\NC \type{`int^1_0 f(x)dx`} \NC \asciimath{int^1 text(_)0 f(x)dx} \NC \NR
+\LL
+\stoptabulate
+
+During the development of the \ASCIIMATH\ support we used the MathJax interpretor
+as a reference since that is available on the web. At the time of writing
+documentation was limited so some trial and error was involved in writing the
+parser. As usual we started from examples. Below we give a number of those
+examples so you can familiarize yourself with \ASCIIMATH. Note that you can use
+\TEX||like math coding and even use the backslash, but be warned for unexpected
+behaviour. In a webpage backticks are used to indicate \ASCIIMATH.
+
+\startlines
+\ExampleLine{sqrt-3ax}
+\ExampleLine{sqrt(-3ax)}
+\ExampleLine{root(3)(ax)}
+\ExampleLine{x^2+y_1+z_12^3}
+\ExampleLine{sin^-1(x)}
+\ExampleLine{d/dx f(x)=lim_(h->0) (f(x+h)-f(x))/h}
+\ExampleLine{f(x)=sum_(n=0)^oo(f^((n))(a))/(n!)(x-a)^n}
+\ExampleLine{int_0^1 f(x)dx}
+\ExampleLine{int^1_0 f(x)dx}
+\ExampleLine{a//b}
+\ExampleLine{a//\alpha}
+\ExampleLine{(a/b)/(d/c)}
+\ExampleLine{((a*b))/(d/c)}
+\ExampleLine{(a/b)/(c/d)={:(ad)/(bd):}/{:(bc)/(bd):}=(ad)/(bc)=(ad)/(bc)}
+\ExampleLine{a/b//c/d=(ad)/(bd)//(bc)/(bd)=ad//bc=(ad)/(bc)}
+\ExampleLine{[[a,b],[c,d]]((n),(k))}
+\ExampleLine{1/x={(1,text{if } x!=0),(text(undefined), text(if ) x=0):}}
+\ExampleLine{<<a,b>> text{ and } [ (x,y),(u,v) ] }
+\ExampleLine{(a,b] = {x in RR | a < x <= b}}
+\ExampleLine{langle larr ; 0,4]}
+\ExampleLine{〈← ; 0,4]}
+\ExampleLine{[0 , rarr rangle}
+\ExampleLine{[0 , →〉}
+\ExampleLine{5/|CD|=8/5}
+\ExampleLine{|MD|/|CD|=|AD|/|MD|}
+\ExampleLine{x lt 4 vv x gt 1}
+\ExampleLine{x \lt 4 vv x \gt 1}
+\ExampleLine{x &lt; 4 vv x &gt; 1} % Hans: werkt niet goed; wel op http://www.wjagray.co.uk/maths/ASCIIMathTutorial.html
+\ExampleLine{lim_(x→∞)1/x=0}
+\ExampleLine{text(D)_(f)}
+\ExampleLine{p _|_ q}
+\ExampleLine{g·g· stackrel (text(n times) ) (...·g)}
+\ExampleLine{stackrel(+)(\rightarrow)}
+\ExampleLine{stackrel(+)(rightarrow)} % Hans: werkt niet goed; wel op http://www.wjagray.co.uk/maths/ASCIIMathTutorial.html
+\ExampleLine{((a_(11),cdots,a_(1n)),(vdots,ddots,vdots),(a_(m1),cdots,a_(mn)))}
+\stoplines
+
+Unfortunately \ASCIIMATH\ can be unpredictable which is a side effect of the fact that a
+high degree of tolerance is built in. We strongly advice to use spaces to make your
+results predictable.
+
+\startlines
+\ExampleLine{o ox x = xo}
+\ExampleLine{a ax x = xa}
+\ExampleLine{ooxx=xo}
+\ExampleLine{aaxx=xa}
+\stoplines
+
+One of the properties is that \TEX\ commands are supported, that is,. with a few
+exceptions: \type {P} and \type {S} don't produce $\P$ and $\S$. Also, don't
+confuse these symbols with the entities supported by \MATHML: in \ASCIIMATH\
+\type{circ} is circle and not a circumflex. Also, \type {&lt;}, \type {&gt;} are
+converted into \asciimath {&lt;} and \asciimath {&gt;} while \type {&amp;}
+becomes \asciimath{&amp;}. As usual with input formats that start out simple, in
+the end they become so complex that one can wonder why to use them. It is the
+usual problem of using one system for everything.
+
+The following examples are similar to the once shown elsewhere in this document.
+
+\startsubsubject[title=derivatives]
+
+\ExampleLine{(da)/(dx) = 0}
+\ExampleLine{dx/dx = 0}
+\ExampleLine{(d(au))/(dx) = a (du)/(dx)}
+\ExampleLine{(d(u+v+w))/(dx) = (du)/(dx) + (dv)/(dx) + (dw)/(dx)}
+\ExampleLine{(d(uv))/(dx) = u (du)/(dx) + v (dv)/(dx)}
+\ExampleLine{(d(uvw))/(dx) = vw(du)/(dx) + uw(dv)/(dx) + uv(dw)/(dx)}
+\ExampleLine{(d(u/v))/(dx) = (v(du)/(dx) - u(dv)/(dx) ) / (v^2) = 1/v (du)/(dx) - u/v^2 (dv)/(dx)}
+\ExampleLine{(d(u^n))/(dx) = n(u)^(n-1) (dv)/(dx)}
+\ExampleLine{(d sqrt(u))/(dx) = 1/(2 sqrt(u)) (du)/(dx) }
+\ExampleLine{(d(1/u))/(dx) = - 1/u^2 (du)/(dx)}
+\ExampleLine{(d(1/(u^n)))/(dx) = - n/u^(n+1) (du)/(dx)}
+\ExampleLine{(d log (u + sqrt(u^2+1)))/(dx) = 1/(sqrt(u^2 + 1)) (du)/(dx) }
+
+\stopsubsubject
+
+\startsubsubject[title=integral]
+
+\ExampleLine{int (1 / (x sqrt(a^2 +- x^2) ) ) dx = - 1/a log (a + sqrt(a^2 +- x^2)) / x}
+\ExampleLine{int (1 / ( a + bx^2) ) = 1 / (2 sqrt(-ab)) log (a + x sqrt(-ab) ) / (a - x sqrt(-ab) ) vv 1 / sqrt(-ab) tanh^(-1) (x sqrt (-ab)) / a}
+\ExampleLine{int ( 1 / (cos(ax) (1 +- sin(ax)) ) ) dx = ( 1 / (2a( 1 +- sin(ax) )) ) + 1 / (2a) log tan(pi/4 + (ax)/2)}
+
+\stopsubsubject
+
+\startsubsubject[title=series]
+
+\ExampleLine{1 - 1/3 + 1/5 - 1/7 + cdots = pi/4}
+\ExampleLine{1 + 1/2^2 + 1/3^2 + 1/4^2 + cdots = pi^2/6}
+\ExampleLine{1 - 1/2^2 + 1/3^2 - 1/4^2 + cdots = pi^2/12}
+\ExampleLine{AA x in RR | e^x = 1 + x + x^2/(2!) + x^3/(3!) + cdots + x^n/(n!)}
+\ExampleLine{AA x in RR | e^(text(-)x) = 1 - x + x^2/(2!) - x^3/(3!) + cdots + (text(-)1^n)x^n/(n!)}
+
+\stopsubsubject
+
+\startsubsubject[title=logs]
+
+\ExampleLine{AA a > 0 ^^ b > 0 | {:log_g:} a + {:log_g:} b}
+\ExampleLine{AA a > 0 ^^ b > 0 | {:log_g:} a/b = {:log_g:} a - {:log_g:} b}
+\ExampleLine{AA b in RR ^^ a > 0 | {:log_g:} a^b = b {:log_g:} a}
+\ExampleLine{AA a > 0 | {:log_g:} a = ({:log_p:} a) / ({:log_p:} g)}
+
+\stopsubsubject
+
+\startsubsubject[title=goniometrics]
+
+\ExampleLine{sin(x+y) = sinx cosy + cosx siny}
+\ExampleLine{sin(x-y) = sinx cosy - cosx siny}
+\ExampleLine{sin(x+y) = cosx cosy - sinx siny}
+\ExampleLine{sin(x-y) = cosx cosy + sinx siny}
+\ExampleLine{tan(x+y) = (tanx + tany) / (1 - tanx tany)}
+\ExampleLine{tan(x-y) = (tanx - tany) / (1 + tanx tany)}
+\ExampleLine{sinp + sinq = 2 sin (p+q)/2 cos (p-q)/2}
+\ExampleLine{sinp - sinq = 2 cos (p+q)/2 sin (p-q)/2}
+\ExampleLine{cosp + cosq = 2 cos (p+q)/2 cos (p-q)/2}
+\ExampleLine{2 cos alpha cos beta = cos(alpha + beta) + cos(alpha - beta)}
+\ExampleLine{-2 sin alpha cos beta = sin(alpha + beta) - sin(alpha - beta)}
+\ExampleLine{AA ∆ ABC | a / (sin alpha) + b / (sin beta) + c / (sin gamma)}
+\ExampleLine{AA ∆ ABC | {:(a^2 = b^2 + c^2 - 2bc cos alpha),(b^2 = a^2 + c^2 - 2ac cos beta),(c^2 = a^2 + b^2 - 2ab cos gamma):}}
+
+\stopsubsubject
+
+\startsubsubject[title=statistics]
+
+\ExampleLine{bar x = 1/n sum x_i}
+\ExampleLine{sigma (x) ~~ sqrt ((x_i - (bar x)^2) / (n-1) )}
+\ExampleLine{sigma (x)^2 ~~ bar ((x_i - bar x)^2) = 1/(n-1) sum (x_i - bar x)^2}
+
+\stopsubsubject
+
+\startsubsubject[title=matrices]
+
+\ExampleLine{|{:(sin alpha,cos alpha),(sin beta,cos beta):}| = sin (alpha - beta)}
+\ExampleLine{|I| = | {: (1,0),(0,1):}| = 1}
+
+\stopsubsubject
+
+\stopchapter
+
+\startchapter[title={A few examples}]
+
+\setups[showexamples]
+
+\startsection[title={derivatives}] \getbuffer[derivates] \stopsection
+\startsection[title={integrals}] \getbuffer[integrals] \stopsection
+\startsection[title={series}] \getbuffer[series] \stopsection
+\startsection[title={logs}] \getbuffer[logs] \stopsection
+\startsection[title={goniometrics}] \getbuffer[goniometrics] \stopsection
+\startsection[title={statistics}] \getbuffer[statistics] \stopsection
+\startsection[title={matrices}] \getbuffer[matrices] \stopsection
+
+\stopchapter
+
+\startchapter[title={Unicode Math}]
+
+\startsection[title={entities}]
+
+Support for \MATHML\ showed up in \CONTEXT\ by the end of second millenium. The
+first more or less complete version of this manual dates from the end of 1999. At
+that time \UNICODE\ math was no fact yet and entities were the way to get special
+symbols done. Mapping the names of symbols onto something that could be rendered
+was up to the \XML\ processors and typesetting engine.
+
+Nowadays we can use \UNICODE\ directly although it has the drawback that not all
+editing applications show the corresponding shapes. It is for this reason that
+entities will have their use for a while. In the next table we see the official
+ones. The table is actually larger, but we only show the shapes that have a math
+property in the \CONTEXT\ character database. The full list is supported and can
+be found in the following documents:
+
+\starttyping
+http://www.w3.org/2003/entities/2007/w3centities-f.ent
+http://www.w3.org/2003/entities/2007/htmlmathml-f.ent
+\stoptyping
+
+\blank \showmathentities
+
+\stopsection
+
+\startsection[title={properties}]
+
+\noindentation A different way to look at this is \UNICODE\ itself. Here's the
+list of characters that have a math related property in \CONTEXT.
+
+\blank \showmathcharacters
+
+\stopsection
+
+\startsection[title={alphabets}]
+
+Traditionally (in \TEX) one enters \ASCII\ characters to represent identifiers
+and use a font switch to get for instance a bold rendering. In \UNICODE\ it is
+more natural to use code points that represent the meaning. So, instead if
+enterinf
+
+So instead of keying in byte \type {U+0058} for a bold \type {x} one will use an
+\UTF\ sequence representing \type {U+1D431}. Because there are not than many
+editors that show all those \UNICODE\ characters it still makes sense to use
+regular latin and greek alphabets combined with directives that tell what real
+alphabet is used. For \CONTEXT\ it does not matter what approach is chosen: both
+work ok and internally characters are mapped onto the right slot. When a font
+does not provide a shape a fallback is chosen. Technically one can construct a
+complete math font by combining all kind of fonts, but this is normally not
+needed.
+
+Here we show the combinations of styles and alternatives. Not all combinations
+are present in \UNICODE. Actually, as \UNICODE\ math is rather agnostic of
+cultural determined math rendering, at some point \CONTEXT\ could provide more.
+\footnote {An example is the German handwriting style Suetterlin that is still
+used for vectors.} Also, modern \OPENTYPE\ fonts can have alternatives, for
+instance variants of script, blackboard or fraktur. This is not related to
+\UNICODE\ and it makes no sense to encode that in \MATHML, but a setup of the
+rendering.
+
+\blank \showmathalphabets
+
+\stopsection
+
+\startsection[title={scripts}]
+
+Glyphs (traditionally) come in three sizes. The script and scriptscript sizes can
+be downscaled from text size but most math fonts have additional glyphs tuned for
+smaller sizes. The next table shows some of this.
+
+\blank \showmathscripts
+
+\stopsection
+
+\startsection[title={bold}]
+
+There are two ways to look at bold math. First there are bold alphabets and bold
+symbols and these have some meaning. Then there is what we can best call boldened
+math that is used in section titles and such. The normal bold then becomes heavy.
+The next table shows (for the font used here) what bold shapes are available.
+
+\blank \showmathbold
+
+\stopsection
+
+\stopchapter
+
+\stopbodymatter
+
+\stoptext
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-001.xml b/doc/context/sources/general/mathml/mathml/pc-d-001.xml
new file mode 100644
index 000000000..d7997f5fd
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-001.xml
@@ -0,0 +1,9 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> a </ci>
+ </apply>
+ <ci> 0 </ci>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-002.xml b/doc/context/sources/general/mathml/mathml/pc-d-002.xml
new file mode 100644
index 000000000..1d93d97bc
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-002.xml
@@ -0,0 +1,9 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> x </ci>
+ </apply>
+ <cn> 1 </cn>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-003.xml b/doc/context/sources/general/mathml/mathml/pc-d-003.xml
new file mode 100644
index 000000000..9e2b391fe
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-003.xml
@@ -0,0 +1,18 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <times/>
+ <ci> a </ci>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <ci> a </ci>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-004.xml b/doc/context/sources/general/mathml/mathml/pc-d-004.xml
new file mode 100644
index 000000000..ef2d5490e
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-004.xml
@@ -0,0 +1,26 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <plus/>
+ <ci> u </ci>
+ <ci> v </ci>
+ <ci> w </ci>
+ </apply>
+ </apply>
+ <apply> <plus/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> u </ci>
+ </apply>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> v </ci>
+ </apply>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> w </ci>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-005.xml b/doc/context/sources/general/mathml/mathml/pc-d-005.xml
new file mode 100644
index 000000000..1e1fc90ca
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-005.xml
@@ -0,0 +1,27 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <times/>
+ <ci> u </ci>
+ <ci> v </ci>
+ </apply>
+ </apply>
+ <apply> <plus/>
+ <apply> <times/>
+ <ci> u </ci>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <ci> v </ci>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> v </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math>
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-006.xml b/doc/context/sources/general/mathml/mathml/pc-d-006.xml
new file mode 100644
index 000000000..aaaf2c082
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-006.xml
@@ -0,0 +1,38 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <times/>
+ <ci> u </ci>
+ <ci> v </ci>
+ <ci> w </ci>
+ </apply>
+ </apply>
+ <apply> <plus/>
+ <apply> <times/>
+ <ci> v </ci>
+ <ci> w </ci>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <ci> u </ci>
+ <ci> w </ci>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> v </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <ci> u </ci>
+ <ci> v </ci>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> w </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math>
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-007.xml b/doc/context/sources/general/mathml/mathml/pc-d-007.xml
new file mode 100644
index 000000000..b1b3617e1
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-007.xml
@@ -0,0 +1,58 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <divide/>
+ <ci> u </ci>
+ <ci> v </ci>
+ </apply>
+ </apply>
+ <apply> <divide/>
+ <apply> <minus/>
+ <apply> <times/>
+ <ci> v </ci>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <ci> u </ci>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> v </ci>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <power/>
+ <ci> v </ci>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <apply> <times/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <ci> v </ci>
+ </apply>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <apply> <divide/>
+ <cn> u </cn>
+ <apply> <power/>
+ <ci> v </ci>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> v </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-008.xml b/doc/context/sources/general/mathml/mathml/pc-d-008.xml
new file mode 100644
index 000000000..9c0b36aed
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-008.xml
@@ -0,0 +1,25 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <power/>
+ <ci> u </ci>
+ <ci> n </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <ci> n </ci>
+ <apply> <power/>
+ <ci> u </ci>
+ <apply> <minus/>
+ <ci> n </ci>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-009.xml b/doc/context/sources/general/mathml/mathml/pc-d-009.xml
new file mode 100644
index 000000000..63fcc3c09
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-009.xml
@@ -0,0 +1,25 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <root/>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <apply> <root/>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-010.xml b/doc/context/sources/general/mathml/mathml/pc-d-010.xml
new file mode 100644
index 000000000..b4d50b2ae
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-010.xml
@@ -0,0 +1,26 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <apply> <minus/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <power/>
+ <ci> u </ci>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-011.xml b/doc/context/sources/general/mathml/mathml/pc-d-011.xml
new file mode 100644
index 000000000..9b1b99068
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-011.xml
@@ -0,0 +1,32 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <power/>
+ <ci> u </ci>
+ <cn> n </cn>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <apply> <minus/>
+ <apply> <divide/>
+ <ci> n </ci>
+ <apply> <power/>
+ <ci> u </ci>
+ <apply> <plus/>
+ <ci> n </ci>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-043.xml b/doc/context/sources/general/mathml/mathml/pc-d-043.xml
new file mode 100644
index 000000000..4e9920ad3
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-043.xml
@@ -0,0 +1,47 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <inverse/>
+ <apply> <sinh/>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <log/>
+ <apply> <plus/>
+ <ci> u </ci>
+ <apply> <root/>
+ <apply> <plus/>
+ <apply> <power/>
+ <ci> u </ci>
+ <cn> 2 </cn>
+ </apply>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <root/>
+ <apply> <plus/>
+ <apply> <power/>
+ <ci> u </ci>
+ <cn> 2 </cn>
+ </apply>
+ <cn> 1 </cn>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <diff/>
+ <bvar> <ci> x </ci> </bvar>
+ <ci> u </ci>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-d-051.xml b/doc/context/sources/general/mathml/mathml/pc-d-051.xml
new file mode 100644
index 000000000..e7cc25f1b
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-d-051.xml
@@ -0,0 +1,17 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <diff/>
+ <bvar> <ci> a </ci> </bvar>
+ <apply> <int/>
+ <lowlimit> <ci> p </ci> </lowlimit>
+ <uplimit> <ci> q </ci> </uplimit>
+ <bvar> <ci> x </ci> </bvar>
+ <apply>
+ <fn> <ci> f </ci> </fn>
+ <ci> x </ci>
+ <ci> a </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-i-022.xml b/doc/context/sources/general/mathml/mathml/pc-i-022.xml
new file mode 100644
index 000000000..115d8ddc8
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-i-022.xml
@@ -0,0 +1,52 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <int/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <times/>
+ <ci> x </ci>
+ <apply> <root/>
+ <apply> <fn> <ci> &plusminus; </ci> </fn>
+ <apply> <power/>
+ <ci> a </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <power/>
+ <ci> x </ci>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <apply> <times/>
+ <apply> <divide/>
+ <cn> 1 </cn> <ci> a </ci>
+ </apply>
+ <apply> <log/>
+ <apply> <divide/>
+ <apply> <plus/>
+ <ci> a </ci>
+ <apply> <root/>
+ <apply> <fn> <ci> &plusminus; </ci> </fn>
+ <apply> <power/>
+ <ci> a </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <power/>
+ <ci> x </ci>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-i-380.xml b/doc/context/sources/general/mathml/mathml/pc-i-380.xml
new file mode 100644
index 000000000..ae6493b9c
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-i-380.xml
@@ -0,0 +1,73 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <int/>
+ <bvar> <ci> x </ci> </bvar>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <times/>
+ <apply> <cos/>
+ <apply> <times/>
+ <ci> a </ci>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ <apply> <fn> <ci> &plusminus; </ci> </fn>
+ <cn> 1 </cn>
+ <apply> <sin/>
+ <apply> <times/>
+ <ci> a </ci>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <plus/>
+ <apply> <fn> <ci> &minusplus; </ci> </fn>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <ci> a </ci>
+ <apply> <fn> <ci> &plusminus; </ci> </fn>
+ <cn> 1 </cn>
+ <apply> <sin/>
+ <apply> <times/>
+ <ci> a </ci>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <ci> a </ci>
+ </apply>
+ </apply>
+ <apply> <log/>
+ <apply> <tan/>
+ <apply> <plus/>
+ <apply> <divide/>
+ <ci> &pi; </ci>
+ <cn> 4 </cn>
+ </apply>
+ <apply> <divide/>
+ <apply> <times/>
+ <ci> a </ci>
+ <ci> x </ci>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-s-001.xml b/doc/context/sources/general/mathml/mathml/pc-s-001.xml
new file mode 100644
index 000000000..ec4f890f0
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-s-001.xml
@@ -0,0 +1,28 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <plus/>
+ <cn> 1 </cn>
+ <apply> <minus/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <cn> 3 </cn>
+ </apply>
+ </apply>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <cn> 5 </cn>
+ </apply>
+ <apply> <minus/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <cn> 7 </cn>
+ </apply>
+ </apply>
+ <ci> &cdots; </ci>
+ </apply>
+ <apply> <divide/>
+ <ci> &pi; </ci>
+ <cn> 4 </cn>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-s-002.xml b/doc/context/sources/general/mathml/mathml/pc-s-002.xml
new file mode 100644
index 000000000..86c2368b9
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-s-002.xml
@@ -0,0 +1,36 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <plus/>
+ <cn> 1 </cn>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <power/>
+ <cn> 2 </cn>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <power/>
+ <cn> 3 </cn>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <power/>
+ <cn> 4 </cn>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <ci> &cdots; </ci>
+ </apply>
+ <apply> <divide/>
+ <apply> <power/>
+ <ci> &pi; </ci>
+ <cn> 2 </cn>
+ </apply>
+ <cn> 6 </cn>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/pc-s-003.xml b/doc/context/sources/general/mathml/mathml/pc-s-003.xml
new file mode 100644
index 000000000..fbe38e40f
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/pc-s-003.xml
@@ -0,0 +1,40 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <plus/>
+ <cn> 1 </cn>
+ <apply> <minus/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <power/>
+ <cn> 2 </cn>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <power/>
+ <cn> 3 </cn>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <apply> <divide/>
+ <cn> 1 </cn>
+ <apply> <power/>
+ <cn> 4 </cn>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ <ci> &cdots; </ci>
+ </apply>
+ <apply> <divide/>
+ <apply> <power/>
+ <ci> &pi; </ci>
+ <cn> 2 </cn>
+ </apply>
+ <cn> 12 </cn>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-001.xml b/doc/context/sources/general/mathml/mathml/wh-g-001.xml
new file mode 100644
index 000000000..bd8935150
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-001.xml
@@ -0,0 +1,28 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <sin/>
+ <apply> <plus/>
+ <ci> x </ci>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ <apply> <plus/>
+ <apply> <times/>
+ <apply> <sin/>
+ <ci> x </ci>
+ </apply>
+ <apply> <cos/>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <apply> <cos/>
+ <ci> x </ci>
+ </apply>
+ <apply> <sin/>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-002.xml b/doc/context/sources/general/mathml/mathml/wh-g-002.xml
new file mode 100644
index 000000000..cfa3cf1a8
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-002.xml
@@ -0,0 +1,28 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <sin/>
+ <apply> <minus/>
+ <ci> x </ci>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <apply> <times/>
+ <apply> <sin/>
+ <ci> x </ci>
+ </apply>
+ <apply> <cos/>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <apply> <cos/>
+ <ci> x </ci>
+ </apply>
+ <apply> <sin/>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-003.xml b/doc/context/sources/general/mathml/mathml/wh-g-003.xml
new file mode 100644
index 000000000..4ed5bdddf
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-003.xml
@@ -0,0 +1,28 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <cos/>
+ <apply> <plus/>
+ <ci> x </ci>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <apply> <times/>
+ <apply> <cos/>
+ <ci> x </ci>
+ </apply>
+ <apply> <cos/>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <apply> <sin/>
+ <ci> x </ci>
+ </apply>
+ <apply> <sin/>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-004.xml b/doc/context/sources/general/mathml/mathml/wh-g-004.xml
new file mode 100644
index 000000000..a981decdb
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-004.xml
@@ -0,0 +1,28 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <cos/>
+ <apply> <minus/>
+ <ci> x </ci>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ <apply> <plus/>
+ <apply> <times/>
+ <apply> <cos/>
+ <ci> x </ci>
+ </apply>
+ <apply> <cos/>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <apply> <sin/>
+ <ci> x </ci>
+ </apply>
+ <apply> <sin/>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-005.xml b/doc/context/sources/general/mathml/mathml/wh-g-005.xml
new file mode 100644
index 000000000..3618ae4fe
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-005.xml
@@ -0,0 +1,31 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <tan/>
+ <apply> <plus/>
+ <ci> x </ci>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ <apply> <divide/>
+ <apply> <plus/>
+ <apply> <tan/>
+ <ci> x </ci>
+ </apply>
+ <apply> <tan/>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <cn> 1 </cn>
+ <apply> <times/>
+ <apply> <tan/>
+ <ci> x </ci>
+ </apply>
+ <apply> <tan/>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-006.xml b/doc/context/sources/general/mathml/mathml/wh-g-006.xml
new file mode 100644
index 000000000..7438cc96d
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-006.xml
@@ -0,0 +1,31 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <tan/>
+ <apply> <minus/>
+ <ci> x </ci>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ <apply> <divide/>
+ <apply> <minus/>
+ <apply> <tan/>
+ <ci> x </ci>
+ </apply>
+ <apply> <tan/>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ <apply> <plus/>
+ <cn> 1 </cn>
+ <apply> <times/>
+ <apply> <tan/>
+ <ci> x </ci>
+ </apply>
+ <apply> <tan/>
+ <ci> y </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-007.xml b/doc/context/sources/general/mathml/mathml/wh-g-007.xml
new file mode 100644
index 000000000..98050709f
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-007.xml
@@ -0,0 +1,33 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <plus/>
+ <apply> <sin/>
+ <ci> p </ci>
+ </apply>
+ <apply> <sin/>
+ <ci> q </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <apply> <sin/>
+ <apply> <divide/>
+ <apply> <plus/>
+ <ci> p </ci>
+ <ci> q </ci>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <cos/>
+ <apply> <divide/>
+ <apply> <minus/>
+ <ci> p </ci>
+ <ci> q </ci>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-008.xml b/doc/context/sources/general/mathml/mathml/wh-g-008.xml
new file mode 100644
index 000000000..3696b239b
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-008.xml
@@ -0,0 +1,33 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <minus/>
+ <apply> <sin/>
+ <ci> p </ci>
+ </apply>
+ <apply> <sin/>
+ <ci> q </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <apply> <cos/>
+ <apply> <divide/>
+ <apply> <plus/>
+ <ci> p </ci>
+ <ci> q </ci>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <sin/>
+ <apply> <divide/>
+ <apply> <minus/>
+ <ci> p </ci>
+ <ci> q </ci>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-009.xml b/doc/context/sources/general/mathml/mathml/wh-g-009.xml
new file mode 100644
index 000000000..a27329902
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-009.xml
@@ -0,0 +1,33 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <plus/>
+ <apply> <cos/>
+ <ci> p </ci>
+ </apply>
+ <apply> <cos/>
+ <ci> q </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <apply> <cos/>
+ <apply> <divide/>
+ <apply> <plus/>
+ <ci> p </ci>
+ <ci> q </ci>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <cos/>
+ <apply> <divide/>
+ <apply> <minus/>
+ <ci> p </ci>
+ <ci> q </ci>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-010.xml b/doc/context/sources/general/mathml/mathml/wh-g-010.xml
new file mode 100644
index 000000000..4860ed243
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-010.xml
@@ -0,0 +1,35 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <minus/>
+ <apply> <cos/>
+ <ci> p </ci>
+ </apply>
+ <apply> <cos/>
+ <ci> q </ci>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <apply> <sin/>
+ <apply> <divide/>
+ <apply> <plus/>
+ <ci> p </ci>
+ <ci> q </ci>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <sin/>
+ <apply> <divide/>
+ <apply> <minus/>
+ <ci> p </ci>
+ <ci> q </ci>
+ </apply>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-011.xml b/doc/context/sources/general/mathml/mathml/wh-g-011.xml
new file mode 100644
index 000000000..d3452b32a
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-011.xml
@@ -0,0 +1,27 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <apply> <sin/>
+ <ci> &alpha; </ci>
+ </apply>
+ <apply> <cos/>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ <apply> <plus/>
+ <apply> <sin/>
+ <apply> <plus/>
+ <ci> &alpha; </ci>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ <apply> <sin/>
+ <apply> <minus/>
+ <ci> &alpha; </ci>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-012.xml b/doc/context/sources/general/mathml/mathml/wh-g-012.xml
new file mode 100644
index 000000000..55b1be31e
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-012.xml
@@ -0,0 +1,27 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <apply> <cos/>
+ <ci> &alpha; </ci>
+ </apply>
+ <apply> <sin/>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <apply> <sin/>
+ <apply> <plus/>
+ <ci> &alpha; </ci>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ <apply> <sin/>
+ <apply> <minus/>
+ <ci> &alpha; </ci>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-013.xml b/doc/context/sources/general/mathml/mathml/wh-g-013.xml
new file mode 100644
index 000000000..25048092b
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-013.xml
@@ -0,0 +1,27 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <apply> <cos/>
+ <ci> &alpha; </ci>
+ </apply>
+ <apply> <cos/>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ <apply> <plus/>
+ <apply> <cos/>
+ <apply> <plus/>
+ <ci> &alpha; </ci>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ <apply> <cos/>
+ <apply> <minus/>
+ <ci> &alpha; </ci>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-014.xml b/doc/context/sources/general/mathml/mathml/wh-g-014.xml
new file mode 100644
index 000000000..196271fbe
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-014.xml
@@ -0,0 +1,29 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <eq/>
+ <apply> <minus/>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <apply> <sin/>
+ <ci> &alpha; </ci>
+ </apply>
+ <apply> <cos/>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <apply> <sin/>
+ <apply> <plus/>
+ <ci> &alpha; </ci>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ <apply> <sin/>
+ <apply> <minus/>
+ <ci> &alpha; </ci>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-015.xml b/doc/context/sources/general/mathml/mathml/wh-g-015.xml
new file mode 100644
index 000000000..1b146e640
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-015.xml
@@ -0,0 +1,32 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <forall/>
+ <condition>
+ <mrow>
+ <mi> &bigtriangleup; </mi>
+ <mi> A </mi>
+ <mi> B </mi>
+ <mi> C </mi>
+ </mrow>
+ </condition>
+ <apply> <plus/>
+ <apply> <divide/>
+ <ci> a </ci>
+ <apply> <sin/>
+ <ci> &alpha; </ci>
+ </apply>
+ </apply>
+ <apply> <divide/>
+ <ci> b </ci>
+ <apply> <sin/>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ <apply> <divide/>
+ <ci> c </ci>
+ <apply> <sin/>
+ <ci> &gamma; </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math>
diff --git a/doc/context/sources/general/mathml/mathml/wh-g-016.xml b/doc/context/sources/general/mathml/mathml/wh-g-016.xml
new file mode 100644
index 000000000..deae671b5
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-g-016.xml
@@ -0,0 +1,90 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <forall/>
+ <condition>
+ <mrow>
+ <mi> &bigtriangleup; </mi>
+ <mi> A </mi>
+ <mi> B </mi>
+ <mi> C </mi>
+ </mrow>
+ </condition>
+ <apply> <eq/>
+ <apply> <power/>
+ <ci> a </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <plus/>
+ <apply> <power/>
+ <ci> b </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <power/>
+ <ci> c </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <minus/>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <ci> b </ci>
+ <ci> c </ci>
+ <apply> <cos/>
+ <ci> &alpha; </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <eq/>
+ <apply> <power/>
+ <ci> b </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <plus/>
+ <apply> <power/>
+ <ci> a </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <power/>
+ <ci> c </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <minus/>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <ci> a </ci>
+ <ci> c </ci>
+ <apply> <cos/>
+ <ci> &beta; </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ <apply> <eq/>
+ <apply> <power/>
+ <ci> c </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <plus/>
+ <apply> <power/>
+ <ci> a </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <power/>
+ <ci> b </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <minus/>
+ <apply> <times/>
+ <cn> 2 </cn>
+ <ci> a </ci>
+ <ci> b </ci>
+ <apply> <cos/>
+ <ci> &gamma; </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math>
diff --git a/doc/context/sources/general/mathml/mathml/wh-l-001.xml b/doc/context/sources/general/mathml/mathml/wh-l-001.xml
new file mode 100644
index 000000000..00ea756c6
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-l-001.xml
@@ -0,0 +1,35 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <forall/>
+ <condition>
+ <apply> <and/>
+ <apply> <gt/>
+ <ci> a </ci>
+ <cn> 0 </cn>
+ </apply>
+ <apply> <gt/>
+ <ci> b </ci>
+ <cn> 0 </cn>
+ </apply>
+ </apply>
+ </condition>
+ <apply> <eq/>
+ <apply> <log/>
+ <logbase> <ci> g </ci> </logbase>
+ <apply> <times/>
+ <ci> a </ci>
+ <ci> b </ci>
+ </apply>
+ </apply>
+ <apply> <plus/>
+ <apply> <log/>
+ <logbase> <ci> g </ci> </logbase>
+ <ci> a </ci>
+ </apply>
+ <apply> <log/>
+ <logbase> <ci> g </ci> </logbase>
+ <ci> b </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-l-002.xml b/doc/context/sources/general/mathml/mathml/wh-l-002.xml
new file mode 100644
index 000000000..5afc5f164
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-l-002.xml
@@ -0,0 +1,35 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <forall/>
+ <condition>
+ <apply> <and/>
+ <apply> <gt/>
+ <ci> a </ci>
+ <cn> 0 </cn>
+ </apply>
+ <apply> <gt/>
+ <ci> b </ci>
+ <cn> 0 </cn>
+ </apply>
+ </apply>
+ </condition>
+ <apply> <eq/>
+ <apply> <log/>
+ <logbase> <ci> g </ci> </logbase>
+ <apply> <divide/>
+ <ci> a </ci>
+ <ci> b </ci>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <apply> <log/>
+ <logbase> <ci> g </ci> </logbase>
+ <ci> a </ci>
+ </apply>
+ <apply> <log/>
+ <logbase> <ci> g </ci> </logbase>
+ <ci> b </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-l-003.xml b/doc/context/sources/general/mathml/mathml/wh-l-003.xml
new file mode 100644
index 000000000..673ca36aa
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-l-003.xml
@@ -0,0 +1,32 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <forall/>
+ <condition>
+ <apply> <and/>
+ <apply> <in/>
+ <ci> b </ci>
+ <ci> &reals; </ci>
+ </apply>
+ <apply> <gt/>
+ <ci> a </ci>
+ <cn> 0 </cn>
+ </apply>
+ </apply>
+ </condition>
+ <apply> <eq/>
+ <apply> <log/>
+ <logbase> <ci> g </ci> </logbase>
+ <apply> <power/>
+ <ci> a </ci>
+ <ci> b </ci>
+ </apply>
+ </apply>
+ <apply> <times/>
+ <ci> b </ci>
+ <apply> <log/>
+ <logbase> <ci> g </ci> </logbase>
+ <ci> a </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-l-004.xml b/doc/context/sources/general/mathml/mathml/wh-l-004.xml
new file mode 100644
index 000000000..bf4e51c0c
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-l-004.xml
@@ -0,0 +1,28 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <forall/>
+ <condition>
+ <apply> <and/>
+ <apply> <gt/>
+ <ci> a </ci>
+ <cn> 0 </cn>
+ </apply>
+ </apply>
+ </condition>
+ <apply> <eq/>
+ <apply> <log/>
+ <logbase> <ci> g </ci> </logbase>
+ <ci> a </ci>
+ </apply>
+ <apply> <divide/>
+ <apply> <log/>
+ <logbase> <ci> p </ci> </logbase>
+ <ci> a </ci>
+ </apply>
+ <apply> <log/>
+ <logbase> <ci> p </ci> </logbase>
+ <ci> g </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-s-001.xml b/doc/context/sources/general/mathml/mathml/wh-s-001.xml
new file mode 100644
index 000000000..b149c7079
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-s-001.xml
@@ -0,0 +1,49 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <forall/>
+ <condition>
+ <apply> <in/>
+ <ci> x </ci>
+ <ci> &reals; </ci>
+ </apply>
+ </condition>
+ <apply> <eq/>
+ <apply> <power/>
+ <ci> &exponentiale; </ci>
+ <ci> x </ci>
+ </apply>
+ <apply> <plus/>
+ <cn> 1 </cn>
+ <ci> x </ci>
+ <apply> <divide/>
+ <apply> <power/>
+ <ci> x </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <factorial/>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <divide/>
+ <apply> <power/>
+ <ci> x </ci>
+ <cn> 3 </cn>
+ </apply>
+ <apply> <factorial/>
+ <cn> 3 </cn>
+ </apply>
+ </apply>
+ <ci> &cdots; </ci>
+ <apply> <divide/>
+ <apply> <power/>
+ <ci> x </ci>
+ <ci> n </ci>
+ </apply>
+ <apply> <factorial/>
+ <ci> n </ci>
+ </apply>
+ </apply>
+ <ci> &cdots; </ci>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/doc/context/sources/general/mathml/mathml/wh-s-002.xml b/doc/context/sources/general/mathml/mathml/wh-s-002.xml
new file mode 100644
index 000000000..ca8583753
--- /dev/null
+++ b/doc/context/sources/general/mathml/mathml/wh-s-002.xml
@@ -0,0 +1,63 @@
+<math xmlns='http://www.w3c.org/mathml' version='2.0'>
+ <apply> <forall/>
+ <condition>
+ <apply> <in/>
+ <ci> x </ci>
+ <ci> &reals; </ci>
+ </apply>
+ </condition>
+ <apply> <eq/>
+ <apply> <power/>
+ <ci> &exponentiale; </ci>
+ <apply> <minus/>
+ <ci> x </ci>
+ </apply>
+ </apply>
+ <apply> <plus/>
+ <cn> 1 </cn>
+ <apply> <minus/>
+ <ci> x </ci>
+ </apply>
+ <apply> <divide/>
+ <apply> <power/>
+ <ci> x </ci>
+ <cn> 2 </cn>
+ </apply>
+ <apply> <factorial/>
+ <cn> 2 </cn>
+ </apply>
+ </apply>
+ <apply> <minus/>
+ <apply> <divide/>
+ <apply> <power/>
+ <ci> x </ci>
+ <cn> 3 </cn>
+ </apply>
+ <apply> <factorial/>
+ <cn> 3 </cn>
+ </apply>
+ </apply>
+ </apply>
+ <ci> &cdots; </ci>
+ <apply> <times/>
+ <apply> <power/>
+ <apply> <minus/>
+ <cn> 1 </cn>
+ </apply>
+ <ci> n </ci>
+ </apply>
+ <apply> <divide/>
+ <apply> <power/>
+ <ci> x </ci>
+ <ci> n </ci>
+ </apply>
+ <apply> <factorial/>
+ <ci> n </ci>
+ </apply>
+ </apply>
+ <ci> &cdots; </ci>
+ </apply>
+ </apply>
+ </apply>
+ </apply>
+</math> \ No newline at end of file
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 0c4892500..de15bae47 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 4c8aa9228..8e59ce1f0 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2016.08.01 10:49}
+\newcontextversion{2016.08.01 13:02}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index d0d438996..083d757e8 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2016.08.01 10:49}
+\edef\contextversion{2016.08.01 13:02}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 6df820770..c2faaa08c 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 879c87379..982ce019e 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 9b63690fc..3b1897342 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index c08e5822a..b6db67ad7 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 5683fb2f2..eb91df5ff 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 08/01/16 10:49:41
+-- merge date : 08/01/16 13:02:59
do -- begin closure to overcome local limits and interference