4

Is it possible to automatically limit the minimal number of characters in the last line of the paragraph, so that when InDesign Paragraph Composer does its job and hyphenates the paragraph, it ensures that the last line is at least N character wide?

1 Answer 1

4

Eureka! Create a new character style NoBreak based on [None]. Tick "No Break" for it in "Basic Character Formats". Then in your paragraph styles add a new GREP style so that apply NoBreak style to text .{10}$. Instead of 10 fill in any number you need as a minimum number of characters in the last line of the paragraph. That's it!

To make the solution more general, one can change regular expression to something like (?<=.{55}).{10}$. Instead of 55 fill in an average width of a line in your paragraph measured in characters. In this case the style will only be applied if a paragraph has more than or equal to 55 + 10 characters in it.

3
  • Be warned that, while it might work for your text, it is not a good general solution: it will also get applied to 2-line paragraphs where the second line is very short.
    – Jongware
    Sep 6, 2016 at 8:32
  • 1
    @RadLexus To make the solution more general, one can change regular expression to something like (?<=.{55}).{10}$. Instead of 55 fill in an average width of a line in your paragraph measured in characters. In this case the style will only be applied if a paragraph has more than 55 + 10 characters in it. Sep 6, 2016 at 20:13
  • 1
    Yes! That should do nicely, and indeed it depends on the average number of characters/line. You can even pick as many "at least" lines as you want, by using a multiple of the number for your font/size/margins.
    – Jongware
    Sep 6, 2016 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.