Possible bug in "text layout" settings during compile

I am trying to compile a book for ePub (windows 10, latest scriv 3) using default Epub 3 copied to My Projects so I can edit it.

I want only the first line to not be indented in a chapter, and not any paragraphs later on if they come after blank lines (it currently removes the indent of a paragraph if it comes after a blank line) I wanted to make this change in compile not by using styles. (I currently have “no styles” set for most text in the scriv editor chapters).

I am using “Section with Titles” for my chapters (Scriv scenes) and I have changed nothing else other than add Front and Back Matter. I thought I could use Text Layout to fix the formatting how I need it.

In the compile window editor in “Text Layout” I uncheck “From All Paragraphs Following Other Elements” and it compiles okay.
I then uncheck “From Paragraphs After Blank Lines” and that compiles okay.

Then I check “From First Regular Paragraph in each Chapter” and the formatting goes weird with huge text.

I am not sure what else is being impacted, but when looking at the HTML in Sigil I see the following in the CSS:

This before checking “From First Regular Paragraph in each Chapter”:

/* Direct formatting styles */
.ps1 {font-family: 'GaramondNo8'; font-size: 1.00rem; margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps2 {font-family: 'GaramondNo8'; font-size: 4.00rem; margin-left: 0rem; text-align: center; text-indent: 0rem}

and this after:

/* Direct formatting styles */
.ps1 { text-indent: 0rem; }

/* Direct formatting styles */
.ps1 {font-family: 'GaramondNo8'; font-size: 4.00rem; margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps2 {font-family: 'GaramondNo8'; font-size: 1.00rem; margin-left: 0rem; text-indent: 0rem}

So I now have huge text for the first paragraph.

There are also impacts on all other pages including the title page where all the spacing has changed between lines.

Is this a bug or am I misunderstanding the use of this “From First Regular Paragraph in each Chapter” option in “Text Layout”?

EDIT: I just spotted some other things it changes in the styles :

This is before I check "From First Regular Paragraph In Each Chapter:

/* Direct formatting styles */
.ps1 {font-family: 'GaramondNo8'; font-size: 1.00rem; margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps2 {font-family: 'GaramondNo8'; font-size: 4.00rem; margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps3 {font-family: 'GaramondNo8'; font-size: 1.00rem; margin-left: 0rem; text-indent: 0rem}
.ps4 {font-family: 'GaramondNo8'; font-size: 1.50rem; margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps5 {margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps6 {font-family: 'GaramondNo8'; font-size: 1.00rem; margin-bottom: 0.83rem; margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps7 {margin-left: 0rem; text-indent: 1.50rem}
.ps8 {font-family: 'Cambria'; font-size: 1.00rem; margin-left: 0rem; text-indent: 1.50rem}
.ps9 {margin-left: 0rem; text-align: center; text-indent: 1.50rem}
.ps10 {font-family: 'Cambria'; font-size: 1.00rem; font-style: italic; margin-left: 0rem; text-align: center; text-indent: 1.50rem}
.ps11 {margin-left: 0rem; text-indent: 0rem}
.ps12 {font-family: 'Cambria'; font-size: 1.00rem; font-style: italic; margin-left: 0rem; text-indent: 1.50rem}
.ps13 {font-family: 'GaramondNo8'; font-size: 1.00rem; font-style: italic; margin-bottom: 0.83rem; margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps14 {font-family: 'GaramondNo8'; font-size: 1.00rem; margin-left: 0rem; text-indent: 3.00rem}
.ps15 {font-family: 'GaramondNo8'; font-size: 1.00rem; font-style: italic; margin-left: 0rem; text-indent: 3.00rem}

and this is after I check it:

/* Direct formatting styles */
.ps1 {font-family: 'GaramondNo8'; font-size: 4.00rem; margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps2 {font-family: 'GaramondNo8'; font-size: 1.00rem; margin-left: 0rem; text-indent: 0rem}
.ps3 {font-family: 'GaramondNo8'; font-size: 1.50rem; margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps4 {margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps5 {font-family: 'GaramondNo8'; font-size: 1.00rem; margin-bottom: 0.83rem; margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps6 {margin-left: 0rem; text-indent: 1.50rem}
.ps7 {font-family: 'Cambria'; font-size: 1.00rem; margin-left: 0rem; text-indent: 1.50rem}
.ps8 {margin-left: 0rem; text-align: center; text-indent: 1.50rem}
.ps9 {font-family: 'Cambria'; font-size: 1.00rem; font-style: italic; margin-left: 0rem; text-align: center; text-indent: 1.50rem}
.ps10 {font-family: 'Cambria'; font-size: 1.00rem; font-style: italic; margin-left: 0rem; text-indent: 1.50rem}
.ps11 {font-family: 'GaramondNo8'; font-size: 1.00rem; font-style: italic; margin-bottom: 0.83rem; margin-left: 0rem; text-align: center; text-indent: 0rem}
.ps12 {margin-left: 0rem; text-indent: 0rem}
.ps13 {font-family: 'GaramondNo8'; font-size: 1.00rem; margin-left: 0rem; text-indent: 3.00rem}
.ps14 {font-family: 'GaramondNo8'; font-size: 1.00rem; font-style: italic; margin-left: 0rem; text-indent: 3.00rem}

From mucking about with it I think the problem only happens when there is a combination of:

“From first regular paragraph in each chapter” checked
and
“From paragraphs after blank lines” unchecked

which unfortunately is what I need.

Okay, yes, there are a lot of problems with the HTML and CSS that the ePub generator produces out of the box. You will also find, as you start trying to stress it outside of its default settings, that it was often only built up to the point of making the “Ebook” format work without changing it much.

Here is a quick fix that would make it easier to suppress the indent after a heading:

  1. Go into the Separators pane, and for “Section Text” (used by scenes), switch Separator before sections to “Single Return”.

    With the empty line gone, in theory the “h1 + p” (etc.) selector that the From paragraphs after headings checkbox adds, would work, because now the empty line is removed in between the first paragraph and the heading.

    But, if you compile to Sigil and inspect the cascade, you’ll see that doesn’t work. There is an automatically generated “.ps1” that comes later in the .css file and takes precedence.

  2. That in particular is difficult to get around cleanly, because it shouldn’t be spamming serialised paragraph classes onto every paragraph to begin with. We could do something like:

    h3 + p[class^="ps"] { text-indent: 0; }

    Whether advanced wildcards are broadly compatible with different ebook readers though is a good question, and answering that would require a lot of device and software testing (I wouldn’t be surprised if Kindle does not). A more brute force approach that should work everywhere:

    h3 + p { text-indent: 0 !important; }

    (Of course you’d probably want the whole h1 – h6 set, especially since the defaults are all over the place with how heading levels are used aesthetically rather than hierarchically, but I’ll keep this example brief.)

So that’s probably the best and simplest way to solve the specific problem. You may also want to turn off all of the indent settings in Text Layout, since you’ll be handling that yourself.

2 Likes

My preference would be to follow generic “guidelines” and make as few changes as possible.

As per the other post where we chatted about this, turns out I was wrong in my approach to “standard practice” and was trying to indent both the first paragraph of a chapter and later paragraphs that came after new lines.

This now becomes a non-issue for me, as I will change my approach to suit “standard guidelines” in both cases. Which is clearly what the current compiler setup adhers to, but I had been fighting with. Doh!

If I do need desperately to make this work I’ll use styling to indent.

For the record, a work around I found - though it risks making the compiler reliant on Scrivener Editor - was to set the section in compiler to use “Text And Notes Use Editor Formatting”.
Then in Text Layout I unchecked “From first regular paragraph in each chapter” and unchecked “From paragraphs after blank lines”.
Then in Scrivener Editor I set the ruler tab indenting as required. This then worked with No Styles or with set styling. The risk being later changes in the editor would impact the ePub compiler which I learnt before often leads to mistakes (when I forgot I did that) and took more hard work to fix than it ever solved.

“Let the compiler be right”, is probably my mantra moving forward.

Anyway, problem solved by adjusting my approach rather than forcing this to work against “standard” practices. Thanks for your help.

1 Like