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?
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.
The easiest option is to use the
pandoc output format and convert it to pdf, you can then use pandoc image attributes https://pandoc.org/MANUAL.html#images 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 https://github.com/JunoLab/Weave.jl/blob/master/examples/markdown_beamer.jmd