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

Full vertical justify but last frame

Explorer ,
Jan 05, 2026 Jan 05, 2026

Hi.

In a book with continuous text (text boxes linked), I have a style in each new chapter to make sure it starts in a new page.

All frames have full justify in VERTICAL alignment, but I wanted something to detect the last frame before the new chapter to make it aligned top. That is because the last frame will probably have much less text and justify it will make it very ugly.


Can be a style, script, GREP...


Any idea?


Many thanks,

Luiz

TOPICS
EPUB , Print , Scripting
244
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 ,
Jan 05, 2026 Jan 05, 2026

Create a blank rectangle and add text wrap and insert it as an anchored object at the end of the chapter. 

This forces the text to the top.  

 

It doesn't have to be big. You could make a decoration for aesthetics end of chapter horizontal line, or image or whatever you might have. 

 

It will flow with the text.

Make it an object style for easy manipulation later on.

 

Screenshot 2026-01-05 at 14.25.24.png

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 ,
Jan 05, 2026 Jan 05, 2026

Why do it this way? Vertically-justified frames cannot allow the last short text volume float to the top.

Instead, why not setup paragraph styles with leading and keep options (or even snap to baseline)?

 

Pages and paragraphs can be tweaked for fit.

Mike Witherell
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 ,
Jan 05, 2026 Jan 05, 2026

Hi Mike - hope you don't mind that I just chime in as I have specific case-use scenario on a daily basis here for this workflow too, and I do wish that the Text Frame Options had this setting, last frame <Alignment Option> at end of a story. It makes a lot of sense and is a bit frustrating for me sometimes.

Certain workflows require vertical justification across all frames especially in long-form books where consistent bottom alignment is part of the visual system.

 

Baseline grids, leading tweaks, or paragraph keep options don’t really solve this when content is fluid. As text, images, tables, or footnotes are added or removed, those methods quickly become fragile and time-consuming to rebalance. You often end up chasing reflow issues across multiple pages.

 

Vertically justified frames guarantee consistent column depth and bottom alignment, which is usually preferable to having visibly ragged bottoms near chapter breaks. The issue isn’t why vertical justification is used it’s how to gracefully handle the final, short frame of a chapter without breaking the rest of the system.

 

That’s why an anchored object (even something subtle like a small rule or spacer with text wrap) works well, it respects the vertical justification model, survives reflow, and doesn’t require manual intervention every time the text changes.

 

In short baseline grids are great when the layout is stable; anchored objects are better when the content isn’t.

 

Here's a basic example, with a heading, columns, table, and keep options the bottom can look ragged. Yes, you can align to a baseline grid, or other methods, but if text reflows, or leading/text size changes, which it can in my work on a daily basis - it's a bit fragile. 

 

Top shows bottom ragged - but the bottom portion shows same text justified. - which gives a cleaner look visually. 

Yes, a baseline grid works too, but when it comes to tweaking size and leading to fit it can be trickier. 

And I know, vertical justification can stretch the leading and make it look uneven, but I guess that's a compromise.

Screenshot 2026-01-05 at 14.57.18.png

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 ,
Jan 07, 2026 Jan 07, 2026
LATEST

Well and clearly stated, Eugene. Thank you!

Mike Witherell
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 ,
Jan 05, 2026 Jan 05, 2026

It sounds like you're looking for something like my (not free) Unjustified script: https://www.id-extras.com/products/unjustified/

Run the script, and all the last pages of chapters will be "unjustified" (i.e., top-aligned).

If text reflows (so that what used to be an end-of-chapter is not an end-of-chapter any more), simply run the script again. It keeps track of any frames it modified, resets them, and then applies top-align to the new ends of chapters.

Nothing to learn! It just works.... 🙂

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 ,
Jan 05, 2026 Jan 05, 2026

Here's a script to change the vertical justification of the text frame preceding the frame that contains the chapter paragraph style. Before you use it, change the name of the paragraph style in the second line to the style that you in fact use.

[Ariel beat me to it with his much more versatile script -- hadn't see his post]

(function () {
  var styleName = 'chapter';
  var frame;
  app.findGrepPreferences = null;
  app.findGrepPreferences.appliedParagraphStyle = 
    app.activeDocument.paragraphStyles.item (styleName);
    
  var found = app.activeDocument.findGrep();
  for (var i = found.length-1; i >= 0; i--) {
    frame = found[i].parentTextFrames[0].previousTextFrame;
    if (frame) {
      frame.textFramePreferences.verticalJustification = 
        VerticalJustification.TOP_ALIGN;
    }
  }
}());

 

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
Guide ,
Jan 05, 2026 Jan 05, 2026

Hi Peter,

 

Basing on your Code:

 

(function () {

    var myDoc = app.activeDocument;

    // Global Reset:
    var myTextFrames = myDoc.textFrames;
    var T = myTextFrames.length,  t;
    for ( t = 0; t < T; t++ ) {
        if ( myTextFrames[t].label === "top-align" ) {
            myTextFrames[t].label = "";
            myTextFrames[t].textFramePreferences.verticalJustification = VerticalJustification.JUSTIFY_ALIGN;
        }
    }

    // Tag to be added manually at the end of the "Chapter" text:
    var myTag = '~j'; // Non-Joiner

    app.findGrepPreferences = null;
    app.findGrepPreferences.findWhat = myTag;
    
    var myFound = myDoc.findGrep();
    var F = myFound.length,  f;
    for ( f = F-1; f >= 0; f-- ) {
        myFound[f].parentTextFrames[0].label = "top-align";
        myFound[f].parentTextFrames[0].textFramePreferences.verticalJustification = VerticalJustification.TOP_ALIGN;
    }
    app.findGrepPreferences = null;

    myDoc.recompose();

    alert( "Done!" )

}());

 

(^/)  The Jedi

 

 

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 ,
Jan 05, 2026 Jan 05, 2026

Thank you to you all. It is interesting that I'm doing books for several years and was fixing manually... The kind of things like "we always did this way", and was good to find better options. 

 

Thank you again!

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