Chapter Formatting

Hi all!

My apologies if this question has been asked before, but I’ve searched and searched, finding no previous post. If you know of a link to a similar post, feel free to direct me there. :slight_smile:

My description may seem confusing so I’ve attached a photo so you can see what I’m going after. So I’m formatting my book for print (pdf) and I’d like the first letter of each chapter to be a different font and to be a larger font as well. (One of the ones I’m trying is called Campanile.) Since a font change ends up creating a larger space between the first and second line, I’ve created little .png’s of each letter and inserted them at the beginning of each chapter. But since this font is bigger than the rest, it towers over the paragraph and I’d like it to sit in a pocket off to the left like in the picture. So this bigger letter would span down a few lines along the left side of the paragraph and the first few lines would indent off to the right to make room for it. So essentially I’m trying to find out how to have the first two or three lines of each chapter indent so that I can have this pic in that space. I haven’t been able to figure out how to indent just the first few lines, but even if I did I don’t think I can insert a photo in that space anyway.

I’ve seen many books that use a special, larger font for the first letter of each chapter and they seem to always indent the first two or three lines when they do this…I just can’t figure out how to do it in Scrivener. In Pages, if you insert a photo to the left of a paragraph, you can enlarge it down the left side of the paragraph and it’ll just move the indentations of the lines accordingly (without messing with line spacing either). But Scrivener doesn’t seem to work that way…

I hope this is making sense. :slight_smile: If anyone has any ideas, I’m all ears!

Thanks so much!!!

Chapter.png

Hi Vyla-

The term you are looking for is a Drop Cap. The only program I know of that does this effectively is Microsoft Word, which if you have you could export your work out to a word file and create your Drop Caps and PDF there.

It would be ideal if Scrivener had this option as well. It would make ePubs look amazingly sharp! I have created a similar effect in Scrivener by using the Compile As-Is feature and enlarging the first letter only that you want Drop Capped and making it bold. When you compile As-Is it will keep the effect. See attached file.
Screen Shot 2013-07-25 at 11.19.36 PM.png

Thanks for your reply. That’s a bummer Scrivener doesn’t offer this type of formatting. I may just use a smaller letter than I initially intended and forget about the Drop Cap. Did you use a photo for that letter? When I increase the font size for one letter it increases the space between the first and second line of the paragraph. I resorted to using a picture of the letter instead, as this seems to respect my line spacing when inserted. Maybe this problem is font specific though. I’m choosing a different font for that letter.

There are other apps which can do drop-caps, Nisus Writer Pro, I guess Mellel and Pages, and if you really want to go top-end, In Design and other page-makeup programs.

Drop-caps is a page layout matter, it’s a matter similar to floating text-boxes, flowing text round images, etc. Scrivener is for creating the textual content, not about page layout, so (i) personally, I doubt if drop-caps will ever appear in Scrivener output, and (ii) if you want such formatting, export your text (preferably to RTF) and open it in Word, NWP — but not Pages … you’ll need docx for that, thanks Apple! — or whatever wordprocessor you prefer, and do the drop-caps there.

Mr X

Disclaimer: totally unrelated to Scrivener, Keith or anyone else involved in Literature & Latte.

[size=200]W[/size]ell, if dropcaps in ePub files are the goal, you can in fact get Scrivener to produce the necessary code for this, since ePub is just based on the same technology used to style web pages, and we’ve provided all of the necessary hooks you would need to do advanced styling from the project side of things. Before digging into that though, it is important to know that not every e-book reader is capable of formatting text around floating boxes. You will, at a worst case scenario, get a result similar to the second screenshot you displayed, where you have one very tall character at the front of the line. It is not uncommon to see a result like that on the Kindle and in other contexts[size=80][1][/size]. Another problem you are going to run into is that e-book publishing is the very antithesis of a stable output! For dropcaps to be successfully implemented, we need absolute control over the font face, leading, and other such trivia—such as we have in print. With electronic publishing, every single device is going to use a different font, different line-heights, text rendering engines and so on. What this ultimately means in practical terms is that there will be some devices that show too much whitespace below the dropcap, because a line has been wrapped that is right on the edge of the dropcap floating box. So if these are acceptable fallbacks and pitfalls for you, then you might be interested in this technique.

There are five separate ingredients that we will need to tap into here, one of which will require the 2.5 version of Scrivener, which has the ability to inject raw HTML code into an e-book:

  1. [b]Format/Formatting/Preserve Formatting[/b]: this menu command draws a blue box around whatever you have selected in the text editor. It is a special range that ordinarily tells the compiler to leave the text alone instead of overriding its formatting. However with some of the other compile formats, it has slightly different usages. One of these is with the HTML based outputs, like ePub.

