Text documentation

25 views
Skip to first unread message

Cyrille Piatecki

unread,
Jan 5, 2025, 10:43:47 AMJan 5
to JSXGraph
As I have seen, the syntax of the text (specially if you need a mix of Latex and result, seems to be very distinct if you use Katex in place of MathJax. I think that the documentation should take it into account and give some exemples.

Alfred Wassermann

unread,
Jan 16, 2025, 3:16:32 AMJan 16
to JSXGraph
Does anybody know if it is possible to use katex and MathJax in one page? This would be helpful for the API reference of the text element.

Best wishes, Alfred

Murray

unread,
Jan 16, 2025, 2:19:52 PMJan 16
to JSXGraph
Hi Alfred

Yes, it's possible. See


I tried several times to get MathJax to only process the "mat" DIVs using the startup options given on this page https://docs.mathjax.org/en/latest/options/startup/startup.html, but it would always go ahead and process everything on the page (if the KaTeX bit wasn't specified).

But my solution appears to work, where I get KaTeX to process it's DIVs first (.'kat") then MathJax processes whatever is not processed yet (in '.mat").

Regards
Murray

Murray

unread,
Jan 16, 2025, 6:00:46 PMJan 16
to JSXGraph
I revised my page just now. Earlier, I couldn't get the "elements" or "document" options in the MathJax's startup block to work. 

My concern with my first attempt was that there could be a timing issue - if KaTeX didn't do its thing first, then everything would be processed by MathJax. (I actually don't think this would have occurred because MathJax waits for everything else on the page to load and process (via the "defer" attribute) before loading and processing.)

The revision makes use of MathJax's "ignoreHtmlClass" which definitely ignores the KaTeX DIVs, so now I'm confident things are working properly.

Regards
Murray

Murray

unread,
Jan 17, 2025, 2:32:52 PMJan 17
to JSXGraph
Alfred

What your were really asking in the first place is if MathJax and KaTeX can run on a JSXGraph board together (or on separate boards on the same page).

Here's a new page where I've taken some of the expressions from your Text documentation page (at https://jsxgraph.uni-bayreuth.de/docs/symbols/Text.html) and run them with the 2 processing engines on the same board.


The approach involves processing the KaTeX first by wrapping that LaTeX in DIVs with class "kat". Then the rest of the math is processed by MathJax using the usual "useMathjax:true" call.

Regards
Murray

Alfred Wassermann

unread,
Jan 17, 2025, 4:01:33 PMJan 17
to JSXGraph
Dear Murray,

thank you very much, you helped me a lot. For the JSXGraph API reference we need to have two or more boards in one HTML page, some with MathJax, others with KaTeX. 
Without this we could give either MathJax or KaTeX examples for JXGraph text elements.

Best wishes,
Alfred


Murray

unread,
Jan 18, 2025, 1:31:36 AMJan 18
to JSXGraph
Hello Alfred

This was an interesting challenge. I only just saw your message, but have been working on exactly that outcome.

I revised the page and now there are a mix of KaTeX boards and MathJax boards on the one page. (I abandoned trying to have both KaTeX and MathJax on one board - I got close, but decided it was never going to be used.)

I made use of toggling these settings (which I didn't expect would actually work, but it did):

JXG.Options.text.useMathJax = true;
JXG.Options.text.useKatex = false;

In some places the labels needed to be surrounded by $...$ and in others they didn't, but at least it's all working and hopefully you can make use of what I've done to revise the Text documentation page.

You may need to refresh the page to see the update:


Regards
Murray
Reply all
Reply to author
Forward
0 new messages