MathJax

From ArchWiki
Revision as of 19:57, 4 August 2017 by Shevket (talk | contribs) (Created page with "ja:MathJax [url=https://www.mathjax.org]MathJax[/url] is a JavaScript display engine for mathematics that works in all browsers. It is able to parse TeX input in html file...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

[url=https://www.mathjax.org]MathJax[/url] is a JavaScript display engine for mathematics that works in all browsers. It is able to parse TeX input in html files to produce svg output, amongst other supported formats.

Installation and Configuration

Install mathjax from the official repositories.

# pacman -S mathjax

Local Usage

To have MathJax parse the TeX code in ~/equations.html and produce SVG output:

<head>
    ...
    <script ="/usr/share/mathjax/MathJax.js?config=TeX-AMS_SVG"></script>
    ...
</head>

Don't forget to include a configuration query string to tell MathJax about your desired i/o formats. You can also configure MathJax inline, see [url=http://docs.mathjax.org/en/latest/config-files.html#common-configurations]here[/url] for more details.

Your browser should now render the symbols at file:///home/user/equations.html.

Server Usage

In order to serve your clients with MathJax processed documents, you need your scripts to access its main file: /usr/share/mathjax/MathJax.js.

Let us assume the server's root directory is set to /srv/http/, creating symlinks will grant your scripts access to the installed package:

$ cp -rs /usr/share/mathjax /srv/http/mathjax

You can now have MathJax parse the TeX code in, say, /srv/http/pages/equations.html by including in its head:

<script src="../mathjax/MathJax.js"></script>