Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inkscape for including SVG graphics #256

Open
fkohrt opened this issue Sep 4, 2020 · 1 comment · May be fixed by #275
Open

Inkscape for including SVG graphics #256

fkohrt opened this issue Sep 4, 2020 · 1 comment · May be fixed by #275

Comments

@fkohrt
Copy link

fkohrt commented Sep 4, 2020

Creating LaTeX PDF reports that contain vector graphics in SVG format require the svg package, which in turn uses Inkscape. Thus, I'd be glad if Inkscape could be installed as a system package.

@fkohrt fkohrt linked a pull request Mar 2, 2021 that will close this issue
@fkohrt
Copy link
Author

fkohrt commented Dec 16, 2021

As #275 seems not to get merged, an alternative is to use the rsvg R package. Its dependency librsvg has already been merged (#43).

Here's an example Rmd:

---
title: SVG Test
output: pdf_document
---

```{cat, svg-drawing, engine.opts = list(file = "./drawing.svg")}
<?xml version="1.0" encoding="UTF-8"?>
<svg width="96.725mm" height="50.327mm" version="1.1" viewBox="0 0 96.725 50.327" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
 <metadata>
  <rdf:RDF>
   <cc:Work rdf:about="">
    <dc:format>image/svg+xml</dc:format>
    <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
    <dc:title/>
   </cc:Work>
  </rdf:RDF>
 </metadata>
 <g transform="translate(-27.689 -45.179)">
  <path d="m100.09 88.093-6.259-9.7729-10.235 5.4701 3.7384-10.987-10.658-4.5917 10.921-3.9274-3.0554-11.196 9.8795 6.0894 6.8483-9.3694 1.3988 11.521 11.595-0.48748-8.1351 8.2767 7.6106 8.7615-11.543-1.1998z" fill="#ff0808"/>
  <text x="83.593781" y="83.789787" fill="#000000" font-family="'CMU Serif'" font-size="12.7px" letter-spacing="0px" stroke-width=".26458" text-align="end" text-anchor="end" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan x="83.593781" y="83.789787" font-size="3.8806px" stroke-width=".26458" text-align="end" text-anchor="end">This is a test for testing.</tspan></text>
 </g>
</svg>
```


```{r, echo=FALSE}
rsvg::rsvg_pdf("./drawing.svg", "./drawing.pdf")
knitr::include_graphics(normalizePath("./drawing.pdf"))
```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant