[Pharo-users] Mathex: Generating latex math from Pharo.
Julien Delplanque
julien at tamere.eu
Sun Sep 6 10:15:00 EDT 2015
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
More information about the Pharo-users
mailing list