Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set paren-based math mode delimiters correctly #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sergiofenoll
Copy link

As is, if you include MathJax and write anything inbetween parentheses or square brackets, MathJax will treat it as a math mode block. This change sets it to use \( \) and \[ \] instead (although I still think it's problematic that you can write stuff outside of <vue-mathjax/> elements that will be rendered as LaTeX, but I'm not sure how/if that's fixable).

An example of the wrong behaviour I'm describing:

<p>
  ... (hopefully) be ...
</p>

gets rendered as

image

because it's recognized as an inline math block.

After applying my changes, it only happens if I write

<p>
  ... \(hopefully\) be ...
</p>

(I still think this last part shouldn't happen, but I'm not sure how to disable it)

@justforuse justforuse mentioned this pull request Apr 29, 2021
@justforuse
Copy link
Owner

justforuse commented May 10, 2021

You mean that your formula includes ( and ), but dont want to render them as mathjax formula, just print what it is?

@justforuse
Copy link
Owner

justforuse commented May 10, 2021

Maybe you should not pass them to the formula prop. Can you give a demo?

@captainblubb
Copy link

Hey! I Do have the same issue on my project! The (xxx) should not be recognized as inline math!

how can i change die implementation in https://github.com/justforuse/vue-mathjax/blob/master/src/components/vue-mathjax.vue to something like:

window.MathJax.Hub.Config({
tex2jax: {
inlineMath: [['$', '$']],
displayMath: [['$$', '$$']],
processEscapes: true,
processEnvironments: true
},

@justforuse
Copy link
Owner

justforuse commented Mar 28, 2022

@captainblubb For now, you can pass your custom config, just pass the options prop, it support override current config. https://github.com/justforuse/vue-mathjax/blob/master/src/components/vue-mathjax.vue#L42-L57

or we could support deep configuration merge in future🤔

@captainblubb
Copy link

captainblubb commented Mar 28, 2022

Hey!

Thank you!! I am new but I got it running!

Create your config as object in data() e.g.

VueMathJaxOptions:
{
tex2jax: {
inlineMath: [['$', '$']],
displayMath: [['$$', '$$'], ['[', ']']],
processEscapes: true,
processEnvironments: true
}
}

and add it to your tag as options :)

vue-mathjax :options="VueMathJaxOptions" :formula="testformular">

Works great!

@justforuse
Copy link
Owner

@captainblubb glad this help you 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants