Displaying maths equations

Bringing your stacks to the web

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Steve Flavel
Posts: 5
Joined: Sun Mar 27, 2016 6:30 pm

Displaying maths equations

Post by Steve Flavel » Thu Jul 21, 2022 10:11 pm

I need to show simple maths equations in my current project. It will be used by maths students.

The equations and expressions are randomly generated and I would like to display them correctly.

What is the best approach?

Regards


Steve

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Displaying maths equations

Post by dunbarx » Fri Jul 22, 2022 5:28 am

Hi.

Not sure how you want to structure this, but there are several ways to assemble strings of characters according to rules that you determine. Try this stack, which is only partly silly.
pullEquations.livecode.zip
(1.24 KiB) Downloaded 98 times
Then write back with what you really want.

Craig

Steve Flavel
Posts: 5
Joined: Sun Mar 27, 2016 6:30 pm

Re: Displaying maths equations

Post by Steve Flavel » Fri Jul 22, 2022 6:34 am

Thanks Craig
This is what I want to display. But like equation In Word. So like your file, I would like to generate equations or statements and then display them using mathematical symbols. See the attachment,
Attachments
mathImage.png

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Displaying maths equations

Post by dunbarx » Fri Jul 22, 2022 6:46 pm

So the same concept would apply, to select certain characters, as well as random characters, and build them into a format of some kind. LC cannot, within a field, build a wide division line like you have in your examples. But a graphic can be placed properly to do that job.

In fact, I wonder if it would not be better, instead of building the contents of a field char by char and graphic by graphic, to build a superstructure or two (or twenty?) that can contain several fields and graphics in fixed locations. If you do not need a lot of different ones that might be much simpler. In your two examples, you would have two "templates", and just fill in the blanks.


I don't know how many you want, or how different these might be.

Craig

stam
Posts: 2636
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Displaying maths equations

Post by stam » Fri Jul 22, 2022 7:09 pm

I really don't know if this is viable, but perhaps you could use a browser widget to display the equations with a javascript engine like MathJax? (https://www.mathjax.org)

SparkOut
Posts: 2839
Joined: Sun Sep 23, 2007 4:58 pm

Re: Displaying maths equations

Post by SparkOut » Fri Jul 22, 2022 7:25 pm

I don't know, haven't tried and don't really have a clue about what's involved but this looks like the sort of formula rendering that LaTex is renowned for and might be possible to leverage either by shell call to a Tex flavour app, which outputs to rtf??? Or within a browser control as suggested above.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Displaying maths equations

Post by jacque » Sat Jul 23, 2022 6:29 pm

There are math fonts designed for this purpose. You could try one of those. I've never needed one but the basic idea is that you translate the formula into letter equivalents and set the font to the math one.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “HTML5”