gpt4 book ai didi

javascript - 如何在 jqMath 中的格式化表达式中保留空格

转载 作者:行者123 更新时间:2023-11-30 09:03:02 24 4
gpt4 key购买 nike

我正在使用 jqMath用于数学方程格式化程序。我不想从表达式中删除空格和换行符。我怎样才能做到这一点?我已经尝试了很多,但找不到任何解决方案。

最佳答案

来自作者...

In general, it's best to let html handle the text, and jqMath handle the math. For example, write " using $y = (x+1)/(x+2)$", or "<td>$x+y = 2$<td>(1)" inside an html table.

You have to be able to separate user input into mathematics and non-mathematics. If a user inputs "using y=x" you don't want "using" parsed as the product of 5 variables u, s, i, n, and g. Similarly, if he inputs extra spaces that you want to keep outside the mathematics, you have to capture them using regular expressions or something, and don't pass them to jqMath. If you want the spaces to be part of the mathematics, you could make the user input \table or \sp or \text or something, though most users won't know to do that. You could tell users that they need to put $ $ around their mathematics if they want it to format, and then you could search for that.

Basically, jqMath isn't smart enough to tell what's math and what isn't, without $ $ to help.

Probably 0.2.0 will be out in a couple months, or at least I'll have a version I could send you by then.

更新: 支持/text 和/html 的新版本已经发布

关于javascript - 如何在 jqMath 中的格式化表达式中保留空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7601222/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com