Forgot password?
 Register account
View 297|Reply 3

LaTeX delimiter

[Copy link]

3153

Threads

7906

Posts

610K

Credits

Credits
64096
QQ

Show all posts

hbghlyj Posted 2023-2-27 23:32 |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

3153

Threads

7906

Posts

610K

Credits

Credits
64096
QQ

Show all posts

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

3153

Threads

7906

Posts

610K

Credits

Credits
64096
QQ

Show all posts

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

3153

Threads

7906

Posts

610K

Credits

Credits
64096
QQ

Show all posts

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

Mobile version|Discuz Math Forum

2025-6-5 01:02 GMT+8

Powered by Discuz!

× Quick Reply To Top Edit