Hi everyone,
Some time ago, I asked for a framework that would allow me to write valid latex math from Pharo (in a similar way that I used to do with pylatex in Python) see the thread here: http://forum.world.st/Generate-latex-from-Pharo-td4826739.html. Damien Cassou pointed me the Pillar-ExporterLaTeX package to do it, so I used it to create the Mathex package that you can get here: https://github.com/juliendelplanque/mathex or by evaluating: Metacello new baseline: 'Mathex'; repository: 'github://juliendelplanque/mathex/repository'; load. for tests: Metacello new baseline: 'MathexTests'; repository: 'github://juliendelplanque/mathex/repository'; load. From now, it does not support all the possible math commands of latex but you can already do things like: (Phi equal: ((1 asMathex + 5 asMathex sqrt) // 2)) equation asString. and get: \begin{equation} \phi=\frac{ 1 +\sqrt{ 5 }}{ 2 }\end{equation} Also, and in fact this is the kind of feature I was looking for, you can export a Matrix into latex math like this: (Matrix diagonal: #(42 42 42)) asMathex asString. Each command/operation is represented by an object in the package. To understand how I implemented that have a look on the MObject>>#doesNotUnderstand: where I explain it. I will soon work on an importer that will create, automatically, latex command as objects from a file that describe how to do it. What do you think about this? Hope this package could helps someone else one day. Julien |
On Sun, Sep 6, 2015 at 10:15 PM, Julien Delplanque <[hidden email]> wrote:
> Hi everyone, > > Some time ago, I asked for a framework that would allow me to write valid > latex math from Pharo > (in a similar way that I used to do with pylatex in Python) see the thread > here: > http://forum.world.st/Generate-latex-from-Pharo-td4826739.html. > > Damien Cassou pointed me the Pillar-ExporterLaTeX package to do it, so I > used it to create the > Mathex package that you can get here: > https://github.com/juliendelplanque/mathex > or by evaluating: > > Metacello new > baseline: 'Mathex'; > repository: 'github://juliendelplanque/mathex/repository'; > load. > > for tests: > > Metacello new > baseline: 'MathexTests'; > repository: 'github://juliendelplanque/mathex/repository'; > load. > > From now, it does not support all the possible math commands of latex but > you can already do things like: > > (Phi equal: ((1 asMathex + 5 asMathex sqrt) // 2)) equation asString. > > and get: > > \begin{equation} > \phi=\frac{ 1 +\sqrt{ 5 }}{ 2 }\end{equation} > > Also, and in fact this is the kind of feature I was looking for, you can > export a Matrix into latex math like this: > > (Matrix diagonal: #(42 42 42)) asMathex asString. > > Each command/operation is represented by an object in the package. > To understand how I implemented that have a look on the > MObject>>#doesNotUnderstand: where I explain it. > > I will soon work on an importer that will create, automatically, latex > command as objects from a file that describe > how to do it. > > What do you think about this? > > Hope this package could helps someone else one day. I don't have an immediate need, but its cool and good to know its there for when I do. cheers -ben |
In reply to this post by Julien Delplanque
Hi Julien,
Julien Delplanque <[hidden email]> writes: > Hi everyone, > > Some time ago, I asked for a framework that would allow me to write > valid latex math from Pharo > (in a similar way that I used to do with pylatex in Python) see the > thread here: > http://forum.world.st/Generate-latex-from-Pharo-td4826739.html. > From now, it does not support all the possible math commands of latex > but you can already do things like: > > (Phi equal: ((1 asMathex + 5 asMathex sqrt) // 2)) equation asString. > > and get: > > \begin{equation} > \phi=\frac{ 1 +\sqrt{ 5 }}{ 2 }\end{equation} I think that's great news! One of Pillar's feature requests is to let users write LaTeX (e.g., formulas) in their pillar document and get nice results in all exports (LaTeX, HTML, ePub...): https://github.com/pillar-markup/pillar/issues/18. I'm not sure how this request fits in your work, but there might be some intersection. -- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill |
On 07/09/15 13:56, Damien Cassou wrote:
> Hi Julien, > > Julien Delplanque <[hidden email]> writes: > >> Hi everyone, >> >> Some time ago, I asked for a framework that would allow me to write >> valid latex math from Pharo >> (in a similar way that I used to do with pylatex in Python) see the >> thread here: >> http://forum.world.st/Generate-latex-from-Pharo-td4826739.html. >> From now, it does not support all the possible math commands of latex >> but you can already do things like: >> >> (Phi equal: ((1 asMathex + 5 asMathex sqrt) // 2)) equation asString. >> >> and get: >> >> \begin{equation} >> \phi=\frac{ 1 +\sqrt{ 5 }}{ 2 }\end{equation} > > I think that's great news! One of Pillar's feature requests is to let > users write LaTeX (e.g., formulas) in their pillar document and get nice > results in all exports (LaTeX, HTML, ePub...): > https://github.com/pillar-markup/pillar/issues/18. I'm not sure how this > request fits in your work, but there might be some intersection. > from Mathex to represent an equation as Mathex objects. After that the translation to html should be easy. Maybe I'll give a try if I have some time. Julien |
Julien Delplanque <[hidden email]> writes: > On 07/09/15 13:56, Damien Cassou wrote: >> Julien Delplanque <[hidden email]> writes: >>> >>> (Phi equal: ((1 asMathex + 5 asMathex sqrt) // 2)) equation asString. >>> >>> and get: >>> >>> \begin{equation} >>> \phi=\frac{ 1 +\sqrt{ 5 }}{ 2 }\end{equation} >> >> I think that's great news! One of Pillar's feature requests is to let >> users write LaTeX (e.g., formulas) in their pillar document and get nice >> results in all exports (LaTeX, HTML, ePub...): >> https://github.com/pillar-markup/pillar/issues/18. I'm not sure how this >> request fits in your work, but there might be some intersection. >> > I guess if a latex math parser is created, it is possible to use objects > from Mathex to represent an equation as Mathex objects. > > After that the translation to html should be easy. > > Maybe I'll give a try if I have some time. we could ask the Pillar users to write using Mathex directly so we don't have to write a LaTeX parser. The only remaining thing is to generate png pictures from Mathex objects for inclusion in HTML. -- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill |
On 08/09/15 16:36, Damien Cassou wrote: > Julien Delplanque <[hidden email]> writes: > >> On 07/09/15 13:56, Damien Cassou wrote: >>> Julien Delplanque <[hidden email]> writes: >>>> (Phi equal: ((1 asMathex + 5 asMathex sqrt) // 2)) equation asString. >>>> >>>> and get: >>>> >>>> \begin{equation} >>>> \phi=\frac{ 1 +\sqrt{ 5 }}{ 2 }\end{equation} >>> I think that's great news! One of Pillar's feature requests is to let >>> users write LaTeX (e.g., formulas) in their pillar document and get nice >>> results in all exports (LaTeX, HTML, ePub...): >>> https://github.com/pillar-markup/pillar/issues/18. I'm not sure how this >>> request fits in your work, but there might be some intersection. >>> >> I guess if a latex math parser is created, it is possible to use objects >> from Mathex to represent an equation as Mathex objects. >> >> After that the translation to html should be easy. >> >> Maybe I'll give a try if I have some time. > we could ask the Pillar users to write using Mathex directly so we don't > have to write a LaTeX parser. The only remaining thing is to generate > png pictures from Mathex objects for inclusion in HTML. > |
Hi,
On 08/09/15 13:02, Julien Delplanque wrote: > > > On 08/09/15 16:36, Damien Cassou wrote: >> Julien Delplanque <[hidden email]> writes: >> >>> On 07/09/15 13:56, Damien Cassou wrote: >>>> Julien Delplanque <[hidden email]> writes: >>>>> (Phi equal: ((1 asMathex + 5 asMathex sqrt) // 2)) equation asString. >>>>> >>>>> and get: >>>>> >>>>> \begin{equation} >>>>> \phi=\frac{ 1 +\sqrt{ 5 }}{ 2 }\end{equation} >>>> I think that's great news! One of Pillar's feature requests is to let >>>> users write LaTeX (e.g., formulas) in their pillar document and get >>>> nice >>>> results in all exports (LaTeX, HTML, ePub...): >>>> https://github.com/pillar-markup/pillar/issues/18. I'm not sure how >>>> this >>>> request fits in your work, but there might be some intersection. >>>> >>> I guess if a latex math parser is created, it is possible to use >>> objects >>> from Mathex to represent an equation as Mathex objects. >>> >>> After that the translation to html should be easy. >>> >>> Maybe I'll give a try if I have some time. >> we could ask the Pillar users to write using Mathex directly so we don't >> have to write a LaTeX parser. The only remaining thing is to generate >> png pictures from Mathex objects for inclusion in HTML. >> > Oh yeah, it would be easier to set up I guess :) > > Or maybe use mathjax instead of png to generate math on HTML: https://www.mathjax.org/ Cheers, Offray |
On 08/09/15 21:20, Offray Vladimir Luna Cárdenas wrote: > Hi, > > On 08/09/15 13:02, Julien Delplanque wrote: >> >> >> On 08/09/15 16:36, Damien Cassou wrote: >>> Julien Delplanque <[hidden email]> writes: >>> >>>> On 07/09/15 13:56, Damien Cassou wrote: >>>>> Julien Delplanque <[hidden email]> writes: >>>>>> (Phi equal: ((1 asMathex + 5 asMathex sqrt) // 2)) equation >>>>>> asString. >>>>>> >>>>>> and get: >>>>>> >>>>>> \begin{equation} >>>>>> \phi=\frac{ 1 +\sqrt{ 5 }}{ 2 }\end{equation} >>>>> I think that's great news! One of Pillar's feature requests is to let >>>>> users write LaTeX (e.g., formulas) in their pillar document and >>>>> get nice >>>>> results in all exports (LaTeX, HTML, ePub...): >>>>> https://github.com/pillar-markup/pillar/issues/18. I'm not sure >>>>> how this >>>>> request fits in your work, but there might be some intersection. >>>>> >>>> I guess if a latex math parser is created, it is possible to use >>>> objects >>>> from Mathex to represent an equation as Mathex objects. >>>> >>>> After that the translation to html should be easy. >>>> >>>> Maybe I'll give a try if I have some time. >>> we could ask the Pillar users to write using Mathex directly so we >>> don't >>> have to write a LaTeX parser. The only remaining thing is to generate >>> png pictures from Mathex objects for inclusion in HTML. >>> >> Oh yeah, it would be easier to set up I guess :) >> >> > > Or maybe use mathjax instead of png to generate math on HTML: > > https://www.mathjax.org/ > > Cheers, > > Offray > > > as an extension of Mathex. |
Free forum by Nabble | Edit this page |