Avoid a single letter at the end of a line?

Explorer ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

Hello

is it possible to automatically avoid having a single letter at the end of a line? 

 
Is it possible to set a minimum number of letters under which they must necessarily wrap as for the hyphenation?
Thanks
TOPICS
How to

Views

673

Likes

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
Adobe Community Professional ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

I don't think so, but that's because a single letter (usually a or I, in English) at the end of a line is not considered a wrapping fault. There's no demand for a rule to prevent it.

 

It's not a seamless fix, but I'd just use a hard space after that e and any like it (GREP or search/replace for all instances).

|| Word & InDesign to Kindle (& EPUB): a Professional Guide (Amazon)

Likes

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
Adobe Community Professional ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

Yes, it's possible, as part of a paragraph style. If you search for terms like runts or orphans you should find some other threads on this topic which discuss the pros and cons of doing this.

The short answer is you would need to add a GREP style to add a character style that consists of nothing but No Break to your chosen minimum number of characters. One expression that should work is .{N}$ where N is your desired number.

Likes

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
Adobe Community Professional ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

@Peter Spier if you look at the OP screenshot, the single letter (a e in its exemple) is not located at the end of a paragraph but at the end of a line, and AFAIK there is now way to choose “end of a line” using GREP. If it exists, I would love to know how!

Likes

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
Adobe Community Professional ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

You could apply no break to any single letter and space.

 

Below you can see I applied the style “No break” to the term. I added an underline to see where it is applied.

(?<=\s)[\l\u]\s

Screenshot 2021-12-03 at 5.34.58 PM.png

Likes

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
Adobe Community Professional ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

If I had such a requirement, I would probably apply a grep style in paragraph style with character style No Break or something similar.

\h\K\w\h\w(?=\w+)

 

Likes

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
Explorer ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

Thank you.

I tried to add your grep style to paragraph style:

Schermata 2021-12-03 alle 08.34.38.png

but I don't see any change in text

Schermata 2021-12-03 alle 08.35.38.png

what am I doing wrong?
I don't know anything about grep.

.

Likes

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
Adobe Community Professional ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

Did your applied character style actually include application of the No Break attribute?

 

Likes

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
Explorer ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

No.

Likes

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
Adobe Community Professional ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

Here are some more explanatory screenshots:

 

without grep style

no_single_letter_at_the_end_of_a_line_01.png

 

with grep style

no_single_letter_at_the_end_of_a_line_02.png

 

no_single_letter_at_the_end_of_a_line_03.png

 

no_single_letter_at_the_end_of_a_line_04.png

 

paragraph style with grep style and character style No Break (colored for better illustration)

no_single_letter_at_the_end_of_a_line_05.png

Likes

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
Adobe Community Professional ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

Ah, much better. I misread the post and was looking at it as end of paragraph rather than end of line.

For what it's worth I agree that a single character at the end of any line other than the last is not a compositional problem, though I would probably not want to see a single character followed by a hyphen, but that is controllable in the hyphenation settings.

The biggest problem I see with this kind of requirement is a major performance hit as the grep style must constantly look at the entire paragraph, or maybe even story, as text is entered or edited and the paragraph composer re-flows the exisitng text.

Likes

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
Adobe Community Professional ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

That is one possible mistake.

 

Another one:

Did you applied the paragraph style?

Likes

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
Explorer ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

Yes.
Is the grep correct in this way?

 

Schermata 2021-12-03 alle 13.24.38.png

Likes

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
Adobe Community Professional ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

Did you write that grep? Or did you copy it from one of my recent posts?

 

If the latter, please highlight the entire grep code in the Grep Style tab. Perhaps you accidentally copied a space at the beginning or at the end.

 

Maybe you can also upload a test document without confidential data as Indd with specification of the exact InDesign version and link it here (e.g. Dropbox or similar). A filled text frame and your paragraph format + character format is sufficient.

Likes

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
Explorer ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

Likes

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
Adobe Community Professional ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

I think the problem is CS6. I don't think that version recognizes the \h or \K parameters.

Likes

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
Adobe Community Professional ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

Hi Peter,

pixxxelschubser's GREP Style is also working with InDesign CS6 version 8.1.0.420 on Windows 10.

 

Working-GREP-Style-in-INDD-CS6.PNG

 

Regards,
Uwe Laubender

( ACP )

Likes

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
Adobe Community Professional ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

So it is.

Likes

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
Adobe Community Professional ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

pixxxelschubser_0-1638563433942.png

 

I copied it from your post here above.

This is the test file:
https://drive.google.com/file/d/1qbNEd1tUX9tY2SywEUS-8QheHmZ2N60p/view?usp=sharing

ID CS6

this is the .idml file:
https://drive.google.com/file/d/1bMm35R3OezKaovg1I4ze5NVXnJY8Fyod/view?usp=sharing

thanks a lot


By @AntonioTheAnt

 

Unfortunately, you need an access authorization.

See:

No_access.png

Likes

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
Advisor ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

Just For \Grep Comment! …

 

Capture d’écran 2021-12-03 à 21.56.54.png

 

As we talk about “no-break” (enough greedy, catching the following char), here, this Grep code will be simplistically enough:

 

\b\w\h

 

(^/)  The Jedi

Likes

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
Explorer ,
Dec 10, 2021 Dec 10, 2021

Copy link to clipboard

Copied

Thanks all.

Likes

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
Explorer ,
Dec 10, 2021 Dec 10, 2021

Copy link to clipboard

Copied

I'm sorry, I thought I solved it but I can't get the result I'm looking for. I have tried to assign all the grep styles you have suggested but in no case can I avoid that single letters remain at the end of the lines. If anyone would kindly upload an example file (.idml because I use InDesign CS6 8.0.2 on Mac) to dropbox or drive, I would be very grateful.

Likes

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
Adobe Community Professional ,
Dec 10, 2021 Dec 10, 2021

Copy link to clipboard

Copied

The tendency of solutions to use GREP and scripts sometimes seems (to me) a bit like using a sledgehammer to drive a tack.

 

Do you have any single letters besides 'e' in your project? Is a simple search and replace for 'e ' (e space) to 'e^S' (e nonbreaking space) not sufficient, even if you occasionally have to repeat it? The nonbreaking space will disappear into whole lines, and prevent the e from being left at the end of any line.

 

If you have other letters, a wildcard in the search would get all of them. (' ^$ ' to ' ^$^S')

 

Not seamless, automated and elegant, but sometimes a simple solution is all you really need. I guess you could write a script to do it. though. 🙂

|| Word & InDesign to Kindle (& EPUB): a Professional Guide (Amazon)

Likes

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
Advisor ,
Dec 10, 2021 Dec 10, 2021

Copy link to clipboard

Copied

LATEST

Of course, if you do ignore what is a "no-break"! In French here! …

 

Capture d’écran 2021-12-10 à 19.07.22.png

 

(^/)

Likes

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