Skip to main content

Chapter 3.13 · Part II · The craft

Configuration: exercises

Exercise styles (exerciseStyles) and the book's exercise settings (exercises): number badges, instruction type, option labels and markers, blanks, true/false answers, matching, word banks, writing areas, grids, long division, difficulty marks, icons, the answers' colour, where solutions print, the teacher's edition and the screen editions

Updated 2026-10-2412 minIn chapter 3 Configurationenescadefritptzhjaar

In short

This page lists every setting for the look of exercises. An exercise style decides how the number is printed, how the options are labelled, what a blank to fill in looks like, how the lines to write on are ruled and how grids and sums are drawn. The book settings decide where the solutions are printed and whether the book is the pupil's edition or the teacher's. They also decide how readers answer the exercises on screen. The Exercises page explains how to write the exercises themselves.

#Exercise styles

The exerciseStyles property declares the named styles an exercise picks with :::exercise{style="…"}. A style is the form of a family of exercises; the questions and the answers stay in the Markdown (see Exercises). One style, exercise, ships by default, so the fence works with no configuration; declaring exerciseStyles replaces it, and the first style declared is the one an exercise without style takes. Every field is optional, and the defaults follow the document language where schools differ: option labels, true/false letters, the long division layout, the words printed.

const config: PostextConfig = {
  exerciseStyles: [
    {
      id: 'activity',
      box: 'activity-frame',
      number: { shape: 'disc', background: { hex: '#2a5ea8', model: 'hex' } },
      instruction: { fontFamily: 'Source Sans 3' },
      options: { marker: 'circle' },
      blank: { look: 'dots', width: 'answer' },
      area: { kind: 'grid', lines: 4 },
      level: { glyph: '★', empty: '☆' },
      icons: { pair: { glyph: '👥' } },
    },
    { id: 'quiz', extends: 'activity', options: { layout: 'row', columns: 4 } },
  ],
};
PropertyTypeDefaultDescription
idstring—Identifier selected by :::exercise{style="…"}. An unknown id falls back to the first style and is reported (exerciseUnknownStyle).
namestringidHuman-readable name (editor UI only).
extendsstring—The id of a style this one is based on. Each group (number, options, blank…) is merged field by field, icons by id.
boxstring—A calloutStyles id for the exercise's frame: background, border, stripe, padding, placement, splitting. Unset, the exercise is set in the running text with no frame and is kept together on one page.
numberobject—How the number prints. See Number.
instructionobject—The type of the instruction. See Instruction.
optionsobject—The options of a choice question. See Options.
blankobject—How a [[…]] prints. See Blanks.
trueFalseobject—The answers of a true/false statement. See True or false.
matchobject—Two columns to join. See Match.
bankobject—The word bank. See Word bank.
areaobject—Writing areas. See Writing area.
gridobject—The cells of word searches, crosswords and operations. See Grids.
arithmeticobject—Operations in columns. See Arithmetic.
levelobject—Difficulty marks. See Difficulty.
iconsRecord<string, ExerciseIcon>{}Activity icons by id, named by a fence's icon. See Icons.
answersobject—How answers print in a teacher's edition, in a model item and in the solutions. See Answers.
solutionsExerciseSolutionsConfig—The book's exercises.solutions for this style's exercises: only the fields set here change.
digitalobject—Colours of the screen editions. See Screen colours.
marginTopDimension1emRoom above an exercise without a box.
marginBottomDimension1emRoom below an exercise without a box.
itemSpacingDimension0.25emRoom between two items: options, questions, statements, pairs.

#Number

number sets the exercise number. A bare number is bold, in the main colour, with a full stop after it; a shaped one is a white figure in a disc, a square or a rounded square of the main colour, with nothing after it.

PropertyTypeDefaultDescription
showbooleantruePrint the number. The count goes on either way.
labelboolean | stringfalseA word before the number: true takes the document language's word (Exercise, Ejercicio, Exercice, Übung, 练习, 練習, تمرين…), a string is the word itself ('Activity').
shape'none' | 'disc' | 'square' | 'rounded''none'The shape the number is set in.
colorColorValuewhite on a shape, else the main colourThe number's colour.
backgroundColorValuethe main colourThe shape's fill.
fontFamilystringthe text around itThe number's family.
fontSizeDimension1emThe number's size, an em being the instruction's.
fontWeightnumber700600 or more sets it bold.
suffixstring'.', none on a shapePrinted after a bare number and its label: '.', ')', '、'.
templatestring'{n}'What the number reads: {n} the exercise's count, {h1} and {h2} the chapter's and the section's numbers ('{h1}.{n}' prints 3.4).
resetOn'never' | 'h1' … 'h6''h1'The heading level that starts the count again; 'never' counts through the book.
counterstring'exercise'The counter the style advances. Styles naming one counter share it; a style with a counter of its own ('review') numbers its exercises apart.
formatResourceCounterFormat'decimal'The numerals of {n}, as a resource counter has them: 'roman-upper', 'alpha-lower', 'simp-chinese-informal' (一, 二), 'circled-decimal' (①, ②), 'arabic-indic'…

#Instruction

