# CKEditor Samples » Mathematical Formulas

This sample is not maintained anymore. Check out its brand new version in CKEditor Examples.

This editor allows displaying mathematical formulas, enabled by the Mathjax plugin.

    CKEDITOR.replace( 'textarea_id', {
    	extraPlugins: 'mathjax',
    	mathJaxLib: '<URL to the MathJax library>'
    } );

The following equations are represented in the HTML source code as LaTeX expressions.

# The Cauchy-Schwarz Inequality

\( \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right) \)

# The probability of getting \(k\) heads when flipping \(n\) coins is

\(P(E) = {n \choose k} p^k (1-p)^{ n-k} \)

Finally, while displaying equations is useful for demonstration purposes, the ability to mix math and text in a paragraph is also important. This expression \(\sqrt{3x-1}+(1+x)^2\) is an example of an inline equation. As you see, MathJax equations can be used this way as well, without disturbing the spacing between the lines.