Contents | Start | End | Previous: KB0331: Why does Apple Books fail to open my Epub with a missing resource error? | Next: KB0333: Using Jutoh and KDP to create a print book
Some books have the first line of the first paragraph in a chapter formatted in small caps. Since the length of the first line depends on variables such as text size and display width, you can't use a Jutoh character style to achieve this.
Instead, you can use CSS together with Jutoh paragraph styles to achieve this effect. Note that some Epub viewers don't recognise the required font-variant property, so for example Adobe Digital Editions won't show it if your book is Epub 2 - but it will work if your book is Epub 3. It will work with KF8-capable Kindles. The technique described is only for HTML-based formats and so will not work with ODT.
First, create a new Jutoh paragraph style, for example called First Line Small Caps. In the Style page of the style definition dialog, set Based on to the style you would normally use for the first paragraph in a chapter, let's say Body Text. If you also want a drop cap in this paragraph, check Display drop caps in the Drop Caps page.
Click OK to add the new style. Apply the style to one or more first paragraphs in your book.
Now to add the first line formatting by editing the style sheet. Click Edit in the toolbar, click on the Styles page, and then click on the edit style button (the third on the top row).
Check Use custom CSS, and add the following CSS code:
p.P_First_Line_Small_Caps:first-line { font-variant: small-caps; }
If your new paragraph style isn't called First Line Small Caps, change the above appropriately, substituting underscores for spaces and prefixing with "p.P_".
Click OK, OK again, and compile your project. When you launch the book in a suitable viewer, it should now show the first line in small caps, with a drop cap if you specified it.
Contents | Start | End | Previous: KB0331: Why does Apple Books fail to open my Epub with a missing resource error? | Next: KB0333: Using Jutoh and KDP to create a print book