instruction sets the leading paragraphs of the exercise. Unset fields take the body text's.

PropertyTypeDefaultDescription
boldbooleantrueSet the instruction in bold.
italicbooleanfalseSet it in italic.
colorColorValuethe text'sIts colour, bold runs included.
fontFamilystringthe text'sIts family: a sans-serif instruction over a serif text is common in school books.
fontSizeDimensionthe text'sIts size.

#Options

options sets the options of a choice question (- [ ] …).

PropertyTypeDefaultDescription
labelsResourceCounterFormat | 'none'by languageHow the options are counted: 'alpha-lower' (a, b, c), 'alpha-upper' in Chinese (A, B, C), 'katakana' in Japanese (ア, イ, ウ), 'abjad' in Arabic (أ, ب, ج). Also 'decimal', 'katakana-iroha', 'circled-decimal'… 'none' prints no label.
prefixstring''Before the label: '(' for (a).
suffixstring')'; '.' in Chinese, none in JapaneseAfter the label.
marker'none' | 'box' | 'circle''none'A box or a ring before each option, to tick. With 'none' the reader rings the label.
layout'stack' | 'row''stack''stack': one option a line, its turnover lines hung under its text. 'row': the options side by side. A fence's columns=n sets them in rows too.
columnsnumberall of themOptions to a row in the 'row' layout (up to 6).
shufflebooleanfalsePrint the options in a shuffled order, the same in every output and in the key.
indentDimension1emThe options' indent from the text's edge, for a question without a stem.
bracketbooleanfalseA bracket ( ) at the end of each question's stem to write the letter in, as Chinese and Japanese tests print it. A teacher's edition writes the letter in it.

#Blanks

blank sets how a [[…]] prints in the pupil's text: room the size of the answer with a line, dots or a box, the answer itself not painted.

PropertyTypeDefaultDescription
look'line' | 'dots' | 'box' | 'none''line'A line to write on, a dotted line, a box, or empty room.
width'answer' | 'longest' | Dimension'longest''longest': every blank of the exercise as wide as its longest answer, so no blank gives its answer away. 'answer': each as wide as its own answer. A length: that width for all. A gap's {width=N} wins over it.
extraDimension1.5emRoom added to the answer's width, in whole ems.
minWidthDimension3emThe narrowest blank.
colorColorValueblackThe colour of the line, the dots or the box. Set, it also colours the boxes and rings to tick and the frames of the bank's words, which are otherwise in the main colour.
weightDimension0.6ptThe line's weight.

#True or false

trueFalse sets the answers at the end of a statement.

PropertyTypeDefaultDescription
labels[string, string]by languageThe two answers: ['T', 'F'] in English; V F in Spanish, Catalan, French, Italian and Portuguese; R F in German; √ × in Chinese; ○ × in Japanese; صح خطأ in Arabic.
look'boxes' | 'bracket''boxes''boxes': each label with a box to tick, at the end of the line. 'bracket': one blank to write the answer in.

#Match

match sets an exercise of pairs.

PropertyTypeDefaultDescription
look'dots' | 'letters''dots''dots': two columns with a dot by each item, to join with a line. 'letters': the right column lettered, a blank by each left item for the letter.
gapDimension4emRoom between the two columns.
dotSizeDimension0.35emThe dots' diameter.
colorColorValuethe main colourThe dots, and the word bank's frame.

#Word bank

bank sets the box of words of a gaps exercise with bank or ::bank[…], and of every sort exercise. The box stands where a ::bank line is written, else under the instruction.

PropertyTypeDefaultDescription
boxstringa frame in the match colourA calloutStyles id for the bank's box.
order'shuffle' | 'alpha' | 'written''shuffle'The words shuffled (seeded), in alphabetical order in the document language, or as written.
separatorstringan em spaceBetween two words. Each word is set in a chip with a thin frame.

#Writing area

area sets the space under an open question, under a scrambled sentence and in the columns of a sort exercise.

PropertyTypeDefaultDescription
kind'lines' | 'dots' | 'grid' | 'seyes' | 'tianzige' | 'box' | 'none''lines'Ruled lines, a row of dots, squared paper, French Seyès ruling, 田字格 squares, an empty frame, or blank room. A fence's area overrides it.
linesnumber3How many lines tall. A fence's lines overrides it.
spacingDimension1.35 times the text's line height (1.2 for grids)The distance between two lines.
colorColorValuea light greyThe ruling's colour.
weightDimension0.5ptThe ruling's weight.

#Grids

grid sets the cells of word searches, crosswords and operations in columns.

PropertyTypeDefaultDescription
cellDimension1.6emA cell's side.
fontFamilystringthe text'sThe letters' and digits' family.
fontSizeDimension0.58 of the cell's sideThe size of the letters and digits, an em being the text's.
colorColorValuethe text'sThe letters' and digits' colour.
ruleColorValuea mid greyThe cells' rules.
ruleWidthDimension0.6ptTheir weight.
blockedColorValue—The fill of the crossword's cells that no word takes. Unset, the grid prints only the cells of its words.
uppercasebooleantrueSet the letters of word searches and crosswords in capitals, in the document language's case rules.

