Jump to content
You must now use your email address to sign in [click for more info] ×

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 "

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

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.

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

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.

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

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, radd91 said:

It doesn't work for me.

Regex search active?

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

Link to comment
Share on other sites

The top cog menu in the Find panel > select Regular Expression

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

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.

Download a free manual for Publisher 2.4 from this forum - expanded 300-page PDF

My system: Affinity 2.4.2 for macOS Sonoma 14.4.1, MacBook Pro 14" (M1 Pro)

Link to comment
Share on other sites

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

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.

Hi guys, does is this still work for you in 2.0 Publisher?

I used to use this trick all the time, but in 2.0 it finds nothing..

Link to comment
Share on other sites

20 minutes ago, Liborl said:

Hi guys, does is this still work for you in 2.0 Publisher?

Mělo by. Nedávno jsem to zkoušel. Ale teď zrovna nemám k v2 přístup.

To jest: nesmíš to brát doslova, viz:

On 2/8/2021 at 7:49 PM, loukash said:

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

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

Link to comment
Share on other sites

  • 5 months later...
On 12/8/2022 at 4:10 PM, Liborl said:

Hi guys, does is this still work for you in 2.0 Publisher?

I used to use this trick all the time, but in 2.0 it finds nothing..

try this (?i)(\<[aiouwz])\x{20}

* ctrl F > cog wheel Find and select "Regular Expression"
* Enter phrase: (?i)(\<[aiouwz])\x{20}
* there is a magnifying glass next to the search place, select Special Non-Breaking Space and copy what will complete itself
* enter in Replace: $1 and the copied Non-Breaking Space character
* search and replace all

Link to comment
Share on other sites

  • 2 weeks later...
On 3/26/2022 at 5:32 PM, MikeTO said:

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 can solve runts problem in InDesign first by creating a "No brake" chararcter style and then by adding these two lines in the "Body Text" paragraph style under "Grep Style":

Apply Style: No brake
To Text: .{10}$

Number 10 means you want minimum 10 characters at the last line of the paragraph.

I hope Affinity will add GREP in paragraph styles very soon.

All the latest releases of Designer, Photo and Publisher (retail and beta) on MacOS and Windows.
15” Dell Inspiron 7559 i7 Windows 10 x64 Pro Intel Core i7-6700HQ (3.50 GHz, 6M) 16 GB Dual Channel DDR3L 1600 MHz (8GBx2) NVIDIA GeForce GTX 960M 4 GB GDDR5 500 GB SSD + 1 TB HDD UHD (3840 x 2160) Truelife LED - Backlit Touch Display
32” LG 32UN650-W display 3840 x 2160 UHD, IPS, HDR10 Color Gamut: DCI-P3 95%, Color Calibrated 2 x HDMI, 1 x DisplayPort
13.3” MacBook Pro (2017) Ventura 13.6 Intel Core i7 (3.50 GHz Dual Core) 16 GB 2133 MHz LPDDR3 Intel Iris Plus Graphics 650 1536 MB 500 GB SSD Retina Display (3360 x 2100)

Link to comment
Share on other sites

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

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.

 

 

You can use this expresion:

Find:        <SPACE>(\u|\l)<SPACE>
Change:  <SPACE>
$1~S

where you need to change <SPACE> with regular space character.

All the latest releases of Designer, Photo and Publisher (retail and beta) on MacOS and Windows.
15” Dell Inspiron 7559 i7 Windows 10 x64 Pro Intel Core i7-6700HQ (3.50 GHz, 6M) 16 GB Dual Channel DDR3L 1600 MHz (8GBx2) NVIDIA GeForce GTX 960M 4 GB GDDR5 500 GB SSD + 1 TB HDD UHD (3840 x 2160) Truelife LED - Backlit Touch Display
32” LG 32UN650-W display 3840 x 2160 UHD, IPS, HDR10 Color Gamut: DCI-P3 95%, Color Calibrated 2 x HDMI, 1 x DisplayPort
13.3” MacBook Pro (2017) Ventura 13.6 Intel Core i7 (3.50 GHz Dual Core) 16 GB 2133 MHz LPDDR3 Intel Iris Plus Graphics 650 1536 MB 500 GB SSD Retina Display (3360 x 2100)

Link to comment
Share on other sites

  • 5 months later...

Few years ago we were talking about it here. The solution seems to be still about the same.
But occasionally it is not working as expected.

When I do the search and fix it for each individual occurrence at a time it works well. But If I do the mass replacement, it seems to pick the first found result of the regex, and than use it to replace all other occurrences. So I got the no breaking space correctly, but all the prepositions are the same. :( Anyone have seen similar behaviour?

 

Link to comment
Share on other sites

41 minutes ago, Petr Illek said:

When I do the search and fix it for each individual occurrence at a time it works well. But If I do the mass replacement, it seems to pick the first found result of the regex, and than use it to replace all other occurrences. So I got the no breaking space correctly, but all the prepositions are the same. :( Anyone have seen similar behaviour?

If you can recreate this, please show us the Find string and the Replace string you used, and the options set via the cog icon for the Find field. A sample document, or a sample set of text from your document would also be useful.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

3 hours ago, Petr Illek said:

Few years ago we were talking about it here. The solution seems to be still about the same.
But occasionally it is not working as expected.

Have you seen my regex formula I use? It works great for any language.

All the latest releases of Designer, Photo and Publisher (retail and beta) on MacOS and Windows.
15” Dell Inspiron 7559 i7 Windows 10 x64 Pro Intel Core i7-6700HQ (3.50 GHz, 6M) 16 GB Dual Channel DDR3L 1600 MHz (8GBx2) NVIDIA GeForce GTX 960M 4 GB GDDR5 500 GB SSD + 1 TB HDD UHD (3840 x 2160) Truelife LED - Backlit Touch Display
32” LG 32UN650-W display 3840 x 2160 UHD, IPS, HDR10 Color Gamut: DCI-P3 95%, Color Calibrated 2 x HDMI, 1 x DisplayPort
13.3” MacBook Pro (2017) Ventura 13.6 Intel Core i7 (3.50 GHz Dual Core) 16 GB 2133 MHz LPDDR3 Intel Iris Plus Graphics 650 1536 MB 500 GB SSD Retina Display (3360 x 2100)

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...
×
×
  • Create New...

Important Information

Terms of Use | 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.