Here we have a possible look for dropcaps in the editor. Note that the formatting here is arbitrary and has no bearing on the output itself (though it could be used in conjunction with a RTF file to at least give you the start for a dropcap in a layout program). What looks a bit like an underline here are actually two hyphens on each side. I chose that as my “code” for dropcaps as it is relatively unobtrusive and unique enough to not be accidentally triggered by hyphen usage elsewhere.

  1. Now open up Compile, and enable the option, Treat “Preserve Formatting” block as raw HTML in the HTML Options compile pane. This is the one you will need the beta for!

  2. Replacements compile pane: while we could type in the raw HTML code for every dropcap in the book, it will be easier on the eyes (not to mention more flexible, as you could compile to another format other than ePub and have the “dropcap” removed entirely). Replacements let us look for simple things like “–D–” and turn them into more complex things like [b]<span class="dropcap">D</span>[/b], while compiling. That way the editor stays clean, and we get the technical output we need to style the first letter a bit differently from everything else.

So you will want to Replace[b]--$@--[/b]With[b]<span class="dropcap">$@</span>[/b], if you go with the double-hyphen method[size=80][2][/size]. When you compile, Scrivener will insert the HTML code needed to treat this initial letter as special, in our stylesheet. We could use a less bulky way of doing this, but support for CSS3 is even less abundant than floating box support is, among e-readers, so we’ll stick with the messier but more compatible method of putting a ‘span’ around the letter.

  1. Finally, visit the Layout compile pane, enable “E-book contains script formatting” (ignoring the fact that it does not) and click the [b]Customize CSS...[/b] button. The first thing you will want to do is delete what is already there. As mentioned, this is generally for publishing screenplays via e-books, so there will be things like scene settings, action, etc. Just delete that and replace it with the following example CSS code:

[b]span.dropcap { font-size: 300%; float: left; line-height: 1em; padding-right: 0.15em; }[/b]

Click the OK button, compile, and test the output in something like Adobe Digital Editions, Sigil, or Calibre. Using this code, I got reasonably nice results in Apple iBooks as well, but there was an excess of whitespace beneath the dropcap in ADE (which might impact the NOOK). If the ePub is opened in Kindle Previewer, it will be converted to a hybrid Mobi/KF8 e-book. If the e-reader (currently Paperwhite & Fire) supports the latter format, the dropcap will be displayed somehwat properly (the Paperwhite ignores the line-height setting, causing an amount of padding along the top). On older Kindles and iOS devices, which use the Mobi format still, you’ll get the tall-character rendering.

Of course, you may want to play with the look a bit as I just chose something that looks nice to me without spending too much time on it. The font-size value is a percentage multiplier off of “normal”. So 200% would be twice as big as body text. The line-height command keeps the top of the dropcap flush with the top of the paragraph, rather than having a little space above it—not every e-book reader will respect that. The 0.15em is a unit of measurement based on the font size that adds a little space to the right of the dropcap, between it and the next letter of the word. Adjust that to increase or decrease the spacing.

So what about compiling to other formats? Basically you’ll just want to change your Replacement so that [b]--$@--[/b] is replaced with [b]$@[/b], in effect deleting the hyphens (or whatever). If you style the capital as in the screenshot above, you might even have an acceptably good output for some contexts, even if you use the compiler to reformat the look of the body text, thanks to that Preserve Formatting field.

Footnotes:[size=80]

  1. Amusingly, Amazon even touts this “style” on their Kindle product page, as though it were desirable, so perhaps their being neglectful of the rendering problems will result in people becoming accustomed to this look instead of a dropcap that falls into the text.

  2. I realised after writing this and making all of the screenshots that most people use double-hyphens as a shortcut for inputting an em-dash. So you might need to use another symbol here. The important thing is that the stuff around the dropcap letter is around the [b]$@[/b] in the Replacements panel.
    [/size]

AmberV, this is a terrific tutorial on drop-caps - thanks for it. Unhappily, the OP is formatting a pdf for print.

My suggestion is to use InDesign if the price is acceptable, though unfortunately Adobe charges a premium markup for their software and always has. If free is needed, then either learn LaTex and use the ‘lettrine’ style (it gives lots of option on drop-caps) or look at another page layout package that is free, such as KWord (now called Calligra IIRC).

  • asotir

Agreed, for creating a PDF, InDesign is going to be the best tool for a number of solid reasons, dropcaps included. If cost and training is a concern, then something less sophisticated could be used with the understanding that quality will suffer for it. Word can stand in here.

