First Paragraph in compile

I am looking to compile a manuscript as an e-book, I made a copy of the ‘ebook’ format from Epub2 so I could play with the format, and came across the Text Layout and “remove first line Indent” check mark. I have tried every variation of those check marks I can think of, but none of the compiles remove the indent from the first paragraph.

does anyone know how to use this so the first paragraph indent will be removed?


You are in fact using the right option, at least by that I mean the one indicated in the second screenshot, for this type of setup: where there are no headings at the top of a section, no other elements that the first paragraph would follow. This specific “First regular paragraph…” option is meant to handle such awkward corners that cannot be as easily solved with CSS alone.

But as far as I can tell it doesn’t actually do anything (and that’s a bug)! It’s supposed to be manually removing the indent from the formatting internally, before converting to HTML, which would cause it to be assigned to a different paragraph class, so you’d end up with something like:

<div class="new-section">
<p id="doc1" class="ps1">First para...</p>
<p>Second para...</p>
<p>Third para...</p>

And of course .ps1 in the CSS would be the thing that changes the indent.

But instead you get:

<div class="new-section">
<p id="doc1" class="ps1">First para...</p>
<p class="ps1">Second para...</p>
<p class="ps1">Third para...</p>

The fact that normal paragraphs have classes attached to them is another bug that isn’t directly related. In this case we’d expect to see at least see the messier but functional “ps1” on the first paragraph and “ps2” on all the rest.

You might be able to manage it with CSS though. You’d have to take a look at the actual HTML structure you are getting, using a tool like Sigil or Calibre, where it will also be a lot easier to experiment until you find the right selector to use in the stylesheet.css file. Once you do, you can copy and paste the solution back into the compile format’s CSS pane, left column, to make the formatting permanent. Just bear in mind if you switch to a different Layout or some or all section types, you may have to add another rule (but other checkboxes might help you in that case, too).

To go off of the above example though, I could suppress the indent on the first paragraph thanks to it being the first child element of the div:

div.new-section p:first-child {
    text-indent: 0;
}

If your HTML output is similar in structure, you could probably get away with the same thing.

1 Like

Thank you for the assistance, Amber.

Unfortunately, CSS and HTML are beyond my capability, so I’ll have to look for an alternate way of getting the formatting applied to the manuscript

In case it was not clear, I have given you a potential solution above, you need only copy and paste it into your CSS settings in the compile Format to test it. The only variable is the class name. I used the example “new-section”, which you can see after the dot in the sample, so if you wanted to minimise adjusting the CSS text, you would want to go into the Section Layouts pane, and for the Layout you are using, under the Settings tab, type that into the CSS class name field, precisely as given.

Might be showing of how not into CSS and HTML that I didn’t realize you’d offered a solution.

it might have taken way longer than it should, but I actually managed to make it work.

would it be complicated to have that indent removal work if there is a “chapter title”? I attempted changing the “first-child” to “second-child” since that’s where it would fall in my utterly uneducated opinion, but that didn’t do it.

That’s a good guess, but unfortunately CSS (at the level of compatibility we need for ebooks anyway) does not have a really good way of talking about the second child item.

Now to the current setup: my solution above was based upon the original setup you described, where there was nothing above the first paragraph to work with. Now that you are inserting a heading, you should be able to use one of the other options that does work, without any further CSS tweaks.

And to go a bit further, why not at this point use the stock “Ebook” compile Format? It has a Layout that would do what you want here, called “Section with Title”. It would insert the name of the section and handle the indenting for you, without any further configuration.

If it’s a learning process you’re looking for, then I’m more than happy to help with that, but that is definitely what it would be, to go from completely vanilla settings to something that works well. A lot of polish and effort has gone into the “Ebook” preset, that would take an awful lot of work to rebuild from scratch. I generally only recommend starting from scratch if you have your own CSS already developed and want something with very few opinions to work from, or if you do want an in-depth learning exercise.

That…worked.

The ellipse can’t convey how surprised I am at that, because I am confident that I went through every one of the presets before asking for help, and I never got this result.

So, thank you for taking the time to assistant me, and for getting me to look at this preset again(or for the first time)

1 Like