Ordinal Numbering of Chapers

Auto-number tags allow me to automatically number my chapers. In English, formats such as “Chaper One” are common. In German, the common format (translated) is “First Chapter”. Unfortunately the current auto-number tags – as far as I understand them – do not allow me to automatically insert the word for an ordinal number (e.g. “first”). This would be a great enhancement in a future edition of Scrivener.

Thank you for this wonderful software!


I agree it would be a nice addition, but unfortunately there’s no real way of adding this that, or at least no way that wouldn’t involve a lot of time and work. Currently, Scrivener just calls on Apple’s NSNumberFormatter class, which provides a “spelled-out style” option. So, for instance, take these three lines of code:

NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle:NSNumberFormatterSpellOutStyle];
NSLog (@"%@", [numberFormatter numberWithInteger:2])"

These will print out “two” in English or “zwei” in German. This is because Apple has set up this “number formatter” class so that it can take any number as an input and output it as a word - “one hundred and three” and so on - in a number of languages.

Unfortunately, this NSNumberFormatter class has no support for ordinals (I have just double-checked this). This means that the only way I could implement it is by writing my own support for it, would be a rather large job. It would have to be able to construct any number (“First”, “Four hundred and twenty-second”, “Seven million, two hundred and twenty-four thousand, nine hundred and seventy-sixth” and so on), and it would have to be able to do this in several languages.

Here’s a way you could probably implement it for yourself, though:

  1. For the title prefix, add something like {ord:<$n>}

  2. In Compile’s “Replacements” pane, add replacements such as:
    {ord:1} > First
    {ord:2} > Second
    {ord:3} > Third
    And so on. You would only need to enter as many ordinal numbers as you are likely to have chapters - fifty or so to be sure, maybe.

Then you could save this Compile format for use with other projects. And you can copy and paste the list from the “Replacements” pane into other projects. So you’d only need to do this once.

Thanks for the kind words, by the way!

All the best,

Nice! Thank you :slight_smile: I’ll do that.

I came a cross this very old post because I am trying to solve a similar problem. But I cannot seem to get this method to work. Should this still work as prescribed above in Scrivener 3 on macOS? The result I get when I try is that the numbering stream processes, as you would expect, but the replacement does not. Appreciate any advice/recommendations. Thank you.

It looks like the compile process has changed so that the replacements happens before placeholder tags are converted into such things as digits or words for those numbers. It’s handy for creating your own “fake” placeholders that may be more aesthetically pleasing in the text itself, and then replacing them with real placeholders before they’re expanded. Unfortunately, it means that this work-around won’t function in Scrivener 3.