How to write equations in html? [closed]

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


Solution 1:

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

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

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

Solution 4:

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.

Solution 5:

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