Feature request: Latex formula switch to pdflatex from pstoedit

Bug #212395 reported by Michael Gratton
2
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Wishlist
Unassigned

Bug Description

Since 0.46, PDF import support is really good. Why not use it for the LaTeX equation render effect?

The current path of getting LaTeX text into Inkscape seems to be (latex) -> (dvips) -> (pstoedit) ->Import

I propose using pdflatex so that the path can be (pdflatex) -> Import

The only major difficulty would be clipping the PDF down to the formula. Right now, it looks like dvips uses the -E which puts an EPS bounding box on the output. Some other method will have to be used to clip the PDF.

pstoedit seems to be at the root of a lot of bugs. It doesn't run silently, producing a spurious warning message confusing users. It sometimes hangs, breaking the function alltogether, and it's often quite slow.

nightrow (jb-benoit)
Changed in inkscape:
importance: Undecided → Wishlist
Ryan Lerch (ryanlerch)
Changed in inkscape:
status: New → Confirmed
Revision history for this message
mycae (mycae) wrote :
Download full text (6.1 KiB)

I have independently generated a simple patch that is in the direction of solving, but does not solve, this bug. To keep things consolidated I will post here.

I have attached a patch that removes pstoedit and instead uses the libpoppler based program pdf2svg. There is still a bug in the script after the patch, that I am unable to quite figure out, however the SVG file is *generated* correctly, it just isn't imported properly.

to manipulate the pdf files I have to use dvipdf instead of dvips. However dvipdf does not support the -E flag, it still may be possible (strace?) to work out the ghostscript command that dvipdf uses (I think it uses GS... I'm not an expert in this area).

I have attached the diff for eqtexsvg.py -- although this file seems to differ slightly between releases, so line numbering may be out.

**SNIP***
Hello,

I use inkscape on a variety of platforms, including Fedora Linux and Mac OSX. My applications are typically engineering/scientific in nature - as such I have tried to use the "render latex formula" plugin for inkscape, which I believe is bundled with the latest inkscape in the OSX distribution, and with several other distributions as well.

The operation of this seems to rely on a python script which uses the external program pstoedit to perform an SVG conversion:

    113 os.system('pstoedit -f plot-svg -dt -ssp ' + ps_file + ' ' + svg_file + '> ' + out_file)
    114 svg_open(self, svg_file)

The problem with this is that currently the pstoedit program does not, by default support the plot-svg by default, but rather by the use of a proprietary extension (plugin). This plugin is only available as a binary module -- thus you cannot readily port it to other platforms (eg mac), and some distrubtions wont accept proprietary plugins (fedora).

My suggestion is that recently there has been another conversion utility developed that uses libpoppler known as pdf2svg (http://www.cityinthesky.co.uk/pdf2svg.html). This is a freely available utility that is released under the GPL, and thus distributions such as fedora, could include it in their standard release. The script could be changed, with minimal effort, to use this this utility to generate the SVG output, allowing for a wider range of platforms -- particularly those that cannot use the proprietary binary object that is required for pdf2svg..

I have attached a patch to do this, but don't know where to send it, so I have emailed you directly.

Unfortunately there is a problem with this patch, the svg that is generated is not opened correctly, so all you get is a black rectangle when the scripts complete, however the SVG itself is fine -- if you manually open it it works like a charm. I am not a python programmer, and I am sufficiently unfamiliar with the SVG manipulations that the script performs to correct this error.

If you are able to provide me with some feedback on the progress for this I would also be most appreciative; I hope it may be included in future inkscape releases!

Kind Regards.

**REPLY from Aaron Spike***

mycae wrote:
> Hello,
>
> I use inkscape on a variety of platforms, including Fedora Linux and
> Mac OSX. My applications are ...

Read more...

tags: added: extensions-plugins
removed: latex pdf
su_v (suv-lp)
tags: added: latex
Revision history for this message
Jonathan Hofinger (jhofinger) wrote :

This issue has been fixed a while ago already, the Equation effect now does pdflatex -> Inkscape without extra scripts.

Closed by https://gitlab.com/jhofinger

Changed in inkscape:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.