Dealing with images in PDF display from Weave.jl

I’m using Weave.jl to write up a report using .jmd format. I need to include some images that I’ve already generated, so I included them in my markdown as I normally would:

![a descriptive caption](one pair random data.png)

And it looks fine in the HTML export, but in the PDF it is way too large and has some text on the top. Here’s how it looks in my PDF viewer. Notice that it is not centered and the right part is cut off (it’s an 800px by 800px square image).

Is there a way to tweak how images are displayed in the PDF export?

Also, is there a way to get a figure reference for the image so I can refer to it in the text?

1 Like

Additionally is there a way in Weave to add a caption and figure reference to an image? I guess I could try loading it in a code block with FileIO rather than using markdown syntax, but that seems pretty roundabout and also I don’t see an easy way to load SVG files to get displayed.

CC @mpastell

1 Like

The easiest option is to use the pandoc output format and convert it to pdf, you can then use pandoc image attributes and e.g. pandoc-crossref for figures.

Another solution is to use inline code to specify your own image tag that output correctly to html and latex. There is an example document using this technique to produce beamer slides

1 Like