pandoc-crossref icon indicating copy to clipboard operation
pandoc-crossref copied to clipboard

Sequential Numbering of Figures and Tables Ignoring Chapter in DOCX

Open Mingzefei opened this issue 1 year ago • 0 comments
trafficstars

Hello,

I am trying to convert a LaTeX document to DOCX using pandoc and pandoc-crossref, but I am encountering issues with the numbering format for figures and tables in the resulting DOCX file. My goal is to have sequential numbering (e.g., Fig. 1, Fig. 2, etc.) for figures and tables throughout the document, ignoring chapter numbers. However, despite trying multiple approaches, the output I get in the DOCX file still includes chapter numbers, like Fig. 2.1 and Tab. 2.1.

Here are the methods I have tried so far according to pandoc-crossref/#customization:

0. Based Conversion Command

pandoc \
    ./main_modified.tex \
    -o ./out.docx \
    --filter pandoc-crossref \
    --number-sections \
    -M autoEqnLabels \
    -M tableEqns \
    -M reference-section-title=Reference \
    --bibliography=../ref.bib \
    --citeproc \
    -t docx+native_numbering

Result: Fig. 2.1 and Tab. 2.1.

1. Tried chapters=false

pandoc \
    ./main_modified.tex \
    -o ./out1.docx \
    --filter pandoc-crossref \
    --number-sections \
    -M autoEqnLabels \
    -M tableEqns \
    -M reference-section-title=Reference \
    -M chapters=false \
    --top-level-division=section \
    --bibliography=../ref.bib \
    --citeproc \
    -t docx+native_numbering

Result: Still Fig. 2.1.

2. Tried chaptersDepth=0

pandoc \
    ./main_modified.tex \
    -o ./out2.docx \
    --filter pandoc-crossref \
    --number-sections \
    -M autoEqnLabels \
    -M tableEqns \
    -M reference-section-title=Reference \
    -M chaptersDepth=0 \
    --bibliography=../ref.bib \
    --citeproc \
    -t docx+native_numbering

Result: Still Fig. 2.1.

3. Tried sectionsDepth=-1

pandoc \
    ./main_modified.tex \
    -o ./out3.docx \
    --filter pandoc-crossref \
    --number-sections \
    -M autoEqnLabels \
    -M tableEqns \
    -M reference-section-title=Reference \
    -M sectionsDepth=-1 \
    --bibliography=../ref.bib \
    --citeproc \
    -t docx+native_numbering

Result: Still Fig. 2.1.

Version Information:

pandoc-crossref v0.3.18.0 git commit UNKNOWN (UNKNOWN) built with Pandoc v3.5, pandoc-types v1.23.1 and GHC 9.6.6
pandoc 3.5
Features: +server +lua

I have tried adjusting the metadata options (e.g., chapters=false, chaptersDepth=0, and sectionsDepth=-1) to no avail. Despite these efforts, the figure and table references in the DOCX output still include chapter numbers.

Could you please advise on how I can configure the conversion to use sequential numbering for figures and tables, ignoring chapters?

Thank you!

Mingzefei avatar Oct 19 '24 02:10 Mingzefei