SVG 和 inkscape

SVG 和 inkscape

我有以下示例:

\documentclass{article}
\usepackage{svg}
\begin{document}

\begin{figure}[htbp]
  \centering
  \includesvg{fig1}
  \caption{svg image}
\end{figure}

\end{document}

我想将图 fig1.svg 包含到我的 latex 文档中。
我启用了-shell-escape

编译时我收到以下错误消息:

Package svg Warning: The export with Inkscape failed for file
(svg)                `fig1.svg'
(svg)                Troubleshooting: Please check in the log file how
(svg)                the invocation of Inkscape took place and try to
(svg)                execute it yourself in the terminal on input line 7.

据我所知,latex 找不到 Inkscape(已安装在我的计算机上)。我在 Win10 中使用 Texworks 0.6.2 和 MikTex 2.9。

我如何正确设置 LaTex 可以找到 Inkscape 的目录(实际上位于 C:\Program Files\Inkscape

答案1

我只针对这种情况回复消息请参阅下面的链接以获得更多选择

"Package svg Warning: The export with Inkscape failed for file 'yourimagepath/filename.svg' "

! Package svg Error: File 'filename_svg-tex.pdf' is missing.

在 Windows 中,当 SVG 通过 -shell-escape 运行时,Inkscape 需要“在路径上”

在 TeXworks 中和许多其他编辑器一样,无需繁琐的系统调整即可完成此操作。但是请注意,这只会帮助编辑器内的会话。使用命令行控制台需要不同的方法。

你只需要添加 Inkscape 文件夹对那些TeXworks 将使用注意,您的 inkscape 文件夹可能位于 program files 或 program files (x86) 或您安装它的任何其他位置(您可能需要在编辑器外部使用资源管理器进行搜索,以确保它包含 inkscape.exe)

在此用户情况下,如果有一个空框则输入C:\Program Files\Inkscape或如果存在现有条目;C:\Program Files\Inkscape(即 Windows 使用分号作为分隔符,Mac 用户需要完整的冒号)

准确记下文件夹名称,因为您稍后可能会需要它。

在此处输入图片描述

这将允许 svg 在 TeXworks 内部工作

有关 SVG 启动失败的更详细描述,请参阅https://tex.stackexchange.com/a/474097/170109

要将 Inkscape 文件夹永久设置为您的路径(您确实记下了它,不是吗),有一个很好的指南https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/

相关内容