quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.77k stars 308 forks source link

Image Height Issue in Column Layout Div #7438

Closed ollyhensby closed 10 months ago

ollyhensby commented 10 months ago

Bug description

Image height is not applied when using an image within column layout.

Steps to reproduce

Here is a zip folder containing document.md, document.pdf, and images which demonstrates the issue:

quarto-cli-height-issue.zip

Within the markdown, setting

![Another radiator](images/radiator-2.jpg){height=30mm}

sets the height correctly when rendering to PDF.

However, trying to set the height when within a column layout does not work.

::: {layout-ncol=2}
![Another radiator](images/radiator-2.jpg){height=30mm}

![Look at that, another radiator!](images/radiator-3.jpg){height=10mm}
:::

This behaviour can be seen in the rendered PDF.

Expected behavior

I expect the heights of the images to be adjusted appropriately based on the height value passed

Actual behavior

Currently the image height is not changed within a layout column div.

Your environment

Quarto check output

[✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.1: OK Dart Sass version 1.58.3: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.3.450 Path: /home/jovyan/mambaforge/envs/quarto-resource-path-issue/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK Version: 3.8.10 Path: /usr/bin/python3 Jupyter: (None)

  Jupyter is not available in this Python installation.
  Install with python3 -m pip install jupyter

[✓] Checking R installation...........(None)

  Unable to locate an installed version of R.
  Install R from https://cloud.r-project.org/
mcanouil commented 10 months ago

Thanks for the report.

Could you provide the reproducible example as plain text? (and use online images in it)

You can share a Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four ````).

````qmd
---
title: "Reproducible Quarto Document"
format: html
---

This is a reproducible Quarto document using `format: html`.
It is written in Markdown and contains embedded R code.
When you run the code, it will produce a plot.

```{r}
plot(cars)

The end.

ollyhensby commented 10 months ago

@mcanouil Thanks for the quick reply!

As requested:

---
title: Image Height Issue in Column Layout
author: Oliver Hensby
format:
    pdf:
        pdf-engine: xelatex
---

## Some Images

![A flower](https://www.gstatic.com/webp/gallery3/1_webp_ll.png){height=30mm}

![A penguin](https://www.gstatic.com/webp/gallery3/2_webp_a.png){height=10mm}

::: {layout-ncol=2}
![A flower](https://www.gstatic.com/webp/gallery3/1_webp_ll.png){height=30mm}

![A penguin](https://www.gstatic.com/webp/gallery3/2_webp_a.png){height=10mm}
:::

PDF Output:

image image

The first page shows the images on their own. The second page shows the images within a layout column div.

cscheid commented 10 months ago

This has been fixed on 1.4 prereleases:

image
ollyhensby commented 10 months ago

Perfect, thank you!

ollyhensby commented 10 months ago

@cscheid, which pre-release are you running to compile this successfully?

I installed the latest pre-release and tried to run the above and got the following error:

ERROR: 
compilation failed- error
LaTeX Error: Not in outer par mode.
mcanouil commented 10 months ago

Did you try 1.4.466?

ollyhensby commented 10 months ago

I tried with 1.4.458 but I shall try 1.4.466 now and let you know.

ollyhensby commented 10 months ago

@mcanouil, that resolved the issue for me:

image

Thank you for resolving this so quickly!