[squeakdev] Simple math editor/typesetter
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Sun Sep 11 16:55:57 UTC 2011
I add a commercial software where I could do this.
The idea is to have a tree representing the expression
(1+2/3)*4
Assuming your infix expression used usual mathematical precedence,
you have a tree MultiplyExpression( AddExpression( 1 ,
DivideExpression( 2 , 3 ) ) , 4)
Then you can have a printer of the tree using the visitor pattern.
This way, you can have code generation output (C, Matlab etc...) of
your mathematical expression, LaTeX being just one special case, and
Morph composition just another one.
As long as you do not deal with page layout, the composition is quite
straight forward...
MorphComposer>>visitDivideExpression: aDivideExpression
numeratorMorph := aDivideExpression numerator iterateFromVisitor: self.
denominatorMorph := aDivideExpression denominator iterateFromVisitor: self.
fractionBar := (numeratorMorph width max: denominatorMorph width)
+ self extraWidth.
some more code to create a composite morph with correct alignment...
Nicolas
2011/9/11 Gary Dunn <garydunnhi at gmail.com>:
> I use Lyx on top of LaTeX, then export to image which can be imported into
> Squeak. All very manual. I recall seeing where someone was piping through
> LaTeX to do the job on the fly. I should think that would produce a print
> file easily, a bit harder to make a little illustration for onscreen,
> interactive use.
>
> Gary Dunn
> Open Slate Project
> http://openslate.org
>
> On Sep 11, 2011 4:43 AM, "Nick Chen" <nchen.dev at mac.com> wrote:
>
> Hi
>
> (Crossposted to the
> http://forum.world.st/Simplematheditortypesettertd3805250.html Pharo
> mailing list because that's what I'm using primarily
> but I'm also interested in packages that work in Squeak)
>
> I'm working with some simple math equations and am looking for a nicer way
> to
> display them. Is there any existing work that I might be able to
> reuse/build
> upon?
>
> For instance, given this equation, (1+2/3)*4 I would like to see it
> displayed
> like the Equation Editor in Microsoft Word or the equations in a Mathematica
> notebook. See attached screenshots:
>
> http://forum.world.st/file/n3805256/word.png
>
> http://forum.world.st/file/n3805256/mathematica.png
>
> I'm not looking for anything fancy. Something simple to get me started would
> be helpful as well.
>
> I looked briefly at Dr. Geo but I don't think it supports displaying
> equations in that
> manner.
>
> Thanks!
>
> 
> Nick
>
> 
> View this message in context:
> http://forum.world.st/Simplematheditortypesettertp3805256p3805256.html
> Sent from the Squeak  Dev mailing list archive at Nabble.com.
>
>
>
>
>
More information about the Squeakdev
mailing list
