Giter VIP home page Giter VIP logo

Comments (5)

Andonome avatar Andonome commented on June 6, 2024

from svg.

mrpiggi avatar mrpiggi commented on June 6, 2024

The CLI of Inkscape was dicussed some time ago (#20). At this time --export-type was dropped completely. Apparently, it was brought back again. Nevertheless, inkscape --help as well as Inkscape man page both state (if --export-type is omitted)

file type is guessed from extension if present
the file type to export will be inferred from the extension of the specified filename

What do you get, typing inkscape -V on your terminal? Maybe the link in PATH is pointing to another installation? With

svg.sty    2020/11/26 v2.02k (include SVG pictures)
Inkscape 1.2.2 (732a01da63, 2022-12-09)

calling inkscape "my-svg-example.svg" -D --export-dpi=300 --export-filename="my-svg-example_svg-raw.png" works exactly as expected and creates the desired png file.

\begin{filecontents}[noheader]{my-svg-example.svg}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg">
  <g>
  <text>Package svg: \LaTeX</text>
  </g>
</svg>
\end{filecontents}

\listfiles
\documentclass{article}
\usepackage{svg}
\begin{document}
\includesvg[inkscapeformat=png]{my-svg-example.svg}
\end{document}

my-svg-example_svg-raw

from svg.

CodeMazeSolver avatar CodeMazeSolver commented on June 6, 2024

Thanks for your fast replies.

> inkscape -V
This is what I get, the same version I wrote earlier.
Inkscape 1.2.2 (732a01da63, 2022-12-09)

I made some changes yesterday as well. Right now I have this as my path variable:
C:\Program Files\Inkscape\bin

In the log, I now find that it does not recognize Inkscape even though it is found using cmd.

(|'inkscape' -V )

Package svg Warning: No version of Inkscape was detected by invoking
(svg)                `inkscape -V'
(svg)                so the Inkscape export will fail quite sure as the
(svg)                command is probably unknown to your OS. You could set
(svg)                `inkscapeversion=<version>' manually but this is very
(svg)                unlikely to work on input line 172.

and then

Package svg Info: Calling Inkscape on input line 244.
runsystem(inkscape "./svg/my.svg" -D --export-dpi=300 --export-filename="my_svg
-raw.png")...executed.

runsystem(inkscape "./svg/my.svg" -D --export-dpi=300 \relax --without-gui --ex
port-png="my_svg-raw.png")...executed.

as well as

Package svg Error: Inkscape version not dete
cted.

See the svg package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.244 \includesvg{./svg/my}
                           
It was tried to invoke `inkscape'
for file "./svg/my.svg"
but no result was produced. Check the log file
and set `inkscapeversion=<version>' manually.

runsystem(inkscape "./svg/my.svg" -D --export-dpi=300 --export-filename="my_svg
-raw.png")...executed.


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

I guess I now have an issue with the Inkscape installation...

I did a fresh installation, loading the newest version again from the web to make sure I don't have a corrupted installer.
Also, I still use the same path for the system variables Path.
C:\Program Files\Inkscape\bin

Running the command
inkscape "./svg/my.svg" -D --export-dpi=300 --export-filename="./svg/my-svg.png"

Again, it works in cmd and not in Latex...

Using the actual command as logged in the log file:

inkscape "./svg/my.svg" -D --export-dpi=300 --export-filename="my_svg-raw.png"

The file is successfully created using the console, but not when running it via pdfLatex.
However, the file is not created in the source file folder svg but rather in the folder, which the command is executed from. Might this be an issue?

from svg.

mrpiggi avatar mrpiggi commented on June 6, 2024

That's a tricky one. Package svg tries to detect the version of Inkscape by parsing the output of inkscape -V. In order to get this from stdout it needs to invoke \@@input|"'inkscape' -V " and this might be an problem. So maybe setting \svgsetup{inkscapeversion=1} in the preamble would help. Another solution could be to set the absolute path to Inkscape with \svgsetup{inkscapeexe="C:\Program Files\Inkscape\bin\inkscape.exe"} (try both variants with or without quotes).

However, the file is not created in the source file folder svg but rather in the folder, which the command is executed from.

Package svg creates the desired file in the root folder of your tex file and moves it to the destination folder afterwards for several reasons. Mainly because on some systems, you can't run the inkscape export right in the desired output folder due to write restrictions. So this isn't the problem.

from svg.

CodeMazeSolver avatar CodeMazeSolver commented on June 6, 2024

from svg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.