Skip to content

Conversation

srogmann
Copy link
Contributor

@srogmann srogmann commented Oct 10, 2025

Close #16136

This PR handles LaTeX blocks in (...) and [...], as well as dollar amounts like $100 that should not be interpreted as inline LaTeX.

Examples (e.g. prompt "Think of a grade 4 math question regarding amounts."):

  • ( \mathrm{GL}_2(\mathbb{F}_7) ): Group of invertible matrices with entries in (\mathbb{F}_7).
  • Some kernel of (\mathrm{SL}_2(\mathbb{F}_7)):
    [
    \left{ \begin{pmatrix} 1 & 0 \ 0 & 1 \end{pmatrix}, \begin{pmatrix} -1 & 0 \ 0 & -1 \end{pmatrix} \right} = {\pm I}
    ]
  • $100 and $12.99 are amounts, not LaTeX.
  • I have $10, $3.99 and $x + y$ and $100x$. The amount is $2,000.

@allozaur : I wrote most of this PR a week ago, only just now noticed issue #16136 and your PR #16496. In math-formulas.ts, I've added examples for Storybook, along with tests for Vitest. Feel free to take a look and let me know your thoughts. Detecting inline LaTeX is inherently tricky, so my approach likely won't cover every edge case, but I hope it's a step in the right direction.

@allozaur
Copy link
Collaborator

allozaur commented Oct 11, 2025

Hey @srogmann! Thank you for this contribution :) Yeah, we will definitely work sth out from these PRs :)

@srogmann srogmann force-pushed the feature/svelte_latex_regex branch from 7eb8914 to 9b31191 Compare October 13, 2025 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misc. bug: mathematical expression not decoded in llama.cpp web interface

2 participants