Fix Section Layout Style in Composer

I have been updating my documents from Scrivener 2 to 3 and worked through some instructional videos and documents, but can’t find how to make section titles bold and left aligned in the Kindle output. I have to update a Kindle e-book and just can’t find it. Same for the TOC formatting. Where can I adjust?

You can edit styles in the compiler (see image). For the ToC, this thread might help:

https://forum.literatureandlatte.com/t/toc-table-of-contents-format/39273/2

This guide also has info and samples covering compile settings:

literatureandlatte.com/scriv … date-guide

I have studied the above documents and the official manual as well. Thanks for the information provided and I was able to import my old version 2 compiler format into version 3. However, it feels to me that for a change in the available Section Layouts offered in the compiler, I have to resort to doing CSS stuff??? I can assign a Section Layout to Section Types, but if the Section Layout needs to be finetuned, I have to resort to adjusting the CSS/Stylesheet? That is, except for some basic changes such as setting Title Prefix or setting a title in all Uppercase.

The formatting window only shows the result as that formatted by styles and CSS, but if I go to the styles menu, there is not much I can change that has an effect on how Section Layouts behave.

So, I have a TOC but it is only defined in the Default CSS Stylesheet as follows:
/* Table of contents navigation */
nav#toc ol { list-style: none; padding: 0em; text-align: center; line-height: 1.5em; margin-top: 0.5rem; margin-bottom: 0.5rem; }
nav#toc ol li:before { content: none; }

Do I really have to dive into adjusting the CSS Stylesheet if I want the TOC to look a bit different?

Not unless you want something really exotic.

Format a named style using the WYSIWYG sampler, and the CSS will be generated for you.

OK. I by now read a short primer on CSS (should have done that earlier). What am I still missing out on? The WYSIWYG sample text “editor” as can be seen in the screenshot below is not really helpful. I can make it bold or italic, but not change the font size. I must be missing something important here.

I also do not have any style noted on that list of Styles there as well, but I could add Heading 1 or others, but no toc or other options there.

So how do I change the appearance of a Section Title? Or how do I change the word Content in the table of contents from left-aligned to centred and bold? How to decrease the spacing between an image and the text right below it? How to make the image appear left-aligned and not centred?

Let me give some samples of how it appears now after compiling and what I had before.

This is how the table of contents appears in the Kindle App on a published book. The word “CONTENTS” is bold and centred.

With the new compiler, the table of contents looks different and the word “Contents” is to the left now and not bold. Where, oh where … can I change its appearance? I had the frontwork also stated in the TOC, but now it is gone.

The section headers/titles would initially look like this.

Now it looks different.

A line of text right underneath an image would look initially like this.

Now there is more white space in between the image and the line of text below. Where can I adjust it?

I did not have the title of the book running at the top of each page in the Kindle e-book, but now I have.

It must be me, but I find it hard to figure out the workings of the new compiler and do not understand why from a usability perspective it has become easier to use. Any help appreciated or a pointer to a clear instruction document where it is specified how to adjust the above.

The thread below includes a sample project and, perhaps, some answers (with caveats).

https://forum.literatureandlatte.com/t/toc-table-of-contents-format/39273/1

That link was posted above as well, but it seems so overly complicated for basic formatting needs. I might understand that “under the hood” the new setup of the composer is better, but from a point of view of a typical Scrivener user, I can’t see how this would work out. I am still trying to figure out where my TOC is defined and styled as I do not have a section layout defined for it and still it shows up. Can’t find anywhere in the menus an option for it. And I do even own a software company :slight_smile: but have trouble figuring it out (I don’t code).

If I try to follow the logic on that post, I get stuck.
I a new section layout with the name “Table of Contents” and assigned a class name to it of “toc”.

Then next I tried to add a new Style called “toc” but it is not available on the list.

The latest version of the Scrivener Manual also is not of much help here. What am I missing or doing wrong?
Thanks for the comments and help provided.

One thing I do notice is that if I compile using the older Kindle format <Kindle Mobi Ebook (.mobi)> the output is fine, but when I compile for the newer Kindle format <Kindle KF8/Mobi Ebook (.mobi)> I just can’t get it to render my text to look the same.

If you click in the text and then click on the Aa, can’t you change the font then?

Yes, that works for choosing another font or font size. Thanks! What about the rest and how to implement? There is not much else you can define here and it is unclear where next to do.

So, in Styles, I could add a predefined Section Layout using the + sign and renamed it to “Test heading”, then saved the adjustment.

