如何在jqMath的格式化表达式中保留空格 [英] How to keep spaces in the formatted expression in jqMath

查看:103
本文介绍了如何在jqMath的格式化表达式中保留空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using jqMath for Math equation formatter. I don't want to remove spaces and newline character from the expression. How can I do that? I have tried a lot but I coudn't find any solution.

推荐答案

来自作者...

通常,最好让html处理文本,由jqMath处理 数学.例如,输入"using $ y =(x + 1)/(x + 2)$"或< td> $ x + y = html表中的2 $< td>(1).

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.

您必须能够将用户输入分为数学和 非数学.如果用户输入"using y = x",则您不希望"using" 解析为5个变量u,s,i,n和g的乘积.同样,如果 他输入了您想保留在数学之外的额外空间, 您必须使用正则表达式等捕获它们,并且 不要将它们传递给jqMath.如果您希望空格成为其中的一部分 数学,您可以让用户输入\ table或\ sp或\ text或 尽管大多数用户都不知道这样做.你可以说 用户,如果需要,他们需要将$ $放在数学周围 对其进行格式化,然后就可以进行搜索.

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.

基本上,jqMath不够聪明,无法分辨出什么是数学以及什么 不是,没有$ $的帮助.

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

大概0.2.0会在几个月后消失,或者至少我会有一个 届时我可以发送给您的版本.

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

Update : New version is out which support /text and /html

这篇关于如何在jqMath的格式化表达式中保留空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