Skip to content

[Bug]: Inline LaTeX renders garbled inside right-to-left (Hebrew) paragraphs #47061

Done

Description

@NadavHanan

What happens

Inline math ($...$) inside a Hebrew (right-to-left) paragraph of an assistant message renders as broken glyph fragments. The symbols are partly drawn, overlapping, and misplaced.

In the same thread:

  • display math ($$...$$) renders correctly, including when the surrounding message is Hebrew;
  • the same inline math renders correctly inside an English (left-to-right) paragraph.

Repro

Have the assistant reply with a Hebrew sentence that contains inline math, for example:

הקבועים הם $e$, $i$ ו-$\pi$.

The formulas are recognized as math (they are typeset, just laid out wrong). This reproduces with the plain sentence above; invisible direction marks (U+200F) around the formulas make no difference.

Expected

Inline math in a right-to-left paragraph renders the same way it does in left-to-right text.

Likely cause

The KaTeX output seems to inherit direction: rtl from the paragraph, while KaTeX lays out each formula's parts assuming left-to-right. Isolating the math should fix it:

.katex { direction: ltr; unicode-bidi: isolate; }

Related

Environment

  • T3 Code desktop app for Linux
  • t3 v0.1.13, server on Ubuntu 24.04 (aarch64)
  • Agent: Claude Code

Screenshot

screenshot-2026-12-01_23-53-38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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