Tips for eBook, structure and format

Yes, in fact we demonstrate the basic concept of how one can do that, in our stock “Ebook” compile format:

  1. Double-click the “Ebook” compile Format in the left sidebar to edit it.

  2. In the CSS pane, expand the window a bit if necessary, and have a look through the “Custom Stylesheet” column. At the top you will find two declarations for the .bordered-title selector, and the .bordered-title + subtitle selector. These will add a single-pixel rule above and below the heading block, and manage internal spacing a bit for two-line headings.

  3. How do we get these classes being referred to? Click on the Styles pane for that, and note there are two styles in this list that match the above:

    • “Bordered Title”
    • “Subtitle”

    So by default Scrivener makes the style name CSS-friendly (bordered-title) and uses it on assigned text in the HTML, meaning you can then write CSS to change how it looks directly, implementing designs that the basic Section Layout and Styles features themselves do not support—such as adding rules, or compositing text with a background image. For example, since Bordered Title is set to function as a Heading 2 element, in the Format Bar, we would expect to see HTML something like this being used for it:

    <h2 class="bordered-text">Chapter Twelve</h2>
    

    Also of note here, in the Styles pane, is the CSS Class Name field on the right. Left empty it works like I described above, but you can give your own class name if you already have stylesheets written, or just want to use your own naming convention, whatever.

  4. Now for how those styles themselves are used, go into Section Layouts, and select any of the layouts ending in “(Bordered)”. For example, with “Chapter Heading (Bordered)”, I click into the “CHAPTER ONE” sample text in the Formatting tab, then the Styles button, and see it is assigned to the “Bordered Title” style. So now any binder item with a Section Type that is assigned to use this layout will be given a predictably classed heading that I can add advanced custom CSS for.

    Of course, you are not limited to using the compiler for style management. Styles assigned to text in your writings will also get CSS class names (whether they are in the Format’s style list or not), and this is how you can do such things as adding call-out boxes.

  5. In an abstract way, I would also draw your attention to the Settings tab in the Section Layouts area, where the ideas was to add a CSS class to the whole section (around the title and all content, as well as child binder item content), which puts it into a div in order to do so, nesting divs if different binder items use Layouts with this setting). So that would be useful if you want to implement larger-scale designs. But unfortunately it was never implemented, and all we have this label in the GUI. I mean it does kind of do something, but in a way that isn’t at all useful. I point it out though because someday that will be fixed.

What is the best way to ensure that images and captions appear without disturbing the flow when reading the eBook?

I’m not sure what this means. Back in the “Custom Stylesheet” column, you will see that we do add some CSS to keep caption and figure glued together, so they don’t break across pages. If that’s all you mean, you’re all set.

Each place name and address could be linked to Google Maps. What is the best way to do this and maintain readability of the eBook? Or maybe drop the whole idea?

Yeah I wouldn’t say that would be particularly good, you’d want maps that are designed to display well on black and white devices, for eInk readers for one thing, but probably also with a little control over what is on the map.

I would suggest looking into OpenStreetMap utilities, which is a global project to create open and free maps (this link is to the main page, which does have a map browser, but generally you will want to find a packaged “app” that adds familiar features). Better to support efforts like that, in my opinion. It wouldn’t surprise me if there is a tool or workflow for making its map data look better for eink screens. Since you can download the tiles yourself and edit them locally, you don’t necessarily need external tools to help with that.

Search the forum for specific questions! We have years and years of discussions on specific implementations like glossaries, floating boxes, drop caps, etc. The ebooks tag is often used for such queries, and can help with narrowing down searches.

3 Likes