🚧 This page is currently being revised and reconstructed.
Its structure, examples, and explanations are being updated for current ConTeXt and LuaMetaTeX. Please feel free to edit, correct, or improve this page while the revision is in progress.
Sample documents · Input and compilation · Sample documents · Report style
Contents
-
1
Report style 01
- 1.1 1. Files and output
- 1.2 2. Main techniques used
- 1.3 3. Page-aware headings and MetaFun graphics
- 1.4 4. Structural numbering
- 1.5 5. Highlighted content blocks
- 1.6 6. Local notes
- 1.7 7. Document structure
- 1.8 8. Fonts
- 1.9 9. How the parts fit together
- 1.10 10. Things to adapt when reusing the source
- 1.11 11. Related pages
- 1.12 Report style 02
This example shows how a visually distinctive report can be built by combining several ConTeXt and MetaFun mechanisms in a real document.
The design was inspired by a report published by the French Haut Conseil pour le Climat (HCC). The ConTeXt version was also used as an exercise in learning ConTeXt and MetaFun, starting from extracted PDF text and passing through Markdown and Pandoc before manual typesetting and refinement.
What this page is for.
This is a sample document, not a step-by-step tutorial.
Its main value is to show how page design, structural numbering, MetaFun graphics, highlighted text blocks, notes, document structure, and font setup can be combined in one substantial ConTeXt project.
The source is commented so that individual techniques can be studied and reused independently.
1. Files and output
The original material and the ConTeXt version are available here:
The following image gives an overview of some of the visual features:
Studying the example.
A useful approach is to open the PDF output beside the source and identify one visual feature at a time: headings, numbering, highlighted blocks, notes, or fonts.
The source can then be reduced to a smaller test document for experiments.
2. Main techniques used
The document combines several areas of ConTeXt functionality:
report design
|
+-- page-aware headings
|
+-- structural numbering
|
+-- highlighted text blocks
|
+-- local notes
|
+-- frontmatter / bodymatter / appendices / backmatter
|
+-- MetaFun graphics
|
+-- font setup
The following sections point to the most important commands and settings.
3. Page-aware headings and MetaFun graphics
The headings use rules extending across the page and vary slightly depending on whether they occur on a left or right page.
The implementation combines overlays, MetaFun graphics, and page-side tests.
Relevant commands include:
- \defineoverlay
- \useMPgraphic
- \startuseMPgraphic
- \signalrightpage
-
\doifrightpageelse - \startsectionblockenvironment
The general idea is:
heading | +-- determine left/right page | +-- select appropriate graphic | +-- draw rule or background with MetaFun | +-- typeset heading text
Why use page-aware design?
In a double-sided document, the outer and inner edges of a page are not the same on odd and even pages.
Testing the page side makes it possible to mirror graphical elements instead of applying one fixed design everywhere.
4. Structural numbering
The report changes the presentation of structural numbers according to the sectioning level.
Several mechanisms work together:
- \setuphead
-
\definestructureseparatorset - \defineconversion
- \definestructureconversionset
-
sectionconversionset -
prefixconversionset -
sectionsegments -
sectionstopper
These settings address different parts of structural numbering:
structural number
|
+-- which segments are shown
| sectionsegments
|
+-- how components are converted
| sectionconversionset
| prefixconversionset
|
+-- how components are separated
| \definestructureseparatorset
|
+-- what follows the number
sectionstopper
Structure sets are independent mechanisms.
A separator set controls the characters placed between structural components.
A conversion set controls how the components themselves are represented.
These mechanisms can be combined, but they perform different jobs.
5. Highlighted content blocks
The source defines an encadré — a highlighted block of content that can continue across page breaks.
This is not merely a framed box. It combines a dedicated structural element, numbering, list entries, and a MetaFun background.
5.1 Structural element and numbering
The block is built around:
- \definehead
-
before -
aftersection -
sectionresetset -
bodypartlabel - \setuplist
- \setupreferencestructureprefix
This allows the highlighted material to have its own numbering and to participate in the table of contents or another structural list.
5.2 Background extending across page breaks
The visual emphasis is produced with:
- \definetextbackground
- MetaPost / MetaFun
-
nofmultipars -
multilocs
The MetaFun code can distinguish the first, intermediate, and last parts of a background that spans several paragraphs or pages.
For example, the source uses constructs such as:
for i=1 upto nofmultipars
and tests such as:
if multilocs[i] == 3:
Why this technique is useful.
A normal framed object is often unsuitable for long content because the whole object may need to remain together.
A text background designed for multiple paragraphs can instead follow content across page boundaries.
6. Local notes
The highlighted sections can contain their own note setup.
Relevant mechanisms include:
- \definenote
- \setupnotation
-
numberconversion
This illustrates an important ConTeXt principle: notes can be defined as named series and configured independently instead of treating every note as an undifferentiated footnote.
For a systematic introduction to note mechanisms, see Footnotes.
7. Document structure
The source uses ConTeXt's document divisions:
and organizes material with:
Conceptually:
document | +-- frontmatter | +-- bodymatter | +-- appendices | +-- backmatter
These divisions allow page numbering, headings, lists, and other structural settings to vary according to the part of the document.
For larger projects, see also Project structure.
8. Fonts
The original example uses Garamond Pro and Avenir Next.
The font setup illustrates:
The source also contains code for comparing the x-heights of two fonts in order to calculate a suitable relative scaling factor.
Font availability.
Garamond Pro and Avenir Next are not part of a standard ConTeXt installation.
If these fonts are not installed on your system, adapt the typeface definitions or substitute fonts that are available locally before expecting the example to reproduce the original typography exactly.
9. How the parts fit together
The document is useful because no single command creates its appearance.
Instead, several independent mechanisms are combined:
report style
|
+-----------------+-----------------+
| | |
structure graphics text
| | |
headings overlays notes
numbering MetaFun backgrounds
lists page tests fonts
\ | /
+----------------+----------------+
|
v
complete document
This is typical of larger ConTeXt projects: structure and content remain separate from the graphical mechanisms that present them.
10. Things to adapt when reusing the source
Before using the example as the basis for another document, check at least:
- the installed fonts and typeface names;
- paper size and page layout;
- left/right-page assumptions;
- structural numbering requirements;
- colours and MetaFun graphics;
- note definitions;
- document divisions;
- external resources used by the source.
Do not treat a sample document as a drop-in style package.
This source was created for a particular report and contains design decisions specific to that project.
When reusing it, identify the mechanism you need and adapt that mechanism to your own document rather than assuming that every setting should be copied unchanged.
11. Related pages
- Sample documents
- Document structure and headlines
- Project structure
- Footnotes
- Graphics and media
- MetaFun
Report style 02
| TODO: This second report style still needs documentation. (See: To-Do List) |
Sample documents · Input and compilation · Sample documents · Report style