# Dealing with images in PDF display from Weave.jl

**URL:** <https://discourse.julialang.org/t/dealing-with-images-in-pdf-display-from-weave-jl/25419>\
**Category:** General Usage\
**Created:** [June 18, 2019, 5:51pm UTC](https://discourse.julialang.org/t/dealing-with-images-in-pdf-display-from-weave-jl/25419 "2019-06-18T17:51:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssfrr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ssfrr/32/3736_2.png) [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Post date:** [June 18, 2019, 5:51pm UTC](https://discourse.julialang.org/t/dealing-with-images-in-pdf-display-from-weave-jl/25419/1 "2019-06-18T17:51:36Z")

</div>

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:

```julia
![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).

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/4/84985b994b2a59b2231472b847007e4422e1e3d2.jpeg)

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?

---

<div class="post-metadata">

**Author:** ![ssfrr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ssfrr/32/3736_2.png) [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Post date:** [June 21, 2019, 3:59pm UTC](https://discourse.julialang.org/t/dealing-with-images-in-pdf-display-from-weave-jl/25419/2 "2019-06-21T15:59:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mpastell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mpastell/32/350_2.png) [@mpastell](https://discourse.julialang.org/u/mpastell)\
**Post date:** [June 26, 2019, 5:41am UTC](https://discourse.julialang.org/t/dealing-with-images-in-pdf-display-from-weave-jl/25419/3 "2019-06-26T05:41:18Z")

</div>

The easiest option is to use the `pandoc` output format and convert it to pdf, you can then use pandoc image attributes [Pandoc - Pandoc User’s Guide](https://pandoc.org/MANUAL.html#images) and e.g. pandoc-crossref for figures.

Another solution is to use [inline code](http://weavejl.mpastell.com/dev/usage/#Inline-code-1) 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](https://github.com/JunoLab/Weave.jl/blob/master/examples/markdown_beamer.jmd)
