Skip to main content
Participant
May 16, 2023
Question

Only use the higher between space before and after

  • May 16, 2023
  • 4 replies
  • 607 views

Hi everyone, I'm trying to achieve something in InDesign that I would never thought Microsoft Word would have managed better. I'd like to have the spacing between two different paragraph the higher value between the space after of the first one and the space before of the second one and not the sum of both values as it is.

E.g. if i have Paragraph 1 with space after: 5 mm and Paragraph 2 with space before: 10 mm i'd like the spacing to be 10 mm and not 15 mm.

Thanks

This topic has been closed for replies.

4 replies

John Mensinger
Community Expert
Community Expert
May 16, 2023

Word is a word processor with some "user friendly" auto-compromises built in. Some of those features—the one you cite is a good example—sacrifice user input for anticiated user-perpetrated conflict, or outright error.

 

InDesign, on the other hand, only does exactly what express user input dictates, as it should.

James Gifford—NitroPress
Legend
May 16, 2023

user-perpetrated conflict

 

A description for all output from Word, ever? 😄 😄 😄

 

FRIdNGE
May 16, 2023

Simplistically, 1 click [quickly written]!

 

/*
    _FRIdNGE-0736_AdjustParasSpaces.jsx
    Script written by Michel Allio [16/05/2023]
*/

app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "Adjust Paras Spaces! …");

function main()     
    {
        // Check if Open Document
        if ( app.documents.length == 0 ) {
            alert( "No Open Document! …" )
            exit();
        }
        
        var myDoc = app.activeDocument;

        var myCondition = myDoc.conditions.item('Para1');
        if ( !myCondition.isValid ) myCondition = myDoc.conditions.add({name: 'Para1', indicatorMethod: ConditionIndicatorMethod.USE_HIGHLIGHT, indicatorColor: UIColors.GRID_ORANGE});

        var myCounter = 0;

        var myStories = myDoc.stories,
        S = myStories.length,  s;

        for ( s = 0; s < S ; s++ ) {

            var myParas = myStories[s].paragraphs,
            P = myParas.length,  p;

            for ( p = 0; p < P ; p++ ) {
                try {
                    if ( myParas[p].spaceAfter != 0 && myParas[p+1].spaceBefore != 0 ) {
                        if ( myParas[p].spaceAfter >= myParas[p+1].spaceBefore ) {
                            myParas[p+1].spaceBefore = 0;
                            myParas[p+1].appliedConditions = [myCondition];
                        }
                        else {
                            myParas[p].spaceAfter = 0;
                            myParas[p].appliedConditions = [myCondition];
                        }
                        myCounter++
                    }
                } catch(e) {}

            }
            
        }
        
        alert( "Done! [" + myCounter + "]" )
    }

 

(^/)  The Jedi

Barb Binder
Community Expert
Community Expert
May 16, 2023

Hi @daniele.demidio:

 

I don't know how to get around that in InDesign—perhaps someone else does—but you can log feature requests here: https://indesign.uservoice.com/.

 

~Barb

~Barb at Rocky Mountain Training
James Gifford—NitroPress
Legend
May 16, 2023

Well, just editorializing, but I don't regard Word's behavior in this respect as "better" - just different. I've lost a lot of hours over the years to frustrations with that selective spacing collapse.

 

But if you haven't, look at InDesign's 'ignore spacing between paragraphs' feature, which allows things like simpler spacing rules for list items.