Skip to main content

Documents and pages

A document is a .mtx file whose root is <doc>:

<doc>
<head>
<title>Throughput of a sparse lattice update</title>
<meta name="author" content="A. Saifudin" />
<meta name="doi" content="10.1234/example" />
</head>
<body>
<page flow>
…
</page>
</body>
</doc>

Statements — imports, types, consts, components — may precede the root. A file with no root is a module, not a document.

<head> carries document metadata, not visible content:

ElementReaches the PDF as
<title>Title
<meta name="author" content="…" />Author
<meta name="doi" content="…" />Subject
<meta name="keywords" content="…" />Keywords

Any other name/content pair is carried through into static source. The PDF also records matex as creator and producer.

body and page​

<body> holds one or more <page> elements. A page is a fixed frame:

<page size="A4" flow>
…
</page>
  • With flow, the page is a flowing region: its content continues across as many pages as it needs.
  • Without flow, the page is fixed. Overflow is clipped and reported (fixed-page-overflow).

A page boundary is a new <page> element. There is no <break /> tag and no break property — a forced break is the end of a page, so the geometry is stated once in config rather than repeated at every break.

Geometry​

<page width={210} height={297} unit="mm"
margin={ { top: 30, right: 18, bottom: 25, left: 18 } }
binding="left" flow>
AttributeMeaning
sizeA named page: A0–A6, B5, letter, legal, tabloid
width, heightExplicit dimensions in the page's unit
unitmm (default), cm, in, pt, pc, px
marginAn object of optional sides: top, right, bottom, left, inner, outer
bindingleft (default) or right — which side the gutter is on for odd pages
flowMake the page a flowing region
idAn inert identifier on the page

An absent margin side is zero, not inherited. A page with no margin and no project default gets 20 mm on every side. If the page names neither size nor width/height, the project default applies; with no default it is A4 (210 × 297 mm).

inner and outer swap with parity. An explicit left or right always wins over either.

// A bound work: 30 mm gutter, 18 mm fore-edge.
<page size="A5" margin={ { top: 20, bottom: 20, inner: 30, outer: 18 } } binding="left" flow>

The four page slots​

A page is divided top to bottom:

  1. header
  2. content
  3. notes — the footnote area, managed by the engine
  4. footer

The content area is whatever the other three leave, so a page with footnotes has a shorter content area than one without. The notes area is not authored; it is filled by <footnote> markers in the content.

<page flow>
<header>
<p align="right" font-size={8}>Jin et al. — candidate periodicity</p>
</header>
<footer>
<p align="center" font-size={8}>{pageNo()}</p>
</footer>
<col>
…
</col>
</page>

A <header> or <footer> inside <head> applies to every page; a page-local one overrides it. They hold ordinary markup and may call page predicates from a component, which is how a running head differs between odd and even pages:

export component RunningHead {
if (isEven(pageNo())) {
return <p align="right" font-size={8}>Even pages</p>;
}
return <p align="right" font-size={8}>Odd pages</p>;
}
No ids in page parts

A <header> or <footer> expands once per page. An id there would name many places at once, so it is an error (id-in-page-part).

Containers​

Inside a page, content is arranged by containers. They are the subject of Layout; the short version:

ContainerDirection
<col>Top to bottom, with an optional gap
<row>Left to right, with an optional gap and child weights
<columns>A region that flows into count columns, then the next page
<div>A grouping box; carries keep, gap and id
<section>A named grouping; no visual effect of its own

A complete, minimal document​

<doc>
<head>
<title>A first page</title>
</head>
<body>
<page flow>
<col gap={4}>
<h1 id="intro">A first page</h1>
<p>The page is declared. The break is decided.</p>
</col>
</page>
</body>
</doc>