<commit_before>PHP Markdown Extra Math is an extension of <NAME>'s [PHP Markdown Extra][1], a PHP script for converting text written in [Markdown][2] to HTML. The extension consist of adding support for mathematical equations written in LaTeX to be processed by <NAME>'s [jsMath][3] system.

Here's how it works. The author, writing in Markdown, inserts inline equations like this

    where \(\alpha = (t_1 - t_0)/L\) is the rate at which the thickness increases

enclosing the math in a `\( … \)` pair, just as if writing in LaTeX. PHP Markdown Extra Math converts that to 

    where <span class="math"> \alpha = (t_1 - t_0)/L </span> is the rate at which the thickness increases

which is then converted by jsMath into

![inline math example](http://www.leancrew.com/all-this/images/math-inline-example.png)

(The example is shown as an image here because I don't know how to get jsMath working on GitHub. On a site with jsMath installed, the equation will be rendered as selectable and scalable text.)

Similarly, display Math is enclosed in `\[ … \]` like this:

    Putting this into Castigliano's equation, we get
    
    \[\Delta = \frac{\partial U^*}{\partial F} = \frac{12F}{Eb} \int_0^L \frac{x^2}{(t_0 + \alpha x)^3} dx\]

which PHP Markdown Extra Math will turn into this HTML

    <p>Putting this into the Castigliano equation, we get</p>

    <div class="math">\Delta = \frac{\partial U^*}{\partial F} = \frac{12F}{Eb} \int_0^L \frac{x^2}{(t_0 + \alpha x)^3} dx</div>  

which, in turn, will be rendered by jsMath like this:

![display math example](http://www.leancrew.com/all-this/images/math-display-example.png)


PHP Markdown Extra Math is licensed under the same terms as PHP Markdown Extra. See the License.text file.

[1]: http://michelf.com/projects/php-markdown/extra/
[2]: http://daringfireball.net/projects/markdown/
[3]: http://www.math.union.edu/~dpvc/jsMath/<commit_msg>Add MathJax info to README.<commit_after>PHP Markdown Extra Math is an extension of <NAME>'s [PHP Markdown Extra][1], a PHP script for converting text written in [Markdown][2] to HTML. The extension consist of adding support for mathematical equations written in LaTeX to be processed by either the [MathJax][4] (default) or [jsMath][3] math rendering libraries.

Here's how it works. The author, writing in Markdown, inserts inline equations like this

    where \(\alpha = (t_1 - t_0)/L\) is the rate at which the thickness increases

enclosing the math in a `\( … \)` pair, just as if writing in LaTeX. PHP Markdown Extra Math converts that to

    where <script type="math/tex"> \alpha = (t_1 - t_0)/L </script> is the rate at which the thickness increases

for MathJax, or

    where <span class="math"> \alpha = (t_1 - t_0)/L </span> is the rate at which the thickness increases

for jsMath. This is then converted by whichever math rendering library is being used to

![inline math example](http://www.leancrew.com/all-this/images/math-inline-example.png)

(The example is shown as an image but will be rendered as selectable and scalable text if the server has MathJax or jsMath installed.)

Similarly, display Math is enclosed in `\[ … \]` like this:

    Putting this into Castigliano's equation, we get
    
    \[\Delta = \frac{\partial U^*}{\partial F} = \frac{12F}{Eb} \int_0^L \frac{x^2}{(t_0 + \alpha x)^3} dx\]

which PHP Markdown Extra Math will turn into this HTML

    <p>Putting this into the Castigliano equation, we get</p>

    <script type="math/tex; mode=display">\Delta = \frac{\partial U^*}{\partial F} = \frac{12F}{Eb} \int_0^L \frac{x^2}{(t_0 + \alpha x)^3} dx</script>

for MathJax, or

    <p>Putting this into the Castigliano equation, we get</p>

    <div class="math">\Delta = \frac{\partial U^*}{\partial F} = \frac{12F}{Eb} \int_0^L \frac{x^2}{(t_0 + \alpha x)^3} dx</div>

for jsMath. This will be rendered as:

![display math example](http://www.leancrew.com/all-this/images/math-display-example.png)

The choice of MathJax or jsMath output is made on Line 42 of `markdown.php`:

    @define( 'MARKDOWN_MATH_TYPE',      "mathjax" );

Change the "mathjax" to "jsmath" to change the rendering library.


PHP Markdown Extra Math is licensed under the same terms as PHP Markdown Extra. See the License.text file.

[1]: http://michelf.com/projects/php-markdown/extra/
[2]: http://daringfireball.net/projects/markdown/
[3]: http://www.math.union.edu/~dpvc/jsMath/
[4]: http://www.mathjax.org/
{'fraction_non_alphanumeric': 0.1251411791280777, 'fraction_numerical': 0.012649649875762368, 'mean_word_length': 3.8766519823788546, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 7, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4950585', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1383, 'n_words': 553}