SOPHIA XT
Open source · MIT · version 0.3.4

Documents your agent can write, check and typeset without TeX.

texwright turns Markdown, LaTeX or a JSON document tree into PDF or HTML with its own TeX-style engine. Equations, cross-references, citations, footnotes and figures come out the way LaTeX sets them, and Mermaid diagrams and TikZ pictures are drawn in place, with circuits, trees and 3D plots. There is no TeX installation and no browser: it is one Node.js package with no dependencies, and a check that answers in milliseconds tells the agent what to fix and where.

zip · 3.1 MB Node.js 20+ No dependencies Mermaid, TikZ, circuitikz, PSTricks Tested on Windows and Linux
A page set by texwright: a theorem and proof, a numbered display equation, a plotted SVG figure with its caption, a tip callout and the start of a code listing.

Page 2 of the showcase, as texwright set it

For agents

Give it to your agent in one line.

Paste this into any coding agent. The guide it points to is written for models: the syntax, the check-fix-render loop and what each diagnostic means.

Read https://sophiaxt.com/texwright/AGENTS.md and use texwright to make PDFs from Markdown or LaTeX.
01

Install from this page

npm installs straight from the tarball here. Nothing to register, nothing else to download.

npm install -g https://sophiaxt.com/texwright/texwright-latest.tgz
texwright doc.md -o doc.pdf
02

Or unzip and run

The zip is the same package. Unzip it anywhere with Node.js 20 or later and run it in place.

node texwright/dist/cli.mjs doc.md -o doc.pdf
03

As an MCP server

Nine tools: render, check, fix, repair in one call, outline, preview a page as PNG, the schema, the guide, and new documents from templates.

{
  "mcpServers": {
    "texwright": { "command": "texwright", "args": ["mcp"] }
  }
}
New in 0.3

3D plots, circuits, trees and PSTricks, with no TeX.

These are the drawing packages models reach for when a document needs a figure, and the ones a converter without TeX drops. texwright now draws them with its own interpreters. We wrote 56 documents the way models write them (13 pgfplots 3D, 14 trees and graphs, 14 circuits, 15 PSTricks): texwright draws the figure in all 56, and pandoc's HTML output, without a TeX install, keeps it in none. What is approximated comes back as a warning, and the rest of the picture is still drawn.

A Gaussian surface drawn by texwright from pgfplots source, in the viridis colour map.
pgfplots 3D. \addplot3 surfaces and meshes, colour maps, the default 25/30 view and pgfplots' box.
A common-emitter BJT amplifier drawn by texwright from circuitikz source.
circuitikz. Resistors to transistors, op amps and logic gates, with circuitikz's sizes and labels.
A constituency parse tree drawn by texwright from forest source.
forest and TikZ trees. forest's packed layout, TikZ child trees, \graph layouts and mind maps.
An inclined plane with force vectors drawn by texwright from PSTricks source.
PSTricks. pspicture with pst-plot, pst-node and pst-tree, including PostScript-code functions.
A paraboloid with a jet colour map and a colour bar, drawn by texwright.
Colour bars. jet, viridis, hot and more, with interp shading and a colour bar.
A machine-learning mind map drawn by texwright from TikZ mindmap source.
Mind maps. concept colours carried down each branch, with shaded connections.
Diagrams

Mermaid and TikZ, drawn by texwright itself.

A fenced mermaid block becomes a numbered figure. texwright reads Mermaid's syntax with its own parsers and lays the diagram out itself: no browser, a few milliseconds per diagram, labels set in the sans companion of Computer Modern so they match the page. A mistake comes back as DIAG001 at its line, with a hint and usually the fix.

  • Flowcharts
  • Sequence
  • Class
  • State
  • ER
  • Gantt
  • Pie
  • XY charts
  • Quadrant
  • Timeline
  • Mindmap
  • Journey
```{.mermaid #fig:flow caption="Request handling"}
flowchart LR
  client([Client]) --> api[API] -->|query| db[(Database)]
```

TikZ and pgfplots go through texwright's own interpreter: paths, nodes and shapes, styles, \foreach, positioning and calc, automata, and axes with plots, bars, legends and log scales. Labels use the document's math, so they match the equations around them.

A page set by texwright with a Mermaid flowchart (a build pipeline with an Engine subgraph) and a gantt chart.
A Mermaid sequence diagram with an alt block, set by texwright.
A Mermaid xy chart with bars and a line, and a pgfplots least-squares fit, set by texwright.
TikZ pictures drawn by texwright: a triangle with marked angles and a coordinate plane with two functions.
A TikZ flowchart drawn by texwright, with coloured shapes and labelled arrows.
SVG figures

SVG figures, drawn the way a browser draws them.

Agents make their figures as SVG: charts, diagrams, Mermaid and draw.io exports. texwright draws gradients, transparency, masks, blend modes, filters, text on paths, HTML labels and full CSS selectors. Each pair below is Chrome on the left and texwright's PDF on the right, the PDF drawn by poppler.

0.7
Average difference from Chrome
levels of 255 per pixel, page previews
0.9
The PDF itself
drawn by poppler, same 30 figures
30
Test figures
gradients, masks, filters, text, diagram tools
Radial gradients, as Chrome draws it

