Title alignment in Compile

Sooo, the big day is creeping closer, so once again it’s time to battle the Compile settings. So far I have managed to turn around some skirmishes in my favor, but there is one fight I can’t seem to win.

In Compile view, I set the title alignment like so:

Settings.jpg

What my Epub reader shows me however, is this:

Zwischenablage.jpg

So far, no amount of sliding the little triangles has convinced the title to stay in the middle. (The “as is” boxes in the Contents pane are unticked)

Any ideas?

Edit: forgot to mention: it works in PDF export, using the same settings.

You’ve set first-line, right and left indents for the title line, the blue markers in the ruler shown in your first image. Drag the two on the left by the 4 back to zero and the one on on the right by the 12 all the way to the right edge of the ruler. That will set them all to zero, allowing the text to centre based on the width of the ebook device.

Thanks, but I don’t want it to go over the whole width. I’d like it to be centered within that space.
It works when I compile it as a PDF.

When you say “within that space”, do you mean you’ve set right and left indents for all the body text as well? Usually you want to leave these at zero, so that the text is just bounded by the margins, except for scenarios like block quote paragraphs.

The body text goes over the whole width. What I’m looking for is this:

pdf.jpg

That’s what it looks like in the PDF.

Okay, I must just not have been clear in my earlier post. By removing the indents on the title line, the text will be centred between the margins. It won’t be expanded to fill the whole line.

I may be explaining it wrong. I want the regular text to go over the usual width. No problem there.
The title however should only cover a certain width, and that area should be in the middle above the regular text.

My last screencap shows how it’s supposed to look. That’s how it looks when compiled to PDF. My question is, why doesn’t this work in the Epub format? I use the same settings for both.

Something odd is happening to your epub, that is certain. I notice that your first screencap shows a title with a single line, your second has two lines, so is there a line break in there?

Open the epub in an epub editor like Sigil or Calibre and look at the settings, this would give you an idea as to exactly what formatting Scrivener is outputting to epub. These editors will also let you adjust the settings of the titles, and maybe that is all you would need (at least for now, for this project - it will give you an epub that looks the way you want so you can go ahead and release it).

Post back here what the epub code is, and it will give us a better idea of just how to fix your compile-to-epub settings.

  • asotir

Ok, here’s what Sigil shows me for that title line, plus the first line of regular text:

Very good. The first paragraphs, with style p1, are there to add space to the top of the ‘page’ and are followed by the title, which has style p2. The first line of text has style p3.

Up above what you have sent along, in the header, you will find a link to a style sheet. The way Scrivener handles these is to create several style sheets for the project. They are in the Styles folder of the epub and numbered along the lines of stylesheet1.css, stylesheet2.css, stylesheet3.css, and so on.

So your next step is to open the stylesheet that this particular chapter links to, and see how it dictates the formatting of the p2 paragraph. It should have no margins, and a text-align: center.

Logically, the p2 style in all the chapters should be the title, but this might not be true; you can if you want to get the ebook out fast, go through all the stylesheets and fix it, one by one.

And whatever the formatting of that p2 is will give you a good idea of just how Scrivener thinks you want it aligned…

  • asotir

CSS is basically Chinese to me, so I just made a screenshot of the stylesheet. Which says text-align: left.

Look at the rules for p2. This one is text-align: center as you wish. The Margins spaces go according to a set pattern starting at top – I think they go Top, Right, Bottom, Left. (In other words, clockwise.) If I am right about that, you will note that the margins for p2 have a big indent last on the list, which would be margin-left.

That is why the title, trying to be centered, ends up way off to the right: because its left margin is pushed out to the middle of the page.

So now we know what is going on there. To see if you can fix this in Scrivener, start the Compile dialogue boxes, and in the Formatting pane, click anywhere in the TITLE paragraph in the simulated editor pane down below. Now look at the ruler atop that editor pane. What you want to see is the left margin downward triangle, along with its first-line indent ‘cap’ pushed all the way to the left of the ruler.

If they are already there, then we have another problem…

– asotir

I tried that. Now everything is leaning to the left: neu pdf.jpg

OK, that is odd. My next step would be to follow the procedure: open the epub in Sigil, and look at the formatting of that paragraph. If it does still say text-align: center, then look to see if the margins are still screwy. The margins should be 0 all the way around.

  • asotir