seebk / LaTeXText

Inkscape extension to render text as Latex
GNU General Public License v3.0
140 stars 19 forks source link

Issues installing on platform running Python3 ( Text with Latex [GTK3] ) #40

Open Zipgit opened 1 year ago

Zipgit commented 1 year ago

Attempting to solve some problems with installing on Linux x86_64 debian (Mint).

  1. instructions don't seem to indicate that the package should be unzipped into the ~/.config/inkscape/extensions directory (eventually figured this out, and solved it)
  2. the Extension, as delivered, is not set up to run with `Python3` (which is current, and so it seems that this Extension is not up to date)
  3. Solved some installation problems by editing the install.sh file, changing "python" to "python3"
  4. Multiple errors generated when calling the Extension within Inkscape; here are some generated from the latextext.py program:
/home/username/.config/inkscape/extensions/LaTeXText-master/extension/latextext.py:472: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if self.options.math and latex_string[0] is not '$':

/home/username/.config/inkscape/extensions/LaTeXText-master/extension/latextext.py:639: DeprecationWarning: Effect.OptionParser or `optparse` has been deprecated and replaced with `argparser`. You must change `self.OptionParser.add_option` to `self.arg_parser.add_argument`; the arguments are similar.

  add_options(self.OptionParser)
/home/username/.config/inkscape/extensions/LaTeXText-master/extension/latextext.py:640: DeprecationWarning: Effect.OptionParser or `optparse` has been deprecated and replaced with `argparser`. You must change `self.OptionParser.add_option` to `self.arg_parser.add_argument`; the arguments are similar.

  self.OptionParser.set_conflict_handler("resolve")
Traceback (most recent call last):
  File "/home/username/.config/inkscape/extensions/LaTeXText-master/extension/latextext_gtk3.py", line 176, in <module>
    effect = RenderLatexEffectGTK3()
  File "/home/username/.config/inkscape/extensions/LaTeXText-master/extension/latextext.py", line 640, in __init__
    self.OptionParser.set_conflict_handler("resolve")
AttributeError: 'RenderLatexEffectGTK3' object has no attribute 'set_conflict_handler'

I was able to fix some of these errors, but other persist (due to my poor python3 skills, I guess)

mathieulandreau commented 11 months ago

Hi, I faced exactly the same issues. It seem that the optparse library is not used anymore and replaced by argparse optparse : https://docs.python.org/3/library/optparse.html argparse : https://docs.python.org/3/library/argparse.html

Fortunately the two libraries are almost similar. I modified the source code for argparse use and succeeded in using the LaTexText only on terminal. I couldn't use directly in Inkscape Extensions because when you check (or not) a click box in the dialog box, it output a value of true instead of True. I don't know how to manage that. I also had problems with the input file.

However, now I face another issue with the translation method : Traceback (most recent call last): File "/home/mlandreau/.config/inkscape/extensions/./latextext.py", line 771, in main_standalone() File "/home/mlandreau/.config/inkscape/extensions/./latextext.py", line 753, in main_standalone result = svgprocessor.run() File "/home/mlandreau/.config/inkscape/extensions/./latextext.py", line 478, in run rendergroup = self.align_placement(rendergroup, txt) File "/home/mlandreau/.config/inkscape/extensions/./latextext.py", line 347, in align_placement (tx, ty) = t.get_translation() File "/home/mlandreau/.config/inkscape/extensions/./latextext.py", line 197, in get_translation return (self.matrix[0][2], self.matrix[1][2]) IndexError: list index out of range