This is a great example of the power of the compiler. Without messing with the text in your project editor, you can create a compile format that will insert the scene numbering and paragraph numbering for the text, actually applying the style to the text in the compile format itself.
The attached project demonstrates a setup with scenes as individual documents inside chapter folders. The compile format uses the “Numbered Scene” layout to add “Scene N” to the start of each scene document using the named <$n:scene> placeholder and applies a “Numbered” paragraph style to the text of those documents. That style only exists in this compile format and is formatted in the Styles pane there. (Double-click the “Numbered Scenes & Paragraphs” compile format to edit it and see this.) You can create new compile styles using the + popup menu in the upper right of the Styles pane and choosing Paragraph Style.
For the numbering, I set the paragraph prefix as <$n#scene>-<$n:para>.
followed by a tab (inserted via Opt-Tab
). The first part refers back to the document’s scene number, so scene 2 paragraph 1 will be numbered 2-1. Paragraph numbering will restart with each new scene (handled by the <$rst_para>
placeholder in the title prefix of the Numbered Scene layout) but scene numbering always increments—you might prefer to have it restart at each chapter, in which case you could just add <$rst_scene>
somewhere in the chapter layout title prefix or suffix. We’re using the paragraph prefix for the style so that the numbering is added to the start of every paragraph within the range of the applied style—in this case the range spans the complete document text, so using the other prefix option would only add numbering to the initial paragraph.
To make the paragraph numbering readily visible, the Numbered style uses a half-inch hanging indent; the first tab stop is also at 0.5 inch so all the text left aligns.
So that’s the basic setup. This will not override paragraph styles already in use in the project, as you can see in the example project that uses the Heading 1 and Heading 2 styles in the first scene. These paragraphs aren’t numbered in the output, which in this case I think makes sense—if the numbering is for referencing paragraphs in a draft, title lines probably don’t need that and excluding them reduces clutter. But you may have paragraph styles in the editor that you do want numbered in compile, and that’s easily done by adding the style to the compile format’s Styles pane (select it from the + menu popup) and then copying and pasting the paragraph prefix from the Numbered style into the paragraph prefix of the other style. You may want to also adjust the formatting for the style.
ParagraphNumberingDemo.zip (154.3 KB)