Prevent rendering by Mathjax

Viewed 270

I am using vue-mathjax for compiling the math equations in my vue project. It is compiling the text between first bracket (). I want to prevent compiling the string inside the bracket. In the documentation I found that, for $ sign, if we want to escape compiling, we need to use \$. So I tried this rule for the text inside ().

My expected output: (this is not math)

Here is what I tried: \(this is not math \) The output: \(this is not math \)

It did not compiled the string as math equation, but is shows \ in the output.

If I try without , like (this is not math) The output is this is not math Mathjax compiles the string inside the bracket.

Can anyone help me with the problem?

2 Answers

You have probably misconfigured MathJax's math delimiters to be ( and ) rather than \( and \). Try doubling the backslashes in your configuration and see if that helps. If you have inlineMath: [['\(', '\)'], ['$', '$]] it should be inlineMath: [['\\(', '\\)'], ['$', '$']] (javascript strings use backslash as a special character, so you must use \\ to get a literal \). If you already have that, try inlineMath: [['\\\\(', '\\\\)'], ['$', '$']] (it may be that your content management system itself is using backslashes as special, so you need to double them a second time to get the javascript inserted into the page to have the needed double slashes).

I had the same problem. Including VueMathjax explicitly in my main.js file fixed it. See: https://www.npmjs.com/package/vue-mathjax

Before: enter image description here

After:

main.js:

import VueMathjax from 'vue-mathjax'
Vue.use(VueMathjax)

enter image description here

Related