codex - 💡(How to fix) Fix TUI: support Markdown math rendering for inline and block LaTeX [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#18906Fetched 2026-04-22 07:50:53
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×3unlabeled ×1

Root Cause

Codex is especially useful for coding, research, and technical writing workflows. In those workflows, mathematical notation is common. Right now the terminal UI handles prose and code, but not equations, which creates a gap for engineering and research use cases.

Code Example

$$
q^T k = (q^C)^T k^C + (q^R)^T k^R
$$
RAW_BUFFERClick to expand / collapse

What version of Codex is running?

Observed in the current Codex terminal workflow. I do not have a precise version string to attach here.

Which model were you using?

Observed while using Codex in the terminal UI.

What platform is your computer?

macOS on Apple Silicon in a terminal-based Codex workflow.

What issue are you seeing?

Codex renders regular Markdown reasonably well in the terminal UI, but LaTeX math in Markdown is not rendered.

In practice, inline math such as $W = W_0 + BA$ and block math such as:

$$
q^T k = (q^C)^T k^C + (q^R)^T k^R
$$

show up as raw Markdown/LaTeX source instead of readable equations.

This makes Codex less useful for:

  • ML and math-heavy notes
  • paper reading
  • algorithm derivations
  • technical documentation with equations

What feature would you like?

Support Markdown math rendering in the Codex terminal UI, ideally for both:

  • inline math: $...$
  • block math: $$...$$

Possible implementation directions:

  • render to a terminal-friendly plain-text or Unicode pretty-printed form
  • add a math-aware Markdown parsing/rendering stage
  • optionally support KaTeX-compatible parsing before terminal rendering

Even a partial first step would help:

  • preserve math blocks as visually distinct blocks
  • improve spacing/escaping for common expressions
  • avoid broken rendering for common LaTeX patterns

Why this matters

Codex is especially useful for coding, research, and technical writing workflows. In those workflows, mathematical notation is common. Right now the terminal UI handles prose and code, but not equations, which creates a gap for engineering and research use cases.

Reproduction

  1. Open Codex in the terminal UI.
  2. Ask it to write or display Markdown containing inline and block LaTeX math.
  3. Observe that the expressions are not rendered as readable equations.

Expected behavior

Math expressions should display in a readable rendered form, or at minimum in a terminal-friendly normalized representation that is much easier to read than raw LaTeX source.

Additional context

This request is specifically about the terminal / TUI rendering path, not browser-based Markdown renderers.

extent analysis

TL;DR

To fix the issue of LaTeX math not rendering in Codex's terminal UI, consider adding a math-aware Markdown parsing and rendering stage that can handle inline and block math expressions.

Guidance

  • Investigate using a library like KaTeX to parse LaTeX expressions and render them in a terminal-friendly format.
  • Modify the Codex terminal UI rendering pipeline to include a step for math expression rendering, potentially using Unicode characters for pretty-printing.
  • Consider preserving math blocks as visually distinct blocks and improving spacing/escaping for common expressions as a partial first step.
  • Test the rendering of common LaTeX patterns to ensure they are not broken and are displayed in a readable form.

Example

No specific code example can be provided without knowing the details of the Codex rendering engine, but an example of how KaTeX might be used in a JavaScript context could look like:

const katex = require('katex');
const latexExpression = '$W = W_0 + BA$';
const renderedHtml = katex.renderToString(latexExpression, { throwOnError: false });
console.log(renderedHtml);

However, this would need to be adapted for terminal output rather than HTML.

Notes

The solution will depend on the specifics of the Codex terminal UI and its rendering engine. This guidance assumes that the UI is capable of rendering Unicode characters and that the addition of a math rendering stage is feasible.

Recommendation

Apply a workaround by integrating a library like KaTeX into the Codex terminal UI rendering pipeline to handle LaTeX math expressions, as this seems to be the most direct path to supporting math rendering in the terminal UI.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Math expressions should display in a readable rendered form, or at minimum in a terminal-friendly normalized representation that is much easier to read than raw LaTeX source.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix TUI: support Markdown math rendering for inline and block LaTeX [1 participants]