When going back to Section Layouts and to the formatting screen at the bottom, the new Style I just created and saved is not there.

I am assuming that most of the people using Scrivener are authors and writers and not technicians, software-engineers or coders. It seems to me that I am more or less stuck with some basic templates in the composer that can create a range of formatted documents for me, but that it is damn hard to tweak these predefined formats. I might be mistaken and hope someone can clarify for me how it can be done.

I suppose we are all different; after a first shock of the large change from V2 to V3, I adapted quickly to S3’s compile, and consider it to be carefully designed to deal with a large diversity of outputs (Scrivener doesn’t only output to kindle). I consider myself a technical user in that I prefer Pandoc to drive all my compilation running custom processing filters, there are quite a few technical writers here too… I do not exactly understand where you are having difficulty? There is nothing stopping you from using the old mobi format, but it is more limited and generates poor HTML so to consider it somehow more flexible is incorrect. EPub3 and KF8 are basically HTML5 + CSS based formats, and Scrivener 3 allows you to layer customisation flexibly. The Style editor only creates basic CSS formatting, and if you want more detailed changes then you augment it with custom CSS. Section layouts and styles allow you to semantically tag your parts with CSS classes, and to be able to do all this via a GUI is great.

First you are trying to edit the old mobi format that cannot fully support CSS adjustments. Technically it is better to adapt to the new EPub3 (and derived KF8) format. Your screenshot shows you are selecting the wrong GUI element (it is the text level, not the style, and it does not say it is a style menu anywhere), because you are trying to edit the old mobi format. You may benefit from reading through the Scrivener 2 to 3 tutorial and manual. I would also recommend looking at the EPub3/KF8 EBook compile format as it shows you exactly how to layer section layouts, styles and CSS to build a flexible good looking output.

Thank you for your reply and I do really appreciate the feedback. I slowly am starting to understand that to tweak the output in the new composer I would have to do that using custom HTML5/CSS code. As said, I just read a short primer on CSS and was already more or less familiar with the basics of HTML, but I am just surprised that Scrivener would require its users to resort to writing custom CSS code in order to change basic stuff in how the composer generates its output.

Sure, if you are a technical savvy Scrivener user, I understand that you have a lot of flexibility and power at hand, but what about all the other Scrivener users? How many Scrivener users are able to actually write CSS code to tweak the output? I personally doubt that there are many able to do so.

I did read the documents several times that explain how the migration from version 2 to 3 work out and I do have the same issues when selecting the Kindle KF8/Mobi format. I just cannot change the style or Section Layout as specified above or it is not intuitive for me to figure out. I don’t write code, but own two software companies for many years. If I can’t figure this out, how about all the non-technical authors and writers using Scrivener? Am I the only one having trouble with this part?

It would help if I would get just a step-by-step guide to something as simple as adjusting the TOC title to be centred and bold instead of left-aligned and in normal type.

I have no problem using the older Kindle Mobi Ebook format for now, but since it was mentioned that the KF8/Mobi format was designed in a better way, I would like to know how to use it without losing control on the look-and-feel over the eventual .mobi file submitted to Amazon.com.

Screenshot of the composer frontend with the KF8/Mobi format selected and having the same issues as described above. The focus/selection is on the sample text in the bottom right part.

Are you using a manual TOC or autogenerated one? Can you share a minimal test project that demonstrates your problem, which will be easier for us to tinker with and give more focussed advice?

Reading through the Scrivener Manual again, I found this statement that the control of the layout with Epub and Kindle formats is only handled through CSS and not through the Formatting window you find bottom right in the Composer frontend window. That Formatting window becomes active if you select a format for e.g. print or PDF and then allows you to set a title to be left-aligned or the even change its type or font-size. Once you select an Epub or Kindle output, any of these changes you made in the Formatting window will have no effect on the output. It is now for 100% determined by styles and CSS settings, That is why you get the extra CSS menu in the composer screen to configure it.

So, even if you first configure it for print, save it and them open it to be compiled for Kindle, the preview in the formatting window will still show the format as in print with the Title to the left, but once you run the composer and compile for Kindle, the results will have nothing to do with what was in that Formatting screen and take the format purely out of the CSS window.

So, if I am not happy with how the new composer generates the output for an Epub or Kindle format, it seems to me that the only way I can control and tweak the output is by going into the CSS.

