---
title: 'Mogan STEM: Interactive Scientific Authoring'
url: https://www.emergentmind.com/topics/mogan-stem
type: topic
---

# Mogan STEM: Interactive Scientific Authoring

Mogan STEM is a WYSIWYG, structured editor derived from GNU TeXmacs that is presented as an alternative to TeX for scientific authoring in the era of large language models (LLMs). Its defining claim is that TeX’s linear macro stream, batch compilation model, and multi-pass side effects are poorly matched to interactive, AI-assisted writing, whereas Mogan keeps a document tree in memory, renders interactively, and stores structure explicitly in its `.tmu` format [2603.02873]. In the source paper, Mogan STEM is characterized by an explicit document tree, local and parallel rendering, on-demand plugin loading, in-file storage of structural links such as cross-references, and lower information entropy for LLM-oriented workflows than TeX [2603.02873].

## 1. Scope and nomenclature

Within the cited literature, “Mogan STEM” refers specifically to the editor introduced in “LaTeX Compilation: Challenges in the Era of LLMs” [2603.02873]. It should be distinguished from “MoGAN,” a motion-centric post-training framework for video diffusion [2511.21592], and from “STEM,” the “Structured Transition Evaluation Method” for LLM capability evaluation [2508.12096]. The overlap in naming is lexical rather than conceptual.

The paper positions Mogan STEM against TeX by arguing that TeX’s design, which originated in the 1970s–80s, is a poor fit for interactive and LLM-assisted scientific writing. Four limitations are identified as central: compilation efficiency, generated semantics, error localization, and tool ecosystem constraints [2603.02873]. This framing places Mogan STEM not merely as an editor, but as an alternative document representation and execution model for technical writing.

A plausible implication is that the topic is best understood at the intersection of document engineering, interactive theorem-and-math authoring, and LLM-oriented representation design. The paper’s emphasis is not only typographic output, but also compilation behavior, semantic analyzability, and token efficiency in machine-mediated workflows [2603.02873].

## 2. Motivation: TeX’s limitations in interactive and LLM-assisted writing

The paper’s critique of TeX begins with compilation. TeX uses a unidirectional “read → expand → typeset → output” flow, which requires full re-compilation even for small edits. A one-line deletion can trigger global re-pagination affecting page breaks, float positions, counters, and headers or footers [2603.02873]. Multi-pass recovery mechanisms for cross-references, tables of contents, and bibliographies depend on auxiliary files such as `.aux`, `.toc`, and `.bbl`, and repeated runs such as `pdflatex → bibtex → pdflatex → pdflatex` [2603.02873]. The paper also cites platform variance and toolchain fragmentation, including `pdfLaTeX` versus `XeLaTeX` versus `LuaLaTeX`, and `BibTeX` versus `Biber`, as sources of latency and cognitive overhead.

A second limitation concerns generated semantics. In TeX, semantic and layout behavior are conflated in macro expansion. The paper uses `\section` as a representative example: it simultaneously declares structure and triggers formatting, counter changes, and table-of-contents writing. Because macros may act either as text wrappers or as structural entities, static tools cannot reliably distinguish their roles. Moreover, conditionals such as `\ifdefined...` determine structure only at expansion time, so there is no stable, analyzable AST without simulating TeX execution [2603.02873].

The third limitation is error localization. TeX errors can surface late and far from their origin. The paper gives two examples: missing braces in `\frac` may trigger “Runaway argument?” at `\end{equation}`, and mismatched `\left/\right` can fail during closing stages rather than where the structural inconsistency originated. Reported locations therefore indicate where execution stalled, not where the structure actually broke [2603.02873].

The fourth limitation concerns the surrounding tool ecosystem. Real-time preview in editors is achieved through frequent background compilations, and the lack of a structured tree makes refactoring, semantic checks, and conflict-aware merges difficult. The paper also notes distribution bloat: the TeX Live ISO grew from `2.4 GB (2008)` to `5.9 GB (2025)`, minimal installs exceed `1 GB`, and full distributions are `≈ 6 GB in 2025` [2603.02873].

