title: MathJax node vs MathJax runtime processor output font and scaling issue
body: <p>When using MathJax library on DOM directly [inside an iFrame], math gets rendered with correct font-size and scaling relative to surrounding text. </p>
  
  <p>But when using mathjax_node it scales up the equation.</p>
  
  <p>I'am using following code to do the conversion on server side. Which returns an SVG. Then I just replace the MML code present inside an html page with returned SVG.</p>
  
  <pre><code>var express = require('express');
  var app = express();
  var bodyParser = require('body-parser');
  var fs = require('fs');
  var mjAPI = require("mathjax-node");
  
  mjAPI.config({
  MathJax: {
      SVG: {
          scale: 100,
          font: "MyriadPro-Regular"
      },
      // MatchWebFonts: {
      //     matchFor: {
      //         "HTML-CSS": false,
      //         NativeMML: false,
      //         SVG: true
      //     },
      //     fontCheckDelay: 2000,
      //     fontCheckTimeout: 30 * 1000
      // }
      }
      });
  mjAPI.start();
  
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(bodyParser.json());
  
  var port = process.env.PORT || 8080;
  
  var router = express.Router();
  
  router.use(function (req, res, next) {
      res.header('Access-Control-Allow-Origin', req.headers.origin);
      res.header('Access-Control-Allow-Credentials', true);
      res.header("Access-Control-Allow-Headers", "Origin, X-Requested- 
      With, Content-Type, Accept");
      next();
  });
  
  
  router.route('/processMath')
  
  .post(function (req, res) {
  
      var _obj = req.body.math;
      var _font = req.body.font;
      var _processed = {};
  
      fs.readFile('mathRepo.json', 'utf-8', function (err, buf) {
          var orignalSet = JSON.parse(buf);
  
          Object.keys(_obj).forEach(key =&gt; {
              if (Object.keys(orignalSet).indexOf(_obj[key]) !== -1) {
  
                  var _origMml = _obj[key].replace(/&lt;math/g, "&lt;math class='tex2jax_ignore' ");
  
                  var _container = `&lt;span class="MathJax_SVG" style="display:inline-block;font-size: ` + _font + `;position:relative;"&gt;
                      `+ orignalSet[_obj[key]] + `
                      &lt;span style="display:none;"&gt;
                      `+ _origMml + `
                      &lt;/span&gt;
                  &lt;/span&gt;`;
  
                  _processed[key] = _container;
              } else {
                  if (_obj[key].indexOf('&lt;math') !== -1) {
                      mjAPI.typeset({
                          math: _obj[key],
                          format: "MathML", // or "inline-TeX", "MathML"
                          svg: true,
                          css: true,
                          speakText: true,
                          useFontCache: false,
                          useGlobalCache: false,
                      }, function (data) {
                          if (!data.errors) {
                              orignalSet[_obj[key]] = data.svg;
                              console.log(data)
                              fs.writeFileSync('mathRepo.json', JSON.stringify(orignalSet), function (err, data) {
                                  if (err) console.log(err);
                                  console.log("Successfully Written to File.");
                              });
  
                              var _origMml = _obj[key].replace(/&lt;math/g, "&lt;math class='tex2jax_ignore' ");
  
                              var _container = `&lt;span class="MathJax_SVG" style="display:inline-block;font-size: ` + _font + `;position:relative;"&gt;
                                  `+ data.svg + `
                                  &lt;span style="display:none;"&gt;
                                  `+ _origMml + `
                                  &lt;/span&gt;
                              &lt;/span&gt;`;
  
                              _processed[key] = _container;
                          }
                      });
                  }
              }
          });
  
          res.json(_processed);
      });
  });
  
  app.use('/api', router);
  
  app.listen(port);
  </code></pre>
  
  <p>While using MathJax lib it produces following o/p.</p>
  
  <p><a href="https://i.stack.imgur.com/UYzT6.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>While using Mathjax node it produces,
  <a href="https://i.stack.imgur.com/tk7sR.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>I am just replacing the MML tags present inside an iFrame with the SVG received from MathJax node. I have to use iFrame since it is an epub.
  It scales up and messes the surrounding text. Am I missing out something?</p>