寻求有关使用 MikTex 包“svg”的建议

寻求有关使用 MikTex 包“svg”的建议

我今天花了很多时间阅读如何在 LaTeX 中实现矢量图形,但仍然无法让它工作。我有:

  1. 安装 svg 包
  2. 安装 Inkscape
  3. 将 Inkscape 的 bin 目录添加到 PATH
  4. 将 Inkscape 的 bin 目录添加到 TeXworks 设置中(以及 Inkscape 的主目录,因为我在一个屏幕截图中也看到了它)
  5. 向我正在使用的排版机添加了参数 --tex-option=--shell-escape(pdfLaTeX+MakeIndex+BibTeX,这显然是 MikTex 的默认选项)

尽管如此,我还是收到以下错误消息:

** (org.inkscape.Inkscape:3836): WARNING **: 21:36:44.584: Can't open file: C:\Users\username\AppData\Local\Temp\mik89943\_src\filename.svg (doesn't exist)

** (org.inkscape.Inkscape:3836): WARNING **: 21:36:44.585: Can't open file: C:\Users\username\AppData\Local\Temp\mik89943\_src\filename.svg (doesn't exist)
ink_file_open: 'C:\Users\username\AppData\Local\Temp\mik89943\_src\filename.svg' cannot be opened!
InkscapeApplication::document_open: Failed to open: C:\Users\username\AppData\Local\Temp\mik89943\_src\filename.svg
ConcreteInkscapeApplication::on_open: failed to create document!


Package svg Warning: The export with Inkscape failed for file
(svg)                `filename.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 170.


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

以下是我想做的事情:

\documentclass{scrreprt}

\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{a4paper}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage{siunitx}
\usepackage{verbatim}
\usepackage{listingsutf8}
\usepackage{matlab-prettifier}
\usepackage{svg}
\svgsetup{inkscape=pdf,inkscapeexe="C:/Program Files/Inkscape/bin/inkscape.exe"}
\svgpath{ {img/} }
\usepackage{graphicx}
\graphicspath{ {./img/} }

\begin{document}
\chapter{chaptername}
\section{sectionname}
\begin{description}
\begin{minipage}{\textwidth} %I want the introduction of the item and the code listing on the same page
\item[itemname]
Some text and a code listing
\end{minipage}

More text about the code listing

\includesvg{"filename"}

\end{description}
\end{document}

如果我使用 Inkscape 手动将 svg 转换为 PDF 并使用 \includegraphics,一切都很好,但我有相当多的 svg 文件想要实现,因此有效的 svg 实现会很有帮助。

相关内容