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

Interrupted sequences generated in DOCX when using "Numbered example lists" #7895

Closed
mjfs opened this issue Feb 5, 2022 · 3 comments
Closed

Comments

@mjfs
Copy link
Contributor

mjfs commented Feb 5, 2022

Numbered example list is a great feature in markdown that enables single consistent numbering thought the document. A case where this is especially crucial is sequential paragraph numbering.

The downside of using "Numbered example lists" is that conversion to DOCX results in restarts of native numbering and unnecessary explicit re-entry of the next value whenever a sequence is interspersed with other content. For example:

#	Chapter 1

@a.  Example from paragraph 1 with some content

@a.  Example from paragraph 2 with some content

#	Chapter 2

@a.  Example from paragraph 3 with some content

@a.  Example from paragraph 4 with some content

@a.  Example from paragraph 5 with some content

Although the above paragraphs will get numbered sequentially (1., 2., 3., 4., 5.) in DOCX, the used sequence gets restarted when at "Example from paragraph 3...". At that point a new sequence is used and explicit value "3" in entered.

The downside of this sequence restarts is that it is extremely cumbersome to do any numbering modifications in DOCX (e.g. when a document is sent to a colleague that uses only Microsoft Word).

It would therefore be a real time-saver if Pandoc could follow intended use of numbering in DOCX and therefore reuse the same identifier when "Numbered example lists" are used i.e. <w:numId w:val="same_numeric_value"/> in word/document.xml from DOCX archive would have the same value in this case.

@jgm
Copy link
Owner

jgm commented Feb 5, 2022

Here's what I see when I open this with Word. What version of pandoc are you using and how are you viewing the document?

Screen Shot 2022-02-05 at 8 49 39 AM

@jgm
Copy link
Owner

jgm commented Feb 5, 2022

OK, I see the issue you're raising; if you add a new item after 2, the 3 in Chapter 2 isn't renumbered.

@mjfs
Copy link
Contributor Author

mjfs commented Feb 5, 2022

@jgm: Yes, the fact that automatic renumbering is disabled in this case is a one part of the problem, the other part is that anything else related to the numbering properties also needs to be repeated manually (or scripted) for each paragraph (e.g. numbering style, numbering type).

What makes this even worse is the fact that one can not simply select the next sequence in MS Word and choose to continue numbering (e.g. clicking on number 3. in your screenshot) since the numbering is not in the same group. One actually has to renumber all of sequences used in MS Word due to this issue.

A really clumsy workaround that I use in this case is an external filter (over word/document.xml file in DOCX archive) replacing all level 0 numbering of the same type that have different identifiers with the same identifier - a simplified version of this is attached bellow:

  • replacing <w:ilvl w:val="0"/><w:numId w:val="\d+"/> where \d+ is a regex example
  • with <w:ilvl w:val="0"/><w:numId w:val="1002"/> where 1002 is the number of the first relevant sequence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants