Django How to Integrate a Maths Editor

雨燕双飞 提交于 2021-02-08 11:19:28

问题


I am django newbie and working on a math based project. I need to save texts involving mathematical symbols like integral, sigma, product etc. At the same time, I also need to emphasize or bold some texts (and do all kinds of rich text editing) and include figures that explains a mathematical concept.

At present, I am just saving all the fields in a CharField (with dummy texts and without including any mathematical symbol) and have no idea how to include such a field. If you have any idea/hint or you have worked on similar projects, please help.


回答1:


The most obvious way to do that in Django is indeed to use a CharField and use it to store some LaTeX fragments like:

x=\frac{-b+\sqrt{b^2-4ac}}{2a}

which represents the following expression:

LaTeX can also be used to style your texts very easily. You can integrate a free editor for typing expressions of this kind like mathquill if you plan to store long fragments, use a Django TextField. LaTeX expressions can also be beautifully rendered by Mathjax or KaTeX Edit: You can also use math.stackexchange.com editor: stackedit. It's opensource and you find it there: github.com/benweet/stackedit. It uses KaTeX to render LaTeX math expressions.



来源:https://stackoverflow.com/questions/48297768/django-how-to-integrate-a-maths-editor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!