---
title: "latex-print — Mova code model"
description: "Mova code model of latex/src/print.rs: components with their labels, obernants and the model text."
url: "https://groupants.elamur.ai/free/en/mova/latex/src/print.rs.groupant/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Research](https://md.research.elamur.ai/free/en/) · **Groupants**

This page as HTML: <https://groupants.elamur.ai/free/en/mova/latex/src/print.rs.groupant/>

# latex-print

The groupant beside latex/src/print.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.

## Facts

- **kind:** groupant
- **status:** partial source bound model
- **source:** [`latex/src/print.rs`](https://github.com/ElamurAI/mova-free/blob/main/latex/src/print.rs)
- **source SHA-256:** `a6cb2d3ea7b54e4f…`
- **repository folder:** [`latex/src/print.rs.groupant`](https://github.com/ElamurAI/mova-free/tree/main/latex/src/print.rs.groupant)
- **repository commit:** `48f2e6f74146`

> **Implementation material.** A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.

## Components

| component | label | where |
|---|---|---|
| **approximant** | partial | [approximant](#approximant) |
| **ast** | partial | `syntax.json` |
| **composition** | partial | [composition](#composition) |
| **descriptant** | present | [descriptant](#descriptant) |
| **invariant** | partial | [invariant](#invariant) |
| **tests** | executed bounded checks | [tests](#tests) |

## Obernants

The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.

| id | type | label | where |
|---|---|---|---|
| `behavior_complement` | behavior_complement | partial source derived model | [behavior_complement](#behavior-complement) |
| `reverse_reconstruction` | reverse_reconstruction | partial source derived model | [reverse_reconstruction](#reverse-reconstruction) |
| `token_separation` | token_separation | partial source derived model | [token_separation](#token-separation) |
| `optional_scope` | optional_scope | partial source derived model | [optional_scope](#optional-scope) |
| `fault_support` | fault_support | partial source derived model | [fault_support](#fault-support) |
| `text_loss` | text_loss | partial source derived model | [text_loss](#text-loss) |

## Parts

- [latex-print-stage0](https://md.groupants.elamur.ai/free/en/mova/latex/src/print.rs.groupant/stage0.groupant/)
- [latex-print-stage1](https://md.groupants.elamur.ai/free/en/mova/latex/src/print.rs.groupant/stage1.groupant/)
- [latex-print-stage2](https://md.groupants.elamur.ai/free/en/mova/latex/src/print.rs.groupant/stage2.groupant/)

## Model text


### descriptant

#### latex-print

to_latex walks AST using command-word and digit separators; optional right brackets escape, unknown followed by brace gets relax, aligned leading bracket gets relax. Scripts print primes/sub/sup, trailing empty table row compensated. to_text projects style/group distinctions to Unicode with all-or-none sub/sup conversion; to_sexpr exposes selected structure and unknown start positions.

Epoch2026-10-31: full source reviewed before edits; prospective models retained externally. No optimization.

### approximant

#### Forward relation

to_latex walks AST using command-word and digit separators; optional right brackets escape, unknown followed by brace gets relax, aligned leading bracket gets relax. Scripts print primes/sub/sup, trailing empty table row compensated. to_text projects style/group distinctions to Unicode with all-or-none sub/sup conversion; to_sexpr exposes selected structure and unknown start positions.

No useful approximate executable metric for exact categorical syntax; future caps1/2/5/10% only.

### invariant

#### Domain, invariant and cost

to_latex walks AST using command-word and digit separators; optional right brackets escape, unknown followed by brace gets relax, aligned leading bracket gets relax. Scripts print primes/sub/sup, trailing empty table row compensated. to_text projects style/group distinctions to Unicode with all-or-none sub/sup conversion; to_sexpr exposes selected structure and unknown start positions.

Arbitrary publicly constructed ASTs need not round trip; empty string prints empty Row, numeric boundary spaces preserve separate Num nodes, prime count bounded by u8 representation.

LaTeX O(N+output) with recursive stack O(D); text creates subtree strings and can repeat copying across nested wrappers, conservative O(D*output+N). Allocation failure unmodeled.

### composition

#### Composition

to_latex walks AST using command-word and digit separators; optional right brackets escape, unknown followed by brace gets relax, aligned leading bracket gets relax. Scripts print primes/sub/sup, trailing empty table row compensated. to_text projects style/group distinctions to Unicode with all-or-none sub/sup conversion; to_sexpr exposes selected structure and unknown start positions.

Build generates table enums consumed by parser dispatch and printers. Lexer tokens feed macros and parser; parser returns AST whose equality ignores spans. Printers and gate compare that quotient, not original bytes. Shared parent syntax backs scoped stages; stages are byte-bound projections, not independent Rust modules.

### models

### behavior_complement

Normal printer cannot use fault substitutions; intentional SwapFrac/DropSup/DropLast change only applicable structures. Plain text is not an injective encoding of the AST.

### reverse_reconstruction

Canonical string preimage includes ASTs differing only spans and potentially nonnormalized structures; normalized parser trees are the intended round-trip domain. Text preimage additionally varies styles, groups, presentation variants and column metadata.

### token_separation

Control word before alphanumeric and adjacent numeric fragments get separating space.

### optional_scope

Right bracket prints rbrack in optional context; explicit Group resets optional flag inside.

### fault_support

SwapFrac affects fractions, DropSup scripts, DropLast rows len>=3; unaffected trees can remain green.

### text_loss

Text trims ends, drops dollar markers/styles, font families may collapse; no inverse guarantee.

### tests

#### Evidence — 2026-10-31

print::tests::canonical_latex; print::tests::plain_text; integration golden outputs and corrupted_printer_turns_gate_red

Selected library filters ast:: lex:: macros:: parse:: print:: table:: and integration gate excluding document_extraction_with_preamble_macros and random_token_soup_never_panics_and_roundtrips. Direct rustc --test latex/build.rs exercises private helpers. All selected tests twice debug/release with identical sorted names. Four compiled mutants at build/AST/parser/printer boundaries fail assertions then exact restoration passes. These do not individually cover every source. Build-main failure effects, allocation failures and universal roundtrip are unproved. Strict Clippy reports existing lints. No corpus/live VMM/API/GPU/full-school/held-out tests.
