added asciimath.js and asciimath.html#818
added asciimath.js and asciimath.html#818tom-berend wants to merge 3 commits into
Conversation
|
Dear Tom,
What do you think? All the best, Alfred |
|
Dear Alfred, I can understand if you don't want to include AsciiiMathML in core JSXGraph. And it is definitely your call. But here's some background.
This forum discussion referenced universities running Moodle with old versions of MathJAX, but anyone running in sandboxes has similar limitations. To embed AsciiMath in JSXGraph in a natural way, the library should output HTML and use it in text, instead of modifying the DOM after the page is rendered. That way I only needed to modify 3-4 lines in So I developed a modified version of ASCIIMathML.js that generates plain HTML. I built versions for TS and PHP for my own projects. I converted the TS version to look like JSXGraph code (object syntax instead of class syntax), and that's the version that I submitted. I plugged the PR version of JSXGraphCore into my TSXGraph playground, and it is addictive to use. No flipping `useMathJax' between true/false, no extra setup. If I want a point's name in greek, it is simply `alpha. I think math notation is so basic to JSXGraph that it should always be installed in every environment. No extra setup of the web page, consistent version, etc. If JSXGraph works, then AsciiMath works. But again, it is your call. I did not test the old ASCIIMath flags, happy to do that if you like. But MathJax is a better solution because of Chrome fonts. |
|
Dear Alfred, I suspect you don’t want to accept this PR, but are too nice to reject it. So you are waiting. No worries, I won’t be upset. Well, actually, I WILL be upset. Because I believe that JSXGraph is a compelling educational tool that every first-year STEM student should learn and use, and math notation goes hand-in-hand with graphics for that educational purpose. But to get there, the tools must have a smaller learning curve. For equations, AsciiMath has 90% of the expressive power of LaTeX, with about 10% of the learning curve. The engine is a few hundred lines of JavaScript and is generously licensed. The full manual is a single HTML page. My first use of JSXGraph wasn’t interactive. I needed illustrations for a presentation, and JSXGraph generated high-quality images. I set up an HTML page on my laptop with your 'getting started' instructions, and coded the JS. I pasted screenshots of my constructions into PowerPoint. I suspect that is a common use of JSXGraph. It is a tiny fraction of what JSXGraph is capable of, but still unique and wonderful. Now my interest is in building tools for education. Here is the kind of presentation I want first-year students to be able to pull together: Walking with Coffee. This illustration captures the whole idea.
The labels in this image are simple, but still need LaTeX for proper fonts. For my presentation, I would have had to install MathJAX and learn LaTeX. If I had wanted equations for my image, I would have prepared them in a LaTeX composing tool, changed the backgrounds to transparent (in GIMP), and positioned them using PowerPoint. Ha, ha. I'm joking. Too many layers and tools. It might make sense for a PhD candidate to spend the time learning the stack. Or someone writing a STEM textbook. But not a first-year student, certainly not a high-school student. And that's not even where we want to go. I want the students to ANIMATE the image with JSXGraph, perhaps using the wonderful tools in your Math libraries. I am continuing to work on making JSXGraph more accessible for students. I think TSXGraph and the playground are a good first step. Seamlessly integrating AsciiMath and JSXGraph would be another big step, and I have put considerable time into it. I hope to show yet another step forward in October. So please consider moving forward on this. My fallback is to integrate AsciiMath into TSXGraph, I will continue to work on simplifying the toolchain. But I also think it is the right direction for JSXGraph as an educational tool and a community. |
|
Dear Alfred, I can't achieve the simplicity I want with AsciiMath loaded externally. But I understand and respect your concerns. Let me suggest a different way to move forward. I will modify JSXGraph to expose 'poorMansTex()' from the JXG object so it can be found even after Webpack scrambles the code. Minimal logic changes (make sure that Then when I set up a JSXGraph environment, I will inject AsciiMath (replacing poorMansTex) instead of relying on DOM events to find the tags. I can build this injection seamlessly into 'Simplified JSXGraph' as a demonstration. But to proceed, I need you to delete this pull request. I can't 'sync' my fork to start again (my develop branch is ahead of yours, so github just tells me to have a nice day), and I'm afraid that deleting my repository with an open PR will mangle your repository in some awful way. Hoping this is acceptable. |

Dear Alfred (and team),
This PR adds native AsciiMath processing to JSXGraph. There are no flags or attributes to set; simply start a string with a backtick ( ` ) and the text is rendered as AsciiMath.
Of course, you can use AsciiMath in dynamic labels. See examples/asciimath.html (image below).
AsciiMath is a simple and elegant alternative to LaTeX. Making it 'native' will encourage math notation in JSXGraph, and resolve issues related to hosts running different versions of MathJax. here
This PR includes recent improvements in fonts and matrix handling contributed by Dr Peter Lippman, who maintains the AsciiMathML project.
MathML is supported by all major browsers, but Chrome sometimes requires specifying a math font. This can be done by adding the following line to the HTML header: