How to use mathjax-full - 9 common examples

To help you get started, we’ve selected a few mathjax-full 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 ShaMan123 / react-native-math-view / src / mathjax / SpeechAction.ts View on Github external
}

const renderMath: RenderMath = (math, doc) => {
    const { start, end, bbox, math: latex } = math;
    return
}

//
//  The renderActions needed to remove the data-semantic-attributes.
//    STATE.ENRICHED is the priority of the enrichment, so this will rung just after enrichment.
//    The first function is the one for when the document's render() method is called.
//    The second is for when a MathItem's render(), rerender() or convert() method is called.
//
export const speechAction = {
    simplfy: [
        STATE.TYPESET + 1,
        (doc) => {
            console.log('m1')

            for (const math of doc.math) {
                //removeSemanticData(math);
            }
        },
        renderMath
    ]
};
github ShaMan123 / react-native-math-view / src / mathjax / MathjaxAdaptor.ts View on Github external
constructor(options: MathToSVGConfig) {
        this.options = options;

        //
        //  Create DOM adaptor and register it for HTML documents
        //
        const adaptor = liteAdaptor();
        const htmlHander = RegisterHTMLHandler(adaptor);
        //EnrichHandler(htmlHander, new MathML());

        //
        //  Create input and output jax and a document using them on the content from the HTML file
        //
        this.tex = new TeX({ packages: options.packages });
        this.svg = new SVG({
            fontCache: (options.fontCache ? 'local' : 'none'),
            internalSpeechTitles: true
        });

        this.html = mathjax.document('', {
            InputJax: this.tex,
            OutputJax: this.svg
            //enrichSpeech: options.enrichSpeech
github mathjax / MathJax-demos-node / speech / action.js View on Github external
require('mathjax-full/js/util/asyncLoad/node.js');
require('mathjax-full/js/a11y/semantic-enrich.js');
const STATE = require('mathjax-full/js/core/MathItem.js').STATE;

//
//  Remove the data-semantic-* attributes other than data-semantic-speech
//
function removeSemanticData(math) {
    math.root.walkTree(node => {
        const attributes = node.attributes.getAllAttributes();
        delete attributes.xmlns;    // some internal nodes get this attribute for some reason
        for (const name of Object.keys(attributes)) {
            if (name.substr(0, 14) === 'data-semantic-' && name !== 'data-semantic-speech') {
                delete attributes[name];
            }
        }
    });
}
github mathjax / MathJax-demos-node / speech / action.js View on Github external
if (name.substr(0, 14) === 'data-semantic-' && name !== 'data-semantic-speech') {
                delete attributes[name];
            }
        }
    });
}

//
//  The renderActions needed to remove the data-semantic-attributes.
//    STATE.ENRICHED is the priority of the enrichment, so this will rung just after enrichment.
//    The first function is the one for when the document's render() method is called.
//    The second is for when a MathItem's render(), rerender() or convert() method is called.
//
exports.speechAction = {
    simplfy: [
        STATE.ENRICHED + 1,
        (doc) => {
            for (const math of doc.math) {
                removeSemanticData(math);
            }
        },
        (math, doc) => {
            removeSemanticData(math);
        }
    ]
};
github ShaMan123 / react-native-math-view / src / mathjax / MathjaxAdaptor.ts View on Github external
constructor(options: MathToSVGConfig) {
        this.options = options;

        //
        //  Create DOM adaptor and register it for HTML documents
        //
        const adaptor = liteAdaptor();
        const htmlHander = RegisterHTMLHandler(adaptor);
        //EnrichHandler(htmlHander, new MathML());

        //
        //  Create input and output jax and a document using them on the content from the HTML file
        //
        this.tex = new TeX({ packages: options.packages });
        this.svg = new SVG({
            fontCache: (options.fontCache ? 'local' : 'none'),
            internalSpeechTitles: true
        });

        this.html = mathjax.document('', {
            InputJax: this.tex,
            OutputJax: this.svg
            //enrichSpeech: options.enrichSpeech
        });
github ShaMan123 / react-native-math-view / src / mathjax / MathjaxAdaptor.ts View on Github external
constructor(options: MathToSVGConfig) {
        this.options = options;

        //
        //  Create DOM adaptor and register it for HTML documents
        //
        const adaptor = liteAdaptor();
        const htmlHander = RegisterHTMLHandler(adaptor);
        //EnrichHandler(htmlHander, new MathML());

        //
        //  Create input and output jax and a document using them on the content from the HTML file
        //
        this.tex = new TeX({ packages: options.packages });
        this.svg = new SVG({
            fontCache: (options.fontCache ? 'local' : 'none'),
            internalSpeechTitles: true
        });

        this.html = mathjax.document('', {
            InputJax: this.tex,
            OutputJax: this.svg
            //enrichSpeech: options.enrichSpeech
        });

        //this.html.addRenderAction('mip', ...speechAction.simplfy);
    }
github ShaMan123 / react-native-math-view / src / mathjax / MathjaxAdaptor.ts View on Github external
splitMath = _.memoize((math: string) => {
        let parser = new TexParser(
            math,
            { display: true, isInner: false },
            this.parseOptions
        );

        parser.i = 0;   //  reset parser
        const response = [];
        while (parser.i < parser.string.length) {
            response.push(parser.GetArgument(math, true))
        }
        /*
         * try to compose bbox
        const mathItems = _.map(response, (frag, index, collection) => {
            const bip = new HTMLMathItem(frag, this.tex, true);
            bip.compile(this.html.document)
            bip.bbox = this.svg.getBBox(bip, this.html);
github ShaMan123 / react-native-math-view / src / mathjax / MathjaxAdaptor.ts View on Github external
//  Create DOM adaptor and register it for HTML documents
        //
        const adaptor = liteAdaptor();
        const htmlHander = RegisterHTMLHandler(adaptor);
        //EnrichHandler(htmlHander, new MathML());

        //
        //  Create input and output jax and a document using them on the content from the HTML file
        //
        this.tex = new TeX({ packages: options.packages });
        this.svg = new SVG({
            fontCache: (options.fontCache ? 'local' : 'none'),
            internalSpeechTitles: true
        });

        this.html = mathjax.document('', {
            InputJax: this.tex,
            OutputJax: this.svg
            //enrichSpeech: options.enrichSpeech
        });

        //this.html.addRenderAction('mip', ...speechAction.simplfy);
    }
github ShaMan123 / react-native-math-view / src / mathjax / MathjaxAdaptor.ts View on Github external
constructor(options: MathToSVGConfig) {
        this.options = options;

        //
        //  Create DOM adaptor and register it for HTML documents
        //
        const adaptor = liteAdaptor();
        const htmlHander = RegisterHTMLHandler(adaptor);
        //EnrichHandler(htmlHander, new MathML());

        //
        //  Create input and output jax and a document using them on the content from the HTML file
        //
        this.tex = new TeX({ packages: options.packages });
        this.svg = new SVG({
            fontCache: (options.fontCache ? 'local' : 'none'),
            internalSpeechTitles: true
        });

        this.html = mathjax.document('', {
            InputJax: this.tex,
            OutputJax: this.svg
            //enrichSpeech: options.enrichSpeech
        });

        //this.html.addRenderAction('mip', ...speechAction.simplfy);
    }

mathjax-full

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 and in server-side node applications. This package includes the source code as well as

Apache-2.0
Latest version published 2 years ago

Package Health Score

71 / 100
Full package analysis