---
title: "latex-macros — Mova code model"
description: "Mova code model of latex/src/macros.rs: components with their labels, obernants and the model text."
url: "https://groupants.elamur.ai/free/en/mova/latex/src/macros.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/macros.rs.groupant/>

# latex-macros

The groupant beside latex/src/macros.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/macros.rs`](https://github.com/ElamurAI/mova-free/blob/main/latex/src/macros.rs)
- **source SHA-256:** `4253c16fd5f46f05…`
- **repository folder:** [`latex/src/macros.rs.groupant`](https://github.com/ElamurAI/mova-free/tree/main/latex/src/macros.rs.groupant)
- **repository commit:** `855da7bd4a7b`

> **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) |
| `overwrite_policy` | overwrite_policy | partial source derived model | [overwrite_policy](#overwrite-policy) |
| `capture_semantics` | capture_semantics | partial source derived model | [capture_semantics](#capture-semantics) |
| `failure_precedence` | failure_precedence | partial source derived model | [failure_precedence](#failure-precedence) |
| `delimiter_scope` | delimiter_scope | partial source derived model | [delimiter_scope](#delimiter-scope) |

## Parts

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

## Model text


### descriptant

#### latex-macros

scan visits definition commands in token order, updates hash table on success, counts ignored provides as defined, counts malformed readers as skipped. let clones existing macro or captures CmdRaw. read_def validates body before sequential parameter numbers. match_pattern greedily consumes literal delimiters at brace depth zero.

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

### approximant

#### Forward relation

scan visits definition commands in token order, updates hash table on success, counts ignored provides as defined, counts malformed readers as skipped. let clones existing macro or captures CmdRaw. read_def validates body before sequential parameter numbers. match_pattern greedily consumes literal delimiters at brace depth zero.

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

### invariant

#### Domain, invariant and cost

scan visits definition commands in token order, updates hash table on success, counts ignored provides as defined, counts malformed readers as skipped. let clones existing macro or captures CmdRaw. read_def validates body before sequential parameter numbers. match_pattern greedily consumes literal delimiters at brace depth zero.

nargs accepted0..9 for newcommand; default read only when nargs>0. Malformed input consumed progressively. Source lifetimes own borrowed names/tokens.

O(B) lex plus definition bodies retained; expected hash lookup. Delimited scan O(T*L), where L delimiter length; cloning captured macros proportional to body/pattern/default sizes.

### composition

#### Composition

scan visits definition commands in token order, updates hash table on success, counts ignored provides as defined, counts malformed readers as skipped. let clones existing macro or captures CmdRaw. read_def validates body before sequential parameter numbers. match_pattern greedily consumes literal delimiters at brace depth zero.

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

providecommand cannot overwrite an existing definition. Failed pattern matching does not promise rollback. HashMap names does not promise sorted iteration.

### reverse_reconstruction

Final macro table admits arbitrary overwritten definitions and ignored provides; scan stats constrain success/error counts but not unique source. let copy retains the captured old meaning despite later redefinition.

### overwrite_policy

Later new/renew/def replace; provide only absent, but every successful read increments defined.

### capture_semantics

let existing macro clones value; built-in target saved CmdRaw to avoid future expansion.

### failure_precedence

read_def missing/unclosed body can precede out-of-order parameter diagnosis.

### delimiter_scope

Delimiter matches only at zero brace depth; exactly one group loses braces.

### tests

#### Evidence — 2026-10-31

macros::tests::scans_definitions; macros::tests::delimited_def

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.
