Giter VIP home page Giter VIP logo

Comments (3)

pkra avatar pkra commented on September 24, 2024

You might want to check out https://github.com/josdejong/mathjs/ for parsing and manipulation/computation. Then you can "pretty print" via toTeX and display the result with MathJax. See for example https://mathjs.org/docs/expressions/parsing.html and https://mathjs.org/examples/browser/pretty_printing_with_mathjax.html.html

from mathjax-src.

trebor avatar trebor commented on September 24, 2024

oh thank you for getting back to me!

i had tried something like that originally, but i could not find a way to map the MathJax expression elements in the browser to the math expression tree in mathjs.

i was able to catch mouse events from the MathJax expression on the web page, which is expressed is a tree in the dom, but that "dom tree" is not isomorphic to the tree in mathjs tree.

my workaround was to break the expression out into all the sub-elements, but that does not feel like a great UI. :(

now that i am writing this, i realize i asked the wrong question, i think the better question would be:

can i map mouse events in the dom to nodes, to nodes the math expression tree, be that mathjs or maybe MmlTree?

from mathjax-src.

pkra avatar pkra commented on September 24, 2024

i had tried something like that originally, but i could not find a way to map the MathJax expression elements in the browser to the math expression tree in mathjs.
i was able to catch mouse events from the MathJax expression on the web page, which is expressed is a tree in the dom, but that "dom tree" is not isomorphic to the tree in mathjs tree.

Ah ok, now I understand why you were asking about SRE's annotation - it overlays a similarly "orthogonal" informational structure on top of the visual format. I don't usually think of SRE's tree as suitable for computational work but if you have enough control over the input, then maybe you can use SRE's tree (which is exposed as data attributes) to reconstruct enough information.

can i map mouse events in the dom to nodes, to nodes the math expression tree, be that mathjs or maybe MmlTree?

The MathJax team will know best but I don't think that's doable without preparing the input yourself, e.g., adding data attributes (which MathJax will then preserve in its output).

Maybe the mathjs people have an idea on how to generate something suitable; their docs on customizations include several toTeX related customizations, https://mathjs.org/docs/expressions/customization.html

from mathjax-src.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.