Django如何整合数学编辑器 [英] Django How to Integrate a Maths Editor
问题描述
我是django新手,正在从事基于数学的项目.我需要保存涉及诸如 integral
, sigma
, product
等数学符号的文本.与此同时,我还需要强调或粗体(包括进行各种格式的富文本编辑),并包含解释数学概念的图形.
目前,我只是将所有字段保存在 CharField
中(带有伪文本并且不包含任何数学符号),并且不知道如何包括这样的字段.如果您有任何想法/提示,或者您从事过类似的项目,请提供帮助.
在Django中最简单的方法确实是使用 CharField 并使用它存储一些
LaTeX还可以非常轻松地为您的文本设置样式.您可以集成免费的编辑器来键入此类表达式,例如 mathquill 如果您打算存储长片段,请使用Django TextField .LaTeX表达式也可以通过 Mathjax 或 stackedit .它是开源的,您可以在这里找到它: github.com/benweet/stackedit .它使用KaTeX渲染LaTeX数学表达式.
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.
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.
这篇关于Django如何整合数学编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!