-
Notifications
You must be signed in to change notification settings - Fork 60.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Incorrect Handling of Mixed LaTeX Math Symbols and Natural Language Text with Dollar Signs #4230
Comments
I know this |
The final solution has not been confirmed yet? Honestly, without the merged pull request for fixing the dollar sign issue, further improvements are out of the question. |
This issue is challenging to resolve. I'm not convinced it's feasible to fix given its complexity, particularly for the frontend and the |
Regardless of how the code is encapsulated, it seems that there is no way to avoid using complex logic and regular expressions to address this issue. I conducted a brief search for Markdown rendering packages in Node.js, and it appears that almost all packages have given up on properly handling the rendering of the dollar sign. The maintainers seem to have chosen a rather passive approach of not addressing such rendering issues. The issue might be the only valuable thing there; markdown-it doesn't support LaTeX at all, as for react-markdown, you know. Frankly, if everyone continues to handle this issue with a negative attitude, it may eventually be left to LLM for maintenance. |
I believe there's always a way to resolve this without resorting to complex logic and excessive use of regular expressions. It's just that I currently don't have the time to do it. |
I took a quick look at the example of markdown-to-jsx, and it seems that it requires writing LaTeX rendering conditions. This task seems a bit simpler compared to what we are currently working on, at least we don't have to replace dollar signs. However, the question is whether it's worth refactoring the code. Honestly, if there are no existing solutions available, our choices might be limited. |
I meet the problem too. Can we use the $ to announce here is a math syntax and use The `` of Just some simple ideas. |
Add to prompt may not be a good idea, as each time it will cost some tokens. |
I found a solution: #4354 |
Would you like to share some insights in your PR? I cannot understand the complex regex used in your code
|
I came up with it with the help of LLMs. Here is an explanation:
I think it still can be improved upon. |
I noticed an issue with the regex and fixed it. It is now:
|
Thanks for your explanation. I tried some examples:
The output:
It seems your solution works fine in these examples. |
It is now:
I noticed the issues in your output and fixed them.
|
Update: I went about it the wrong.
|
Unfortunately, there are still some issues:
And here is a related issue: #4537 My workaround has fixed these three issues. You can try it yourself, here is the instance of my fork https://github.com/Algorithm5838/NextChat/tree/dollar-sign: |
Perhaps this problem will never be solved. |
@daiaji Did you try my workaround? If so, how did you find it? |
Sorry, I just feel very frustrated. As you can see, I submitted this PR. Honestly, even though GPT has provided a lot of help and it has taken up a significant amount of my time, it seems that the problem is still far from being solved. That's all for now.😔 |
I understand your frustration. It can be disheartening when you've put in a significant amount of time and effort into a pull request and the problem still remains unsolved. In my opinion, this issue should definitely be addressed in the
I have tested my inputs, and all of them are correctly handled by pandoc. Most of the time, the output of ChatGPT follows this guideline. So I'd like to figure out why |
It's not possible to fix anyway related to LaTeX because the module conflicts with the front-end CSS and UI/UX. |
Bug Description
To solve issue #2841, current text buffer is modified by
escapeDollarNumber
.However, current algorithm will affect all latex formula start with numbers. Even
$1 + 1 = 2$
cannot be correctly displayed.I also have a real-world example:
I know this is a difficult problem to solve, but such case is not rare.
Steps to Reproduce
Expected Behavior
Most latex formula start with numbers should be correctly displayed.
Screenshots
No response
Deployment Method
Desktop OS
No response
Desktop Browser
No response
Desktop Browser Version
No response
Smartphone Device
No response
Smartphone OS
No response
Smartphone Browser
No response
Smartphone Browser Version
No response
Additional Logs
No response
The text was updated successfully, but these errors were encountered: