Paragraph numbering is reset in compiled docx document

I occasionally want to describe steps that my readers should follow. There is no numbered style in Scrivener so I have been using the bullets option. In Scrivener I see the numbers and when I compile to Word using Pandoc → Docx the numbers appear as expected.

Now I want to use images in between the numbered steps AND have the step numbers continue without being reset.

Two images will help to show what I see.

and

I used <Option> Return to get the space in Scrivener for the img reference and then the next paragraph after the image and caption still is numbered as 2. That’s what I want in the docx file. But in the compiled Word, the paragraph number is reset to 1.

Maybe this is a bug? Maybe I can do things in the compile settings to prevent the re-numbering?

Help appreciated.

If the numbers are correct in Scrivener, but incorrect in Word, you should have a look at Word’s settings. It may be “helpfully” “fixing” your numbering.

Are the numbers correct if you compile to PDF?

Thanks @kewms for offering a suggestion. The PDF compile DOES keep the numbers like I want. But my editor wants Word/docx. I can manually in Word say to continue the numbering for the paragraph after the image and it changes it to 2. BUT that’s a manual edit that would need to be done for every step number in such a split list. I am not aware of a preferences setting that I can change to remove this un-helpful intervention of resetting paragraph numbers. But maybe there is one??

Looking at the compiled docx file, the style for the numbered list paragraphs is named Compact. And I can edit this style but I don’t see a place to change the auto-numbering approach, or the resetting of such auto-numbers.

If I use the built-in Scrivener-to-docx compile option rather than the pandoc one I see the same numbering behavior but different use of styles in the compiled Word… The Word style for all paragraphs seems to be based on Normal except for the Caption style with this compile choice.

That would be a question for Microsoft support.

Another check would be to compile to RTF and open in TextEdit. That will confirm that Scrivener is (or isn’t) putting the correct numbers in the output document. If it is, then Scrivener has behaved as instructed.

1 Like

Don’t know what question I would ask Microsoft support to be honest. For the record, if I do RTF with attachments compile from Scrivener, the paragraph numbers are consecutive when I open in TextEdit. That file destination won’t fly with my editor: Word can’t open .rtfd files. For now, I will have to avoid writing paragraphs that would work best if I could interleave images and numbered paragraphs AND want a compiled docx that needs no re-working after opened in Word. sigh

I had a thought that if I ended the list before my non-list item, added the item like the graphic, and then started a new list but set the starting number to the next integer after the last step number in the previous list then after the compile the new list would start at my Scrivener list start. NO! – Word renumbers the following list back to 1. Double sigh Seems like this is both a Word and a Scrivener problem.

The choice of starting a numbered list at a number other than 1 is not working for me when I compile to docx using pandoc-> docx. Compiling to docx with a copy of the built-in compile settings for docx does work. I needed to add some replacements and setup hierarchical figure and chapter numbering in my compile settings copy but then the list auto-numbers are better behaved. Do I need to update my copy of pandoc that is called from Scrivener? I installed it some time ago but have not updated it.

What if you Compile to RTF and open the result in Word?

If it works, you’ve got what you need and have identified a bug in our DOCX converter.

If it fails, then the question for Microsoft support is “why does Word’s conversion from RTF to DOCX renumber lists?”

1 Like

Yes, compiling to RTF and opening the result in Word works – lists auto-number as expected. Compiling to docx using the builtin docx compile settings (not the Pandoc ones) also works. The Scrivener builtin Pandoc → docx compiler settings do NOT work. I had made some customizations there but they are immaterial to how lists auto-number. So the bug may lie in Pandoc rather than how Scrivener uses Pandoc.

As in most things like this, it is best to compile to “MultiMarkdown”, using the “Basic Pandoc” (yes, I know, that’s a bit confusing, legacy terminology) compile Format, and examine the .md file directly. Is the markup that Scrivener is generating here correct?

In my testing, I can create lists with images within them, however I am needing to use the alternate caption markup instead of styled text, owing to how what you’re trying to do here is a bit too complicated for the simple RTF engine. Markdown lists are way more powerful than it, and we try to do as much as we can with conversion, but there are limits. Having a paragraph style within single bullet element is impossible.

So what you want type into the editor is:

<$img:/your/file.png> [!fig(etc) Caption text goes here]

We are putting this all on one line (outside of lists, you could put the bracketed caption line directly below or above the image) to avoid confusing the list converter.

The other thing worth clarifying is that you mention using ⌥↩ to insert line breaks within your list elements, to add additional lines, but by default that isn’t a shortcut for anything, and puts a full carriage return into the document, thus breaking the list into two (and that’s why you get the continuation restarting at “1” most likely). The default shortcut is ⌥⌘↩.

Lastly, do keep in mind that you don’t always have to use Scrivener’s native list building tool, if what you’re trying to do does not work. That isn’t an all or nothing thing, you can predominantly use the list builder if you want, and only use direct Markdown where you need more.

This particular thing should work, but it’s something to keep in mind. As I said above, RTF lists are pretty simplistic compared to what Markdown lists can do. If you need more, use Markdown in the editor. That shouldn’t confuse anything.[1] One thing I can think of where this would be useful is list numbering continuation after a sequence of ordinary paragraphs or other elements. Pandoc does allow for that, but Scrivener’s simple list converter is not programmed to handle that scenario.


  1. Exception being if you are using full RTF conversion. Then you would need a style that is set up to “Treat as raw markup” in the compiler, so that the compiler can know to leave your text alone. ↩︎

1 Like

Thanks @AmberV for your thorough response. I will try these suggestions out. For now the direct docx compiler in Scrivener is working well enough. The ability to end a list, insert the supporting material like figures and code blocks, re-start the list at the next number after the ending number of the previous list works. If I get the docx to a point that it is clean enough to send to my editor without post processing I am good for now. This list restart behavior is broken in the Pandoc → docx compile flow. I can check the markdown results and see what the numbers look like there.

I don’t see that problem myself, unless maybe it’s a Word problem itself (I am opening the .docx file in LibreOffice and get continuation). Here is the Markdown I tested with:

1. Line one.
2. Line two.

A normal line. We could put images here too.

3. The list continues on line three.
4. Line four.

Of course that is different than what you want (I think), which would have the middle line technically a part of item line 2. Such would be accomplished in Markdown by indending the middle line with a tab, which Scrivener will do if you use line breaks inside of item line 2 to set this second line apart.

1. Line one.
2. Line two.

	A normal line. We could put images here too.

3. The list continues on line three.
4. Line four.
1 Like