For LLM workflows, the paper argues that TeX carries “syntax noise,” since multiple forms can render identically, such as `\frac{a}{b}` versus `{a \over b}` and `x^{2}` versus `x^2`. This increases uncertainty and token budget during learning and generation. Because multi-pass semantics and external side effects distribute structural information across files and compilation stages, an LLM may need broad scans to recover display numbers or citation contexts [2603.02873].

## 3. Document model, rendering architecture, and the `.tmu` format

Mogan STEM is described as a functional, tree-based representation for both document structure and mathematics. Its architectural components are an explicit document tree, a rendering engine with local and parallel rendering at leaf nodes, incremental repainting of affected subtrees after edits, and a plugin system that loads features on demand rather than at startup [2603.02873]. Unlike TeX’s macro stream, Mogan separates abstract structure from rendering and maintains a verifiable structural state.

The contrast between TeX and Mogan can be summarized as follows:

| Aspect | TeX | Mogan STEM |
|---|---|---|
| Core representation | Linear macro stream | Explicit document tree |
| Reference stabilization | Auxiliary files and repeated runs | Relationships stored in-tree |
| Update strategy | Full re-compilation | Incremental subtree re-rendering |

The `.tmu` format is the concrete representation of this model. It uses tree or functional S-expressions for content, together with compact tags for associations [2603.02873]. Representative forms given in the paper include the fraction expression `(frac "1" "2")`, an integral encoded through quasi-quoted Scheme with `concat`, `rsub`, `rsup`, and `around*`, and a multi-line document snippet containing a figure and list:
```scheme
(document "Mogan Logo" "(figure )" (itemize (document (concat (item) "WYSIWYG Writing") "")))
```

Cross-references are stored in-file after update. The paper’s example
```text
<associate|sec:tree-struc-on-mogan|<tuple|5.1|13>>
```
encodes a label, section number, and page number directly in the document [2603.02873]. Likewise, a section labeled `sec:intro` may later appear as:
```text
<associate|sec:intro|<tuple|1|2>>
```
This means that tools and LLMs can resolve structure from the document itself rather than from external auxiliary products of a compilation pipeline.

A plausible implication is that Mogan’s document model is intended not only as a rendering substrate but also as a semantically legible interchange format. The paper explicitly links this explicitness to lower information entropy and easier structural resolution for downstream tooling [2603.02873].

## 4. Incremental compilation, rendering efficiency, and plugin loading

The paper decomposes total measured time as
$$
t_{\text{total}} = t_{\text{compiling}} + t_{\text{rendering}} + t_{\text{IO}}.
$$
This definition is important because Mogan’s measurements include WYSIWYG I/O overhead, whereas TeX is typically discussed in terms of compilation alone [2603.02873].

Mogan’s speed claims derive from incremental rendering, tree diffing, local repaint, parallel processing, and the elimination of multi-pass external tools for stabilizing global state. The paper describes the conceptual flow on edit as: identify the affected subtree $S$; validate $S$ against schema or constraints; recompute layout for $S$; update structural links in $S$ and directly linked nodes; diff the old and new subtree; apply a minimal patch to the render tree; and render patched leaves in parallel before updating the viewport [2603.02873].

The benchmark corpus consists of six arXiv papers “rich in cross-references, TOC, bibliographies,” run on hardware listed as `CPU Intel Ultra 9 285H; GPU GeForce RTX 5080; RAM 32 GB LPDDR5X` [2603.02873]. The results summary states that Mogan outperforms TeX in full compilation for most documents despite I/O overhead, with one exception: `arXiv:2502.17655`, a `120-page paper`, where Mogan is slower on initial open because I/O is proportionally large [2603.02873]. For incremental updates—including adding sections, tables, adjusting labels and references, and minor rearrangements—Mogan is faster on all six documents. The paper explains that this removes the apparent contradiction, because during incremental edits `t_IO = 0` after open and the advantage comes from local re-rendering [2603.02873].

The plugin system is also part of the efficiency argument. Mogan is described as a monolithic, self-contained editor containing the core executable, Scheme runtime, document model, and renderer, while plugins load only when required by a document’s structure or operations. Installation is said to be on the order of “one hundred megabytes,” with several hundred megabytes after extraction, compared with TeX Live minimal installations above `1 GB` and full installations of `≈ 6 GB in 2025` [2603.02873].

