Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Dynamic Par styles

Contributor ,
May 10, 2025 May 10, 2025

Hi, Dear Friends!

I have a paragraph style called "par1". This style has zero indent from the top. How can I make it so that when a paragraph with this style is after a paragraph with the style "Par0", and only then, it has an indent of 7 from the top?

 

Thank you, and have a good day!
Susan Flamingo

 

PS ChatGPT choked on this one 😞

TOPICS
How to , Type
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 10, 2025 May 10, 2025
Why not just make a new style?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 10, 2025 May 10, 2025

Yes, of course, but I am addicted to elegant automation...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 10, 2025 May 10, 2025

Are your  paragraphs styled with “Par0” style always followed by a “Par1” paragraph? If yes, just apply a space after to “Par0”

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 10, 2025 May 10, 2025

No.  That is the problem....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 10, 2025 May 10, 2025

@SuzzyFlamingo

 

There is no built-in "conditional styling" in the InDesign. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 11, 2025 May 11, 2025
LATEST

@SuzzyFlamingo

 

My tool isn't free and maybe not cheap - depends on how much you want to automate - but if you work on Windows, you could sort / filter / include / exclude by:

- page - specific / left / right / range, 

- layer - specific / range - part of the name, 

- position (x, y) - specific / area / approximate, 

- applied Master - specific / range - part of the name, 

- text / Cell / Table formatting - 400+ properties each - specific / range, 

- applied ObjectStyle to the TextFrame - specific / range - part of the name, 

- object's properties - TextFrame the text is in - 1000+ properties - specific / range, 

- you're not limited to whole paragraphs - you can mix&match F&C results - so you can search for specific words / phrases, 

- if text is in the "main flow" or in a Cell / Table, 

- if TextFrame - container - is on the page, pasteboard, part of a group or Anchored / InLined, 

- you're not limited to text being in the same text flow - Story, 

- you could even mix&match multiple documents if needed, 

- and more. 

 

After saving all the "requirements" as a Task - you can load them again to process another file - tomorrow, next month, etc. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 11, 2025 May 11, 2025

As @BobLevine points out - use more styles - it's a must for clean document structure.

 

You're probably too deep into the layout to realise that you've encountered a situation that you want to now fix.

 

Luckily that's where scripts can work wonders. 

All you have to do is create your additional Paragraph Style and then add the names of your paragraph styles to the script

Replace Par 1/Par 0/Par 2 in the quotes with your own style names. 

Save the code in a plain text file and change the extension from .txt to .jsx (or grab another srcript and duplicate it and edit it and replace the text in a plain text editor).

 

This is rudimentary - we could add a trigger to make it run automatically - like a listen event when you Save the Document 

var doc = app.activeDocument;
var stories = doc.stories;

for (var s = 0; s < stories.length; s++) {
    var paragraphs = stories[s].paragraphs;
    for (var i = 1; i < paragraphs.length; i++) {
        var thisPara = paragraphs[i];
        var prevPara = paragraphs[i - 1];
        
        if (thisPara.appliedParagraphStyle.name == "Par 1" && //insert your style name
            prevPara.appliedParagraphStyle.name == "Par 0") { //insert your style name
            thisPara.appliedParagraphStyle = doc.paragraphStyles.itemByName("Par 2"); //insert your style name
        }
    }
}

 

https://creativepro.com/how-to-install-scripts-in-indesign/

 

What I'm thinking is that we come up with Scripts to apply your paragraph styles

Then assign Keyboard Shortcuts to your Styles - if you're using hotkeys for Paragraph Styles that's perfect we can replace those Shortcuts to trigger scripts instead. 

 

So if we have script that says you want to assign par1 - the script then triggers.

 

Let us know if this works for you - automation by scripts is awesome and a huge time saver. 

 

It's just 1 extra style

And we can trigger the application with Keyboard Shortcuts when applying the styles

Or simply saving the file - but that could cause mass text shifts.

 

So I think running the script once to apply the style as you want it to appear with the extra style will work for you. 

 

Then the we could build other scripts that trigger with keyboard shortcuts to apply the styles. 

 

Are you interested in this?
If you are drop a sample file with your styles and we can take a look at automating this for you. 

 

<EDIT>

Sample file and script attached (change .txt to .jsx)

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 11, 2025 May 11, 2025

Here's a plug-in that implements conditional styling:

 

https://exchange.adobe.com/apps/cc/2e1fb2bc/conditional-styling-rules

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 11, 2025 May 11, 2025

Thank you for your attention!

So I have to pay 25/year for this? What else will you get with a subscription? 

Also, what exactly is a PlugiN in the context of ID? I would just run the scripts? 

 

Is there documentation for this that I can review before I commit?

 

Thank you, and have a good day!
Susan Flamingo

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 11, 2025 May 11, 2025
quote

Is there documentation for this that I can review before I commit?

By @SuzzyFlamingo

 

 

Their website doesn't seem to offer much yet:

leor_0-1746976493977.png

 

It's done by a reputable developer though; you can try to contact him on LinkedIn:

https://www.linkedin.com/posts/vlad-vladila-97174356_indesign-uxp-automation-activity-73034002506170...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 11, 2025 May 11, 2025

You can try the script that I supplied. If you want to enhance it let me know, no prob.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 11, 2025 May 11, 2025

Hi Suzzy,

I'm Vlad, the developer of the Conditional Styling Rules plugin. Indeed, my website is under construction (and it looks like it will still be like that for a while), but I'll try to answer your questions here (also, thank you, Peter and Leo).

A plugin in InDesign's context is a piece of software that will provide new capabilities to the base application. 

In this case, it means that once the plugin is installed and activated from InDesign's plugins menu, it will show a new panel like all the other "native" tools in InDesign, eg, "Paragraph Styles" panel or "Layers". In this panel, you can create new rules, edit existing ones, delete them, apply, etc. 

krommatine_0-1746983255914.png

 

I tried to keep the UI as self-explanatory as possible. 

Clicking on the "+" button will open the dialog to create a new rule.

For your use case, the rule is very simple:
"When "par1" is preceded by "par0" change the properties of the paragraph to add 7pt spacing on top".

krommatine_1-1746984210790.pngkrommatine_2-1746984246368.png

 

Once the rule is defined, you can apply it globally to the document, or just to a part of it, and when applying it will search for all instances of par0 preceded by par1 and change the spacing as defined. 

Of course, this is just scratching the surface of the capabilities of the plugin. You can define and apply any number of rules, and in the rule's conditions you can specify any number of styles to provide the context. For example you could create a rule that specifies "if Body_Text is preceded by any Heading style, remove the first line indent", of "if List is not followed by any list style add 10p space after". Once you have a good set of rules, a fairly regular document like a fiction book can be styled automatically just by applying all the rules. 

Hope this helps, and I hope you will like the plugin,

Cheers, 
Vlad.
PS: I just got a report that the latest InDesign update is causing the plugin to crash in some instances. I'm actively investigating it and hope to have a fix available by tomorrow. 

—————————————————————————————
Krommatine Systems — Makers of InDesign plugins, tools, and automations.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 11, 2025 May 11, 2025

Change Consecutive Paragraphs does this (not free):

https://www.id-extras.com/products/change-consecutive-paragraphs/

Documentation:

https://www.id-extras.com/help/changeconsecpro/

It also has a fully batch-editor so you can save and reuse all the settings:

https://www.youtube.com/watch?v=nd4yGJv-l3Y

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines