How to write equations in html?

痴心易碎 提交于 2019-12-17 11:18:22

问题


I want to write some complex mathematical equation in my web page. Is there any plugin or anything for this?


回答1:


Try mathjax http://www.mathjax.org/ . I personally find it very good.




回答2:


For complex equations, MathJax is the current practical solution. MathML is a more structural approach in principle, but browser support is rather limited and often of questionable quality.

However, complexity is relative. To some people, E = mc² 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).




回答3:


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).

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.




回答4:


You could try this. Kind of out of date so not sure how it'll work:

http://www.w3.org/Math/

For Firefox, they have a pretty descriptive article on MathML




回答5:


Quick example using 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):

<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} $$

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} $$

And it should show up as an equation just fine on the page.




回答6:


I know this is a bit late. But would like to mention about jqMath which I have personally found easier and much lightweight than MathJax.

Find the details here : https://mathscribe.com/author/jqmath.html

The files can be downloaded from https://mathscribe.com/downloads/mathscribe-win-0.4.6.zip

To use this,

  1. Unzip the downloaded file
  2. find the files jqmath-etc-0.4.6.min.js and jqmath-0.4.3.css, and include them in your html
  3. Make sure your html have <meta charset="utf-8"> in the <head> section.
  4. Also include jQuery before using these.

Now you can write mathematical equations and formulae in your html or web page.

Visit the above link to know more about how to write mathematical formulae using jqMath.



来源:https://stackoverflow.com/questions/12431339/how-to-write-equations-in-html

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