octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GSoC project - LaTeX/TeX


From: Andrej Lojdl
Subject: Re: GSoC project - LaTeX/TeX
Date: Thu, 27 Jun 2013 23:53:19 +0200

After few hours ( maybe a day ) of searching, experimenting and thinking. I finally have some modest plan or idea how could 
be Latex interpreter implemented into Octave. I will try to present my ideas and conclusions here. Be free, to correct me if I've 
made a mistake, or if there is something what can be done better. So here's how I imagine interpreter:

1) Text extraction 
    After some text object appear in .m file or in typed directly in Octave, it will be read and moved ( copied ) into default .tex file. 
Example of this kind of file is in attachment under name default. I presented just minimal set of code for rendering trough Latex.
There are many variations of code that work, this set is something I think is minimal and stable. 

2) Converting
    After first step there is .tex file ready for converting. In my opinion, I would first convert it to .eps , to get bounding box. 
latex default.tex
dvips default.dvi -o -E default.eps
This two program convert .tex -> .dvi and then .dvi -> .eps . When dvips is called, we give him two parameters firs -E enables
slicing off just formula. Second is known, it's changing the name of output file. In attachment are outputs of these two programs.
If you try to open .eps file in any text editing tool, you can find line %%BoundingBox: 158 632 265 645. This information can be used
for some sort of placeholders in Octave plot. 

For converting we can use many different programs proposed by Ben. And I want to thank him for his help. But more or less they are 
same as this combination. If some of them have any new functionality, it needs additional dependencies. I will mention them here if
accidentally missed a good functionality. 
- textogif       [http://www.fourmilab.ch/webtools/textogif/]
- tex2im        [http://www.nought.de/tex2im.html]
- tex2image   [http://dean.serenevy.net/code/projects/tex2image]

3) Rasterize image and place it on plot
    This final step is to convert .eps file to .png image and then put it into placeholder. Converting .eps to bitmap image is done trough
Ghostscript. 
gs -dEPSCrop  -dSAFER  -dBATCH  -dNOPAUSE -r600  -sDEVICE=pnggray  -sOutputFile=defaulteps.png "default.eps"
Output is also in attachment. Scaling factor is 8.3 , BoundaryBox from .eps file is 107x13 pixels and image of .png file is 
892x108 pixels. This final image could be attached to plot or somehow integrated before rendering. I'm not sure how could we do this,
and I would appreciate any help, suggestion or direction regarding this problem. I worked with OpenGL before, but just used it for
drawing points representing molecules of 2D fluid simulation. 

That's all, maybe I wanted to write something in addition but I forgot. 

--
Andrej

Attachment: default.tex
Description: TeX document

Attachment: default.dvi
Description: TeX dvi file

Attachment: default.eps
Description: PostScript document

Attachment: defaulteps.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]