: 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
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?
More posts by @Vandalay110
3 Comments
Sorted by latest first Latest Oldest Best
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-chapterTitle
> heading-chapterSubtitle
>> heading-leadingQuote
>>> text-base
>>> text-base
>>> ...
heading-chapterTitle
> ...
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.
Do a GREP search for (?<!r)^.+
Set the applied paragraph style in your find query to the text style.
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.
Flexibler
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:
Crawl through the text and find the chapter opening block.
Target the next paragraph (the beginning of the chapter text).
Apply your "text-opener" style.
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.
[ UPDATE ]
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.
No, you’re supposed to use two separate styles.
Why are you trying to confuse how things are formatted by having two separate visual appearances be applied by a single style?
Nested styles might be needed to achieve this effect but it sounds like that is what you are already using. If you want you can attempt to have the styles automatically applied depending on the content of the text.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.