Fan of creative technology, elearning, instructional design and a little geeky

InDesign Character Styles & EPUB

I’ve been head deep into EPUB… and wanted to share another finding with InDesign CS5.5. A short post only, because I’m in the middle of work 🙂

InDesign CS5.5 now recognises character styles that are applied through nested styles and GREP styles during EPUB export.  That’s very cool!  It adds a span tag with class references to the style names by default, when leaving the Export Tagging, Tag setting set to [automatic] and Class field left empty.

FWIW I’m not promoting using the [automatic] setting with class field left empty as a ‘best practice’…  🙂

There is however one exception: Drop Caps. When using a drop cap that’s formatted through the Drop Caps and Nested Style feature, no <span> tag is added to the resulting html inside the EPUB. The Drop Cap is basically totally ignored…

So I applied the Drop Cap character style over the top of the already formatted Drop Cap, and left the Tag set to [automatic], but added a Class name “dropcap”

After Exporting the EPUB and taking a look at the HTML that was generated I saw this:

Export HTML result

Hmmm…. so I removed the Drop Cap reference within the Paragraph Style…

drop cap InDesign set to [none]

And exported the same document again, leaving the character style applied to the initial cap and with Export Tagging defined as before and ended up with the same result as earlier. As a last step, I forced the Tag option to span and exported once more…

Export Tagging options

Same result once again.

Wanted to share this finding. It’s not a major issue, as the matching style declaration is also added to the template.css, but it just makes a bit harder to develop a reusable template.css file for publications, when this char-style-override occurs. (Note, that I had the Include Style Overrides option in EPUB Export dialog deselected during all of this).

 

Similar posts
  • Adobe InDesign and XML: A Reference Guide The following is a reference guide I have compiled over time for those of you who are looking at doing a little more with XML in InDesign (originally published Feb. 2011, last updated Feb 2018). If you have any extra information you’d like to see added to this guide, feel free to message me. Mapping XML tags to InDesign [...]
  • How to change the colour of bullet points in InDesig... A few weeks ago I recorded a short quick tip tutorial. InDesign’s Control panel, gives users a quick and easy way to format text as a bulleted list. Highlight the text, and click the Bulleted List button in the Paragraph Formatting Controls mode for the Control panel. This applies a universal bullet character as the [...]
  • Creating a pop-up window in a PDF with Adobe InDesig... In the following YouTube tutorial, we’ll create an interactive PDF from Adobe InDesign, in which we click on a button, which in turn opens up a simple pop-up window containing a close-box. When the close-box is clicked the pop-up window disappears [...]
  • Adobe: the Founders’ Perspective. Adobe changed the world and revolutionized the publishing industry. A must watch computer history video for anyone who has a passion for the big red A. John Warnock and Chuck Geschke presenting… ‘the founders’ perspective’. Chuck: “When someone tell you our products have made a difference in their life, in their work, their creativity… that [...]
  • InDesign: Facing pages with odd-numbered left pages Back in 2004 I wrote a tip for InDesign CS on how you could have the first page of your document be a left page AND have it start with page number 1. It’s hard to believe this is almost a decade ago… But a recent question on Facebook, made me think I should really [...]

