quarto-dev / quarto-cli

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

Image added in column div is missing in Powerpoint presentation #10101

Open kernie opened 2 weeks ago

kernie commented 2 weeks ago

Bug description

Hello,

I have a document (full example with image is uploaded) like

---
title: "Some title"
author: "Somebody"
format: pptx
---

## Slide 1

::::: columns

::: {.column width="100%"}

No image appears
![Caption](image){}

:::

:::::

## Slide 2

Image appears

![Caption](image){}

and after rendering the image in the column of slide 1 is missing, while it is there in the next slide.

ImageMissing.zip

Steps to reproduce

Extract the ZIP and render.

Expected behavior

No response

Actual behavior

No response

Your environment

Linux Ubuntu 24.04

Quarto check output


Quarto 1.5.45
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.45
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /usr/local/texlive/2024/bin/x86_64-linux
      Version: 2024

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.3
      Path: /usr/bin/python3
      Jupyter: 5.3.2
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.3.3
      Path: /usr/lib/R
      LibPaths:
        - /home/id6945/R/x86_64-pc-linux-gnu-library/4.3
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.47
      rmarkdown: 2.27

[✓] Checking Knitr engine render......OK

``
mcanouil commented 2 weeks ago

edit: your content needs to match PowerPoint template layout.

  1. width is actually not supported by Pandoc thus Quarto (both documentation is not updated yet on that)
  2. there are no "one column" layout which is possibly the issue as Pandoc tries to fit the content in one of the layout.
Outdated. Could you share a **small self-contained "working" (reproducible)** example to work with, _i.e._, a complete Quarto document or a Git repository? The goal is to make it as easy as possible for us to recreate your problem so that we can fix it: please help us help you! Thanks. This being said, --- You can share a **self-contained "working" (reproducible)** Quarto document using the following syntax, _i.e._, using more backticks than you have in your document (usually four ` ```` `). See . If you have multiple files (and if it is **absolutely required** to have multiple files), please share as a Git repository.
RPython
`````md ````qmd --- title: "Reproducible Quarto Document" format: html engine: knitr --- This is a reproducible Quarto document. {{< lipsum 1 >}} ```{r} x <- c(1, 2, 3, 4, 5) y <- c(1, 4, 9, 16, 25) plot(x, y) ``` ![An image]({{< placeholder 600 400 >}}){#fig-placeholder} {{< lipsum 1 >}} The end after @fig-placeholder. ```` ````` `````md ````qmd --- title: "Reproducible Quarto Document" format: html engine: jupyter --- This is a reproducible Quarto document. {{< lipsum 1 >}} ```{python} import matplotlib.pyplot as plt x = [1, 2, 3, 4, 5] y = [1, 4, 9, 16, 25] plt.plot(x, y) plt.show() ``` ![An image]({{< placeholder 600 400 >}}){#fig-placeholder} {{< lipsum 1 >}} The end after @fig-placeholder. ```` `````
Additionally and if not already given, please share the output of `quarto check` within a code blocks (*i.e.*, using three backticks ` ```txt `), see .
mcanouil commented 2 weeks ago

Beside the fact that a "one column" layout does not exist, the issue comes directly from Pandoc. Note that the "workaround" is to not use column at all if you don't intend to have columns.

## Slide

:::: {.columns}
::: {.column}
whatever 

![An image](https://placehold.co/600x400.png)
:::
::::
pandoc issue10101.md --from markdown --to pptx -o issue10101.pptx
mcanouil commented 2 weeks ago

Out of curiosity what were you trying to do?

kernie commented 2 weeks ago

It doesn't work for 2 either... So I tried to have 2 columns, left column with text and right one with image, which is a classical (boring) presentation layout...

23.06.2024 00:13:26 Mickaël Canouil @.***>:

Out of curiosity what were you trying to do?

— Reply to this email directly, view it on GitHub[https://github.com/quarto-dev/quarto-cli/issues/10101#issuecomment-2184210770], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AFR5ZF2JACB3FI7EMUWPUTDZIXZH7AVCNFSM6AAAAABJXU2EWKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBUGIYTANZXGA]. You are receiving this because you authored the thread. [Verfolgungsbild][https://github.com/notifications/beacon/AFR5ZF57GS76QTMJHOZTZQDZIXZH7A5CNFSM6AAAAABJXU2EWKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUCGBUVE.gif]

mcanouil commented 2 weeks ago

What does not work exactly?

InputOutput
````qmd --- title: "Quarto Playground" format: pptx --- ## Slide :::: {.columns} ::: {.column} ![An image]({{< placeholder 600 400 >}}) ::: ::: {.column} ![An image]({{< placeholder 600 400 >}}) ::: :::: ```` image
````qmd --- title: "Quarto Playground" format: pptx --- ## Slide :::: {.columns} ::: {.column} Text ::: ::: {.column} ![An image]({{< placeholder 600 400 >}}) ::: :::: ```` image
````qmd --- title: "Quarto Playground" format: pptx --- ## Slide :::: {.columns} ::: {.column} ![An image]({{< placeholder 600 400 >}}) ::: :::: ```` image
kernie commented 2 weeks ago

After comparing your source code and mine I saw that I had an error in the class specifier (missing dot). That's my bad! And thank you very much for your analysis!

Some observation however:

EDIT: Sorry, you mentioned this already! So closing...

mcanouil commented 2 weeks ago

Even if the single-column layout is unnecessary, I think it should still work correctly. So we should report this to Pandoc, thus reopening.

mcanouil commented 1 week ago

I opened an issue upstream:

cderv commented 1 week ago

BTW as explained in Powerpoint, there s Slide Layout detection in PPTX by pandoc system. https://quarto.org/docs/presentations/powerpoint.html#slide-layouts

Some layout are two columns content and you don't need to use .columns to activate it.

---
title: test
format: pptx
---

## Slide

Text content 

![An image](https://placehold.co/600x400.png)

image

Though, funny thing (or not...) using two images only keep one image 😓

---
title: test
format: pptx
---

## Slide

![An image 1](https://placehold.co/400x400.png)

![An image 2](https://placehold.co/600x400.png)

image

Which is probably a pandoc bug

quarto pandoc --to pptx -o test.pptx test.qmd

gives the same...

related to the issue you opened ? 🤷‍♂️

mcanouil commented 1 week ago

I would say you found another bug which might be related but not sure.

It seems from the screenshot that the two images are stacked on top of each other.

cderv commented 1 week ago

It seems from the screenshot that the two images are stacked on top of each other.

Oh I did not thing of that! Looking at the xml would tell us. I see...

Not easy one. I would say I would expect the Two column layout to be active in this case but it explicitly required columns indeed

Two Content This layout is used for two-column slides, i.e. slides containing a div with class columns which contains at least two divs with class column.

So not sure it is a bug... Just silently doing what the doc is saying... 😓

mcanouil commented 1 week ago

No need to go look at the xml^^

https://github.com/quarto-dev/quarto-cli/assets/8896044/a54bef5e-f698-4665-b1a1-9b3e449869b1

(The "2" in the caption was weird in your screenshot)

cderv commented 4 days ago

Good catch !