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

ODT reference.odt does not contain TableCaption style #10053

Closed
iandol opened this issue Aug 4, 2024 · 3 comments
Closed

ODT reference.odt does not contain TableCaption style #10053

iandol opened this issue Aug 4, 2024 · 3 comments
Labels

Comments

@iandol
Copy link
Contributor

iandol commented Aug 4, 2024

Explain the problem.

When Pandoc has a table with a caption:

> pandoc -s -o out.odt

  Right     Left     Center     Default
-------     ------ ----------   -------
     12     12        12            12
    123     123       123          123
      1     1          1             1

Table:  Demonstration of simple table syntax.

Text
image

The ODT does not have a styled caption (it is Default Paragraph Style). The paragraph XML source is styled with TableCaption:

<text:p text:style-name="TableCaption">Demonstration of simple table syntax.</text:p>

…however this style is not present in the reference.odt — I checked in Pandoc V3.3

The fix is simple, add this named style. I attach a custom-reference.odt where this is done and using this reference the table caption is styled. Here is what I added:

image

This is the latest pandoc, generating using: pandoc -o custom-reference.odt --print-default-data-file reference.odt

custom-reference.odt

I edited custom-reference.odt using Libreoffice:

Version: 24.2.5.2 (AARCH64) / LibreOffice Community
Build ID: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59
CPU threads: 8; OS: macOS 14.6; UI render: Skia/Metal; VCL: osx
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: threaded

I can make this a pull request once I find where reference.odt is on github.

Pandoc version?
ε ➪ pandoc -v
pandoc 3.3
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /Users/ian/.local/share/pandoc
Copyright (C) 2006-2024 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

@iandol iandol added the bug label Aug 4, 2024
@iandol
Copy link
Contributor Author

iandol commented Aug 4, 2024

The added style in styles.xml in custom-reference.odt is this:

<style:style style:name="TableCaption" style:family="paragraph" style:parent-style-name="Caption"/>

So perhaps adding this line to https://github.com/jgm/pandoc/blob/main/data/odt/styles.xml is enough?

An alternative is to use the Table style which is the native table caption style name.

@jgm
Copy link
Owner

jgm commented Aug 4, 2024

Yes, that is the right place to add it.

@iandol
Copy link
Contributor Author

iandol commented Aug 7, 2024

Thanks for merging, Jon!

@iandol iandol closed this as completed Aug 7, 2024
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

2 participants