I would like to do the equivalent this code in Mathjax
\let\oldsqrt\sqrt \renewcommand{\sqrt}[1]{\p{\oldsqrt{#1}}}
where \p is the command
p: ['\\class{invisible}{#1}',1],
I am wondering how to do this in window.Mathjax's macro notation:
I tried this but it didn't work because I get a "math input error". I'm pretty sure this because of the lack of \let.
sqrt: ['\\p{\\sqrt{#1}}', 1],
I added an import for let which requires newcommand
window.MathJax = Object.assign({
loader: { load: ['[tex]/color','[tex]/textcomp','[tex]/newcommand'] },
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
packages: { '[+]': ['bold-chars', 'color','textcomp','newcommand'] },
macros: Object.assign({
I then tried
sqrt: ['\\let\\oldsqrt\\sqrt\\p{\\oldsqrt{#1}}', 1],
But I still get the "math input error".