[GH-ISSUE #5253] [BUG]: Broken LaTeX rendering #4990

Closed
opened 2026-06-05 14:51:20 -04:00 by yindo · 7 comments
Owner

Originally created by @sinister-cat on GitHub (Mar 23, 2026).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/5253

How are you running AnythingLLM?

Docker (local)

What happened?

LaTeX renders do not "replace" the raw code in Firefox. That is, the raw code is displayed alongside the rendered image for some reason. I've attached screenshots here too.

I tried disabling all my extensions, not sure why it's not working

ungoogled-chromium 145.0.7632.159 Official Build:

Image

Firefox 140.8.0 esr:

Image

Actual text from LLM:

### Inline Equations (single dollar signs)

Here are some inline examples: $E = mc^2$ and $a^2 + b^2 = c^2$.

For calculus: $\frac{d}{dx} f(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}$.

---

### Display Equations (double dollar signs)

**Pythagorean Theorem:**

$$
a^2 + b^2 = c^2
$$

**Quadratic Formula:**

$$
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$

Running with local llama-server and Qwen3.5-122B if that changes anything

Are there known steps to reproduce?

  1. Ask LLM to generate LaTeX
  2. Open conversation in Firefox
  3. Open conversation in Chrome
  4. Firefox render is broken
Originally created by @sinister-cat on GitHub (Mar 23, 2026). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/5253 ### How are you running AnythingLLM? Docker (local) ### What happened? LaTeX renders do not "replace" the raw code in Firefox. That is, the raw code is displayed alongside the rendered image for some reason. I've attached screenshots here too. I tried disabling all my extensions, not sure why it's not working ungoogled-chromium 145.0.7632.159 Official Build: <img width="1331" height="1184" alt="Image" src="https://github.com/user-attachments/assets/86f4da41-8841-4ca4-9c8a-7216b581bace" /> Firefox 140.8.0 esr: <img width="1086" height="1327" alt="Image" src="https://github.com/user-attachments/assets/ce24e793-5a7c-4563-9610-649795b5866d" /> Actual text from LLM: ``` ### Inline Equations (single dollar signs) Here are some inline examples: $E = mc^2$ and $a^2 + b^2 = c^2$. For calculus: $\frac{d}{dx} f(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}$. --- ### Display Equations (double dollar signs) **Pythagorean Theorem:** $$ a^2 + b^2 = c^2 $$ **Quadratic Formula:** $$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} $$ ``` Running with local llama-server and Qwen3.5-122B if that changes anything ### Are there known steps to reproduce? 1. Ask LLM to generate LaTeX 2. Open conversation in Firefox 3. Open conversation in Chrome 4. Firefox render is broken
yindo added the good first issueUI/UXpossible bug labels 2026-06-05 14:51:20 -04:00
yindo closed this issue 2026-06-05 14:51:20 -04:00
Author
Owner

@timothycarambat commented on GitHub (Mar 23, 2026):

This has to be a dependency issue with the underlying LaTEX library and not with AnythingLLM directly.

<!-- gh-comment-id:4111956547 --> @timothycarambat commented on GitHub (Mar 23, 2026): This has to be a dependency issue with the underlying LaTEX library and not with AnythingLLM directly.
Author
Owner

@sinister-cat commented on GitHub (Mar 23, 2026):

A quick search in KaTeX's issues didn't yield anything... Tried on another machine and got the same results.

Not sure where to start poking around. I suppose I'll be using Chrome for the time being.

<!-- gh-comment-id:4114832392 --> @sinister-cat commented on GitHub (Mar 23, 2026): A quick search in KaTeX's issues didn't yield anything... Tried on another machine and got the same results. Not sure where to start poking around. I suppose I'll be using Chrome for the time being.
Author
Owner

@sinister-cat commented on GitHub (Mar 23, 2026):

Looks like even under Chrome certain things are broken. This equation is not rendered fully:

Chrome:

Image

Firefox:

Image

Raw text:

$$\pi_i = \pi_0 \cdot \binom{3}{i} \cdot \rho^i \quad \text{for } i \leq 1$$
$$\pi_i = \pi_0 \cdot \binom{3}{i} \cdot \rho^i \quad \text{for } i > 1 \text{ (still 1 repair person)}$$

Same text in LMStudio:

Image

Unfortunately just switching to Chrome isn't a great workaround.

<!-- gh-comment-id:4115047302 --> @sinister-cat commented on GitHub (Mar 23, 2026): Looks like even under Chrome certain things are broken. This equation is not rendered fully: Chrome: <img width="323" height="182" alt="Image" src="https://github.com/user-attachments/assets/cd6461ec-e933-4912-8367-e730d90ba902" /> Firefox: <img width="964" height="303" alt="Image" src="https://github.com/user-attachments/assets/8157937c-0116-4344-8961-0db627ddd7f1" /> Raw text: ``` $$\pi_i = \pi_0 \cdot \binom{3}{i} \cdot \rho^i \quad \text{for } i \leq 1$$ $$\pi_i = \pi_0 \cdot \binom{3}{i} \cdot \rho^i \quad \text{for } i > 1 \text{ (still 1 repair person)}$$ ``` Same text in LMStudio: <img width="497" height="103" alt="Image" src="https://github.com/user-attachments/assets/1ab916f0-ee0b-4f6d-8b1c-a003748a38fc" /> Unfortunately just switching to Chrome isn't a great workaround.
Author
Owner

@Vangmay commented on GitHub (Mar 23, 2026):

Hello, I am new to anything-llm. Can I give it a try?

<!-- gh-comment-id:4115061716 --> @Vangmay commented on GitHub (Mar 23, 2026): Hello, I am new to anything-llm. Can I give it a try?
Author
Owner

@sinister-cat commented on GitHub (Mar 23, 2026):

@Vangmay I'm pretty sure this originates from the libraries used as well. I've been trying to chase this down with the help of deepwiki but I don't have enough time (or the expertise) to chase down the rendering aspect of this... I'm trying to move away from LMStudio to something more backend-agnostic and this has been a pain to resolve.

I would be eternally grateful if you could :)

