Documents

Code blocks and equations

Some content has to be reproduced exactly: a configuration snippet, a decision rule, a formula. Prose paraphrases it and gets it wrong. These two blocks print it as written.

Create a document with OneCraftA code listing with line numbers and a numbered LaTeX equation, in a real procedure
A scheduling rule printed as a code listing with line numbers
A code block prints exactly what you write, with line numbers a reviewer can point at.

A code block prints exactly what you write

It is set in a monospace face, keeps its indentation, and can carry line numbers. That last part matters more in a document than in an editor, because line numbers give a reviewer something to point at: "line four should be a warning, not an approval". Without them a review turns into quoting fragments.

A numbered LaTeX equation for a monthly charge, with its variables explained underneath
An equation on its own line with its own number, and the variables defined under it.

Not only for software

The block suits any rule where the exact characters matter. A pricing rule, an escalation rule, a validation pattern, a configuration a technician has to type in. Writing a rule as a listing forces it to be unambiguous, which is why an operations procedure often benefits from one more than a paragraph would.

Equations are block level and numbered

An equation is written in LaTeX and printed on its own line with an optional number beside it. The number is the point: it lets the text refer back to equation one rather than describing it again. Inline arithmetic that reads fine as a sentence should stay a sentence.

Always define the variables

A formula without its terms defined is decoration. The convention is a short paragraph immediately underneath saying what each symbol is, in the same order they appear. It costs two lines and it is the difference between a document somebody can use and one they have to ask about.

Where these two belong

Technical papers, runbooks, integration guides and operations procedures. A listing in a proposal is usually a mistake, because the reader is buying an outcome rather than reviewing an implementation. If a client genuinely needs the configuration, it belongs in an appendix or a separate technical document, not in the middle of the commercial pitch.

How it works, in three steps

  1. Step 1

    Decide if the exact characters matter

    If a paraphrase would be wrong, use a block. If not, write the sentence.

  2. Step 2

    Turn line numbers on for anything reviewed

    They give a reviewer something to point at.

  3. Step 3

    Define the variables under an equation

    Each symbol, in the order it appears, in one short paragraph.

The full walkthrough with screenshots is in the guide Every document component and when to use it.

Limits worth knowing

See it on a finished piece

Questions people ask

Does the code get syntax highlighted?

It is set in monospace with its indentation kept and optional line numbers, which is what a printed document needs. It is a listing, not an editor.

Can I put an equation inside a sentence?

No, equations are block level. Arithmetic that reads fine in a sentence should stay in the sentence.

Why number an equation?

So the text can refer to it later without repeating it. If nothing refers back, leave the number off.

Make your own document

The button opens the generator with this use case already described. Change the wording to match yours, generate, then edit anything you like.

Create a document with OneCraft

Related pages

More finished work of this kind is on the document examples hub.