Chrome

Radial gradients, as texwright's PDF shows it

texwright PDF

Radial gradients. Focal points and every spread method, as PDF shadings.
Fading stops, as Chrome draws it

Chrome

Fading stops, as texwright's PDF shows it

texwright PDF

Fading stops. Stops that differ in opacity, drawn through a soft mask.
Masks, as Chrome draws it

Chrome

Masks, as texwright's PDF shows it

texwright PDF

Masks. Luminance and alpha masks, in object or user units.
Drop shadows, as Chrome draws it

Chrome

Drop shadows, as texwright's PDF shows it

texwright PDF

Drop shadows. The shadow becomes an image; the shape stays vector.
Text on a path, as Chrome draws it

Chrome

Text on a path, as texwright's PDF shows it

texwright PDF

Text on a path. Each glyph placed and turned along the curve.
HTML labels, as Chrome draws it

Chrome

HTML labels, as texwright's PDF shows it

texwright PDF

HTML labels. Mermaid's foreignObject labels, wrapped and centred.
Blend modes, as Chrome draws it

Chrome

Blend modes, as texwright's PDF shows it

texwright PDF

Blend modes. mix-blend-mode as the PDF's own blend modes.
draw.io diagrams, as Chrome draws it

Chrome

draw.io diagrams, as texwright's PDF shows it

texwright PDF

draw.io diagrams. Shapes, arrows, labels and the shadow filter.
The loop

Problems come back as data, with the fix attached.

doc.md:3:5 E REF001 Reference to undefined label "sec:intr" | Did you mean "sec:intro"? | fix "sec:intr" -> "sec:intro" safe

01 · Check

Every stage but page layout, in milliseconds. One line per problem, with a code, a position and a hint.

texwright check doc.md --diagnostics compact

02 · Fix

Most diagnostics carry their fix as an edit. The unambiguous ones apply in one go.

texwright check doc.md --fix

03 · Render

The result says which page each heading, figure and table landed on.

texwright doc.md -o doc.pdf

04 · Look

The page as a PNG from texwright's own rasterizer, so the agent can see what it made.

texwright preview doc.md --page 2

What it sets

A paper, a homework set or a report, from plain text.

Page 1 of a texwright showcase: title, authors, abstract, a table of contents with page numbers, and numbered equations.
Page 1 of a LaTeX article typeset by texwright.

Mathematics by TeX's rules

amsmath and amssymb, numbered rows in align and gather, siunitx, mhchem and physics commands without loading anything.

References that resolve

Sections, figures, tables, equations, theorems and listings numbered, with @fig:x, \ref, \eqref, \cref and exact page references.

Citations

BibTeX or CSL-JSON, numeric or author-year.

Pages like LaTeX's

Knuth-Plass line breaking, TeX hyphenation, footnotes at the foot of the page, floating figures, Latin Modern type.

Three inputs, mixed freely

Markdown with pandoc's extensions, LaTeX as models write it (article, report, book, IEEEtran, revtex, llncs, moderncv, exam, beamer and more), or a JSON document tree.

Layout and brand from the document

Paper, margins, size, theme, running heads, authors and brand fonts (mainfont, sansfont, monofont; TTF, OTF, WOFF or WOFF2) as pandoc's front-matter keys. No template to edit.

Measured

Tested on what models actually write.

80/80
Documents that render clean
written by models for a PDF, unchanged
1,903
Tests
passing on Windows and Linux
0
Runtime dependencies
Node.js built-ins only

We asked models for 80 documents (papers, homework, lecture notes, lab reports, CVs, letters, exams) written for pandoc or an ordinary LaTeX installation, then rendered them as they came. All 80 now render with no errors and no warnings; the last one to pass drew its figure in TikZ. A further 30 LaTeX documents in the classes and packages models reach for also check clean. A command starts in about 0.2 seconds, and through the MCP server repeat calls take 15 to 20 ms. The method and the held-out results are in the paper.

What it does not do yet. PSTricks' psmatrix and packages built far beyond TikZ are reported rather than drawn: export those figures as SVG. Beamer comes out as a document, not slides. Hyphenation is English only. Arabic, the Indic scripts and right-to-left text are not supported, the PDF is not tagged for screen readers, and PDF files cannot be used as figures.

Downloads

Everything, with one address that always works.

texwright-latest.zip and texwright-latest.tgz always hold the newest version, so an agent can keep one address. Only the current version is kept under its own name as well.

FileWhat it isSizeSHA-256
texwright-0.3.4.zipThe package as a zip. Unzip and run with Node.js.3.1 MBeeea43605e9111f7…
texwright-0.3.4.tgzThe same package for npm install.2.8 MBa91a9c923adc5ac5…
AGENTS.mdThe guide for agents: syntax, the loop, diagnostics.
CHEATSHEET.mdOne page of syntax.
texwright-paper.pdfThe paper: design, engine, benchmark, security.336 KB
release.jsonVersion, install line, sizes and full SHA-256 hashes.
llms.txtThis page for language models.

texwright is written by Thomas Garren at SOPHIA XT and released under the MIT licence. Its text is set in Latin Modern (GUST Font License) and its mathematics in the KaTeX fonts (SIL Open Font License); both ship inside the package.