react-hook-mathjax icon indicating copy to clipboard operation
react-hook-mathjax copied to clipboard

Adding delimiters to ignore non-math text

Open AnimeAllstar opened this issue 2 years ago • 1 comments

My goal is to render part of the text in latex. For example:

{The sum of $$n$$ numbers is $$n(n+1)/2$$} should render as {The sum of n numbers is n(n+1)/2}.

Only everything in $$...$$ should be turned into an svg.

I have been trying to use the delimiter option in Mathjax. I'm guessing that this regards text outside the delimiters as non-math and renders is normally. But it appears to be doing nothing. I used this as my options for the MathJaxProvider:

{
        tex: {
            inlineMath: [ 
                ['$$', '$$']
            ]
        }
}

I only want part of the text to be processed to latex. Is all text in the latex prop assumed to be latex, or is there a MathJax option that I can add to skip normal text? I could manually delimit and insert <Tex2SVG latex={latex}/> whenever I do find a $$...$$ but maybe there is an in-built option or maybe a feature request?

AnimeAllstar avatar May 17 '22 18:05 AnimeAllstar