• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H12-Sep-2020-6143

es5/H03-May-2022-

.gitignoreH A D12-Sep-202011 31

.travis.ymlH A D12-Sep-2020376 1716

CONTRIBUTING.mdH A D12-Sep-202013.6 KiB315237

LICENSEH A D12-Sep-202011.1 KiB203169

README.mdH A D12-Sep-20209.4 KiB232176

bower.jsonH A D12-Sep-2020222 1211

composer.jsonH A D12-Sep-2020483 1514

package.jsonH A D12-Sep-20202.7 KiB6059

README.md

1# MathJax
2## Beautiful math in all browsers
3
4<img class="shield" alt="GitHub release version" src="https://img.shields.io/github/v/release/mathjax/MathJax-src.svg?sort=semver"> <img class="shield" alt="GitHub release version (branch)" src="https://img.shields.io/github/package-json/v/mathjax/MathJax/legacy-v2.svg?label=release-v2">
5<a class="reference external image-reference" href="http://www.numfocus.org"><img alt="powered-by NumFocus" src="https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&amp;amp;colorA=E1523D&amp;amp;colorB=007D8A"></a>
6
7MathJax is an open-source JavaScript display engine for LaTeX, MathML,
8and AsciiMath notation that works in all modern browsers.  It was
9designed with the goal of consolidating the recent advances in web
10technologies into a single, definitive, math-on-the-web platform
11supporting the major browsers and operating systems.  It requires no
12setup on the part of the user (no plugins to download or software to
13install), so the page author can write web documents that include
14mathematics and be confident that users will be able to view it
15naturally and easily.  Simply include MathJax and some mathematics in
16a web page, and MathJax does the rest.
17
18Some of the main features of MathJax include:
19
20- High-quality display of LaTeX, MathML, and AsciiMath notation in HTML pages
21
22- Supported in most browsers with no plug-ins, extra fonts, or special
23  setup for the reader
24
25- Easy for authors, flexible for publishers, extensible for developers
26
27- Supports math accessibility, cut-and-paste interoperability, and other
28  advanced functionality
29
30- Powerful API for integration with other web applications
31
32See <http://www.mathjax.org/> for additional details about MathJax,
33and <https://docs.mathjax.org> for the MathJax documentation.
34
35## MathJax Components
36
37MathJax version 3 uses files called *components* that contain the
38various MathJax modules that you can include in your web pages or
39access on a server through NodeJS.  Some components combine all the
40pieces you need to run MathJax with one or more input formats and a
41particular output format, while other components are pieces that can
42be loaded on demand when needed, or by a configuration that specifies
43the pieces you want to combine in a custom way.  For usage
44instructions, see the [MathJax documentation](https://docs.mathjax.org).
45
46Components provide a convenient packaging of MathJax's modules, but it
47is possible for you to form your own custom components, or to use
48MathJax's modules directly in a node application on a server.  There
49are [web examples](https://github.com/mathjax/MathJax-demos-web)
50showing how to use MathJax in web pages and how to build your own
51components, and [node
52examples](https://github.com/mathjax/MathJax-demos-node) illustrating
53how to use components in node applications or call MathJax modules
54directly.
55
56## What's in this Repository
57
58This repository contains only the component files for MathJax, not the
59source code for MathJax (which are available in a separate [MathJax
60source repository](https://github.com/mathjax/MathJax-src/)).  These
61component files are the ones served by the CDNs that offer MathJax to
62the web.  In version 2, the files used on the web were also the source
63files for MathJax, but in version 3, the source files are no longer on
64the CDN, as they are not what are run in the browser.
65
66The components are stored in the `es5` directory, and are in ES5 format
67for the widest possible compatibility.  In the future, we may make an
68`es6` directory containing ES6 versions of the components.
69
70## Installation and Use
71
72### Using MathJax components from a CDN on the web
73
74If you are loading MathJax from a CDN into a web page, there is no
75need to install anything.  Simply use a `script` tag that loads
76MathJax from the CDN.  E.g.,
77
78``` html
79<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
80```
81
82See the [MathJax
83documentation](https://docs.mathjax.org/en/latest/index.html#browser-components),
84the [MathJax Web Demos](https://github.com/mathjax/MathJax-demos-web),
85and the [MathJax Component
86Repository](https://github.com/mathjax/MathJax-demos-web) for more information.
87
88### Hosting your own copy of the MathJax Components
89
90If you want to host MathJax from your own server, you can do so by
91installing the `mathjax` package using `npm` and moving the `es5`
92directory to an appropriate location on your server:
93
94``` bash
95npm install mathjax@3
96mv node_modules/mathjax/es5 <path-to-server-location>/mathjax
97```
98
99Note that we are still making updates to version 2, so include `@3`
100when you install, since the latest chronological version may not be
101version 3.
102
103Alternatively, you can get the files via GitHub:
104
105``` bash
106git clone https://github.com/mathjax/MathJax.git mj-tmp
107mv mj-tmp/es5 <path-to-server-location>/mathjax
108rm -rf mj-tmp
109```
110
111Then (in either case) you can use a script tag like the following:
112
113``` html
114<script id="MathJax-script" async src="<url-to-your-site>/mathjax/tex-chtml.js"></script>
115```
116
117where `<url-to-your-site>` is replaced by the URL to the location
118where you moved the MathJax files above.
119
120See the
121[documentation](https://docs.mathjax.org/en/latest/web/hosting.html)
122for details.
123
124### Using MathJax components in a node application
125
126To use MathJax components in a node application, install the `mathjax` package:
127
128``` bash
129npm install mathjax@3
130```
131
132(we are still making updates to version 2, so you should include `@3`
133since the latest chronological version may not be version 3).
134
135Then require `mathjax` within your application:
136
137```js
138require('mathjax').init({ ... }).then((MathJax) => { ... });
139```
140
141where the first `{ ... }` is a MathJax configuration, and the second
142`{ ... }` is the code to run after MathJax has been loaded.  E.g.
143
144```js
145require('mathjax').init({
146  loader: {load: ['input/tex', 'output/svg']}
147}).then((MathJax) => {
148  const svg = MathJax.tex2svg('\\frac{1}{x^2-1}', {display: true});
149  console.log(MathJax.startup.adaptor.outerHTML(svg));
150}).catch((err) => console.log(err.message));
151```
152
153**Note:** this technique is for node-based application only, not for
154browser applications.  This method sets up an alternative DOM
155implementation, which you don't need in the browser, and tells MathJax
156to use node's `require()` command to load external modules.  This
157setup will not work properly in the browser, even if you webpack it or
158bundle it in other ways.
159
160See the
161[documentation](https://docs.mathjax.org/en/latest/index.html#server-nodejs)
162and the [MathJax Node
163Repository](https://github.com/mathjax/MathJax-demos-node) for more details.
164
165## Reducing the Size of the Components Directory
166
167Since the `es5` directory contains *all* the component files, so if
168you are only planning one use one configuration, you can reduce the
169size of the MathJax directory by removing unused components. For
170example, if you are using the `tex-chtml.js` component, then you can
171remove the `tex-mml-chtml.js`, `tex-svg.js`, `tex-mml-svg.js`,
172`tex-chtml-full.js`, and `tex-svg-full.js` configurations, which will
173save considerable space.  Indeed, you should be able to remove
174everything other than `tex-chtml.js`, and the `input/tex/extensions`,
175`output/chtml/fonts/woff-v2`, `adaptors`, `a11y`, and `sre`
176directories.  If you are using the results only on the web, you can
177remove `adaptors` as well.
178
179If you are not using A11Y support (e.g., speech generation, or
180semantic enrichment), then you can remove `a11y` and `sre` as well
181(though in this case you may need to disable the assistive tools in
182the MathJax contextual menu in order to avoid MathJax trying to load
183them when they aren't there).
184
185If you are using SVG rather than CommonHTML output (e.g., `tex-svg.js`
186rather than `tex-chtml.js`), you can remove the
187`output/chtml/fonts/woff-v2` directory.  If you are using MathML input
188rather than TeX (e.g., `mml-chtml.js` rather than `tex-chtml.js`),
189then you can remove `input/tex/extensions` as well.
190
191
192## The Component Files and Pull Requests
193
194The `es5` directory is generated automatically from the contents of the
195MathJax source repository.  You can rebuild the components using the
196command
197
198``` bash
199npm run make-es5 --silent
200```
201
202Note that since the contents of this repository are generated
203automatically, you should not submit pull requests that modify the
204contents of the `es5` directory.  If you wish to submit a modification
205to MathJax, you should make a pull request in the [MathJax source
206repository](https://github.com/mathjax/MathJax-src).
207
208## MathJax Community
209
210The main MathJax website is <http://www.mathjax.org>, and it includes
211announcements and other important information.  A [MathJax user
212forum](http://groups.google.com/group/mathjax-users) for asking
213questions and getting assistance is hosted at Google, and the [MathJax
214bug tracker](https://github.com/mathjax/MathJax/issues) is hosted
215at GitHub.
216
217Before reporting a bug, please check that it has not already been
218reported.  Also, please use the bug tracker (rather than the help
219forum) for reporting bugs, and use the user's forum (rather than the
220bug tracker) for questions about how to use MathJax.
221
222## MathJax Resources
223
224* [MathJax Documentation](https://docs.mathjax.org)
225* [MathJax Components](https://github.com/mathjax/MathJax)
226* [MathJax Source Code](https://github.com/mathjax/MathJax-src)
227* [MathJax Web Examples](https://github.com/mathjax/MathJax-demos-web)
228* [MathJax Node Examples](https://github.com/mathjax/MathJax-demos-node)
229* [MathJax Bug Tracker](https://github.com/mathjax/MathJax/issues)
230* [MathJax Users' Group](http://groups.google.com/group/mathjax-users)
231
232