Mathjax: using "tex-...-full.js" still needs extensions being loaded and added ...

Created on 11 Feb 2020  路  6Comments  路  Source: mathjax/MathJax

The following minimal test code doesn't typeset the equations:

<!DOCTYPE html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  <meta name="viewport" content="width=device-width">
  <title>MathJax v3 with TeX input and SVG output</title>
  <script>
  MathJax = {
    tex: {
        inlineMath: [['$', '$']],
        tagFormat: {
            number: function(n){
                return String(n).replace(/0/g,"00");
            }
        }
    },
    svg: {fontCache: 'global'}
  };
  </script>
  <script id="MathJax-script" async src="tex-svg-full.js"></script>
</head>
<body>
   When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
    $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
</body>
</html>

The problem is resolved if one adds the extension, loads it inside the loader, and adds it as a package to the config setup of Mathjax; but isn't "...-full.js" package expected to be single-file solutions?

Feature Request Fixed Test Needed v3

All 6 comments

You are right, the tagFormat extension is not included in the -full versions. The idea was that they would include all the extensions that could be used with \require{}, and since tagFormat is only useful when there is additional configuration (the tagFormat block in the tex configuration), it doesn't make sense for use with \require{}. But I see your point. We should probably include it in the -full TeX components.

Any chance your modified version of mhchem here can also be added to the main stream and the full version?

@parhizkari, no, that version will not become part of the MathJax distribution.

What I recommend is that you open an issue on the mhchem GitHub page requesting that the number patterns be made configurable, like the one for the TeX input jax. That way, you would be able to configure mhchem to meet your needs without having to have multiple copies of mhchem in the distribution.

This issue again persists in version 3.1, is tagFormat intentionally missed from this version?

is tagFormat intentionally missed from this version?

No, tagformat is there, but version 3.1 normalized the package names to all lower case. We tried to make it as backward compatible as possible, but some places need to be made lower case. This apparently is one of them.

See the documentation for more details.

There is code to rename the configuration block for the extension (see mathjax/MathJax-src#485), but it turns out only to be applied when the package is loaded as an external component, not in the combined components, which is an oversight. I will make a new issue for that problem. For now, you will need to rename the configuration block by hand.

Was this page helpful?
0 / 5 - 0 ratings