Skip to main content

Configuration

The project file is matex.config.json or config.json, found by walking up from the document. Every key is optional, and a key overrides a built-in default; it never enables a feature.

A relative path inside the config is relative to the config file, not to the working directory and not to the document.

{
"$schema": "./matex.config.schema.json",
"element": {
"page": { "size": "A4",
"margin": { "top": 30, "right": 18, "bottom": 25, "left": 18 } },
"p": { "font-size": 9.5, "leading": 1.35, "align": "justify" },
"h1": { "font-size": 18, "leading": 1.1 },
"h2": { "font-size": 12, "leading": 1.2 },
"caption": { "font-size": 8, "leading": 1.25 },
"cell": { "font-size": 8.5, "leading": 1.25 }
},
"numbering": {
"h1": { "scope": "document" },
"h2": { "scope": "document" },
"figures": { "scope": "document" },
"tables": { "scope": "document" },
"equations": { "scope": "section" }
},
"generated": {
"dir": "gen",
"kinds": {
"figures": "fig",
"tables": "tab",
"equations": "eq",
"headings": "head"
},
"refs": { "const": "refs", "type": "Refs" }
},
"font": {
"default-family": "body",
"size": 10,
"faces": [
{ "family": "body", "path": "assets/Inter-Regular.ttf" },
{ "family": "body", "path": "assets/Inter-Bold.ttf", "weight": 700 },
{ "family": "body", "path": "assets/Inter-Italic.ttf", "italic": true },
{ "family": "math", "path": "assets/STIXTwoMath-Regular.otf" }
]
},
"pagination": {
"fragment-min": 2,
"heading-min": 2,
"baseline": 12
},
"hyphenation": {
"auto": false,
"words": ["hy-phen-ation", "peri-odo-gram"]
}
}

An unknown top-level key is an error (config-unknown). A malformed value is an error (config-shape), as is invalid JSON (config-json) or an unreadable file (config-read).

element​

One default per tag, keyed by tag name:

{ "element": { "h1": { "font-size": 17 }, "p": { "align": "justify" } } }
  • An attribute on the tag beats the default.
  • There is no cascade, no selector, and no group rule.
  • A key in a tag's object that the tag does not understand is ignored.
  • A length here is millimetres unless the tag's unit says otherwise.
  • A font-size is always points.

The properties each tag understands are listed in Styling.

numbering​

One scope per citable kind:

{
"numbering": {
"h1": { "scope": "document" },
"h2": { "scope": "section" },
"equations": { "scope": "section", "style": "lower-roman" }
}
}
KeyValues
scopedocument (1, 2) or section (3.1)
stylearabic (default), lower-roman, upper-roman, lower-alpha, upper-alpha

Kinds are h1–h6, figures, tables, equations. A kind absent from the object is unnumbered. scope is required; a missing or unknown scope is an error (config-scope). An unknown style is config-style.

See Headings and numbers.

generated​

{
"generated": {
"dir": "gen",
"kinds": {
"figures": "fig",
"tables": "tab",
"equations": "eq",
"headings": "head"
},
"refs": { "const": "refs", "type": "Refs" }
}
}
KeyMeaning
dirDirectory for generated stores, relative to the config file
kindsCitable kind to file/type prefix, e.g. figures → fig.g.mtx, Figure
refs.constThe bibliography store's const name
refs.typeThe bibliography store's union name

The const for a kind is the kind's own name (figures), so figures[to] reads naturally. The type is the singular, capitalised prefix (Figure). refs is named separately because its records are authored, not counted.

font​

{
"font": {
"default-family": "body",
"size": 10,
"faces": [
{ "family": "body", "path": "assets/Inter-Regular.ttf" },
{ "family": "body", "path": "assets/Inter-Bold.ttf", "weight": 700 },
{ "family": "body", "path": "assets/Inter-Italic.ttf", "italic": true }
]
}
}
KeyMeaning
facesDeclared faces: family + path, optional weight (1–1000) and italic
default-familyFamily used when a tag names none
sizeEngine default font size in points

Several faces may share a family. <b> asks for 700, <i> asks for italic, and font-weight / font-style select within the family. A face is never synthesised: if the family has no matching face, the nearest declared face is used.

If default-family is absent, the first declared face's family is used. If no face can be read, the engine falls back to its bundled Liberation Sans face and reports font-fallback.

Math is set in the family named math; without one it uses the default face.

pagination​

{ "pagination": { "fragment-min": 2, "heading-min": 2, "baseline": 12 } }
KeyMeaning
fragment-minThe minimum lines on each side of a page break (default 2)
heading-minLines of the block after a heading that must fit with it (default 2)
baselineA fixed baseline step in points; absent leaves the leading multiplier alone

baseline snaps every line box up to a whole number of steps, which is how a document sits on a grid.

hyphenation​

{
"hyphenation": {
"auto": false,
"words": ["hy-phen-ation", "peri-odo-gram"]
}
}
KeyMeaning
autoUse the embedded English (US) Knuth–Liang patterns
wordsWords with explicit break points

words may be an array of hyphenated spellings, or an object keyed by the word:

{ "words": { "periodogram": "peri-odo-gram" } }

A literal hyphen in a word is always a break point. A word with no break point stays whole and is clipped with a warning if it cannot fit.

Minimal configuration​

A document can be built with no config at all: A4, 20 mm margins, the bundled face, no numbering. The project file exists to change those defaults, not to enable the engine.