Repository navigation
Closed
Labels
CLIIssues related to the Codex CLITUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displayenhancementNew feature or request
Description
What variant of Codex are you using?
CLI
What feature would you like to see?
Proposal: render LaTeX in the Codex TUI
Background
LaTeX rendering has been requested previously. I recently shared a prototype on twitter, which was positively received, and @fcoury invited me to contribute it.
I cannot open a PR as it is restricted to collaborators, however my implementation can be found here:
Implementation
The implementation:
- recognizes explicitly delimited display and inline math while excluding Markdown code;
- renders it in-process using RaTeX, a Rust implementation of KaTeX-style mathematical layout;
- displays the resulting images using the Kitty graphics protocol, similar to the existing
/petsfeature; - does not require an external TeX installation or renderer process.
Using KaTeX directly would require an HTML/CSS layout and rasterization engine.
Known limitations
- Inline images must fit terminal-cell geometry, and their baseline alignment varies somewhat between terminal implementations. Inline math is therefore rendered in Unicode whenever possible.
- Native terminal selection copies the Kitty Unicode-placeholder cells rather than the original LaTeX source.
Additional information
No response
Reacted by Jake Edmonstone, aa-sz, nullbio, phyrevue, Gili Tzabari, Frane Doljanin, Nir Shtamberger, HimariO, Piotr Nikiel, Marco Kurzynski and 1 more
Metadata
Metadata
Assignees
Labels
CLIIssues related to the Codex CLITUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displayenhancementNew feature or request
Activity
github-actions commentedon Jul 30, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
fcoury-oai commentedon Jul 30, 2026
Thank you very much for taking the time @haskallcurry! In the next days I will be reviewing the PR and trying to land an adaptation soon. I will fully credit you when I do!
imvladikon commentedon Jul 31, 2026
Funny, because I did it too (but in a different way)
#32828 (comment)
@fcoury-oai FYI
nullbio commentedon Aug 22, 2026
+1. Super annoying seeing raw Latex.
It should be switchable with alt+r by the way, not sure if you implemented that?
FacuVCanale commentedon Aug 30, 2026
I built and live-tested a RaTeX/Kitty variant focused on scrollback behavior and would like to share the implementation and one load-bearing finding for the upstream adaptation.
Implementation: https://github.com/FacuVCanale/codex-ratex
Release/demo binary: https://github.com/FacuVCanale/codex-ratex/releases/tag/v0.1.0-ratex.1
Commit: FacuVCanale@36a4620
Key experiment
On Ghostty via HERDR:
The important unit is therefore the placement, not the uploaded texture. Even when all cropped
a=pcommands are emitted in one synchronized-output batch, Ghostty currently recomposes multiple placements progressively. The working design computes the finalized Markdown layout first, paints every display formula at its real terminal-row offset in one transparent response canvas, and emits exactly onea=tplus onea=pwithz=-1. Text between equations remains terminal-native/selectable above transparent canvas regions.Upstream-shaped behavior
inline_latexfeature, default off.ImageProtocol::Kitty); iTerm2 generic/local-file mode is excluded./clearinvalidate upload state and replay the canvas.Validation
cargo check -p codex-tui, debug build, release build, fmt, and diff-check passI read the contribution policy and am intentionally not opening an unsolicited PR. The fork is rebased onto current main and is available as implementation evidence for the maintainer-owned adaptation. The single-canvas/single-placement result is the main recommendation I would carry upstream; using one placement per formula looked correct while stationary but was unusable during real scroll testing.
etraut-openai commentedon Oct 12, 2026
Basic LaTeX rendering is now in place. More complex equations — those that can't feasibly be rendered in text — fall back on raw LaTeX still.