Indent the first line of each titled section

I need the fist line of each titled section to be indented. (I am using an edited form of the Manuscript Times project format when I compile.) How do I prevent those first lines from being un-indented?

Thanks for your help!

Terrible typo: The First line, not the fist line.

In the Compile Format settings (edit your Compile format), under “Section Layouts”, choose the “Section Text” section layout. Then select the “Settings” tab at the bottom and change “Paragraph first line indents” to “Do not change”.

All the best,

I’m trying to do this with an eBook compile for Kindle but I get no such option. The problem I’m having is that I’d prefer to remove indents ONLY after Chapter Titles. The “remove first line indents from paragraphs after headings” option exists in the Text Layout tab of the Format Editor, but it does not remove indents. The only option that seems to have any effect is the top option, “remove first line indents from all paragraphs following other elements”.

Could this be a bug? The functionality appears to be as simple as unchecking the ‘other elements’ option and checking the ‘after headings’ option, but doing this does not remove any indents at all, and neither does checking any of the subsequent options.

I should mention that I’m editing the Scene style, which defaults to Section Text. I have their enclosing folders designated as Chapter Headings, so that the first scene of every chapter follows a heading and should therefore have its indent removed. If I check ‘following other elements’, it does remove the indent but removes them for all subsequent scenes within that chapter as well. It seems to be either all or nothing.

The problem here is a bit of a clash of settings. Ebooks are all HTML and CSS. Scrivener provides a bunch of settings for ePub 3 and Kindle formats that are essentially just a UI window on the underlying CSS, so that users unfamiliar with CSS do not have to code all of that themselves. The option to remove indents after headings (with other indent options deselected) creates the following CSS:

p { margin: 0rem 0% 0rem 0rem; text-indent: 1.5rem; } h1 + p, h2 + p, h3 + p, h4 + p, h5 + p, h6 + p { text-indent: 0em; }

This CSS makes it so that any paragraph directly following a heading has its indent removed.

However, the way the “Ebook” Compile format is set up means that this won’t necessarily work for that format, because scene heading paragraphs will not directly follow heading paragraphs in the HTML even though it may look as though they do in the output - which is why it has “From all paragraphs following other elements” set. In particular:

  1. In the “Chapter Title” (and “Chapter Title (Bordered)”) Section Layouts, under “Title Options” > “Title Prefix”, there is a newline added after the “Chapter <$t:chapter>” prefix. This means that the first paragraph following the chapter heading is in fact a blank line, so it’s that paragraph that will have its first line indent removed according to the CSS, not the scene paragraph that follows it.

  2. The “Section Text” section layout is also set to have an empty line before it under “Separators” - this has the same effect as (1).

  3. Both “Section Text” and “Chapter Title” (and its bordered variant) have a “CSS Class Name” set under “Section Layouts” > Settings. This causes a

    block to be placed around these sections in the HTML, and this in turn also prevents the “h1 + p” CSS from working because these rules do not seem to work across div blocks.

To get the results you want, you could reverse all of the above - remove the CSS class names for “Section Text” and “Chapter Title” and remove any blank lines that appear between chapter titles and section text (via “Separators” and the title prefix for chapter titles).

There is probably an easier way using a little custom CSS, though, so I’ve asked Ioa, our resident CSS expert, to take a look at this post in case there is. (Those familiar with CSS can in fact ignore a lot of the settings and just work with the CSS directly. Alternatively you can use Scrivener’s settings and then append a little custom CSS to tweak things where needed, which is what the built-in “Ebook” format does.)

Ioa got back to me and here’s a simpler way of doing it:

  1. Under “Separators”, select “Section Text” and change “Separator before sections” to “Single return”.

  2. Under “CSS”, in the left “Custom Stylesheet” pane, paste the following at the bottom:

.chapter-title + .section p:first-child { text-indent: 0em; }

This will tell the HTML to remove indents from the first paragraph in a “Section Text” block that follows a “Chapter Title” block.

Alternatively, you can omit (1) above and simply:

  • Under “CSS”, in the left “Custom Stylesheet” pane, paste the following at the bottom:
.chapter-title + .separator + .section p:first-child {text-indent: 0em; }

This tells the HTML to remove indents from the first paragraph in a “Section Text” block that follows a separator that itself follows a “Chapter Title” block.

Unfortunately there is no good way to have Scrivener programmatically handle the almost infinite possible combinations of section layouts in the CSS.

All the best,

Wow, thank you for the thorough explanation. As I’m not terribly familiar with CSS, I did devise a workaround: I created a new section which I called Subsequent Scene and set my desired separators to occur before and between each. Then I turned on ‘remove indents following all elements’ for the Scene section, but I set the default sub-document types for all chapter folders to Subsequent Scene and then changed the first of each back to Scene. Worked a treat. Now the indents are removed only from the first paragraph of each chapter, and because the indents for Subsequent Scenes are left alone, it never removes indents after scene breaks within chapters. It’s a bit of a workaround but it gives the desired results.

One benefit to discovering this workaround is that it really gave me a baptism by fire regarding Scrivener 3’s compile options. I have to say that you’ve done some really marvellous work here, in the program as a whole, of course, but in Compile especially. Never have a been so impressed wrestling with a piece of software. In fact it wasn’t so much wrestling as exploring paths that wound up leading to destinations other than my desired one, but I emerged from the journey enriched.

And thanks for Ioa’s solution as well! I’ll employ that one in the future.

I’m glad you found a solution - that’s definitely another valid way of doing it if you aren’t likely to switch around your first scenes to become later scenes.

Many thanks for the kind words about Compile. Compile is one of the most difficult aspects of Scrivener to design and get right (hence it has been completely different in all three major versions as I’ve revised each iteration from what I’ve learned!), since it has to allow the user to create any number of formats from any binder structure. Thus there is a lot there, and some concepts - such as Section Layouts and Section Types - require a little learning to get the most out of it. So it’s great to hear that your exploration was fruitful.

All the best,