Latex server parsed into HTML or SVG images or programs

Latex formula expressions into usable data in the server

Language and extensions

Ready to work

Paste the code

var mjAPI = require('mathjax-node-svg2png');

mjAPI.config({
        displayMessages: false,    // determines whether Message.Set() calls are logged
        displayErrors:   true,     // determines whether error messages are shown on the console
        undefinedCharError: false, // determines whether "unknown characters" (i.e., no glyph in the configured fonts) are saved in the error array
        extensions: '',            // a convenience option to add MathJax extensions
        fontURL: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/fonts/HTML-CSS', // for webfont urls in the CSS for HTML output
        paths: {},                  // configures custom path variables (e.g., for third party extensions, cf. test/config-third-party-extensions.js)
        MathJax: {
            showProcessingMessages: false,
            messageStyle: "none",
            extensions: ["tex2jax.js"],
            jax: ["input/TeX", "output/HTML-CSS"],
            tex2jax: {
              //inlineMath: [ ['$','$'], ["\\(","\\)"] ],
              displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
              processEscapes: true
            },
            "HTML-CSS": { fonts: ["TeX"], showMathMenu: false }
        }               // standard MathJax configuration options, see https://docs.mathjax.org for more detail.
});

mjAPI.start();

var math = '   \\triangle ABC  ,  AC\\bot BC   ,  AC=8\\rm cm   ,  BC=4\\rm cm  ,  AP\\bot AC  ,  A  ,  D  ,  E ';

mjAPI.typeset({
    math: math,
    format: 'inline-TeX',
    svg: false, //关闭SVG转换
    png: true// open images converted into other reference GitHUb If set 
    Scale: . 1 ,
     @ HTML: to true, 
}, function (Data) { 
    the console.log ( 'Data:' ) 
    the console.log (Data); 
} 
)

When other language development, program changes can be invoked through the command line program

var Math = '\\ Triangle the ABC, the BC BOT \\ the AC, the AC. 8 cm & lt RM = \\, the BC = \\. 4 cm & lt RM, the AC BOT \\ the AP, A, D, E' ; 

// modify 

var Math process.argv = [2 ]; 

// the CLI command node xxx.js "formula word" exemplary: the test.js Node " \ Triangle the ABC, the AC \ BOT the BC, the AC =. 8 \ cm & lt RM, the BC =. 4 \ cm & lt RM , the AP \ BOT AC, A, D, E "

You can also modify into other communication agreement  

 

Record it

 

Guess you like

Origin www.cnblogs.com/Gasg/p/10980690.html