#Arithmetic

arithmetic sets operations in columns.

PropertyTypeDefaultDescription
division'bracket' | 'potence' | 'inline'by languageLong division. 'bracket': the divisor left of the dividend, a bracket over it, the quotient on top (English, Chinese, Japanese, Arabic, and any language without its own). 'potence': the divisor right of the dividend under an L, the quotient under the divisor (Spanish, Catalan, French, Italian, Portuguese). 'inline': 864 : 4 = with the quotient on the line and the steps under it (German).
columnsnumber4Operations to a row, fewer when the column is too narrow.

#Difficulty

level sets the marks a fence's level prints after the number, in a smaller size.

PropertyTypeDefaultDescription
glyphstring'●'A level reached: '★', '■'.
emptystring'○'A level not reached; '' prints none.
maxnumber3The highest level: level=2 with max: 3 prints ●●○.
colorColorValuethe main colourThe marks' colour.

#Icons

icons maps an id to an activity icon (oral, written, pair work, listening, calculator), printed after the number when a fence names it: icon="pair".

PropertyTypeDefaultDescription
glyphstring—A character to print: '✎', '🎧', a glyph of an icon font.
fontFamilystring—The family of an icon font.
colorColorValue—The icon's colour.
resourceIdstring—A bitmap or SVG resource printed as the icon, in place of a glyph.
altstring—What the icon stands for, for screen readers and the tagged PDF.
sizenumber0.75The icon's height in ems of the instruction: the height of a capital by default.

An icon prints as an inline symbol after the number: the picture of resourceId when it names one, else the glyph set in fontFamily, in color (the text's when unset). It stands on the instruction's baseline, size ems tall, and its alt is read in its place.

#Answers

answers sets the answers wherever they show: a teacher's edition, the model item of an example exercise, rings and filled boxes, lines drawn between pairs, letters and digits in grids.

PropertyTypeDefaultDescription
colorColorValue#d6246e, a magenta redThe answers' colour, as a teacher's book overprints them.
fontFamilystringthe text'sA face for the answers: a handwriting face is common.
italicbooleanfalseSet answers in blanks in italic.

#Screen colours

digital sets how the HTML viewer and EPUB books show a checked answer.

PropertyTypeDefaultDescription
correctColorColorValuea green (#1e8e3e)A right answer.
wrongColorColorValuea red (#c5221f)A wrong answer.

#Book settings

The exercises property holds the settings of the whole book: the edition, where solutions print, the seed of every shuffle and the screen editions. A book that sets neither exercises nor exerciseStyles lays out and hashes as before.

const config: PostextConfig = {
  exercises: {
    edition: 'student',
    solutions: { placement: 'chapterEnd', layout: 'key' },
    seed: 3,
    digital: { check: 'instant' },
  },
};
PropertyTypeDefaultDescription
edition'student' | 'teacher''student''teacher' prints every answer in its slot in the answers colour: a teacher's book from the pupil's text.
solutionsExerciseSolutionsConfig—Where and how the solutions print. See Solutions.
seednumber1What every shuffle is drawn from: options, right columns, order items, scrambled words, banks, word-search fillers. Change it for another version of a test; print, screen and key stay in agreement.
digitalobject—The HTML viewer and EPUB books. See Screen editions.

#Solutions

exercises.solutions, and a style's solutions over it for that style's exercises.

PropertyTypeDefaultDescription
placement'none' | 'after' | 'inverted' | 'chapterEnd' | 'directive''none''none': no solutions in print. 'after': after each exercise, in smaller type. 'inverted': after each exercise, turned upside down. 'chapterEnd': at the end of the chapter, under heading. 'directive': where a :::solutions line stands.
boxstringa frameless box in smaller typeA calloutStyles id for a solution's box, and for the list of a chapter's solutions.
headingstringthe document language's wordThe heading of the solutions at the end of a chapter: Solutions, Soluciones, Solucions, Corrigés, Lösungen, Soluzioni, Gabarito, 参考答案, 解答, الحلول. A :::solutions{title="…"} line sets its own.
layout'key' | 'full''full''key': the answers alone (1 b · 2 water). 'full': the key, then the exercise's :::solution.

#Screen editions

exercises.digital sets how exercises behave in the HTML viewer and in EPUB books.

PropertyTypeDefaultDescription
interactivebooleantrueExercises the reader can answer. false shows them as printed.
persistbooleantrueKeep the reader's answers in the browser, per book.
check'button' | 'instant''button''button': answers are checked when the reader asks. 'instant': each answer is checked as it is given.

The screen can have its own exercise settings: htmlViewer.overrides takes exercises and exerciseStyles too, merged over the book's before the HTML viewer lays out, so print keeps its solutions at the end of the chapter while the screen hides them, or the screen drops the writing areas a reader has no use for.

const config: PostextConfig = {
  htmlViewer: {
    overrides: {
      exercises: { solutions: { placement: 'none' } },
      exerciseStyles: [{ id: 'exercise', area: { kind: 'none' }, blank: { minWidth: { value: 6, unit: 'em' } } }],
    },
  },
};