Html 如何在html中编写方程式?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12431339/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to write equations in html?
提问by anan_xon
I want to write some complex mathematical equation in my web page. Is there any plugin or anything for this?
我想在我的网页中写一些复杂的数学方程。有没有插件或任何东西?
回答by mathematician1975
Try mathjax http://www.mathjax.org/. I personally find it very good.
试试 mathjax http://www.mathjax.org/。我个人觉得非常好。
回答by Jukka K. Korpela
For complex equations, MathJaxis the current practical solution. MathMLis a more structural approach in principle, but browser support is rather limited and often of questionable quality.
对于复杂的方程,MathJax是当前的实用解决方案。MathML原则上是一种更结构化的方法,但浏览器支持相当有限,而且质量往往有问题。
However, complexity is relative. To some people, E= mc2 or ?/?t+ v? ? might be complex, and such constructs can be written fairly well using just HTML with some help from CSS; see my page Math in HTML (and CSS).
然而,复杂性是相对的。对某些人来说,E= mc2 或 ?/? t+ v? ? 可能很复杂,在 CSS 的帮助下,仅使用 HTML 就可以很好地编写此类结构;请参阅我的页面Math in HTML (and CSS)。
回答by deckele
If you don't want to implement any JavaScript in your HTML, you can use CodeCogs' equation editor tool (http://www.codecogs.com/latex/about.php).
如果您不想在 HTML 中实现任何 JavaScript,您可以使用 CodeCogs 的公式编辑器工具 ( http://www.codecogs.com/latex/about.php)。
It's really easy to use. All you do is use the button interface to write your equation and an HTML image link is immediately generated. When you run your HTML the image will be generated on CodeCogs' servers and implemented in your site. It's a very comfortable tool.
它真的很容易使用。您所做的就是使用按钮界面来编写您的方程式,并立即生成一个 HTML 图像链接。当您运行 HTML 时,图像将在 CodeCogs 的服务器上生成并在您的站点中实现。这是一个非常舒适的工具。
回答by aug
You could try this. Kind of out of date so not sure how it'll work:
你可以试试这个。有点过时,所以不确定它会如何工作:
For Firefox, they have a pretty descriptive article on MathML
回答by Jared Wilber
Quick example using mathjax
:
使用的快速示例mathjax
:
Load the cdn: (make sure to specify a ?config=
option as it doesn't come included in the recommended cdn link- default
works just fine):
加载 cdn:(确保指定一个?config=
选项,因为它没有包含在推荐的 cdn 链接中-default
工作正常):
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=default'></script>
Then, inside your html simply wrap the equation inside $$ {equation here} $$
然后,在你的 html 中简单地将方程包裹在里面 $$ {equation here} $$
e.g. $$ {J(\theta) =\frac{1}{2m} [\sum^m_{i=1}(h_\theta(x^{(i)}) - y^{(i)})2 + \lambda\sum^n_{j=1}\theta^2_j} $$
例如 $$ {J(\theta) =\frac{1}{2m} [\sum^m_{i=1}(h_\theta(x^{(i)}) - y^{(i)})2 + \lambda\sum^n_{j=1}\theta^2_j} $$
And it should show up as an equation just fine on the page.
它应该在页面上显示为一个方程式。
回答by Jishad
I know this is a bit late. But would like to mention about jqMathwhich I have personally found easier and much lightweight than MathJax.
我知道这有点晚了。但是我想提一下jqMath,我个人认为它比 MathJax 更容易、更轻量。
Find the details here : https://mathscribe.com/author/jqmath.html
在这里找到详细信息:https: //mathscribe.com/author/jqmath.html
The files can be downloaded from https://mathscribe.com/downloads/mathscribe-win-0.4.6.zip
这些文件可以从https://mathscribe.com/downloads/mathscribe-win-0.4.6.zip下载
To use this,
要使用这个,
- Unzip the downloaded file
- find the files jqmath-etc-0.4.6.min.jsand jqmath-0.4.3.css, and include them in your html
- Make sure your html have
<meta charset="utf-8">
in the<head>
section. - Also include jQuerybefore using these.
- 解压下载的文件
- 找到文件jqmath-etc-0.4.6.min.js和jqmath-0.4.3.css,并将它们包含在你的 html 中
- 确保您的 html
<meta charset="utf-8">
在该<head>
部分中。 - 在使用这些之前还包括jQuery。
Now you can write mathematical equations and formulae in your html or web page.
现在您可以在您的 html 或网页中编写数学方程式和公式。
Visit the above link to know more about how to write mathematical formulae using jqMath.
访问上面的链接以了解有关如何使用 jqMath 编写数学公式的更多信息。