Home > Mobile >  How to resize figures in Quarto (PDF output)?
How to resize figures in Quarto (PDF output)?

Time:09-27

I do not get the syntax for resizing graphics in Quarto, could you please give me a hint. The following has no effect.

---
title: "resize image"
format: pdf
---

![World](images/World.pdf){fig-width=5}

![World](images/World.pdf){fig-width=10}

![World](images/World.pdf){fig-width=50%}

![World](images/World.pdf){fig-height=50%}

https://quarto.org/docs/reference/formats/pdf.html#figures

https://quarto.org/docs/authoring/figures.html

CodePudding user response:

You can use width and height, as documented here.

---
title: "resize image"
format: pdf
---

![Elephant with small width](elephant.png){width=10%}

![Elephant with larger height](elephant.png){height=50%}

You can also use px and in as the unit, or specify it between quotes:

![Elephant with height=100px](elephant.png){height=100px}

![Elephant](elephant.png){height=2in}

![Elephant](elephant.png){height="100"}

Why are fig-height and fig-width not working?

As stated in the document you cite, fig-height and fig-width are settings for the default size for figures generated by R or Matplotlib graphics.

Since your image is not generated by R or Matplotlib, you should use pandoc's attributes, as documented here.

  • Related