1

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:

  1. Installed the svg-package
  2. Installed Inkscape
  3. Added Inkscape's bin-directory to PATH
  4. 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)
  5. 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.

Stefan
  • 73
  • 5
  • Not just with TeX or Inkscape, this general kind of error message often (not always) happens when one or more of the programs was installed by different users, with different privileges. Using Windows methods, can you check who owns the folders through C:\Users\username\AppData\Local\Temp and 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:12
  • @rallg While there is a second Windows user account on this machine, it has not been used since before either MikTex or Inkscape have been installed. The directory you mentioned has the same privileges as the MikTex directory. The Inkscape directory has the privileges all other directories in Program Files seem to have. – Stefan Feb 18 '24 at 11:14
  • Can you try typesetting the MWE from this answer? If that doesn't work, try typesetting from the command line (pdflatex --shell-escape mwe if the file is mwe.tex) and see if that helps. If that also doesn't work, double check that inkscape is really in PATH (run inkscape -V). Then come back here and report how it went. – schtandard Mar 18 '24 at 14:22
  • inkscape -V in 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

0 Answers0