Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config options don't change appearance of SVG output #456

Open
lizdenhup opened this issue Feb 21, 2020 · 1 comment
Open

Config options don't change appearance of SVG output #456

lizdenhup opened this issue Feb 21, 2020 · 1 comment

Comments

@lizdenhup
Copy link

lizdenhup commented Feb 21, 2020

Hi!

I am using Mathjax-node v2.1.1 to render SVG output. The SVG output is too large and the font-weight is too heavy compared to its surrounding text. I've tried changing the config options to no avail. Here is an example of the typeset math compared to the text it is surrounded by:

Screen Shot 2020-02-21 at 12 29 12 PM

My configuration code looks like this:

const mjAPI = require("mathjax-node");
mjAPI.config({
  MathJax: {
    SVG : {
      minScaleAdjust: 30,
      scale: 70,
      font : "STIX-Web",
      mtextFontInherit: true,
      addMMLclasses: true,
      matchFontHeight: true
    }
  }
});

Changing the configuration has not seemed to yield any differences in rendering whatsoever. Thanks for weighing in on what I should do!

@dpvc
Copy link
Member

dpvc commented Feb 24, 2020

Changing the configuration has not seemed to yield any differences in rendering whatsoever.

Not all MathJax configuration options apply to mathjax-node. One of these is the scale parameter. In the browser, MathJax handles the scale by placing a <span style="font-size:70%"> element around the <svg> element, but that is not included in the mathjax-node output, since that produces only the <svg> element. You can modify your code to include a surrounding <span> to include the needed scaling factor, if you want.

Also note that mtextFontInherit: true, while allowed, will not produce the result you may be expecting. Since mathjax-node does not have access to the surrounding font (as MathJax does in the browser), it can not know the size of the text in that font, and so doesn't know how much space to leave for it. So mathjax-node uses the monospace font, so that it can approximate the size better.

As for the darkness, I am not able to reproduce the result you are seeing. Can you link to an actual page that shows it? You might try changing the blacker option in the SVG configuration block. Its default should be 1, but try setting it to 1 or 0 and see if that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants