Jump to content

orphaned conjunctions: a, i, o, u, y, w, z


Recommended Posts

Please, please make a checkbox that will remove orphaned conjunctios (a, i, o, u, y, w, z) from the end of line by inserting a non-breaking space between the letter and the following word.

Please think about it this way: most people in Central and Eastern Europe still use InDesign because removing the mentioned orphans is too much of a fuzz.

 

 

Link to comment
Share on other sites

On 2/6/2021 at 2:09 AM, Colorado said:

Please think about it this way: most people in Central and Eastern Europe still use InDesign because removing the mentioned orphans is too much of a fuzz

Does InDesign already have an automatic way to deal with this, other than GREP find/replace (which of course you can do in Publisher as well)? I am unaware of it, but then I have never worked on any Eastern European language.

Link to comment
Share on other sites

1 hour ago, garrettm30 said:

GREP find/replace (which of course you can do in Publisher as well)?

I just wanted to post that idea as well, but I thought I'd better test it first:
While you can easily search for such one-character prepositions and conjunctions using regex "\h\w\h", apparently you cannot replace with a combination of regex and Affinity special characters à la "\h\w<NBPS>".
All I then get is "w "…

Am I missing something or is this yet another halfbaked feature of limited use…?
I have only very basic regex knowledge though, but to be sure I just looked up regular-expressions.info/shorthand.html yet again.

For the record, being a native Czech speaker, I'm quite familiar with these typographical issues.
So the only workaround is to search and replace each combination as plain text, and replacing with " x<NBPS>"
e.g. in Czech:
" a "
" i "
" k "
" o "
" s "
" u "
" v "
" z "

Link to comment
Share on other sites

45 minutes ago, loukash said:

Am I missing something or is this yet another halfbaked feature of limited use…?

Publisher regex is not half-baked. I would love to be able to save searches like in InDesign, but Publisher's faithfulness in interpreting regex itself seems to be better than InDesign in my experience.

I don't know a thing about your language, so I may have missed something important, but here is a first try. Search for:

\h([aiouywz])\b

Replace with:

 $1

Note that the first character in the replacement string is a no-break space, but some browsers will copy it as a regular space. But this gets you the idea. That will change any space before one of those single-letter words into a no-break space. If I didn't get all the letters you needed, just add another letter between the square brackets in the search string. If you need to search for words of more than one letter, let me know, and I will come up with an additional search.

@loukash What you are missing here is the concept of capture groups, which is probably to be your next cool trick in your mastery of regex. You're going to love them. I will try to explain. Parentheses define capture groups. In the example above, I search for any character of a, or i, or o, (etc.). By putting that inside of parentheses, I have defined a capture group. When we go to replace, we can use $1 to substitute whatever was found each time in that capture group. The $1 is because it is the first capture group. If you had more than one capture group, it would just be sequential: $2, $3, etc. $0 is equal to the entire match, no parentheses required.

Here is another example to illustrate. Let's say you want to change this phone number 987-645-4321 to the format 987.645.4321. We build a pattern to look for three sets of one or more digits with hyphens between them, and we will define each set of digits as a capture group so that we can use them in our replacement:

(\d+)-(\d+)-(\d+)

In our replacement string, we will rebuild it using periods and the digits that matched in our capture groups:

$1.$2.$3

Give it a try:

https://regex101.com/r/7jAa5d/3

If you have a whole lot of extra time, you might consider a couple of videos I made to demonstrate regex at use in Publisher when another forum member was wanting some tutorials. The first post is here: 

 

Link to comment
Share on other sites

34 minutes ago, garrettm30 said:

Replace with:


 $1

Argh! Silly me!
I'm still a regex noob…

35 minutes ago, garrettm30 said:

Note that the first character in the replacement string is a no-break space

It's the other way round: what we need is <NBSP> after the preposition so that it's never at the end of a line.

So the search string for Polish is:

\h([aiouywz])\b\h

Search string for Czech:

\h([aikosuvz])\b\h

Replace with:

<space>$1<NBSP>

… where <space> is a simple " " character and <NBSP> is the Non Breaking Space special character placeholder from the loupe menu.

Works perfect.

Link to comment
Share on other sites

45 minutes ago, garrettm30 said:

Parentheses define capture groups.

Yes, now I remember that I've already been there many times before – the old Media Rage.app uses regex to manipulate audio file tags – but I forgot about it today in this context. D'oh!

48 minutes ago, garrettm30 said:

a couple of videos I made to demonstrate regex at use in Publisher

Thanks, will check that out.

Link to comment
Share on other sites

  • 1 year later...
On 2/8/2021 at 7:49 PM, loukash said:

Argh! Silly me!
I'm still a regex noob…

It's the other way round: what we need is <NBSP> after the preposition so that it's never at the end of a line.

So the search string for Polish is:

\h([aiouywz])\b\h

Search string for Czech:

\h([aikosuvz])\b\h

Replace with:

<space>$1<NBSP>

… where <space> is a simple " " character and <NBSP> is the Non Breaking Space special character placeholder from the loupe menu.

Works perfect.

Hi!

It doesn't work for me.

When I paste: "\h([aiouywz])\b\h" in Find - nothing happend :(

Link to comment
Share on other sites

12 minutes ago, loukash said:

Regex search active?

I can't see anything like Regex in Publisher, where it is?

 

edit: Ok, you mean regular expression right? 

Now its work but it find letters even in inside lines :/ 

Link to comment
Share on other sites

  • 1 month later...
On 2/8/2021 at 9:37 AM, garrettm30 said:

Does InDesign already have an automatic way to deal with this, other than GREP find/replace (which of course you can do in Publisher as well)? I am unaware of it, but then I have never worked on any Eastern European language.

Sorry for replying to your old post. No, InDesign doesn't have a way to deal with runts yet and I find it a surprising gap given how many releases they've done.

Non-hyphenated runts are common in English, too:

she was born in 1898 and died of pneumonia at age
7.

really was a bit too expensive, at least for Mary and
I.

You have to use Grep in both InDesign and Affinity to avoid runts, at least runts not caused by hyphenation. It would be great if in "Flow Options" a checkbox named "Prevent last line runts" was added along with a field named "Minimum length of last word". If checked and you set it to 2 characters (the period wouldn't count), you'd eliminate single-character words on the last line - Publisher would force the prior word to the last line. Set it to 3 and you'd eliminate runts like "56" and "me".

The problem with adding this is that Affinity doesn't have whole paragraph justification so fixing a runt might cause a justification issue. But using Grep would lead to the same justification issue. For now there's really no replacement for a manual review.

Affinity Publisher/Designer/Photo for macOS Monterey 12.6, MacBook Pro 14" (M1 Pro)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

Please note there is currently a delay in replying to some post. See pinned thread in the Questions forum. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.