[squeak-dev] Re: Simple math editor/typesetter

Nick Chen nchen.dev at mac.com
Sun Sep 11 19:21:15 UTC 2011


Yes, I would like it to display using Morphs so that I can have more options
for
interactivity e.g. editing and drag-and-drop.

I already have a parser implemented; this whole thing is part of a bigger
project and I'm working on the display part currently. The Visitor pattern
would
be used to do the projection into Morphic.

You mentioned "MorphComposer". Was that part of your original software?
Would
you happen to know if there are existing Morphic objects that I could re-use
or
would I need to create my own from scratch. I looked at the tiles in
Scratch/Etoys and I would like something more "pretty".

Thanks!

-- Nick


Nicolas Cellier wrote:
> 
> 2011/9/11 Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
>> I add a commercial software where I could do this.
> 
> s/I add/I had/
> 
>> 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 on-screen,
>>> 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
>>>
>>> (Cross-posted to the
>>> http://forum.world.st/Simple-math-editor-typesetter-td3805250.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
>>> re-use/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/Simple-math-editor-typesetter-tp3805256p3805256.html
>>> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>>>
>>>
>>>
>>>
>>>
>>
> 


--
View this message in context: http://forum.world.st/Simple-math-editor-typesetter-tp3805256p3805687.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.



More information about the Squeak-dev mailing list