13 Comments

  1. Casey Casey
    January 13, 2012    

    Cari, I am using CS5. I need to have different character styles within different paragraphs, however, when applied and viewed as EPub, it is holding the size with it. My paragraph styles aren’t (which is what I want for e-readers). Do you have any suggestions.

    Bottom line: I can’t seem to bold something within a paragraph and keep the flexibility of font size and type that comes with e-readers.

    Help and Thanks

    • February 17, 2012    

      Hi Casey,

      it sounds to me like the Characters Styles are containing font, size etc. information and overwriting what the paragraph style should be doing… And possibly a character style is applied to all of the paragraph text?
      Try this:
      Create paragraph style, apply it to some dummy text,
      Now for the character styles, just make a change to some of the text formatted with the paragraph style
      Next create a new character style. The Style Settings should indicate that only those overrides that you added to the paragraph style are part of the character style.

      Hope this is of help,

      Cari

  2. August 17, 2011    

    @Graham

    Yep, you’d need to fix these at HTML/CSS level.
    I’m not aware of any generic .css for iBooks being available. Generally publishers will custom build these for their publications and set-up mapping guides to their style-names in InDesign etc.

    Cari

  3. August 7, 2011    

    So…I guess you’re saying that Drop Caps don’t export or display with InDesign CS 5.5? Mine aren’t, either. It would appear that you have manually added a style to your exported CSS file called “span.char-style-override-1”, is this correct?

    Second question: I’d like to find a generic CSS template for the iBook app – is there such a thing? I’ve been searching the web…didn’t find anything. I’ve been trying to copy the ePubs on my iPad to my computer to open them up and look at their CSS but haven’t figured out how to do that, either! Any help is appreciated.

  4. July 16, 2011    

    Good day Cari

    Ebooks I publish from Indesign CS5.5 do not centre the book title on the title page. If I edit the book using Sigil and enter a before the title, the problem is rectified – but then Sigil takes away the TOC. Can I not use nested styles to add the ?

    Many thanks if you could help.

    Regards

    Etienne

  5. May 13, 2011    

    @Kai
    You’re absolutely right about that. The use of a nested style or GREP style definitely doesn’t add the float:left; property to the style declaration that is added. Which makes me think that is finding might be something that Adobe’s gotta work on a bit more in a future release.
    As long as that drop-cap is a true drop cap the char-style-override will be generated.
    So for the time being we’ll just need to keep an eye out for those char-style-overrides. And hope at some point that the drop-cap style name referenced in InDesign will be as the class-value in the resulting HTML. Especially for those of us building generic template.css files that can be used across publications.

  6. May 12, 2011    

    “char-style-override” is generally generated, if you work with drop caps oder the image exportoption within a paragraph.

    The benefit of the real drop cap is, that in CS5.5 the float element and margins are generated during the export. That is not the case, if you use a nested style.

  7. May 11, 2011    

    Also, to Bob:

    First-letter won’t do it if you’re formatting fiction, because many chapters start with dialogue. Consider this opening line:

    “‘Tis lovely!” she cried.

    In that case, you may very well choose to drop-cap the first three characters. GREP can handle it easily, but a rigid “first letter” rule won’t.

  8. May 11, 2011    

    @Keith That’s an excellent work-around, especially when working in a workflow that uses a pre-defined template.css that contains the declaration.

    It would mean removing the drop-cap from InDesign altogether, and just applying the nested/GREP style instead for EPUB export purposes. This would affect the layout of the InDesign file.

    As long as there’s a true-drop-cap there, InDesign will generate the char-style-override.

    *updated this comment 12-May // CJ

  9. May 11, 2011    

    I’m still on CS4, so maybe I’m missing something, but why not use the nested feature instead of the drop-cap feature?

    That is, apply the character style “dropcap” to the first character of the paragraph?

    Do GREP styles also get recognized during export? Because if they do, that could let you automatically apply “dropcap” where needed.

    If they’re not recognized, you could still build and save a GREP search/replace that you could run on all open documents (i.e., all chapter files at once) to apply “dropcap” to the first letter OR open-quote-plus-letter OR open-quote-plus-apostrophe-plus-letter that occurs in paragraph style “body-first.”

  10. May 11, 2011    

    If it does work you could really simplify the code in your case. If the drop cap style only takes place in the first paragraph after an h1 you could have a CSS rule for “h1+p:first-letter”

    Again, though, this would really need some testing.

  11. May 11, 2011    

    @Bob

    For the document I’m working with there’s only 1 drop cap per chapter, so I basically added a style declaration for span.char-style-override-1 🙂

    The issue with drop-caps in EPUB is also that you don’t quite know how things are going to look esp, with different font support for different devices, plus font-size variations.

    Like your sample I used % in font-size and float:left 🙂

    I’m snowed under with work, so can’t really test the pseudo element atm, but not sure if that is supported with EPUB 2.0.1 … maybe once EPUB goes ‘CSS3″?

  12. May 11, 2011    

    Does EPUB support the firstletter .psuedo element? (I know Adobe Digital Editions doesn’t but I think EPUB does) If so, you could set a dropcap class for those paragraphs and then add the CSS.

    p.dropcap:first-letter {
    font-size : 300%;
    font-weight : bold;
    float : left;
    color : #c00;
    }

    This should certainly be tested on the target devices before using.

Leave a Reply

Your email address will not be published. Required fields are marked *