## 5. Structural validity and error localization

A central technical distinction in the paper is that Mogan maintains verifiable structure at input time. Explicit `around*` and bracket nodes preserve completeness, and bracket pairs and similar constructs are functional objects that remain paired unless explicitly edited [2603.02873]. This makes error propagation local rather than global.

The paper contrasts TeX and Mogan with concrete examples. In TeX, an “Unclosed brace in `\frac`” may fail only at `\end{equation}`, far from the origin of the structural defect. In Mogan, the fraction node is a 2-argument function, so validation fails locally and highlights the fractional subtree rather than the entire page [2603.02873]. Likewise, the integral example encoded with `around*` manages nested brackets such as `[F(x)] |`, and even omitted parentheses do not break the overall expression because bracket functions are represented as nodes with enforced pairing.

The broader claim is that AST-level validation and constraints prevent error propagation. A missing bracket in TeX can “run away” and corrupt subsequent parsing, whereas in Mogan the fault is confined to the nearest ancestor node and the remainder of the document stays renderable [2603.02873]. The paper also states that errors do not abort the entire output because local modules isolate faults.

This suggests a shift from recovery after failed batch execution to input-time structural preservation. In that interpretation, Mogan’s editor is not merely preventing specific syntax errors; it is constraining document states so that categories of failure become non-global by construction [2603.02873].

## 6. LLM-oriented experiments, token cost, and information entropy

The paper’s LLM-oriented argument is that `.tmu` has lower information entropy than TeX because it reduces interchangeable syntactic forms and encodes structure explicitly. The canonical entropy definition is stated as
$$
H(X) = -\sum_i p_i \log p_i.
$$
The argument is qualitative, but the paper says that lower entropy makes structurally valid next tokens more predictable and that fine-tuning results corroborate this interpretation [2603.02873].

Three task families are evaluated. The first is a structure locating task using four LLMs and `20 questions` on `arXiv:2502.17655`. The score is
$$
u_s = \max\left(0, \begin{cases}
5 - \left\lfloor \dfrac{T}{10^4} \right\rfloor, & \text{right answer} \\
0, & \text{wrong answer}
\end{cases}\right),
$$
with $\sum u_s \in [0,100]$, where $T$ counts input, thinking, output, and tool tokens [2603.02873]. The reported result is that Mogan `(.tmu)` leads for most LLMs, despite those models being trained heavily on TeX corpora, because structural links such as `<associate|label|<tuple|section|page>>` are directly available.

The second family concerns merging files with distinct doc-styles. The paper defines doc-style as macro naming conventions, aliasing, and redefinitions. The assignment asks models to merge `theorems.tex` and `proofs.tex`, each written in distinct styles with cross-references, into a single file using the style of `theorems.tex`, with successful compilation and proper placement of proofs under theorems via cross-references [2603.02873]. The score is
$$
u_m = \max\left(0, \begin{cases}
20 - 2 E_{\text{ref}} - \left\lfloor \dfrac{T}{10^4} \right\rfloor - E_{\text{sty}}, & \text{success on first try} \\
10 - 2 E_{\text{ref}} - \left\lfloor \dfrac{T}{10^4} \right\rfloor - E_{\text{sty}}, & \text{success on second try} \\
0, & \text{fail within two tries}
\end{cases}\right),
$$
with $\sum u_m \in [0,100]$ [2603.02873]. The reported result is that `.tmu` achieves higher scores on all LLMs; the paper attributes this to grammar consistency and explicit structure, and states that in practice merging is copy-paste in Mogan.

