Documentation
¶
Overview ¶
Package engine is the core of a pure-Go (CGO=0) TeX engine: a faithful re-implementation of TeX's mouth and gullet — category-code tokenization, the equivalents table (eqtb) with grouping/scoping, macro definition with delimited parameters, and the expansion machinery (\def, \edef, \let, \expandafter, \csname, \noexpand, \string, \the, \number, conditionals, integer registers). It is the foundation on which the real LaTeX kernel and packages will run, gated by TeX's own conformance suite (the TRIP test) — the path to functional parity with a TeX distribution, not a subset.
Index ¶
Constants ¶
const InfPenalty = 10000.0
InfPenalty is TeX's "infinite" penalty (∞ = forbidden break, −∞ = forced).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine holds all TeX state: the input stack, the eqtb (control-sequence meanings), integer registers, category codes, the grouping save stack, and the \message output buffer.
type Item ¶ added in v0.2.0
type Item struct {
Kind ItemKind
Width float64
Stretch, Shrink float64 // glue only
Penalty float64 // penalty only
Flagged bool // penalty only (e.g. a hyphen) — consecutive flags are penalised
}
Item is one element of a horizontal list.
type Line ¶ added in v0.2.0
type Line struct {
Start, End int // item index range [Start, End) actually set on the line
Ratio float64 // glue adjustment ratio r (−1 fully shrunk … +tolerance stretched)
}
Line describes one output line of a broken paragraph.
func KnuthPlass ¶ added in v0.2.0
KnuthPlass breaks items into lines of the given width, minimising total demerits (linePenalty is TeX's \linepenalty). It returns the chosen lines in order and ok=false if no sequence of feasible breaks exists within tolerance.