Generate latex from Pharo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Generate latex from Pharo

Julien Delplanque
Hi everyone,

Is there any framework to generate latex code from Pharo? I would like to give a latex representation to some objects so I can export the latex code to a file I would include to my latex main file (for example).

For example for a matrix I would like to do something like:

fileStream nextPutAll: myMatrix asLatex.

to have something like:
\begin{pmatrix}
   1 & 2 \\
   3 & 4 
\end{pmatrix}

in the file.

I used to do it with pylatex in Python and I wonder if something equivalent already exists in Pharo?

Regards,

Julien
Reply | Threaded
Open this post in threaded view
|

Re: Generate latex from Pharo

CyrilFerlicot
Hi,
I don't know if there is a framework but if you don't find you can
still take a look at the class PRLaTeXCanvas and PRLaTeXWriter from
Pharo. Maybe that'll help you to make something.

On 16 May 2015 at 14:42, Julien Delplanque <[hidden email]> wrote:

> Hi everyone,
>
> Is there any framework to generate latex code from Pharo? I would like to
> give a latex representation to some objects so I can export the latex code
> to a file I would include to my latex main file (for example).
>
> For example for a matrix I would like to do something like:
>
> fileStream nextPutAll: myMatrix asLatex.
>
> to have something like:
>
> \begin{pmatrix}
>    1 & 2 \\
>    3 & 4
> \end{pmatrix}
>
>
> in the file.
>
> I used to do it with pylatex in Python and I wonder if something equivalent
> already exists in Pharo?
>
> Regards,
>
> Julien



--
Cheers
Cyril Ferlicot

Reply | Threaded
Open this post in threaded view
|

Re: Generate latex from Pharo

Julien Delplanque
 From which package does these classes come from?

On 16/05/15 15:26, Cyril Ferlicot wrote:

> Hi,
> I don't know if there is a framework but if you don't find you can
> still take a look at the class PRLaTeXCanvas and PRLaTeXWriter from
> Pharo. Maybe that'll help you to make something.
>
> On 16 May 2015 at 14:42, Julien Delplanque <[hidden email]> wrote:
>> Hi everyone,
>>
>> Is there any framework to generate latex code from Pharo? I would like to
>> give a latex representation to some objects so I can export the latex code
>> to a file I would include to my latex main file (for example).
>>
>> For example for a matrix I would like to do something like:
>>
>> fileStream nextPutAll: myMatrix asLatex.
>>
>> to have something like:
>>
>> \begin{pmatrix}
>>     1 & 2 \\
>>     3 & 4
>> \end{pmatrix}
>>
>>
>> in the file.
>>
>> I used to do it with pylatex in Python and I wonder if something equivalent
>> already exists in Pharo?
>>
>> Regards,
>>
>> Julien
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Generate latex from Pharo

CyrilFerlicot
Pillar-ExporterLaTeX but they inherit from Pillar-ExporterCore I think

On 16 May 2015 at 15:30, Julien Delplanque <[hidden email]> wrote:

> From which package does these classes come from?
>
>
> On 16/05/15 15:26, Cyril Ferlicot wrote:
>>
>> Hi,
>> I don't know if there is a framework but if you don't find you can
>> still take a look at the class PRLaTeXCanvas and PRLaTeXWriter from
>> Pharo. Maybe that'll help you to make something.
>>
>> On 16 May 2015 at 14:42, Julien Delplanque <[hidden email]> wrote:
>>>
>>> Hi everyone,
>>>
>>> Is there any framework to generate latex code from Pharo? I would like to
>>> give a latex representation to some objects so I can export the latex
>>> code
>>> to a file I would include to my latex main file (for example).
>>>
>>> For example for a matrix I would like to do something like:
>>>
>>> fileStream nextPutAll: myMatrix asLatex.
>>>
>>> to have something like:
>>>
>>> \begin{pmatrix}
>>>     1 & 2 \\
>>>     3 & 4
>>> \end{pmatrix}
>>>
>>>
>>> in the file.
>>>
>>> I used to do it with pylatex in Python and I wonder if something
>>> equivalent
>>> already exists in Pharo?
>>>
>>> Regards,
>>>
>>> Julien
>>
>>
>>
>
>



--
Cheers
Cyril Ferlicot

Reply | Threaded
Open this post in threaded view
|

