You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI: LaTeX math formulas rendered as raw text instead of being rendered in terminal #34407
When the LLM returns a response containing LaTeX math formulas (both \$...$\ and \\(...\\)\ formats), the opencode CLI displays them as raw LaTeX source code instead of rendering them as formatted math expressions. For example, instead of seeing a properly rendered fraction \�/b, the terminal shows \\(\\frac{a}{b}\\)\ or \$\\frac{a}{b}$.
Environment
Mode: opencode CLI (terminal)
Model: opencode zen / DeepSeek V4 Flash Free
Platform: Windows 11 (PowerShell 7)
OpenCode version: latest
Expected behavior
LaTeX math expressions should be rendered in the terminal (e.g., via Unicode approximations, or a terminal-compatible math renderer). Common approaches used by other CLI tools include:
The system prompt for CLI mode should instruct models to output math using Unicode characters or plain-text alternatives instead of LaTeX delimiters, since there is no LaTeX renderer in the terminal. Alternatively, implement a lightweight terminal-side LaTeX-to-Unicode converter.
We tracked this for study/tutor UX: Obsidian-style $…$ / $$…$$ in TUI chat.
Conclusion: cannot ship a KaTeX chat renderer from an OpenCode plugin pack — TUI plugins have no chat-markdown slot; rendering lives in OpenTUI MarkdownRenderable + OpenCode TextPart.
Contribution specs we keep in-repo until this lands:
OpenTUI: lexer for $/$$ + KaTeX → terminal graphics (Kitty/iTerm-class)
OpenCode: wire TextPart + instruct CLI agents to prefer $/$$ over \(...\) / \[...\]
Until a release documents TUI $/$$ rendering, our harness keeps forbidding those delimiters in chat (Unicode/plain text only; $/$$ for Obsidian notes).
Happy to align with maintainers if there is a preferred design (flag name, image protocol, inline vs display-only first).
the TUI shows the raw LaTeX source, which is barely readable.
Proposal: convert LaTeX math to Unicode plain text in the TUI markdown renderer (e.g. a TeX→Unicode pass similar to unicodeit / flatlatex). Example of the desired output:
Works in every terminal, no image protocol (Kitty/Sixel/iTerm2) support required — much lower complexity than rendering formulas to images.
Covers the most common cases well: sub/superscripts, Greek letters, fractions (as a/b), Σ/∏/∫/√, relation symbols.
Complex constructs (matrices, multi-line aligned equations) can gracefully fall back to the raw source.
The conversion could happen at render time only, leaving the stored message untouched, so /export and /share still produce the original LaTeX.
Current workarounds I'm using: an AGENTS.md rule asking the model to emit Unicode math instead of LaTeX, and /export to view in an editor with KaTeX. A built-in render-time conversion would be a much better default.
Activity
github-actions commentedon Jun 29, 2026
This issue might be a duplicate of existing issues. Please check:
If the underlying cause or fix would be the same, consider adding to that issue instead.
3nricoMarinelli commentedon Jul 9, 2026
I have the same issue. Would be great to have LaTeX rendering.
YannikG commentedon Jul 20, 2026
Harness note (yannik-opencode)
We tracked this for study/tutor UX: Obsidian-style
$…$/$$…$$in TUI chat.Conclusion: cannot ship a KaTeX chat renderer from an OpenCode plugin pack — TUI plugins have no chat-markdown slot; rendering lives in OpenTUI
MarkdownRenderable+ OpenCodeTextPart.Contribution specs we keep in-repo until this lands:
$/$$+ KaTeX → terminal graphics (Kitty/iTerm-class)$/$$over\(...\)/\[...\]Until a release documents TUI
$/$$rendering, our harness keeps forbidding those delimiters in chat (Unicode/plain text only;$/$$for Obsidian notes).Happy to align with maintainers if there is a preferred design (flag name, image protocol, inline vs display-only first).
jitinnair1 commentedon Jul 22, 2026
Found this PR in the opentui repo that might address this: anomalyco/opentui#1148
Ondre119 commentedon Aug 4, 2026
+1, same pain point here. When the model outputs display math like
the TUI shows the raw LaTeX source, which is barely readable.
Proposal: convert LaTeX math to Unicode plain text in the TUI markdown renderer (e.g. a TeX→Unicode pass similar to
unicodeit/flatlatex). Example of the desired output:Why this approach:
a/b), Σ/∏/∫/√, relation symbols./exportand/sharestill produce the original LaTeX.Current workarounds I'm using: an
AGENTS.mdrule asking the model to emit Unicode math instead of LaTeX, and/exportto view in an editor with KaTeX. A built-in render-time conversion would be a much better default.neriousy commentedon Oct 1, 2026
Closing as a duplicate of #40508. Same request: render LaTeX in the terminal UI. Tracking in the V2 TUI issue #40508.