我尝试在 Inkscape 中使用 Latex,但无法正常工作。我安装了所有必需的软件包(例如 Inkscape 版本 1.0.2、texlive-base、pdflatex、pdf2svg、python-lxml、python-gi)。我的电脑操作系统是 Ubuntu 18.04
但是,当我使用带有 latex(GTK3)的程序扩展>渲染>文本在 inkscape 中启动 letex 时,屏幕上打印了以下错误。
有谁能帮我解决这个问题吗?
kscape has received additional data from the script executed. the script did not return an error but this may indicate results will not be as expected
/home/joha/.config/inkscape/extensions/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/joha/.config/inkscape/extensions/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")
/usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
Traceback (most recent call last):
File "latextext_gtk3.py", line 176, in <module>
effect = RenderLatexEffectGTK3()
File "/home/joha/.config/inkscape/extensions/latextext.py", line 640, in __init__
self.OptionParser.set_conflict_handler("resolve")
AttributeError: 'RenderLatexEffectGTK3' object has no attribute 'set_conflict_handler'
$ which inkscape
产出/usr/bin/inkscape
和
$ apt-cache policy inkscape
输出
Installed: 1.0.2+r75+1~ubuntu18.04.1
Candidate: 1.0.2+r75+1~ubuntu18.04.1
Version table:
*** 1.0.2+r75+1~ubuntu18.04.1 500
500 ppa.launchpad.net/inkscape.dev/stable/ubuntu bionic/main amd64 Packages
100 /var/lib/dpkg/status 0.92.3-1
500 500 archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
答案1
我建议删除本地扩展安装
rm /home/joha/.config/inkscape/extensions/latextext.py
那么你有两个选择:
使用预装的LaTeX (pdflatex)(Inkscape,扩展 → 数学 → LaTeX (pdflatex))已从 PPA 安装 Inkscape
您需要安装依赖项和先前版本的 Inkscape:
sudo apt-get install texlive pstoedit
使用预装的 LaTeX 扩展(Inkscape,扩展 → 渲染 → LaTeX)
您需要安装依赖项和先前版本的 Inkscape:
sudo apt-get install texlive pstoedit sudo apt-get install ppa-purge sudo ppa-purge ppa:inkscape.dev/stable
。
答案2
我在使用 Inkscape 1.3 的 Ubunutu 23.04 中遇到了类似的问题。我的解决方法是:
- 将操作系统从 23.04 更新至 23.10
- sudo apt 删除 inkscape texlive pstoedit
- sudo apt 安装 inkscape texlive pstoedit
- 安装 texlive-latex-extra
现在使用扩展>渲染>公式(pdflatex)编写表达式可以正常工作。