Rendering Math expressions

108 views
Skip to first unread message

satwik mallajosyula

unread,
Nov 11, 2024, 7:12:18 PM11/11/24
to MathJax Users
Hi guys,
I am working on an AI chatbot and I am using a combination of Mathjax and katex to render math stuff return by the LLM. For some reason, after its being rendered it looks like the image below.
123.jpg

And below is what my code looks like, it would be really great if someone could help me with this

ktex.jpgrender.jpg

It would be great to know what the reason is for this and would appreciate any help.

Thanks,
Satwik

Davide Cervone

unread,
Nov 12, 2024, 10:18:08 AM11/12/24
to mathja...@googlegroups.com
From your first image, it looks like the math delimiters are not being included in the document correctly.  The inline math seems to be coming out as "\ (...)" rather than "\(...\)", and the display math is "[ ... \]" rather than "\[ ... \]".  If the delimiters are not correct, MathJax won't be able to locate the math properly, and so won't typeset it.

The configuration you have shown in your image looks like the KaTeX configuration, not the MathJax one, so we can't help you with that.

Davide

On Nov 11, 2024, at 7:12 PM, satwik mallajosyula <satw...@gmail.com> wrote:

Hi guys,
I am working on an AI chatbot and I am using a combination of Mathjax and katex to render math stuff return by the LLM. For some reason, after its being rendered it looks like the image below.
<123.jpg>

And below is what my code looks like, it would be really great if someone could help me with this

<ktex.jpg><render.jpg>

It would be great to know what the reason is for this and would appreciate any help.

Thanks,
Satwik


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/fff2aa9c-9cac-415c-a2f8-db3519ce0363n%40googlegroups.com.
<123.jpg><ktex.jpg><render.jpg>

Ali Raza

unread,
Jan 16, 2025, 7:06:05 PM1/16/25
to MathJax Users

It seems like your AI chatbot is rendering math content using MathJax and KaTeX, but the output isn't appearing as intended, as shown in the image. Here are some steps to troubleshoot and improve the rendering:

  1. Check Compatibility: Ensure that your implementation supports both MathJax and KaTeX without conflict. These two libraries can sometimes overlap in functionality, which might lead to rendering issues.

  2. Debug Rendering: Verify the rendering sequence in your chatbot's front end. MathJax and KaTeX require specific DOM elements to complete their rendering. Make sure the elements containing math expressions are fully loaded before these libraries process them.

  3. Adjust Math Formatting: Double-check the syntax of the LaTeX expressions being passed from the LLM to ensure they conform to the specific requirements of MathJax or KaTeX.

  4. AI Enhancements for Clarity: If the output math expressions include complex layouts or large equations, consider using AI image enhancers. This way, you can convert rendered LaTeX to high-quality images for use in chat.

Let me know if you want assistance diagnosing your code, optimizing the rendering process, or integrating fallback options!

Reply all
Reply to author
Forward
0 new messages