[GH-ISSUE #15310] Markdown/LaTex inline math is not rendered correctly in Ollama GUI and appears as raw source text #35554

Open
opened 2026-04-22 20:07:32 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @gurol on GitHub (Apr 3, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/15310

What is the issue?

When I display content containing inline LaTeX-style math expressions in the Ollama GUI, the expressions are not rendered. Instead, the GUI shows the raw source text, including ..., backslashes, and commands such as \rightarrow.

For example, content like:

$C \rightarrow S \rightarrow L \rightarrow P \rightarrow A$

and

$Why \rightarrow What \rightarrow How \rightarrow Where \rightarrow When$

is displayed literally in the chat/output view, instead of being rendered as formatted inline math or symbolic arrows.

This breaks readability and makes educational or technical content much harder to follow.

Expected behavior

The GUI should do one of the following consistently:

Render inline LaTeX/math expressions correctly when enclosed in ..., including commands such as \rightarrow.
If LaTex/math rendering is not supported, gracefully fall back to readable markdown/plain text handling rather than exposing raw escape syntax in a visually broken way.

Actual behavior

The GUI displays the raw expression text literally, including:

Dollar signs
Backslashes
LaTex commands such as \rightarrow

As a result, expressions that should appear as arrow-based sequences are shown as unrendered source code inside normal prose.

Example output

YATAY EKSEN: $C \rightarrow S \rightarrow L \rightarrow P \rightarrow A$

DİKEY EKSEN : $Why \rightarrow What \rightarrow How \rightarrow Where \rightarrow When$

Observed result
The UI displays the literal source text, including \rightarrow, instead of rendering arrows.

Impact
This is especially problematic for:

  • technical documentation
  • educational material
  • architecture/framework explanations
  • mathematical or symbolic notation in responses

It reduces clarity and makes the GUI feel inconsistent with markdown-capable chat interfaces.

Possible cause

This looks like one of the following:

  • inline math is not supported in the markdown renderer
  • math syntax is being escaped or sanitized before rendering
  • the renderer supports markdown but not KaTeX/MathJax-style inline expressions
  • backslash-based commands are passed through as plain text without fallback formatting

Suggested fix

Either:

  • add proper inline/block math rendering support, or
  • detect unsupported LaTex syntax and convert common commands such as \rightarrow into readable Unicode equivalents like →

Relevant log output


OS

macOS

GPU

Apple

CPU

Apple

Ollama version

0.20.0

Originally created by @gurol on GitHub (Apr 3, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/15310 ### What is the issue? When I display content containing inline LaTeX-style math expressions in the Ollama GUI, the expressions are not rendered. Instead, the GUI shows the raw source text, including $...$, backslashes, and commands such as \rightarrow. For example, content like: `$C \rightarrow S \rightarrow L \rightarrow P \rightarrow A$` and `$Why \rightarrow What \rightarrow How \rightarrow Where \rightarrow When$` is displayed literally in the chat/output view, instead of being rendered as formatted inline math or symbolic arrows. This breaks readability and makes educational or technical content much harder to follow. Expected behavior The GUI should do one of the following consistently: Render inline LaTeX/math expressions correctly when enclosed in $...$, including commands such as \rightarrow. If LaTex/math rendering is not supported, gracefully fall back to readable markdown/plain text handling rather than exposing raw escape syntax in a visually broken way. Actual behavior The GUI displays the raw expression text literally, including: Dollar signs Backslashes LaTex commands such as \rightarrow As a result, expressions that should appear as arrow-based sequences are shown as unrendered source code inside normal prose. Example output ``` YATAY EKSEN: $C \rightarrow S \rightarrow L \rightarrow P \rightarrow A$ DİKEY EKSEN : $Why \rightarrow What \rightarrow How \rightarrow Where \rightarrow When$ ``` Observed result The UI displays the literal source text, including `\rightarrow`, instead of rendering arrows. Impact This is especially problematic for: - technical documentation - educational material - architecture/framework explanations - mathematical or symbolic notation in responses It reduces clarity and makes the GUI feel inconsistent with markdown-capable chat interfaces. Possible cause This looks like one of the following: - inline math is not supported in the markdown renderer - math syntax is being escaped or sanitized before rendering - the renderer supports markdown but not KaTeX/MathJax-style inline expressions - backslash-based commands are passed through as plain text without fallback formatting Suggested fix Either: - add proper inline/block math rendering support, or - detect unsupported LaTex syntax and convert common commands such as \rightarrow into readable Unicode equivalents like → ### Relevant log output ```shell ``` ### OS macOS ### GPU Apple ### CPU Apple ### Ollama version 0.20.0
GiteaMirror added the bug label 2026-04-22 20:07:32 -05:00
Author
Owner

@deckar01 commented on GitHub (Apr 5, 2026):

Syntax

Streamdown uses double dollar signs ($$) to delimit mathematical expressions. Unlike traditional LaTeX, single dollar signs ($) are not used by default to avoid conflicts with currency symbols in regular text.

Inline Math

Wrap inline mathematical expressions with $$

https://streamdown.ai/docs/plugins/math#syntax

I can't get models to reliably use that syntax even with carefully worded system prompts. The majority of LaTeX training data is TeX files where text dollar signs are escaped.

I'm curious if the ollama maintainers would be interested in adding a Streamdown extension that uses a heuristic to differentiate between inline LaTeX and text dollar signs. I doubt there is much appetite upstream since this is an LLM + markdown + LaTeX specific problem. I will try running an extension in my own fork for now.

<!-- gh-comment-id:4189570870 --> @deckar01 commented on GitHub (Apr 5, 2026): > ### Syntax > > Streamdown uses double dollar signs (`$$`) to delimit mathematical expressions. Unlike traditional LaTeX, single dollar signs (`$`) are not used by default to avoid conflicts with currency symbols in regular text. > > ### Inline Math > > Wrap inline mathematical expressions with `$$` https://streamdown.ai/docs/plugins/math#syntax I can't get models to reliably use that syntax even with carefully worded system prompts. The majority of LaTeX training data is TeX files where text dollar signs are escaped. I'm curious if the ollama maintainers would be interested in adding a Streamdown extension that uses a heuristic to differentiate between inline LaTeX and text dollar signs. I doubt there is much appetite upstream since this is an LLM + markdown + LaTeX specific problem. I will try running an extension in my own fork for now.
Author
Owner
<!-- gh-comment-id:4190091044 --> @deckar01 commented on GitHub (Apr 6, 2026): https://github.com/deckar01/ollama/commit/b978ce651d68b57adca6b8ae001e8d90ce1ab59c#diff-0e6c65323f5bb1c28410c4b3030aa7b7886e666859f000bcf6c817201dbfb370 <img width="1590" height="904" alt="Image" src="https://github.com/user-attachments/assets/7962c950-04fb-4423-b3ee-bd7092e74571" />
Author
Owner

@PureBlissAK commented on GitHub (Apr 18, 2026):

🤖 Automated Triage & Analysis Report

Issue: #15310
Analyzed: 2026-04-18T18:22:39.654747

Analysis

  • Type: unknown
  • Severity: medium
  • Components: unknown

Implementation Plan

  • Effort: medium
  • Steps:

This issue has been triaged and marked for implementation.

<!-- gh-comment-id:4274310389 --> @PureBlissAK commented on GitHub (Apr 18, 2026): <!-- ollama-issue-orchestrator:v1 issue:15310 --> ## 🤖 Automated Triage & Analysis Report **Issue**: #15310 **Analyzed**: 2026-04-18T18:22:39.654747 ### Analysis - **Type**: unknown - **Severity**: medium - **Components**: unknown ### Implementation Plan - **Effort**: medium - **Steps**: *This issue has been triaged and marked for implementation.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#35554