Open gitopandi opened 2 years ago
Hi Andreas,
I have made some small tweaks to the Crossref project, and updated the repo with a newer zip file. but I don't think this will change your observed behaviour.
![caption][ref link]
to define the figure. This is valid pandoc markdown (and is also part of the original markdown spec, and commonmark too), so I'm somewhat confused why Typora doesn't support this? I've never used it (I use VSCode to edit markdown if I need to), so I don't know what flavour of markdown it supports…pandoc-crossref
doesn't generate native figure numbers, I made an issue on this but the developer does not want to add output-specific code: https://github.com/lierdakil/pandoc-crossref/issues/299 - another crossref plugin has a similar request and a bit more progress: https://github.com/tomduck/pandoc-fignos/issues/34 — one thing to look out for is that Quarto https://quarto.org has built a new cross referencing filter for pandoc which may or may not generate native figure numbering on Word… Note if you use LaTeX then lists of figures etc. works fine.Hi Ian,
After a while I'm back to writing. Thanks al lot for you answers and infos. I solved the issue with the figures and understood what my wrong thought was.
If I have more time I will have a look to quarto. In the mean time i use a PDF to Word converter. With a few manual corrections, the word doc is O.K.
@gitopandi — By the way, I just checked Quarto does not [yet] support native Figure labels for DOCX. BUT I noticed at least in the most recent Word you can build the list-of-figures (LOF) based on styles and each figure caption has the style "Image Caption" so you can the LOF.
I am very surprised a PDF > DOCX converter produces better output than Pandoc?
@iandol Could you provide the openxml lines to create the LOF based on style?
Is the magic in here: <w:instrText xml:space=\"preserve\"> TOC \h \z \u </w:instrText>
?
OK, found it: TOC \h \z \t "Image Caption" \c
would provide everything of style "Image Caption". Thanks for mentioning this possibility!
@iusgit -- great, for tables I would assume it would be TOC \h \z \t "Table Caption" \c
. I'd made a test docx but it seems you got there first.
I assume that a Lua filter could insert this into the DOCX to allow lof
to work with DOCX while we wait for Quarto, pandoc-crossref and others to update to utilise native numbering...
Correct, tables work as you say.
I am very surprised a PDF > DOCX converter produces better output than Pandoc?
It was as you think. Pandoc was the best option 😄
An example of injecting a TOC and LOF manually into a docx:
---
title: hello
author: Jane Doe
---
```{=openxml}
<w:sdt>
<w:sdtPr><w:docPartObj><w:docPartGallery w:val="Table of Contents" /><w:docPartUnique /></w:docPartObj></w:sdtPr>
<w:sdtContent>
<w:p><w:pPr><w:pStyle w:val="TOCHeading" /></w:pPr><w:r><w:t xml:space="preserve">Table of Contents</w:t></w:r></w:p>
<w:p><w:r><w:fldChar w:fldCharType="begin" w:dirty="true" />
<w:instrText xml:space="preserve">TOC \o "1-3" \h \z \u</w:instrText>
<w:fldChar w:fldCharType="separate" /><w:fldChar w:fldCharType="end" /></w:r></w:p>
</w:sdtContent>
</w:sdt>
<w:sdt>
<w:sdtPr><w:docPartObj><w:docPartGallery w:val="Table of Figures" /><w:docPartUnique /></w:docPartObj></w:sdtPr>
<w:sdtContent>
<w:p><w:pPr><w:pStyle w:val="TOCHeading" /></w:pPr><w:r><w:t xml:space="preserve">Table of Figures</w:t></w:r></w:p>
<w:p><w:r><w:fldChar w:fldCharType="begin" w:dirty="true" />
<w:instrText xml:space="preserve">TOC \h \z \t "Image Caption" \c</w:instrText>
<w:fldChar w:fldCharType="separate" /><w:fldChar w:fldCharType="end" /></w:r></w:p>
</w:sdtContent>
</w:sdt>
Blah
Blah
@iandol can you fix your example with the changes mentioned here: https://github.com/quarto-dev/quarto-cli/discussions/2464#discussioncomment-10131723 ?
It is also important to link to the pandoc issue regarding lof and lot in docx: https://github.com/jgm/pandoc/issues/8245
Hi,
I used you crossref examplae, because I'm switching from pure Markdown with Typora as my editor back to Scrivener. Your setup works fine, but I have issue with figures and tables:
Any help is appreciated and thanks very much for your work during the last years
Andreas