Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Well and clearly stated, Eugene. Thank you!
Copy link to clipboard
Copied
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.... 🙂
Copy link to clipboard
Copied
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;
}
}
}());
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more