Implementing natural display for mathematical expressions

Hello, I want to make a scientific calculator similar to this (square root, fractions, etc.) in libcosmic.
How is the drawing of the expressions done, and what libraries can I use to help me do that?

GUI libraries are many and have specific features, pros and cons. So the more specific you can be the better. The link you posted is to a Mac App. Do you want to make a Mac app? For all Apple devices?

(I can't actually answer your question because I don't use GUI libraries. But I know you'll need to provide more info so others can answer.)

I wanted to make a Linux app with similar feature to the app I linked (pretty display for square root, fraction, etc.). I planned to use libcosmic for my GUI library. I specifically want advice on how the pretty display can be done and what I need for it and I don't mind switching the GUI library itself if I have to.

Since libcosmic uses iced, you have the option of enabling the svg feature to display math equations rendered as SVG images.

Getting an SVG from an equation is a little costly, though. mathjax_svg delegates the task to v8. A pure-Rust solution might be putting together some of the relevant pieces of typst (which is a very large typesetting application like LaTeX). The typst-layout crate handles math syntax parsing, producing a Frame object, and the typst-svg crate can convert the Frame into an SVG string.

I haven't tried either of these myself, but they were the only options I could find quickly.

1 Like