Auto-Numbering Help

I have a Scrivener file with defined headings.
I’d like to compile to Word such that the headings are numbered in the following fashion:

  1. Heading One
    1.1 This is heading two.
    1.1.1 This is a paragraph.

Autonumbering (insert autonumbering only deletes text) is pretty opaque. How can I accomplish this.

The project is short enough so that I could convert it to Markdown.

Or export the whole thing to text and then run it through LaTeX.

Ideas?

You will have to use styles for all of these elements (including paragraphs).

image

These above placeholders go in the Paragraph’s prefix (styles panel - compile format) :

Don’t forget to have a space at the end of your placeholders sequence, so that the numbering is detached from the paragraph’s first letter.

. . . . . . . .

image

This above will reset your HEADING ONE to “1” at the beginning of each new documents :

Make sure to add it as a suffix for all the needed layouts (top section of the above screenshot).
. . . . . .

For more details, refer to the placeholders list.
It should be somewhere under the help menu (that’s where it is in the Windows version.)

<$n:stringname> inserts the value of the string’s “n” incremented by 1.
<$n#stringname> inserts the current value of the string’s “n”, without incrementing it.

. . . . .

You should get this :
Whether the HEADING is all caps or not is up to you. It has nothing to do with the placeholder here.

  1. HEADING
    1.1 Heading two
    1.1.1 Paragraph
    1.1.2 Paragraph
    1.2 Heading two
    1.2.1 Paragraph
  2. HEADING
    2.1 Heading two
    2.1.1 Paragraph
    2.2 Heading two
    2.2.1 Paragraph

=Next document=

  1. HEADING
    1.1 Heading two
    1.1.1 Paragraph
    1.1.2 Paragraph
    etc

. . . . . .
You can also skip a HeadingTwo if you don’t need it, paragraphs will still reset to “1”, as I have included <$rst_PARA> in both places. (HEADING and HeadingTwo)

. . . . . .
If you don’t want your HeadingOne to reset between documents and keep incrementing throughout the compiled output, just don’t reset it in the layout’s suffix at all.

. . . . . .
Note that the indents have to be set in the editor and saved within the styles. (You can also further tweak them in the style’s panel of your compile format, though. ← So that you get what you want once compiled, but that it doesn’t look like a mess in the editor, the numbering not being in yet, waiting to be inserted at compile.)
And (and this is important) you need to take into account that the numbering (generated by the placeholders) is part of the paragraph. Meaning that to make it look clean, you’ll have to take into account the space it occupies on the first line of your paragraphs, and adjust this indent below, so that the paragraph looks like a “clean block”.
image

You can see in the above screenshot that it looks like the indent is all wrong, but, once the numbering from the placeholder is inserted, it should line up.
. . . . . .

This should work. :crossed_fingers:
(I am only 98% sure – or 2% insecure today ; depends on how you look at it, I guess.
I had a hard time designing this post, as the editing count shows… My apology if I made a mistake somewhere – someone will call it out if that is the case, and that is alright.)

. . . . . . .
P.S. If you don’t want to do it using styles, you can do it in the editor instead, but you will have to insert the right sequence of placeholders and resets everywhere it is needed.
The only good reason I can see to do it like that would be in the case where you’d have a few consecutive paragraphs that you wish to be only numbered once and be treated as a single text unit.
Still, using a different style in this case for paragraphs that should not be numbered (and have their indent tuned accordingly) would be way more convenient.
It all depends then on how much of a cue of what is “going to happen” you wish to visually get from the editor.

If this only concerns parts of your work, I’d recommend then using styles only where needed. Keep things simple (use “no style” for your body text), and only use styles where you need the numbering to kick in.

. . . . . .
P.S.2 The other options you mentioned in your original post might be just as good. I don’t know. I use neither Markdown or LaTex.

1 Like

So the placeholder text for Heading 1 is:

<$n:heading><$rst_HEADINGTWO><$rst_PARA>

?

Why HEADINGTWO?

and for Heading 2:

<$n#heading>.<$n#headingtwo><$rst_PARA>

?

Did you mean to put a period in the second example?

Looks right. (Except that it is missing a period at the end (or after the first placeholder), if you want to stick to what you asked for in your original post. (I made a mistake in my previous post as regard to that, when I gave an example of what you should get.) – On the other hand, note that you don’t have a period at the end of the numbering of subheadings and paragraphs, which is somewhat inconsistent.)
I would personally leave the period out for the main header.
. . . .

Name it what you want, as long as your subheading has a string/stream of its own, with a unique name.
You named it as such:

. . . . .

No.
→ <$n#heading>.<$n:headingtwo><$rst_PARA> ←
as in :
< heading as its count (n) currently is>.<subheading’s n+1><reset paragraph’s n>
“:” versus “#” makes the difference. → You have <$n#headingtwo> wrong.

. . . . . . .

Yes.
It is the period that, as per your original post, you say you want in :

My third “example” has 2 periods.

The <$rst_X> placeholders (the resets) are invisible post compile.

It’s worth noting that if all you need is 1., 1.1, 1.1.1. style heading numbering and no advanced capabilities surrounding that, such as building figure captions based off of them, that the <$hn> placeholder is all you need, at all levels.

This would presume that numbered “paragraphs” would be in the binder outline at that point, as they seem to be structural anyway.

But headers, sub-headers and paragraphs would all need to be split up into single documents each, right?

That is why I stated that structural paragraphs would need to be promoted to the binder level. The documentation for all of the placeholders is found in the Help menu:

[<$hn>, etc.] Gets replaced during the Compile process with hierarchical numbering based on the level of the document in which the placeholder occurs relative to the Draft folder or compile group (depending on the current compile settings). So occurrences of the <$hn> placeholder in the second document in the Draft folder may get replaced with the number “2”; occurrences of the placeholder in the third subdocument of the eighth document in the Draft folder may be replaced with “8.3”.

How can you put every single paragraph in a 30 page document in the Binder??

Then there will be headers with no text: you’d be composing in the Binder, not the Editor.

Could you post an example?

Right.
Except for the paragraphs. You would have to set the paragraphs documents to compile without a title (set the placeholder elsewhere than in the binder itself, or <$hn> be their sole title (with a space)), composing the paragraph itself in the editor.

image
That is a very rough example.

I think that this would be how. (Not sure if the chapters documents – if you have any, and that would be intended not to take part in the numbering – would create an issue…)

If you use that approach, you’ll be able to see your text as a whole in a scrivening.

I proposed the other way because of the numbered paragraphs by the way. So that, yes, you don’t end up with a load of tiny bits, and the issue of formatting the paragraphs with the lead-in numbering.