- Notifications
You must be signed in to change notification settings - Fork225
MathJax source code for version 3 and beyond
License
mathjax/MathJax-src
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
MathJax is an open-source JavaScript display engine for LaTeX, MathML,and AsciiMath notation that works in all modern browsers. It wasdesigned with the goal of consolidating the recent advances in webtechnologies into a single, definitive, math-on-the-web platformsupporting the major browsers and operating systems. It requires nosetup on the part of the user (no plugins to download or software toinstall), so the page author can write web documents that includemathematics and be confident that users will be able to view itnaturally and easily. Simply include MathJax and some mathematics ina web page, and MathJax does the rest.
Some of the main features of MathJax include:
High-quality display of LaTeX, MathML, and AsciiMath notation in HTML pages
Supported in most browsers with no plug-ins, extra fonts, or specialsetup for the reader
Easy for authors, flexible for publishers, extensible for developers
Supports math accessibility, cut-and-paste interoperability, and otheradvanced functionality
Powerful API for integration with other web applications
Seehttp://www.mathjax.org/ for additional details about MathJax,andhttps://docs.mathjax.org for the MathJax documentation.
This repository contains the source files for MathJax, which arewritten in TypeScript. These are compiled into JavaScript files andthen combined into component files for use on the web. The componentfiles are available from severalCDN services that hostMathJax,and also from theMathJax ComponentRepository. Node applicationscan use either the component files, or call the MathJax JavaScriptfiles directly.
If you are loading MathJax from a CDN into a web page, there is noneed to install anything. Simply use ascript
tag that loadsMathJax from the CDN. E.g.,
<scriptid="MathJax-script"asyncsrc="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
See theMathJaxdocumentation,theMathJax Web Demos,and theMathJax ComponentRepository for more information.
To use MathJax components in a node application, install themathjax
package:
npm install mathjax@3
(we are still making updates to version 2, so you should include@3
since the latest chronological version may not be version 3).
Then requiremathjax
within your application:
require('mathjax').init({ ...}).then((MathJax)=>{ ...});
where the first{ ... }
is a MathJax configuration, and the second{ ... }
is the code to run after MathJax has been loaded. E.g.
require('mathjax').init({loader:{load:['input/tex','output/svg']}}).then((MathJax)=>{constsvg=MathJax.tex2svg('\\frac{1}{x^2-1}',{display:true});console.log(MathJax.startup.adaptor.outerHTML(svg));}).catch((err)=>console.log(err.message));
Note: this technique is for node-based applications only, not forbrowser applications. This method sets up an alternative DOMimplementation, which you don't need in the browser, and tells MathJaxto use node'srequire()
command to load external modules. Thissetup will not work properly in the browser, even if you webpack it orbundle it in other ways.
See thedocumentationand theMathJax NodeRepository for more details.
You can use the MathJax JavaScript files (as opposed to MathJaxcomponents) directly in node applications. This gives you thegreatest flexibility, but requires more coding. To use this approach,install themathjax-full
package:
npm install mathjax-full
This will provide the following directories:
node_modules/ mathjax-full/ ts/ the MathJax source TypeScript files js/ the compiled JavaScript files components/ the component build tools and control files es5/ the packages component files
You can use the components and JavaScript files directly in your nodeapplications (see theMathJax nodedemos for examples).
If you want to work from the GitHub repository directly, then do the following:
git clone https://github.com/mathjax/MathJax-src.git mathjax-srccd mathjax-srcnpm run --silent compilenpm run --silent make-components
in order to compile the JavaScript files from the TypeScript source,and build the component files from the JavaScript files.
If you are interested in contributing code to MathJax, please see thedocumentation for contributors for details on howto do this, and for the policies for making pull requests. Inparticular, please be careful that you are working from the properbranch in the git repository, or you may be asked to rebase yourchanges when you make a pull request.
The main MathJax website ishttp://www.mathjax.org, and it includesannouncements and other important information. AMathJax userforum for askingquestions and getting assistance is hosted at Google, and theMathJaxbug tracker is hostedat GitHub.
Before reporting a bug, please check that it has not already beenreported. Also, please use the bug tracker (rather than the helpforum) for reporting bugs, and use the user's forum (rather than thebug tracker) for questions about how to use MathJax.
About
MathJax source code for version 3 and beyond
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.