rstudio / shinyapps-package-dependencies

Collection of bash scripts that install R package system dependencies
https://www.shinyapps.io/
Other
79 stars 56 forks source link

Inkscape for including SVG graphics #256

Open fkohrt opened 4 years ago

fkohrt commented 4 years ago

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 commented 2 years ago

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>
rsvg::rsvg_pdf("./drawing.svg", "./drawing.pdf")
knitr::include_graphics(normalizePath("./drawing.pdf"))