<!-- gh-comment-id:4115077175 --> @sinister-cat commented on GitHub (Mar 23, 2026): @Vangmay I'm pretty sure this originates from the libraries used as well. I've been trying to chase this down with the help of [deepwiki](https://deepwiki.com/Mintplex-Labs/anything-llm) but I don't have enough time (or the expertise) to chase down the rendering aspect of this... I'm trying to move away from LMStudio to something more backend-agnostic and this has been a pain to resolve. I would be eternally grateful if you could :)
Author
Owner

@Vangmay commented on GitHub (Mar 23, 2026):

@Vangmay I'm pretty sure this originates from the libraries used as well. I've been trying to chase this down with the help of deepwiki but I don't have enough time (or the expertise) to chase down the rendering aspect of this... I'm trying to move away from LMStudio to something more backend-agnostic and this has been a pain to resolve.

I would be eternally grateful if you could :)

Sure I will give it a try and let you know!

<!-- gh-comment-id:4115082300 --> @Vangmay commented on GitHub (Mar 23, 2026): > [@Vangmay](https://github.com/Vangmay) I'm pretty sure this originates from the libraries used as well. I've been trying to chase this down with the help of [deepwiki](https://deepwiki.com/Mintplex-Labs/anything-llm) but I don't have enough time (or the expertise) to chase down the rendering aspect of this... I'm trying to move away from LMStudio to something more backend-agnostic and this has been a pain to resolve. > > I would be eternally grateful if you could :) Sure I will give it a try and let you know!
Author
Owner

@sinister-cat commented on GitHub (Mar 24, 2026):

@Vangmay see PR from just now, not sure why the mismatch between AnythingLLM and LMStudio is though

edit: the PR has screenshots that seem fine, I'll have a look if it's working when I can

<!-- gh-comment-id:4115261505 --> @sinister-cat commented on GitHub (Mar 24, 2026): ~~@Vangmay see PR from just now, not sure why the mismatch between AnythingLLM and LMStudio is though~~ edit: the PR has screenshots that seem fine, I'll have a look if it's working when I can
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#4990