Skip to content

Commit

Permalink
Rethink the cairosvg dependency (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
rikhuijzer authored May 14, 2021
1 parent a13460b commit 68937d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions docs/contents/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ _gen/my_data_mean-sco.md
Conversions for Gadfly are also included, see @fig:example_plot.
This is actually a bit tricky, because we want to show vector graphics (SVG) on the web, but these are not supported (well) by LaTeX.
Therefore, portable network graphics (PNG) images are passed to LaTeX via cairosvg;
I found that this tool does the best conversions without relying on Cairo.jl.
(Cairo.jl doesn't work for me on NixOS.)
I found that this tool does the best conversions without relying on Cairo and/or Fontconfig, which are not so stable in combination with Compose in my experience.

```{.include}
_gen/example_plot-sco.md
Expand Down
2 changes: 2 additions & 0 deletions src/outputs/compose.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ function convert_gadfly_output(path, out;
svg_filename = "$file.svg"
svg_path = joinpath(im_dir, svg_filename)
write_svg(svg_path, out, width, height)

png_filename = "$file.png"
png_path = joinpath(im_dir, png_filename)
svg2png(svg_path, png_path)

im_link = joinpath("im", svg_filename)
caption, label = caption_label(path, caption, label)
pandoc_image(file, png_path; caption, label)
Expand Down

0 comments on commit 68937d3

Please sign in to comment.