I have spend a good chunk of today reading up on how to implement vector graphics in LaTeX and still cannot get it to work. I have:
- Installed the svg-package
- Installed Inkscape
- Added Inkscape's bin-directory to PATH
- Added Inkscape's bin-directory to the TeXworks settings (as well as Inkscape's main directory, as I have seen that too in one screenshot)
- Added the argument --tex-option=--shell-escape to the typesetter I'm using (pdfLaTeX+MakeIndex+BibTeX, which apparently is the default option with MikTex)
Still, this is the error message I get:
** (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
Here's what I'm trying to do:
\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}
Everything is fine if I convert the svg into PDF manually with Inkscape and use \includegraphics, but I have quite a few svg-files I'd like to implement, so a working svg-implementation would be helpful.
C:\Users\username\AppData\Local\Tempand see if they agree, and all have read/write permission for your username? If that is not the issue, then I have no further suggestion. – rallg Feb 17 '24 at 21:12pdflatex --shell-escape mweif the file ismwe.tex) and see if that helps. If that also doesn't work, double check that inkscape is really in PATH (runinkscape -V). Then come back here and report how it went. – schtandard Mar 18 '24 at 14:22inkscape -Vin the shell returns the current Inkscape version, so the PATH variable should be right. Running the MWE from your link in TeXworks failed at first. I then ran it through the command line and it worked. Tried again in TeXworks and it worked there also, then.Still, I get the same error with my own document, either trying to typeset via TeXworks or command line.
– Stefan Mar 22 '24 at 14:34