# brucemiller/latexml architecture

> Architecture diagram of the GitHub repository brucemiller/latexml, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/brucemiller/latexml
- Repository: https://github.com/brucemiller/latexml

## Overview

LaTeXML converts TeX and LaTeX documents into structured formats including XML, HTML, MathML, ePub, and JATS. The product workflow is document input, TeX processing, and output generation; the tree also shows package support, post-processing modules, and a browser-side MathJax fallback. The available source excerpt covers only that fallback, so internal conversion-stage connections are shown as unverified rather than inferred as confirmed calls.

Main entry points: [`lib/LaTeXML/Post`](https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML/Post) (Post-processing), [`lib/LaTeXML/Core`](https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML/Core) (Conversion core), [`bin`](https://github.com/brucemiller/latexml/tree/master/bin) (CLI tools), [`lib/LaTeXML/resources/javascript/LaTeXML-maybeMathjax.js`](https://github.com/brucemiller/latexml/blob/master/lib/LaTeXML/resources/javascript/LaTeXML-maybeMathjax.js) (MathJax fallback)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_cli["CLI tools"]
end

subgraph group_processing["TeX processing"]
  node_core["Conversion core"]
  node_engine["TeX engines"]
  node_packages["Package support"]
  node_mathparser["Math parser<br/>[MathParser.pm]"]
end

subgraph group_conversion["Conversion output"]
  node_post["Post-processing"]
  node_xml["XML output"]
  node_html["HTML output"]
  node_mathml["MathML output"]
  node_epub["ePub output<br/>[Epub.pm]"]
  node_jats["JATS output"]
end

subgraph group_browser["Browser rendering"]
  node_fallback["MathJax fallback"]
end

node_author(("Document author"))
node_browser(("Web browser"))
node_mathjax(("MathJax CDN"))

node_author -.->|"provides TeX"| node_cli
node_cli -.->|"converts"| node_core
node_core -.->|"uses"| node_engine
node_core -.->|"supports"| node_packages
node_core -.->|"parses math"| node_mathparser
node_core -.->|"post-processes"| node_post
node_post -.->|"generates"| node_xml
node_post -.->|"generates"| node_html
node_post -.->|"generates"| node_mathml
node_post -.->|"generates"| node_epub
node_post -.->|"generates"| node_jats
node_browser -.->|"runs"| node_fallback
node_fallback -->|"loads conditionally"| node_mathjax

click node_cli "https://github.com/brucemiller/latexml/tree/master/bin"
click node_core "https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML/Core"
click node_engine "https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML/Engine"
click node_packages "https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML/Package"
click node_mathparser "https://github.com/brucemiller/latexml/blob/master/lib/LaTeXML/MathParser.pm"
click node_post "https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML/Post"
click node_xml "https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML"
click node_html "https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML"
click node_mathml "https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML/Post/MathML"
click node_epub "https://github.com/brucemiller/latexml/blob/master/lib/LaTeXML/Post/Manifest/Epub.pm"
click node_jats "https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML"
click node_fallback "https://github.com/brucemiller/latexml/blob/master/lib/LaTeXML/resources/javascript/LaTeXML-maybeMathjax.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_browser toneBlue
class node_core,node_engine,node_packages,node_mathparser toneAmber
class node_post,node_xml,node_html,node_mathml,node_epub,node_jats toneMint
class node_fallback toneRose
class node_author,node_mathjax toneIndigo
```

## Components

### User interface

- [CLI tools](https://github.com/brucemiller/latexml/tree/master/bin): `bin`

### TeX processing

- [Conversion core](https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML/Core): `lib/LaTeXML/Core`
- [TeX engines](https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML/Engine): `lib/LaTeXML/Engine`
- [Package support](https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML/Package): `lib/LaTeXML/Package`
- [Math parser](https://github.com/brucemiller/latexml/blob/master/lib/LaTeXML/MathParser.pm): `lib/LaTeXML/MathParser.pm`

### Conversion output

- [Post-processing](https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML/Post): `lib/LaTeXML/Post`
- [XML output](https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML): `lib/LaTeXML`
- [HTML output](https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML): `lib/LaTeXML`
- [MathML output](https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML/Post/MathML): `lib/LaTeXML/Post/MathML`
- [ePub output](https://github.com/brucemiller/latexml/blob/master/lib/LaTeXML/Post/Manifest/Epub.pm): `lib/LaTeXML/Post/Manifest/Epub.pm`
- [JATS output](https://github.com/brucemiller/latexml/tree/master/lib/LaTeXML): `lib/LaTeXML`

### Browser rendering

- [MathJax fallback](https://github.com/brucemiller/latexml/blob/master/lib/LaTeXML/resources/javascript/LaTeXML-maybeMathjax.js): `lib/LaTeXML/resources/javascript/LaTeXML-maybeMathjax.js`

### Other components

- **Document author**
- **Web browser**
- **MathJax CDN**

## Connections

- Document author → CLI tools: provides TeX
- CLI tools → Conversion core: converts
- Conversion core → TeX engines: uses
- Conversion core → Package support: supports
- Conversion core → Math parser: parses math
- Conversion core → Post-processing: post-processes
- Post-processing → XML output: generates
- Post-processing → HTML output: generates
- Post-processing → MathML output: generates
- Post-processing → ePub output: generates
- Post-processing → JATS output: generates
- Web browser → MathJax fallback: runs
- MathJax fallback → MathJax CDN: loads conditionally (evidence: `lib/LaTeXML/resources/javascript/LaTeXML-maybeMathjax.js`)