My tutorial was for the second poster, who expressed an interest in having dropcaps in Scrivener for ePubs.

If one is looking simply for a classy way to set off a chapter, dropcaps are one way of doing it, but capitalising the first few words is another, much easier way, and this can be done automatically with the compiler in the Formatting pane, under Section Layout, “First Page” tab.

This post contains tips on how to make this technique work with Scrivener 3. Firstly it is worth noting that if you intend to use KF8 or ePub 3, then much of the above can be dispensed with, as we’ve added specific features to aid in formatting drop caps (though the formatting is still up to you, given how fluid and evolving this aspect of design remains).

  1. In the Compile overview screen, right-click on the Format in the left sidebar that is being used to style the ebook, and choose to edit it (duplicating if necessary).
  2. In the Section Layouts compile format pane, locate the layout used to style the body text, where drop caps should be added, and click on the “New Pages” tab in the lower half of that pane.
  3. Set the Number of opening words to make uppercase to zero if necessary. This will activate the Add “first-letter” span style to first letter checkbox: tick that.
  4. In the CSS compile format pane, make sure either “Append” or “Use” custom style sheet is chosen, and in the left column, add your drop cap CSS using the “first-letter” selector.

For Mobi and ePub 2, the same basic idea shared before still applies, but there are now better ways to go about getting the HTML around the first letter:

  1. In the main editor, apply whatever formatting you wish to a first letter and use the Format ▸ Style ▸ New Style from Selection... menu command. Save the style as a character style. As with before, the actual formatting is entirely arbitrary, we won’t be using it directly. Using a style simply replaces the Preserve Formatting usage in the v2 example above.

  2. In the Compile overview screen, right-click on the Format in the left sidebar that is being used to style the ebook, and choose to edit it (duplicating if necessary).

  3. Click on the Styles compile format pane and click the + button in the upper right corner to add your drop cap style created above:

    • Tick the Treat as raw markup flag in the right-hand column.
    • Place the <span class=“first-letter”> code into the Prefix field, and <\span> into the Suffix field.

    This step replaces the need to use Replacements. Instead of having to type in hyphens or other characters into the editor, we can now atttach the HTML we need to make this work directly onto styled text itself, leaving the editor clean.

  4. In the Text Layout pane, tick Include scriptwriting CSS and following the instructions provided in step 4 of the prior how-to.

These two methods can be used in the same project; they will not collide with one another so long as you use two different Compile Formats (which you generally should do anyway for these two very different approaches to ebook output). If you need both ePub 2 and ePub 3, the styled first letter in the editor will not conflict with the “first-letter” class Scrivener assigns. Download the example project for three demonstrations of the basic technique:

  • ePub 2 / Kindle Mobi
  • ePub 3 / KF8
  • Pandoc ePub

The “Universal Technique” binder item demonstrates how to format your text if you require other export methods beyond ePub 3 and KF8. The second binder item shows that nothing special is necessary in the text at all, if those are all you need, since Scrivener can add the necessary HTML automatically. Naturally, in testing this project, the second paragraph will not have a dropcap in Pandoc and ePub 2 / Mobi output.

May ask for more details regarding “add your drop cap CSS using the “first-letter” selector,” or for a pointer about where to learn more about how to write the custom CSS needed here.

I added this to the Custom Stylesheet:

/* Add Drop Cap first letter. */ span.first-letter { font-size: 300%; float: left; line-height: 1em; padding-right: 0.15em; }
Along with checking the “first-letter” span style box in New Pages for the layout in question.
I got this:

But I still get that even if I remove the CSS I added, so I’m still missing something significant.

I’ve looked at the provided sample file, and when compiling it has an option to compile for epub 3. But my new file doesn’t have that option, which I think is because the epub in scrivener 3.1 is automatically epub 3. If that is not correct then maybe that’s my problem.

I do not get the option for “first-letter” span in either Text Groups or Text. See attached. What am I doing wrong? This is Scrivener version 3.03. I’m trying to avoid having to buy Vellum simply for the drop caps option. Thanks.

Hi.

The first-letter span style is exclusive to ebook (ePub and Kindle) compiles only. Your screenshot shows a PDF compile.

Slàinte mhòr.

Thanks for the fast response. I checked it and noticed that I get the option with epub3 and KindleF8/Mobi. I’m not knowledgeable as to differences in epub2 vs. epub3, and Mobi vs. KindleF8/Mobi. Maybe the drop caps render only in particular devices, not others.

I still need it in print. Looks like I’m stuck with either hiring a fiverr gig or buying Vellum and being typographically constrained by their limited font choices. InDesign is too much for someone who only wants book formatting.

Thanks again, much appreciated.