Numbers across blocks
How it works
Numbers across blocks
In LA TEX, the number of a section or an equation comes from counters that run through the whole document, and a \ref needs a second run. ReflowEd typesets each block on its own, so it works the numbers out separately, from the order of the blocks, and fills them in without typesetting anything.
The context of a block
Some of what earlier blocks do shows in later ones. Before a block is typeset, ReflowEd puts a short context in front of its source: the definitions made in earlier blocks (a \newcommand between two paragraphs, say), whether \appendix came before it, and whether it follows a heading, in which case its first paragraph is not indented. The block with the bibliography also gets the keys that are cited. Counter values are not part of the context. As the context is part of the block’s cache key, moving a block typesets it again only when its context changes.
Filling in the numbers
The TEX side marks where each number and each reference goes in a typeset block. After every change, ReflowEd counts the sections, theorems, equations and figures over the blocks in order, and the viewer puts the text in the marked places. The format is read from the number as TEX printed it, so letters after \appendix apply from there on, and a \setcounter takes effect at the start of its block. A reference shows its target’s number; \cref and \autoref add the name, as in “Lemma 3.2”. When a block moves, the numbers after it change straight away.
References and citations describes what this looks like in the editor.