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

format: docx will double up autonumbering in headings if number-sections: true is supplied in YAML and the reference-doc includes numbering. #12095

Open
charliejhadley opened this issue Feb 15, 2025 · 6 comments
Labels
bug Something isn't working docx Issues with the docx format

Comments

@charliejhadley
Copy link

Bug description

Hello Quarto devs! Thanks for the ambitious project - it's very impressive.

I'll leave this up to you if you count this as a bug or expected behaviour. When combining number-sections: true with a reference-doc with numbering included it'll double up the numbers.

Image

Steps to reproduce

Reprex making use of the attached reference doc

custom-reference-doc.docx

---
title: "Untitled"
format: 
  docx:
    reference-doc: custom-reference-doc.docx
number-sections: true
---

# First heading

# Second heading

## Subheading


---

Actual behavior

Image

Expected behavior

Image

Your environment

  • IDE: Visual Studio
  • OS: macOS 14.4 (23E214)

Quarto check output

Quarto 1.6.40
[✓] Checking environment information...
Quarto cache location: /home/vscode/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.4.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.46.3: OK
Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.6.40
Path: /opt/quarto/bin

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

[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /home/vscode/.TinyTeX/bin/x86_64-linux
Version: 2024

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

[✓] Checking Python 3 installation....OK
Version: 3.13.1
Path: /usr/local/bin/python3
Jupyter: 5.7.2
Kernels: python3

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

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

  Unable to locate an installed version of R.
  Install R from https://cloud.r-project.org/
@charliejhadley charliejhadley added the bug Something isn't working label Feb 15, 2025
@mcanouil
Copy link
Collaborator

Thank for the report.

I would say there is no bug here.

Quarto does not use the styles from the reference document to number section.
The option works exactly as intended in the intended context.

To avoid this behaviour, this would require a complete rework of how numbering works.

Note that you would get the exact same thing using Pandoc directly:

quarto pandoc --from markdown --to docx -o document.docx --number-section --reference-doc custom-reference-doc.docx document.qmd
Image

@mcanouil mcanouil added the docx Issues with the docx format label Feb 15, 2025
@charliejhadley
Copy link
Author

That makes perfect sense - thanks for taking the time to reply! I'm going to close :)

@mcanouil
Copy link
Collaborator

I'm reopening because the maintainers might see this as an enhancement to make

@cderv
Copy link
Collaborator

cderv commented Feb 18, 2025

Thank @mcanouil.

I don't think we can do something about this. Also because pandoc itself does not handle this differently.

number-sections: true should not be used with reference doc that already set number in their heading styles.

Unfortunately I don't see what enhancement we could do, especially with custom reference doc... 🤔

@mcanouil
Copy link
Collaborator

The style is likely controlled somehow in OpenXML, I'm guessing using OpenXML to set numbering instead of hardcoding it could be the enhancement, but it could be on Pandoc side.
The major hiccup is the deep expertise in OpenXML required. Unfortunately, Word and PowerPoint do not share the same OpenXML markups for many things as I discovered with simple text styling.
So, it would be a huge endeavour in my opinion.

@cderv
Copy link
Collaborator

cderv commented Feb 18, 2025

I agree that if this was done, it should probably be upstream in Pandoc anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docx Issues with the docx format
Projects
None yet
Development

No branches or pull requests

3 participants