Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write summation expression in HTML?

Tags:

html

web

How to write equivalent HTML expression for following Latex:

$$\sum_{k=1}^Nk(N-k+1)  

The image is:

enter image description here

I did like this:

∑ <sub>k=1</sub> <sup>N</sup>  

but output is like this

k=1N

I am not good at HTML and I searched on web but couldn't find answer. Please help on this..Thanks!

like image 948
Grijesh Chauhan Avatar asked Nov 29 '12 12:11

Grijesh Chauhan


People also ask

How do you do summation in HTML?

to get: ∑k=1N k (N - k + 1) .

How do you write a summation expression?

A series can be represented in a compact form, called summation or sigma notation. The Greek capital letter, ∑ , is used to represent the sum. The series 4+8+12+16+20+24 can be expressed as 6∑n=14n . The expression is read as the sum of 4n as n goes from 1 to 6 .

How do you type the summation symbol?

You can press the Alt key in combination with numbers on the numeric keypad to insert the Sigma symbol: Press Alt + 229 to enter lower case Sigma (σ) Press Alt + 228 to enter upper case or capital letter Sigma (Σ)


2 Answers

If you need it for a lot of stuff in your project you'll probably find MathJax useful. Otherwise if you need just this one formula then try this - DEMO

<p>
    <span>&Sigma;</span>
    k ( N - k + 1 )
</p>​

CSS

p {
    height: 50px;
    line-height: 50px;
}

span {
    position: relative;
    font-size: 2.5em;
    display: inline-block;
    line-height: .7em;
    vertical-align: middle;
}

span:before {
    font-size: 12px;
    display: block;
    position absolute;
    left: 0;
    top: 0;
    content: "N";
    width: 22px;
    text-align: center;
}

span:after {
    font-size: 12px;
    display: block;
    position absolute;
    left: 0;
    bottom: 0;
    content: "k = 1";
    width: 27px;
    text-align: center;
}
​
like image 92
Zoltan Toth Avatar answered Sep 20 '22 05:09

Zoltan Toth


Whilst MathJax is almost certainly the correct answer (there is even an example of a summation on the homepage), you can use simple HTML elements (however these won't look as good as the final MathJax/LaTeX results).

The summation sign is HTML entity &sum; and the super- and sub-scripts can be marked up with the sup and sub elements, so try:

&sum;<sub>k=1</sub><sup>N</sup> k (N - k + 1)

to get: ∑k=1N k (N - k + 1) .

like image 33
Chris Avatar answered Sep 19 '22 05:09

Chris