Skip to main content

Crate retex_engine

Crate retex_engine 

Source
Expand description

The retex TeX engine: a clean-room implementation of LuaTeX’s typesetting machine.

The Engine holds all state of a TeX run. Its methods are spread over modules following the parts of TeX: The Program:

  • [print] and error — terminal and log output, error recovery;
  • hash, eqtb, save — control sequences, equivalents, grouping;
  • input — the input stack and the tokenizer (get_next);
  • expand, cond, scan — expansion, conditionals, scanning;
  • prefixed — assignments;
  • maincontrol — the chief executive.

Modules§

align
Alignments: \halign and \valign (TeX: The Program §768–§812).
backend
Backend variables and feedback (\pdfvariable, \pdffeedback, \dvivariable, \dvifeedback).
build
Building boxes and lists (TeX: The Program §1055–§1135, with e-TeX’s and LuaTeX’s changes).
clock
The job’s start time: \time, \day, \month, \year, the log banner and the PDF creation date.
cmd
Command codes and their ranges.
codes
Character codes: IniTeX defaults and LuaTeX’s packed math and delimiter codes.
cond
Conditional processing (TeX: The Program §487–§510, plus the e-TeX and LuaTeX conditionals).
diag
Structured diagnostics for retex’s default output mode.
dirs
Directions: the direction parameters (\pagedir, \bodydir, \pardir, \textdir, \mathdir, \linedir and their numeric …direction forms), the directions of boxes, and the direction nodes (\begindir/\enddir) that text-direction changes leave in horizontal lists (LuaTeX manual §3.3).
display
Displaying boxes, glue, equivalents and the semantic nest (TeX: The Program §173–§198, §218–§219, §252; e-TeX show_save_groups).
dvi
The DVI writer (TeX: The Program §583–§602, §617–§642), as LuaTeX uses it when \outputmode=0.
eqtb
The table of equivalents (TeX’s eqtb) and its storage.
error
Error reporting and recovery (TeX: The Program §71–§98, §311–§320).
expand
Expansion (TeX: The Program §366–§401, with e-TeX and LuaTeX additions): expand, macro calls, \csname, \noexpand, \input.
expansion
Font expansion (hz): \adjustspacing, \expandglyphsinfont, \efcode and the expansion_factor of glyph and kern nodes.
files
Files: \input, the log file, \openin/\read, \scantokens pseudo-files and the record of files read and written that the pass driver uses (TeX: The Program §511–§538, §480–§486; e-TeX).
fonts
Fonts as TeX sees them: metrics, parameters (\fontdimen), identifiers and font-related assignments (TeX: The Program §539–§582, §1252–§1261).
format
Format files: dumping the engine state after an IniTeX run (\dump) and loading it at the start of a normal run.
glue
Glue specifications.
hash
The control-sequence table (TeX’s hash).
hmode
Characters and spaces in horizontal mode (TeX: The Program §1034–§1044, LuaTeX style).
hyph
Language data: \patterns, \hyphenation, \hjcode and the per-language hyphen characters (LuaTeX manual §5.4–§5.8), stored per \language with retex-hyph.
image
Image resources: \saveimageresource, \useimageresource, \lastsavedimageresourceindex and \lastsavedimageresourcepages.
init
Engine construction, IniTeX initialization and the job driver.
input
The input stack and the tokenizer (TeX: The Program §300–§365).
linebreak
Breaking paragraphs into lines (TeX: The Program §813–§890, with e-TeX’s \lastlinefit and penalty arrays, and LuaTeX’s changes).
maincontrol
The chief executive (TeX: The Program §1029–§1054) and the semantic nest (§211–§219).
math
Building math lists (TeX: The Program §1136–§1206, with e-TeX’s \middle and LuaTeX’s extensions).
mathdisplay
Displaying noads (TeX: The Program §690–§698) in LuaTeX’s format.
mathparams
LuaTeX’s math parameters (\Umath…) and how font assignments set them.
meaning
Printing control sequences, token lists and meanings (TeX: The Program §262–§299).
misc
Smaller commands: extensions (\write, \openout, \special), LuaTeX’s normal commands, hyphenation data, directions, random numbers, Lua calls and backend hooks.
mlist
Converting math lists to horizontal lists (TeX: The Program §699–§767, with e-TeX’s \middle) the way LuaTeX does it for traditional (TFM) fonts.
nodeproc
LuaTeX’s node processing before packaging and line breaking: the hyphenation, ligaturing and kerning passes (LuaTeX manual §5.5–§5.6).
nodes
Node memory: an arena of typesetting nodes addressed by NodeRef.
pack
Packaging: hpack and vpackage (TeX: The Program §644–§679).
page
Breaking vertical lists into pages: \vsplit, the page builder, the output routine and \shipout (TeX: The Program §967–§1028 and §638, with e-TeX’s mark classes and saved discards).
pdfext
\pdfextension (LuaTeX manual §3.2.2): PDF literals, matrices, colour stacks, objects, annotations, links, destinations, outlines and document-level dictionaries.
prefixed
Assignments (prefixed_command, TeX: The Program §1211–§1280, with e-TeX and LuaTeX additions).
primitives
Lookup tables over LuaTeX’s primitives (crate::primitives_gen).
primitives_gen
LuaTeX’s primitive table: names, command codes, modifiers and groups.
print
Low-level output: terminal, log file, strings and \write streams.
protrusion
Character protrusion (margin kerning): \protrudechars, \lpcode, \rpcode, margin kern nodes, \leftmarginkern and \rightmarginkern.
save
Grouping and the save stack (TeX: The Program §268–§284, with the e-TeX tracing extensions).
scan
Scanning numbers, dimensions, glue, keywords and token lists (TeX: The Program §402–§486, e-TeX §1490ff, LuaTeX extensions).
shipout
Shipping pages out (TeX: The Program §592–§640, LuaTeX’s PDF backend positions).
showbox
Displaying node lists in LuaTeX’s formats (TeX: The Program §173–§198, §218–§219, §986).
snapshot
Resuming a run from a snapshot of the process.
the
\the, \unexpanded, \detokenize, conversion commands (\number, \string, \meaning, …) and the \show family (TeX: The Program §464–§472, §1293–§1298, e-TeX and LuaTeX additions).
timing
Phase timing for performance work: with RETEX_TIMING set in the environment, mark prints the time elapsed since the first mark to stderr, and Accumulators report their totals at [report].
token
Tokens and token lists.
typeset
Typesetting: shared state, hooks and small helpers.
utf8x
UTF-8 encoding for TeX characters.

Structs§

Engine
The global state of a TeX run.

Enums§

ListFilter
Result of a node-list filter callback.

Traits§

LuaHost
Callbacks from the engine into an embedded Lua interpreter.

Type Aliases§

EngineHook
A one-shot callback into the host, run with the engine borrowed.