To make and balance pages, that is, to make sure that the text fills the text area on a page precisely and that facing pages and/or columns are equally deep, the space before certain defined paragraphs (headings, block quotes and other secondary material, etc.) can be varied a bit by adding or removing 1, 2, or 3 points.
Another requirement is to set half a line of white before or after certain text elements, while that space can't be set in a paragraph style.
Space before and (less commonly) after can be manipulated in the Paragraph panel, but that's cumbersome. When you're making pages, what you want is to use the keyboard. We'll show six scripts here which, when assigned to keyboard shorcuts, do just that.
The six scripts are in the linked zip file, below. They are in two groups: three scripts to change the space before the selected paragraph, and three others to target the selected paragraph's space after.
pspace-before-6.jsx Add half a line of white before the selected paragraph. The script calculates this on the basis of the selected paragraph's leading. It handles paragraphs with fixed and with automatic leading.
pspace-before-inc.jsx Increase the selected paragraph's space-before by 1 point.
pspace-before-dec.jsx Reduce the selected paragraph's space-before by 1 point.
pspace-after-6.jsx Add half a line of white after the selected paragraph.
pspace-after-dec.jsx Reduce the selected paragraph's space-after by 1 point.
pspace-after-inc.jsx Increase the selected par's space-after by 1 point.
Copy these six scripts to your Scripts folder, then set up keyboard shortcuts in the keyboard shortcuts editor (Edit > Keyboard shortcuts). The way I set them up is as follows:
pspace-before-6.jsx F1
pspace-before-inc.jsx Shift+F1
pspace-before-dec.jsx Crtl+F1
pspace-after-6.jsx F2
pspace-after-inc.jsx Shift+F2
pspace-after-dec.jsx Ctrl+F2
You can use any key combination you want, but the way I configured them allows me to press them with one hand.
These are fairly old scripts, but refreshed and first posted in June 2023.
Consider making a donation. To make a donation, please press the button below. This is Paypal's payment system; you don't need a Paypal account to use it: you can use several types/brands of credit and debit card.
Installing and running scripts
Questions, comments? Get in touch