Forgot password?
 Create new account
View 159|Reply 3

LaTeX delimiter

[Copy link]

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

hbghlyj Posted at 2023-2-27 23:32:34 |Read mode
The regular expression \\\[(.*?)\\\]|\\\((.*?)\\\)|\$\$(.*?)\$\$|\$(.*?)\$ will match LaTeX formulas.

You can test it at regex101.com/

Screenshot 2023-02-27 at 15-36-29 regex101 build test and debug regex.png

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

 Author| hbghlyj Posted at 2023-2-27 23:35:43
建议论坛公式编辑器像regex101这样的效果, 把LaTeX公式背景高亮
可以研究一下regex101如何实现这样的效果

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

 Author| hbghlyj Posted at 2023-4-13 22:27:11
我发现 regex101 文本编辑器是一个带有 contenteditable="true" 的 <div>
背景高亮是使用 <canvas> 实现的。
Screenshot 2023-04-13 152522.png

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

 Author| hbghlyj Posted at 2023-5-12 06:11:39
Last edited by hbghlyj at 2023-5-12 14:05:00oijaz.unicode-latex-1.2.0
我做了少量修改:
$type completion.js (954 Bytes, Downloads: 23)
$type extension.js (5.1 KB, Downloads: 23)
$type latex.js (61.43 KB, Downloads: 23)
使用negative lookbehind只替换\不替换\\

手机版Mobile version|Leisure Math Forum

2025-4-20 22:02 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list