Ubuntu – Render LaTeX is not working in Inkscape after installing to 18.04

aptdowngradeghostscriptinkscapepackage-management

I have recently installed Ubuntu 18.04 (Not upgrade, a clean install). In Ubuntu 18.04, the rendering LaTeX function in Inkscape is not working. Following is the error output:

*** WARNING - the DELAYBIND command has been deprecated, and will be

           removed in the next version. For now you can restore

           the behaviour by using -dREALLYDEALYBIND but if you

           require continued use of this command you should contact

           the Ghostscript developers. Commercial customers of

           Artifex should email their support contact, free users

           are encouraged to talk to us on the #ghostscript IRC

           channel on irc.freenode.net.



Unrecoverable error: undefined in DELAYBIND

PostScript/PDF Interpreter finished. Return status 65280 executed command : /usr/bin/gs -q -dDELAYBIND -dWRITESYSTEMDICT -dNODISPLAY -dNOEPS "/tmp/psin5eNNQ0"

The interpreter seems to have failed, cannot proceed !

Traceback (most recent call last):
  File "eqtexsvg.py", line 160, in <module>
    e.affect()
  File "/usr/share/inkscape/extensions/inkex.py", line 283, in affect
    self.effect()
  File "eqtexsvg.py", line 154, in effect
    svg_open(self, svg_file)
  File "eqtexsvg.py", line 81, in svg_open
    doc = inkex.etree.parse(filename)
  File "src/lxml/etree.pyx", line 3426, in lxml.etree.parse
  File "src/lxml/parser.pxi", line 1839, in lxml.etree._parseDocument
  File "src/lxml/parser.pxi", line 1865, in lxml.etree._parseDocumentFromURL
  File "src/lxml/parser.pxi", line 1769, in lxml.etree._parseDocFromFile
  File "src/lxml/parser.pxi", line 1162, in lxml.etree._BaseParser._parseDocFromFile
  File "src/lxml/parser.pxi", line 600, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 710, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 639, in lxml.etree._raiseParseError
  File "/tmp/inkscape-Y11679/eq.svg", line 1
lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1

From the google search, what I have found that the problem is arising because of the ghostscript. The Render>LaTeX extension actually calls pstoedit which in terns calls ghostscript using DELAYBIND flag to convert from LaTeX to SVG. But in the newer version of ghostscript the flag DELAYBIND has been deprecated. The solution is to downgrade ghostscript to or below 9.20 version. The following are the methods that I have tried to downgrade ghostscript without any success.

Downgrading ghostscript from apt or aptitute

I have tried to downgrade the ghostrict using the following command.

sudo aptitude install ghostscript=9.18~dfsg~0-0ubuntu2

Or by using

sudo apt install ghostscript=9.18~dfsg~0-0ubuntu2

I am getting the following output

Unable to find a version "9.18~dfsg~0-0ubuntu2" for the package "ghostscript"

or

E: Version '9.18~dfsg~0-0ubuntu2' for 'ghostscript' was not found

I have tried some other version, like 9.20 of ghost script. Nothing worked.

Installing from ghostscript website:

I have downloaded the ghostscript from the ghostscript website, and installed using the following command

sudo ./configure
sudo make
sudo make install

It seems the installation is done, but if I am running the command

ghostscript  --version

It is showing the version as 9.22.

All the online solution that I am able to find is pointing towards the downgrading the ghostscript. But I don't know how to do it in Ubuntu 18.04.

Any solution?

Best Answer

Assuming you use Latex Inkscape plugin, texText, it support pdf2svg beside ghostscript+pstoedit. So, in case of Ubuntu 18.04, installing pdf2svg solves the problem

sudo apt install pdf2svg

It works for me on Ubuntu 18.04, InkScape 0.92.