The third family concerns debugging ill-formed documents. Twenty ill-formed samples are distributed as `Unclosed bracket 4; Unclosed environment 5; Wrong command usage 4; Undefined cross-reference 3; Conflicting packages 2; Self-recursive macros 2` [2603.02873]. The score is
$$
u_d = \max\left(0, \begin{cases}
5 - \left\lfloor \dfrac{T}{10^4} \right\rfloor, & \text{right answer} \\
0, & \text{wrong answer}
\end{cases}\right),
$$
with $\sum u_d \in [0,100]$ [2603.02873]. The result reported is that the Mogan group fixes all errors, with only two cases above `10k tokens`, whereas the TeX group requires more “thinking.” The paper adds an important qualification: if a document is authored in Mogan, `.tmu` cannot have “unclosed environments” or “self-recursive macros” [2603.02873].

The fine-tuning experiment uses parallel supervised fine-tuning `(LoRA)` on `Qwen2.5-7B-Instruct`, with a dataset of `1000 random formulas in TeX converted to Mogan S-expressions`, identical rendering, and `289` training steps on `Intel Ultra 9 285H, GeForce RTX 5080, 32 GB RAM` [2603.02873]. Coverage includes fractions, radicals, subscripts and superscripts, matrices, piecewise functions, integrals and summations, limits, quantifiers, composite functions, and nested parentheses. The task is prefix completion. The reported training result is that loss converges to `≈0.4 on Mogan` versus `≈0.7 on TeX` after `289 steps` [2603.02873].

A concise summary of the reported LLM results is useful:

| Task | Setup | Reported outcome |
|---|---|---|
| Structure locating | 4 LLMs, 20 questions | `.tmu` leads for most LLMs |
| Doc-style merging | 4 LLMs, two assignments | `.tmu` higher scores on all LLMs |
| Fine-tuning | LoRA on Qwen2.5-7B-Instruct, 289 steps | Loss `≈0.4` vs `≈0.7` |

## 7. Conversion workflows, limitations, and research directions

Mogan includes a built-in LaTeX importing engine. In the reported experiments, `.tex` sources were imported to `.tmu` with identical rendering content [2603.02873]. Export to final formats such as PDF is supported, but TeX compatibility is characterized as `Partial` rather than complete [2603.02873]. The paper does not claim export back to `.tex`; its emphasis is on import and final-format export.

The stated limitations are concrete. First, TeX compatibility is partial, and very complex, heavily macro-driven templates may not map `1:1` to Mogan’s structural model. Second, TeX’s package ecosystem remains far broader, even though Mogan supports on-demand plugins. Third, very large documents may incur noticeable initial-open I/O overhead, illustrated by the slower first open for the `120-page` `arXiv:2502.17655` case. Fourth, community adoption is a nontrivial issue: migration requires different habits and workflows, and “Overleaf-style line-based collaboration” does not transfer directly because Mogan is structure-based rather than plain-text-based [2603.02873].

The paper’s practical guidance is correspondingly specific. Mogan is recommended for interactive WYSIWYG authoring with immediate feedback, for documents rich in cross-references, equations, and figures, for LLM-integrated workflows involving authoring, merging, and debugging, and for lightweight or constrained installations, given the contrast between a Mogan installer of roughly `≈100 MB` and TeX Live installs above `1 GB` or around `≈6 GB` for full distributions [2603.02873]. Migration is described as beginning with `.tex` import into `.tmu`, followed by validation of structure and references, while expecting only partial compatibility for exotic macro packages [2603.02873].

The paper closes with an explicit appeal for larger experiments on LLM training using `.tmu`. Proposed directions include broader scientific corpora incorporating sections, figures, and citations; varied model sizes; comparative token cost; perplexity; entropy estimates; tokens per second; and accuracy on authoring, merging, and debugging tasks [2603.02873]. Research questions posed include whether `.tmu` consistently lowers token usage for structure-heavy tasks, how loss curves and downstream accuracy scale with corpus size, and which ablations—such as bracket function variants or reference-tag density—drive gains [2603.02873].

Taken together, these claims define Mogan STEM as a structured-document system whose significance lies not only in rendering and editing, but in the proposal that scientific document formats should be designed for both human authoring and machine reasoning. The paper’s results suggest faster incremental updates, more local error handling, and lower token cost for several LLM tasks, while leaving open broader questions of compatibility, ecosystem maturity, and scaling beyond the reported experiments [2603.02873].

Source: https://www.emergentmind.com/topics/mogan-stem