1

Need help with math.js and LaTeX using MathJax.

For example, at the moment: \frac{140.8~\mathrm{m}}{\mathrm{s}}

Will result to: enter image description here

Which is not what I want.

I want to force it to use slash (eg: 140.8 m/s) or display as 140.8 ms^(-1).

I'm new in using math.js with MathJax.

Any help appreciated.

smkso
  • 95
  • 1
  • 6

1 Answers1

1

So I found out about macros, so created one to replace \frac with \flatfrac.

window.MathJax = {
  loader: {load: ['[tex]/physics']},
  tex: {
        packages: {'[+]': ['physics']},
        macros: {
            frac: "\\flatfrac"
        }
    }
};

Not sure this is the best thing or correct usage, but it works!

smkso
  • 95
  • 1
  • 6