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 inheriting master slide font settings #9896

Open
yonicd opened this issue Jun 20, 2024 · 7 comments
Open

Figure captions not inheriting master slide font settings #9896

yonicd opened this issue Jun 20, 2024 · 7 comments
Labels

Comments

@yonicd
Copy link

yonicd commented Jun 20, 2024

Explain the problem.

When pandoc renders a pptx from an md with a figure in it that has a caption, it does not use the font defined in the master slide template for the caption.

  • In this example in the repo I set the master slide fonts to Verdana and the subtitle comes out in Calibri.
  • This behavior is the same with tables and the tables captions
  • This behavior was initially posted in a quarto discussion and was diagnosed as a bug in pandoc and not quarto by the developers.
git clone [email protected]:yonicd/test_pandoc_pptx.git
pandoc test.md -o test.pptx --reference-doc=template.pptx

Pandoc version

pandoc --version
pandoc.exe 3.2
Features: +server +lua
Scripting engine: Lua 5.4
@yonicd yonicd added the bug label Jun 20, 2024
@jgm
Copy link
Owner

jgm commented Jun 20, 2024

Currently the caption is just added in a text box after the image. No special style is applied. I imagine Word does something else, perhaps attaching a style, but I'm not really familiar with pptx format so this would take a while to debug.

@yonisidi
Copy link

Do you mean here?

@jgm
Copy link
Owner

jgm commented Jun 21, 2024

That's a relevant data structure but that's not where the XML is being written.

The thing to figure out first would be what pandoc should be including in the XML in order to have these styled correctly. (I understand how styles work in docx, but I know nothing about pptx.) If we figure that out, I think changing the code should be relatively straightforward.

@yonisidi
Copy link

yonisidi commented Jun 21, 2024

So the original xml looks like this (after converting to zip and unarchiving the output pptx):

<p:txBody>
  <a:bodyPr/>
  <a:lstStyle/>
  <a:p>
    <a:pPr lvl="0" indent="0" marL="0" algn="ctr">
      <a:buNone/>
    </a:pPr>
    <a:r>
      <a:rPr/>
      <a:t>Image Caption</a:t>
    </a:r>
  </a:p>
</p:txBody>

Based on this SO answer it looks like it gives a roadmap on what is expected in openxml:

example solution

<p:txBody>
  <a:bodyPr/>
  <a:lstStyle/>
  <a:p>
    <a:pPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" lvl="0" indent="0" marL="0" algn="ctr">
      <a:buFont typeface="Arial" charset="0" pitchFamily="34" panose="020B0604020202020204"/>
    </a:pPr>
    <a:r>
      <a:rPr/>
      <a:t>Image Caption</a:t>
      <a:rPr lang="en-US" dirty="0" sz="900"/>
    </a:r>
  </a:p>
</p:txBody>

@jgm
Copy link
Owner

jgm commented Jun 21, 2024

This is just specifying a particular typeface and size directly. I thought the idea was to make this sensitive to some kind of global style?

@yonicd
Copy link
Author

yonicd commented Jun 21, 2024

Yes, you are correct. That is the intent.

@jgm
Copy link
Owner

jgm commented Jun 21, 2024

That's the part I don't know how to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants