Clemens Lode introduces texlode, a browser-based real-time LaTeX editor that typesets large documents in ~1ms using standard, unmodified LuaTeX.
The editor achieves sub-millisecond speeds by leveraging the paragraph-local nature of the Knuth-Plass line-breaking algorithm, recompiling only the edited paragraph on each keystroke while caching the rest of the document.
In benchmarks comparing texlode to Typst, texlode scales at $O[1]$ constant time, whereas Typst scales at $O(n)$ due to whole-document state cache invalidations.
On a 300-page document, texlode maintains a 0.7ms recompile speed compared to Typst's 214ms latency.
Sub-millisecond compilation enables advanced real-time layout features, including full-book float placement, orphan/widow constraint balancing, and evolutionary algorithm-based page tuning.
texlode vs. Typst compilation speeds across varying document page sizes
[
00:18:10
]
The Problem with Large Documents: Long recompilation times plague large LaTeX projects (often exceeding 800 pages), disrupting the polishing phase of typesetting.
The Speed vs. Quality Trade-off:
Standard word processors like Microsoft Word operate in real time but utilize simplified typesetting algorithms.
LaTeX produces industry-grade typography but relies on slow, batch-compilation cycles.
Goal of texlode: Bridge the gap by delivering a real-time WYSIWYG editing environment using standard LaTeX engines without modifying the typesetting core.
Timeline and summary of prior attempts to bridge the gap in real-time TeX rendering
[
00:07:48
]
Previous Solutions:
LyX [1995]: Introduced structured previews but still required batch LaTeX for final outputs.
GNU TeXmacs [1999]: True WYSIWYG editor but utilized its own engine, making it TeX-incompatible.
Overleaf [2012]: Solved collaborative workflow issues but relies on full, slow recompilation on the server.
SwiftLaTeX / BusyTeX [2019]: Implemented WebAssembly, eliminating the need for separate servers but still requiring full document rebuilds.
TeXPresso [2023]: Modified the XeTeX engine to snapshotted states but restricted to Unix-like platforms.
Typst [2023]: Leverages incremental compilation with memorization to speed up rendering, but is completely TeX-incompatible and scales poorly on very large files.
The Market Gap: Achieving sub-100ms, $O[1]$ compilation using standard, unmodified LuaTeX.
The texlode Architecture and Optimization Strategy [00:08:57]
Recompilation benchmark limits across various paragraph lengths in LuaTeX
[
00:10:00
]
Paragraph-Local Processing: Because the Knuth-Plass line-breaking algorithm operates locally on individual paragraphs, edits to one paragraph do not change line breaks in surrounding ones.
Granular Caching: texlode treats the paragraph as the smallest organizational unit. Only the paragraph containing the active cursor is compiled per keystroke.
Standard Engine Preservation: Instead of modifying the LuaTeX compiler, the editor wraps standard TeX Live 2025 in a sophisticated client-server caching model.
Live Demonstration of the texlode Editor [00:14:54]
The texlode user interface showing side-by-side editing and real-time layout rendering
[
00:15:09
]
Dynamic Interaction: Live demonstration of drag-and-drop figure adjustments, real-time table styling, and column-width resizing.
AST Mapping: Changes made in the design window map back to unique style IDs in the LaTeX source using a Webflow-like style architecture.
Performance Benchmarks: texlode vs. Typst [00:18:09]
Comparison of compilation scaling speeds between texlode and Typst versions
[
00:18:10
]
Algorithmic Scaling:
Typst scales at $O(n)$ because its cache invalidation depends on the whole-document state.
texlode scales at $O[1]$ because of its strict paragraph-level compilation architecture.
Benchmark Data: Under test conditions, texlode maintains a constant 0.70ms compile speed for a medium paragraph across 10, 100, and 300 pages. Typst (v0.15) increases from 11ms at 10 pages to 214ms at 300 pages.
Future Possibilities of Sub-Millisecond Recompilation [00:21:01]
Advanced Layout Optimizations:
Full-Book Float Placement: Calculating optimal image/table positioning globally rather than restricting rendering page by page.
Widow/Orphan Balancing: Formulating double-page spreads as a global constraint satisfaction problem.
River and Similarity Avoidance: Iterative re-breaking of paragraphs to avoid vertical alignment of white spaces or repeating line-ending words.
Evolutionary Tuning: Using evolutionary algorithms to rapidly run hundreds of variations of page layouts to choose the most visually balanced option.
Handling Custom Macros: If a layout element (like a complex table) spans several paragraphs or relies on custom external packages, the system gracefully degrades by recompiling the entire active page rather than just the edited paragraph.
Latency Control on Page Overflow: If paragraph edits push text onto a subsequent page, the editor prioritizes rendering the user's active page first. The downstream reflow calculations run asynchronously in the background.
Bibliographies and References: The editor uses caching wrappers to handle citations. If a user inputs a brand-new citation, a background routine updates the .bbl files to resolve the reference without freezing the main interface.