Drop caps for first paragraph in chapter in InDesign


Is there a way to format paragraph styles so that only the first paragraph in each chapter gets a drop cap?

So far I have seen this solved by saving a "first_paragraph" style and a "regular" style to be the next-style, however I am modifying an imported text, so I need it to be able to automatically change all first chapter paragraphs.

Is there a way to de this without introducing separating into two paragraph styles?

7/19/2015 3:24:00 AM

Different styles are for different styles

You don't want one style to produce two different visual results. That would be a very strange feature. What you're after is automation of applying the styles. That makes sense.

I assume you have your whole book chained in one text flow. And the styles surrounding your chapter text are already in place from the source. The source doc should have the basic semantic framework in place.

So from the source file your styles should look something like this:

> heading-chapterSubtitle
>> heading-leadingQuote
>>> text-base
>>> text-base
>>> ...
> ...

Easy answer

Break each chapter into it's own source doc prior to import. Assuming your style flow is opening stuff > text > end of chapter as I outlined above, you should be able to select the frame at the start of the chapter and apply style then next (or whatever it's called). Problem solved.

^ There's also a slick scripting solution for that, but it breaks the "easy answer" promise.

Flexible answer

Assuming a structured pattern like my outline, InDesign has all the search power to do the style application for you.

  1. Do a GREP search for (?<!\\r)^.+
  2. Set the applied paragraph style in your find query to the text style.
  3. Set the applied p-style in replace to your "text-opener" style.

That will set the first paragraph in a sequence of text-styled paragraphs to your desired style. The problem is, you can only run it once and you need to be sure you don't have the opener style applied anywhere yet.


InDesign's javascript library can make this more flexible. Once you set something like this up, minor adjustments can make it serve all sorts of purposes.

Write functions to:

  1. Crawl through the text and find the chapter opening block.
  2. Target the next paragraph (the beginning of the chapter text).
  3. Apply your "text-opener" style.
  4. Repeat until you reach the document's end.

InD gives you script access to all the search functions your heart desires.

If you're new to scripting, it may sound daunting at first. It's really not that difficult and there are plenty of people on Adobe's forum to help you out. I haven't written scripts for InD in a long while, but if I find something to get you started, I'll post it back here.


For reference

The definitive on-line guide to InDesign's javascript library for just about every version of the app is kindly provided by Jongware.

Here's an example that shows you how to access your paragraph styles and apply them. In this case, it's just operating on the selected story and applying according to the order of the paragraphs. Not a very flexible approach (compared to searching), but it might work for you.

var mySelection = app.selection[0],
    paraStyle1 = app.activeDocument.paragraphStyles.itemByName("style1"),
    paraStyle2 = app.activeDocument.paragraphStyles.itemByName("style2");

mySelection.paragraphs[0].appliedParagraphStyle = paraStyle1;
mySelection.paragraphs[1].appliedParagraphStyle = paraStyle2;

Another option: Don't learn, just pay for it. This fine scripter has already solved your problem and packed it up nicely.

enter image description here

7/24/2015 8:37:00 PM