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

Avoid sentence starting line with single letter

Contributor ,
Jun 11, 2022 Jun 11, 2022

Copy link to clipboard

Copied

Is there a way to set body text to avoid the end of a line starting a new sentence with a one or two character word? It interrupts flow, in my view, to have a single short word like "I" or "At" as a lone fragment at the end of line following a completed sentence, until they eye tracks down and back to the next line's start.

I'd be interested in a method to have this automatically controlled by settings, and a way to do it selectively, case-by-case. Thanks in advance.

TOPICS
How to , Type

Views

155

Translate

Translate

Report

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 ,
Jun 11, 2022 Jun 11, 2022

Copy link to clipboard

Copied

I can think of a few different ways to achieve this effect. The method that would be most like something that is "automatically controlled by settings" would be for each Paragraph Style to have a GREP Style that applied a No Break character style to any instance of 

   Beginning of word followed by

   One or two letters ("word characters") followed by

   One space followed by 

   One letter

 

(\<\w{1,2})(\s)(\w)

 

There are other ways to build that regular expression; for instance, you could use word boundaries instead of spaces to isolate your one-or-two-letter word.

 

But this method relies on having all of the text in your document marked with well-managed paragraph styles. That's the way that the regulars here in this forum will advise you to work. However, you could do a global find-replace where you look for one of the above patterns, and replace the space following the word-one-to-two-letters-long with a non-breaking space character. Then it wouldn't matter whether or not you were using styles. For your "selective use" case you could simply replace any given non-breaking space with a normal word space, which would be fewer steps than turning your GREP Style off in your paragraph style. 

Find:

(\<\w{1,2})(\s)(\w)

Replace with:

$1~S$3

 

 

 

 

 

Votes

Translate

Translate

Report

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 ,
Jun 12, 2022 Jun 12, 2022

Copy link to clipboard

Copied

Far be it from me to tell you what pleases you aesthetically, but I can easily see this causing real problems in justified text, bad rags in ragged text, and possible cases of forcing a story into overset if you have a string of short words in a row on a narrow column.

Votes

Translate

Translate

Report

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 ,
Jun 12, 2022 Jun 12, 2022

Copy link to clipboard

Copied

LATEST

Ha! I wrote pretty much exactly what Peter wrote, but I deleted it in an effort to not be judgy about your preferences. Just the string "If I am at a..." would be enough to cause problems if they were all strung together with No Break or with non-breaking spaces.

 

There was another blind alley I wandered down for a moment; the Find/Change window doesn't have the search scope of looking at text in InDesign line by line, but you can do so in ExtendScript. So, we could write a script that searched only for one or two short words at the end of the line. So then you'd be able to search for your undesired short words, instead of riding the lines all the way through the document. And that's where the judgy part happens to be, coincidentally. We should probably be looking at the rag with our eyes and our judgmental capacites, not trusting algorithms to lay them out for us without human intervention.* That's totally a value judgment on my part, and one regarding which I feel pretty confident. You might want a tool to help you affect the rag when your line ends in a short word, but I wouldn't suggest programatically preventing all short words from appearing at the ends of lines. 

 

*I mean, I suspect that eventually the machine learning people will develop some algorithms that ride the lines for us; dunno if we'll all be out of our jobs or not, at that point. But today, we should be riding the lines. 

Votes

Translate

Translate

Report

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 ,
Jun 12, 2022 Jun 12, 2022

Copy link to clipboard

Copied

The most time-saving way is the one suggested by Joel, but yes, it can create some difficulties in particular cases shown by Peter. So you can use another way. You can change an usual space after the single uppercase letter to nonbreaking space using Find/Change window > GREP option.

"Find What" field: (\s\u)(\s) (Space, Any uppercase letter) followed by (Space).

"Change To" field: $1~S — keeping the first parenthesis content and changing the last simple space to nonbreaking space.

Votes

Translate

Translate

Report

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