quarto-dev / quarto-cli

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

Extra dot in the number of the highest section heading in qmd docx #10441

Open phamdn opened 3 months ago

phamdn commented 3 months ago

Bug description

When using number-sections: true, qmd docx produces an extra dot after the number of the Heading 1, which does not occur in Rmd word_document

Steps to reproduce

In qmd

---
title: "Untitled"
format: 
  docx:
    number-sections: true
---

# Heading 1

## Heading 2

### Heading 3

and in Rmd

---
title: "Untitled"
output: 
  word_document:
    number_sections: true

---

# Heading 1

## Heading 2

### Heading 3

Expected behavior

1 Heading 1 1.1 Heading 2 1.1.1 Heading 3

Actual behavior

  1. Heading 1 1.1 Heading 2 1.1.1 Heading 3

Your environment

RStudio 2024.04.2 Windows 11

Quarto check output

Quarto 1.5.55
[>] 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.55
      Path: C:\Program Files\Quarto\bin
      CodePage: 65001

[>] Checking tools....................OK
      TinyTeX: v2024.01
      Chromium: (not installed)

[>] Checking LaTeX....................OK
      Using: TinyTex
      Path: 
      Version: 2023

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

[>] Checking Python 3 installation....(None)

      Unable to locate an installed version of Python 3.
      Install Python 3 from https://www.python.org/downloads/

[>] Checking R installation...........OK
      Version: 4.3.3
      Path: C:/PROGRA~1/R/R-4.3.3
      LibPaths:
        - C:/win-library
        - C:/Program Files/R/R-4.3.3/library
      knitr: 1.48
      rmarkdown: 2.27

[>] Checking Knitr engine render......OK
mcanouil commented 3 months ago

Thanks for the report.

Note that what Rmarkdown does is not relevant. Quarto is not Rmarkdown and has made several design/style choices different from Rmarkdown.

This being said, indeed the level one headings get a trailing dot after the number while the other headings don't.

mcanouil commented 3 months ago

The trailing dot is Quarto's doing.

InputOutput
````sh echo "# Heading 1a ## Heading 2 ### Heading 3 # Heading 1b" > index.qmd quarto pandoc --from markdown --to docx --number-sections index.qmd -o index.docx ```` image
````sh echo "# Heading 1a ## Heading 2 ### Heading 3 # Heading 1b" > index.qmd quarto render index.qmd --to docx --number-sections -o index.docx ```` image
KilianSander commented 1 month ago

Apart from manually removing the trailing dot in docx, is there any other way to deal with this?