# #StackBounty: #jekyll #github-pages #mathjax #tex Upgrading from MathJax 2.7.5 to 3.0, trying to preserve a custom TeX environment

### Bounty: 200

I use MathJax with my Jekyll blog on GitHub Pages. In fact, I wrote a blog post on exactly what steps I took to set up MathJax 2.7.5: "MathJax in Jekyll" (August 2018)

For a couple of posts, I wanted to use a psmallmatrix environment, like the one from the mathtools package: $$begin{psmallmatrix} 1 \ 0 end{psmallmatrix}$$. I know how I would create such an environment in actual TeX, using the newenvironment command: "How do I make a small pmatrix?"

But to get the command "pre-loaded" in MathJax 2.7.5, I was doing this, cargo-culting some code from MathJax’s version of the AMSmath package:

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: [
"MathZoom.js",
"AssistiveMML.js",
],
jax: ["input/TeX", "output/CommonHTML"],
TeX: {
extensions: [
"AMSmath.js",
"AMSsymbols.js",
"noErrors.js",
"noUndefined.js",
]
}
});
var TEX = MathJax.InputJax.TeX;
var COLS = function (W) {
var WW = [];
for (var i = 0, m = W.length; i < m; i++)
{WW[i] = TEX.Parse.prototype.Em(W[i])}
return WW.join(" ");
};
environment: {
psmallmatrix: ['Array',null,'(',')','c',COLS([1/3]),".2em",'S',1],
}
});
});
</script>
https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js


Sometime in the past year or so, MathJax 2.7.5 completely stopped working on GitHub, so I’m trying to upgrade to MathJax 3.0.

I have managed to translate the non-tricky parts of this config by using MathJax’s own config converter, but I don’t know what to do about my hand-crafted psmallmatrix.
Here’s what I have now:

<script type="text/javascript">
window.MathJax = {
tex: {
packages: ['base', 'ams'],
},
},
};
</script>
https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js


How can I recover my hand-crafted psmallmatrix environment, in MathJax 3.0? The formatting need only be roughly equivalent, as long as I can keep invoking it with begin{psmallmatrix}.

I should mention that the MathJax docs on "Defining TeX Macros" give an example of how to "preload" the TeX parser with a macro, roughly equivalent to what newcommand would do. The docs say:

window.MathJax = {
tex: {
macros: {
RR: "{\bf R}",
bold: ["{\bf #1}", 1]
}
}
};


But the docs are missing any examples of how to do the same kind of thing for newenvironment.

Get this bounty!!!

This site uses Akismet to reduce spam. Learn how your comment data is processed.