As a side effect, select Kindle as output format and then edit the format. The Formatting preview screen will look different and not allow you to select a title, move it to the left, change its font-size and so on. All these things are possible if you would have selected the print format.

In Scrivener 2, this limitation was not there, so I had more control of the outcome. Now I have to do it in CSS.

Again, the CSS option is probably great and gives me great control, but who in the world of Scrivener wants to go into CSS coding to tweak a bit of formatting?

I can upload a test document, but please double check first if you can use the formatting window in the composer frontend if you select Epub or Kindle as output format. You probably can’t and it explains all the issues above.

You are still not distinguishing between Epub2/legacy mobi and EPub3/KF8 — these use a radically different process for compilation. The old method used Apple’s RTF to HTML4 converter, which transformed much of the editor formatting but produced really messy and outdated HTML. The EPub3/KF8 engine uses RTF⇨MMD which produces very clean HTML, with the caveat that it uses markdown structuring. Both methods use CSS under the hood; it is the only way to style HTML, but for EPub3 the automatic style conversion is more limited, the trade off for a much cleaner and easier to tweak HTML output.

Here is what I edit in the formatting pane:

And what gets automatically added to the CSS (font size, line spacing, bold, color, indentation, margins — I did NOT add this CSS, Scrivener did):

And the right-aligned bolded coloured EPub title output (iBooks):
Screen Shot 2018-01-01 at 23.03.12.png

That should get you most of what you want, the formatter does not add more because MOST ebook readers override the formatting anyway. If you want more precise tweaking, you can supplement the default styles with your own custom overrides. I would agree that some bits of the UI are a bit misleading (the “Include font family” toggle does nothing for Epub3, font families are never included!) This is due to the fact there at least 13 major compile format targets, and designing a UI that is consistent across so many different outputs is challenging…

Perhaps reading this will help: literatureandlatte.com/blog/ … crivener-3

Why not just use legacy mobi format, which is what you were using in Scrivener 2? It is still available for you, just use it and when you have time learn to use the more powerful modern format, then you have that option. I just tested this in Scrivener 2 setting custom fonts present on my system for titles and they are not visible in my eBook viewer at all. Scrivener 3 is more flexible, more powerful, yet retains the old format so you really have the best of all worlds…Screen Shot 2018-01-01 at 23.03.12.png

Thank you for the response and advise. I have just downloaded an e-book from Amazon about Markup and Pandoc. Just to get a better picture. Will respond tomorrow. Tied up now with New Year family stuff :slight_smile: but thanks again for the great willingness to help out on this forum.

Enjoy the family stuff, more important than nerdleing with CSS … :smiley:

If a user styles the text in the sampler, the CSS gets generated automatically and is included in the compiled ebook (subject to ebook limitations). Sample project attached, if it helps to have a sandbox.

Scrivener Test.zip (95.6 KB)

That all works for as long as you do not compile for Kindle KF8/Mobi Ebook as once you select that as for your compile format, the formatting window has no effect and does not seem to work. Right? If I select the 3Pub3 format and then run that export file through Kindle Previewer 3, I am able to make some adjustments that end up in the mobi file. However, if I select Kindle KF8/Mobi as compile format, whatever I change in the CSS does not seem to end up in the book.

No, that is not right. Bridey’s Scrivener Test.scriv project is already designed EPub3/KF8 — his TOC document uses the Table of Contents Section Layout which uses Heading 1 style for title and toc style for text. He has modified Heading 1 to be green using the Styles panel, and made a toc style that is magenta text, also edited using Styles and adding a CSS class called toc, but he has added no custom CSS, he has only used the GUI to make these changes AFAICT.

As I mentioned above (viewtopic.php?p=256588#p256588), you can modify font size, line spacing, bold, italic, color, indentation, margins using the Styles visual editor. If you have more detailed changes, then the CSS can be edited for more specific needs. Again this is for EPub3/KF8, where the output is semantic clean and elegant HTML5.

Actually I may have misunderstood you. You are saying EPub3 looks OK, and if you maually convert EPub3 to KF8 it is OK, but if you use KF8 directly then you can’t see the changes? This could be possible as the base CSS is different, I’ll need to test.

EDIT: KF8 output is working as EPub3 for me, here i’ve centered the heading, coloured it green, bold+italics and the text is right-aligned, bolded coloured red using the Styles editor, viewed in Calibre’s .mobi viewer:

Scrivener Test.mobi.zip (39 KB)
Scrivener Test.scriv.zip (74.2 KB)