How to use mathjax - 9 common examples

To help you get started, we’ve selected a few mathjax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mathjax / MathJax-src / v3 / samples / tex-tree.js View on Github external
import {MathJax} from "mathjax/mathjax.js";
export {MathJax} from "mathjax/mathjax.js";

import "mathjax/handlers/html.js";

let html = MathJax.HandlerFor("");

MathJax.HandleRetriesFor(function () {

    html.TestMath(process.argv[3] || '').Compile();
    console.log(html.math[0].tree);

}).catch(err => {
  console.log(err.message);
  console.log(err.stack.replace(/\n.*\/system\.js:(.|\n)*/,""));
});
github mathjax / MathJax-src / v3 / samples / mml-tree.js View on Github external
import {MathJax} from "mathjax/mathjax.js";
export {MathJax} from "mathjax/mathjax.js";

import "mathjax/handlers/html.js";
import {MmlVisitor} from "TreeJax/lib/mml_visitor.js";

let mml = new MmlVisitor();
let html = MathJax.HandlerFor("");

MathJax.HandleRetriesFor(function () {

    html.TestMath(process.argv[3] || '').Compile();
    mml.visitTree(html.math[0].tree);
    console.log(mml.getResult().toString());

}).catch(err => {
  console.log(err.message);
  console.log(err.stack.replace(/\n.*\/system\.js:(.|\n)*/,""));
});
github mathjax / MathJax-src / v3 / samples / tex-typeset.js View on Github external
import {MathJax} from "mathjax/mathjax.js";
export {MathJax} from "mathjax/mathjax.js";

import "mathjax/handlers/html.js";

let html = MathJax.HandlerFor(`

<title>Test MathJax3</title>

This is some math: \\(x+1\\).
\\[x+1\\over x-1\\]


`);

MathJax.HandleRetriesFor(function () {

    html.FindMath()
        .Compile()
        .Typeset();
        
    console.log(html.math);

}).catch(err =&gt; {
  console.log(err.message);
  console.log(err.stack.replace(/\n.*\/system\.js:(.|\n)*/,""));
});
github mathjax / MathJax-src / v3 / samples / tex-typeset.js View on Github external
import {MathJax} from "mathjax/mathjax.js";
export {MathJax} from "mathjax/mathjax.js";

import "mathjax/handlers/html.js";

let html = MathJax.HandlerFor(`

<title>Test MathJax3</title>

This is some math: \\(x+1\\).
\\[x+1\\over x-1\\]


`);

MathJax.HandleRetriesFor(function () {

    html.FindMath()
        .Compile()
        .Typeset();
        
    console.log(html.math);
github mathjax / MathJax-src / v3 / samples / tex-tree.js View on Github external
import {MathJax} from "mathjax/mathjax.js";
export {MathJax} from "mathjax/mathjax.js";

import "mathjax/handlers/html.js";

let html = MathJax.HandlerFor("");

MathJax.HandleRetriesFor(function () {

    html.TestMath(process.argv[3] || '').Compile();
    console.log(html.math[0].tree);

}).catch(err =&gt; {
  console.log(err.message);
  console.log(err.stack.replace(/\n.*\/system\.js:(.|\n)*/,""));
});
github mathjax / MathJax-src / v3 / samples / mml-tree.js View on Github external
import {MathJax} from "mathjax/mathjax.js";
export {MathJax} from "mathjax/mathjax.js";

import "mathjax/handlers/html.js";
import {MmlVisitor} from "TreeJax/lib/mml_visitor.js";

let mml = new MmlVisitor();
let html = MathJax.HandlerFor("");

MathJax.HandleRetriesFor(function () {

    html.TestMath(process.argv[3] || '').Compile();
    mml.visitTree(html.math[0].tree);
    console.log(mml.getResult().toString());

}).catch(err =&gt; {
  console.log(err.message);
  console.log(err.stack.replace(/\n.*\/system\.js:(.|\n)*/,""));
});
github segment-boneyard / socrates / lib / editor / filters / mathjax.js View on Github external
Editor.filter('dom', function (dom, done) {
    MathJax.Hub.Queue(['Typeset'], MathJax.Hub, dom);
    MathJax.Hub.Queue(function () {
      done(null, dom);
    });
  });
};
github segment-boneyard / socrates / lib / editor / filters / mathjax.js View on Github external
var MathJax = require('mathjax');


/**
 * Configure.
 *
 * http://docs.mathjax.org/en/latest/config-files.html#the-tex-ams-mml-htmlormml-configuration-file
 */

MathJax.Hub.Config({
  config: ["MMLorHTML.js"],
  jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML"],
  extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js"],
  TeX: {
    extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
  },
  tex2jax : {
    displayMath : [['$$','$$'], ['\\[','\\]']],
    inlineMath  : [['\\(','\\)']]
  }
});


/**
 * Filter dom and turn it into MathJax.
 */
github mathjax / MathJax-src / v3 / mathjax / handlers / html / HTMLCompile.js View on Github external
export function HTMLCompile(math) {
  return Translate(math.math,math.display);
}

mathjax

Beautiful and accessible math in all browsers. MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all browsers. This package includes the packaged components (install mathjax-full to get the source

Apache-2.0
Latest version published 3 years ago

Package Health Score

46 / 100
Full package analysis