Re: Generate latex from Pharo

Damien Cassou-2
In reply to this post by Julien Delplanque

Julien Delplanque <[hidden email]> writes:

>  From which package does these classes come from?

Gofer new
        smalltalkhubUser: 'Pier' project: 'Pillar';
        configurationOf: 'Pillar';
        load.

(ConfigurationOfPillar project version: #stable) load: 'latex exporter'.


With this loaded, you now have 2 choices:

- instantiate PRLaTeXCanvas and PROutputStream manually and use them, or

- create a Pillar document and export it as LaTeX.


Continue asking questions here if you have more.


--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: Generate latex from Pharo

Julien Delplanque
Is there anything already done to generate code related to math environment?

I would like messages like:

Fraction>>asMathLatex

that returns $\frac{numerator}{denominator}$.

Julien

On 17/05/15 09:06, Damien Cassou wrote:

> Julien Delplanque <[hidden email]> writes:
>
>>   From which package does these classes come from?
> Gofer new
>          smalltalkhubUser: 'Pier' project: 'Pillar';
>          configurationOf: 'Pillar';
>          load.
>
> (ConfigurationOfPillar project version: #stable) load: 'latex exporter'.
>
>
> With this loaded, you now have 2 choices:
>
> - instantiate PRLaTeXCanvas and PROutputStream manually and use them, or
>
> - create a Pillar document and export it as LaTeX.
>
>
> Continue asking questions here if you have more.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Generate latex from Pharo

CyrilFerlicot
Sorry but that's an item of the TODO list of Pillar.

On 17 May 2015 at 11:25, Julien Delplanque <[hidden email]> wrote:

> Is there anything already done to generate code related to math environment?
>
> I would like messages like:
>
> Fraction>>asMathLatex
>
> that returns $\frac{numerator}{denominator}$.
>
> Julien
>
>
> On 17/05/15 09:06, Damien Cassou wrote:
>>
>> Julien Delplanque <[hidden email]> writes:
>>
>>>   From which package does these classes come from?
>>
>> Gofer new
>>          smalltalkhubUser: 'Pier' project: 'Pillar';
>>          configurationOf: 'Pillar';
>>          load.
>>
>> (ConfigurationOfPillar project version: #stable) load: 'latex exporter'.
>>
>>
>> With this loaded, you now have 2 choices:
>>
>> - instantiate PRLaTeXCanvas and PROutputStream manually and use them, or
>>
>> - create a Pillar document and export it as LaTeX.
>>
>>
>> Continue asking questions here if you have more.
>>
>>
>
>



--
Cheers
Cyril Ferlicot

Reply | Threaded
Open this post in threaded view
|

Re: Generate latex from Pharo

Julien Delplanque
Oh ok :)

Do you have this todo list online?

On 17/05/15 12:19, Cyril Ferlicot wrote:

> Sorry but that's an item of the TODO list of Pillar.
>
> On 17 May 2015 at 11:25, Julien Delplanque <[hidden email]> wrote:
>> Is there anything already done to generate code related to math environment?
>>
>> I would like messages like:
>>
>> Fraction>>asMathLatex
>>
>> that returns $\frac{numerator}{denominator}$.
>>
>> Julien
>>
>>
>> On 17/05/15 09:06, Damien Cassou wrote:
>>> Julien Delplanque <[hidden email]> writes:
>>>
>>>>    From which package does these classes come from?
>>> Gofer new
>>>           smalltalkhubUser: 'Pier' project: 'Pillar';
>>>           configurationOf: 'Pillar';
>>>           load.
>>>
>>> (ConfigurationOfPillar project version: #stable) load: 'latex exporter'.
>>>
>>>
>>> With this loaded, you now have 2 choices:
>>>
>>> - instantiate PRLaTeXCanvas and PROutputStream manually and use them, or
>>>
>>> - create a Pillar document and export it as LaTeX.
>>>
>>>
>>> Continue asking questions here if you have more.
>>>
>>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Generate latex from Pharo

CyrilFerlicot
http://smalltalkhub.com/#!/~Pier/Pillar

"LaTeX embedding: LaTeX is very useful to write mathematical formulas
for example. It would be nice to be able to embed LaTeX formulas
inside a Pillar document and get these formulas fully exported. Org
mode does something similar already."

On 17 May 2015 at 12:33, Julien Delplanque <[hidden email]> wrote:

> Oh ok :)
>
> Do you have this todo list online?
>
>
> On 17/05/15 12:19, Cyril Ferlicot wrote:
>>
>> Sorry but that's an item of the TODO list of Pillar.
>>
>> On 17 May 2015 at 11:25, Julien Delplanque <[hidden email]> wrote:
>>>
>>> Is there anything already done to generate code related to math
>>> environment?
>>>
>>> I would like messages like:
>>>
>>> Fraction>>asMathLatex
>>>
>>> that returns $\frac{numerator}{denominator}$.
>>>
>>> Julien
>>>
>>>
>>> On 17/05/15 09:06, Damien Cassou wrote:
>>>>
>>>> Julien Delplanque <[hidden email]> writes:
>>>>
>>>>>    From which package does these classes come from?
>>>>
>>>> Gofer new
>>>>           smalltalkhubUser: 'Pier' project: 'Pillar';
>>>>           configurationOf: 'Pillar';
>>>>           load.
>>>>
>>>> (ConfigurationOfPillar project version: #stable) load: 'latex exporter'.
>>>>
>>>>
>>>> With this loaded, you now have 2 choices:
>>>>
>>>> - instantiate PRLaTeXCanvas and PROutputStream manually and use them, or
>>>>
>>>> - create a Pillar document and export it as LaTeX.
>>>>
>>>>
>>>> Continue asking questions here if you have more.
>>>>
>>>>
>>>
>>
>>
>
>



--
Cheers
Cyril Ferlicot

Reply | Threaded
Open this post in threaded view
|

Re: Generate latex from Pharo

Damien Cassou-2
In reply to this post by Julien Delplanque

Julien Delplanque <[hidden email]> writes:

> Is there anything already done to generate code related to math environment?
>
> I would like messages like:
>
> Fraction>>asMathLatex
>
> that returns $\frac{numerator}{denominator}$.

stream := PROutputStream on: String new writeStream.
configuration := PRCocoonConfiguration new.
stream configuration: configuration.
canvas := PRLaTeXCanvas on: stream.

canvas raw: '$'.
canvas command name: 'frac'; parameter: 'numerator'; parameter: 'denominator'.
canvas raw: '$'.
canvas flush

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: Generate latex from Pharo

Damien Cassou-2
In reply to this post by CyrilFerlicot

Cyril Ferlicot <[hidden email]> writes:

> http://smalltalkhub.com/#!/~Pier/Pillar
>
> "LaTeX embedding: LaTeX is very useful to write mathematical formulas
> for example. It would be nice to be able to embed LaTeX formulas
> inside a Pillar document and get these formulas fully exported. Org
> mode does something similar already."

this is something else. This feature means writing LaTeX directly inside
the Pillar document and get nice output in all export formats.

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: Generate latex from Pharo

Julien Delplanque
In reply to this post by Damien Cassou-2
Ok thank you :)

On 17/05/15 21:18, Damien Cassou wrote:

> Julien Delplanque <[hidden email]> writes:
>
>> Is there anything already done to generate code related to math environment?
>>
>> I would like messages like:
>>
>> Fraction>>asMathLatex
>>
>> that returns $\frac{numerator}{denominator}$.
> stream := PROutputStream on: String new writeStream.
> configuration := PRCocoonConfiguration new.
> stream configuration: configuration.
> canvas := PRLaTeXCanvas on: stream.
>
> canvas raw: '$'.
> canvas command name: 'frac'; parameter: 'numerator'; parameter: 'denominator'.
> canvas raw: '$'.
> canvas flush
>


Reply | Threaded
Open this post in threaded view
|

Re: Generate latex from Pharo

stepharo
In reply to this post by Damien Cassou-2

> stream := PROutputStream on: String new writeStream.
> configuration := PRCocoonConfiguration new.
> stream configuration: configuration.
> canvas := PRLaTeXCanvas on: stream.
>
> canvas raw: '$'.
> canvas command name: 'frac'; parameter: 'numerator'; parameter: 'denominator'.
> canvas raw: '$'.
> canvas flush
>
Why not?

stream := PROutputStream on: String new writeStream.
canvas := PRLaTeXCanvas on: stream.