Skip to content

bug: math equations rendered as raw LaTeX source — agents not instructed to use KaTeX-compatible syntax #15053

Description

@alberti42

Description

The opencode web/desktop frontend renders math using KaTeX, which requires $...$ for inline equations and $$...$$ (flush-left, surrounded by blank lines) for display equations. However, the system prompts for all agent families give no instruction about this. LLMs default to \(...\) and \[...\], which KaTeX cannot parse, so equations appear as raw LaTeX source instead of rendered formulas (see the screenshot).

Expected behavior: Equations should be rendered by KaTeX as properly formatted math.

Plugins

None

OpenCode version

dev branch (SHA1 68cf011)

Steps to reproduce

Ask any agent (OpenAI, Claude, Gemini, …) a question that involves a mathematical equation, e.g.:

Answer quickly: Can you remind me how the Schrödinger equation looks like?

Screenshot and/or share link

Image

Operating System

All systems

Terminal

Does not apply

Activity

added
coreAnything pertaining to core functionality of the application (opencode server stuff)
on Feb 25, 2026

github-actions commented on Feb 25, 2026

@github-actions
Contributor

This issue might be a duplicate of existing issues. Please check:

  • Desktop: Katex Parse Error Bug while using GLM-5 #14748: Desktop: Katex Parse Error Bug while using GLM-5 — also involves KaTeX rendering failures in the desktop app, though the root cause described there is different (parse error with table content vs. LLM using wrong math delimiters)

alberti42 commented on Feb 26, 2026

@alberti42
ContributorAuthor

This issue might be a duplicate of existing issues. Please check:

  • Desktop: Katex Parse Error Bug while using GLM-5 #14748: Desktop: Katex Parse Error Bug while using GLM-5 — also involves KaTeX rendering failures in the desktop app, though the root cause described there is different (parse error with table content vs. LLM using wrong math delimiters)

No I had checked it and it had nothing to do with the current issue.

assigned and unassigned on Apr 26, 2026
removed
bugSomething isn't working
coreAnything pertaining to core functionality of the application (opencode server stuff)
on May 3, 2026

hectorandac commented on Jun 16, 2026

@hectorandac

I'm facing the same issue would be nice to have a fix for this I'm using gemma 4 and I can't understand any formulas :'(

alberti42 commented on Jun 25, 2026

@alberti42
ContributorAuthor

I designed, and Claude wrote, an Emacs extension that makes user experience 100% better than in the original OpenCode TUI.

https://www.reddit.com/r/emacs/comments/1ufbipv/for_scientists_and_learners_agentshell_renders/

It extends the agent-shell Emacs package by adding a live equation rendering in SVG format. It feels amazing. And it shows the power of Emacs, allowing for easy customizations compared to other editors.

github-actions commented on Aug 25, 2026

@github-actions
Contributor

To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

arefks commented on Aug 27, 2026

@arefks

same issue for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions