Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure captions not appearing in pptx output (Output format pptx does not currently support FloatRefTarget nodes) #8667

Closed
justinaskav opened this issue Feb 9, 2024 · 7 comments · Fixed by #10117
Assignees
Labels
bug Something isn't working crossref figures needs-discussion Issues that require a team-wide discussion before proceeding further pptx issue with pptx format regression Functionality that used to work but now is broken.
Milestone

Comments

@justinaskav
Copy link

justinaskav commented Feb 9, 2024

Bug description

Starting from 1.4.367, figure captions are not included in Powerpoint output.

When rendering, this warning is emitted:

WARNING (/Applications/quarto/share/filters/main.lua:20045) 
Emitting a placeholder FloatRefTarget
Output format pptx does not currently support FloatRefTarget nodes.

Until 1.4.366, the figure caption text was shown alongside the image.

Steps to reproduce

---
format: pptx
---

## Slide Title

The text "Figure Caption" is not shown in Powerpoint output.

![Figure Caption](./assets/existing-image.png){#fig-figure}

Expected behavior

The text "Figure Caption" is visible below the figure. This is the behaviour until 1.4.366.

Actual behavior

No text appears below the figure. Also, when rendering, a warning is emitted (shown in Bug Description part).

Your environment

  • IDE: NVIM v0.9.5
  • OS: MacOS Sonoma 14.3.1

Quarto check output

Quarto 1.5.9
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.9
      Path: /Applications/quarto/bin

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

[✓] Checking LaTeX....................OK
      Tex:  (not detected)

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

[✓] Checking Python 3 installation....OK
      Version: 3.10.13 (Conda)
      Path: /opt/homebrew/Caskroom/miniforge/base/bin/python
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with conda install jupyter

[✓] Checking R installation...........OK
      Version: 4.2.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/justinas/Library/R/arm64/4.2/library
        - /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library
      knitr: 1.42
      rmarkdown: 2.21

[✓] Checking Knitr engine render......OK
@justinaskav justinaskav added the bug Something isn't working label Feb 9, 2024
@cderv
Copy link
Collaborator

cderv commented Feb 9, 2024

Thanks for the report.

This is the results with 1.3.450
image

No caption in 1.4 and current 1.5
image

@cscheid I am surprised we missed this - is there a reason I am not seeing to have this change in behavior for Powerpoint with the new cross reference system ? Or just a missing piece ?

I understand this could be a cross ref limitation with powerpoint...

Related to

@cderv cderv added crossref figures powerpoint regression Functionality that used to work but now is broken. labels Feb 9, 2024
@cderv
Copy link
Collaborator

cderv commented Feb 9, 2024

@justinaskav to be clear, here by setting a id with a prefix like this #fig-, it triggers cross referencing system for figures. See https://quarto.org/docs/authoring/cross-references.html

Quarto is currently missing support for this in powerpoint (the issue here).

If no id with #fig is provided, a caption will be there.

@justinaskav
Copy link
Author

justinaskav commented Feb 12, 2024

@cderv thanks for the workaround!

@cderv cderv self-assigned this Feb 20, 2024
@cscheid cscheid added this to the v1.5 milestone Jun 5, 2024
@cscheid cscheid modified the milestones: v1.5, v1.6 Jun 17, 2024
@cderv
Copy link
Collaborator

cderv commented Jun 19, 2024

@cscheid I don't know how we could handle this, but I believe we should restore previous behavior for 1.5.

I was thinking we could do something rather rough like not trying to parse FloatRefTarget at all for formats we know won't handle it.

Something like

--- a/src/resources/filters/quarto-pre/parsefiguredivs.lua
+++ b/src/resources/filters/quarto-pre/parsefiguredivs.lua
@@ -356,6 +356,11 @@ function parse_floatreftargets()
     }), false
   end

+  -- Some formats does not support Float Targets reference
+  if _quarto.format.isPowerPointOutput() then
+    return {}
+  end
+
   return {
     traverse = "topdown",
     Figure = function(fig)

This would mean that no matter the identifier we would ignore the node for some formats like powerpoint. This would handle the Figure as a normal figure.

We could also try to detect ids to able to warn before even parsing them that FloatRefTarget are ignored, or ignoring formats in quarto.FloatRefTarget constructor somehow.

After all it seems we are doing some AST nodes processing to find FloatRefTarget when we know we won't be able to handle them later with add_renderer()

@cderv cderv added the needs-discussion Issues that require a team-wide discussion before proceeding further label Jun 19, 2024
@cscheid
Copy link
Collaborator

cscheid commented Jun 19, 2024

That's going to be really hard to do and regression prone this close to shipping.

@cscheid
Copy link
Collaborator

cscheid commented Jun 19, 2024

(I agree that we want to fix the regression.)

@cderv
Copy link
Collaborator

cderv commented Jun 19, 2024

That's going to be really hard to do and regression prone this close to shipping.

Do you think it is really regression prone if we managed to target only PowerPoint output , and even only Figure which is the reported issue ?

I am thinking we could do something quite scoped maybe.

We would need to fix for other formats probably and other types obviously but could do this later.

@mcanouil mcanouil added pptx issue with pptx format and removed powerpoint labels Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crossref figures needs-discussion Issues that require a team-wide discussion before proceeding further pptx issue with pptx format regression Functionality that used to work but now is broken.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants