How to hyphenate numbers?

Community Beginner ,
Dec 16, 2020 Dec 16, 2020

Copy link to clipboard

Copied

Hello,

how can I hyphenate numbers?

 

I have the following problem:
In my catalog are many tables with Article-Numbers, which consists of numbers and letters, f.e. ABC123XYZ. I need to hyphen this Article- Numbers in the corresponding column, so the content fits (and line-breaks if needed) and causes no overset errors. Unfortunately indesign doesnt hyphenate numbers, even when I add the Article-Number with hyphens to the user-dictionary through Edit>Spelling>UserDictionary...

 

Because of many entries, I need this to happen automatically and not manually by adding Type>InsertSpecialCharacter>HypensAndDashes>DiscretionaryHyphens.

 

How can I solve this?

Thanks...

TOPICS
How to, Type

Views

110

Likes

translate

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 16, 2020 Dec 16, 2020

Copy link to clipboard

Copied

This is a job for GREP find/change - (edited for discretionary hypen instead of a dash)

This expression will work even if your number of letters and numbers is not always the same.

It finds a full "word" consisting of any number of upper case letters followed by any number of digits, and replaces it with the letters, a discretionary hyphen, then the numbers

Screen Shot 2020-12-16 at 11.46.49 AM.pngScreen Shot 2020-12-16 at 11.46.01 AM.png

 

Likes

translate

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 Beginner ,
Dec 17, 2020 Dec 17, 2020

Copy link to clipboard

Copied

Thanks, it works, but theres a small drawback, the search applies to the complete document. Is it possible to specify the search and apply only on tables in the document?

Likes

translate

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 17, 2020 Dec 17, 2020

Copy link to clipboard

Copied

If the text in your tables has a different paragraph- or character style formatting (or different formatting), you could use that (in the Find Format box of the GREP dialog) to isolate the change to the tables.

Likes

translate

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 17, 2020 Dec 17, 2020

Copy link to clipboard

Copied

One more option, if the formatting idea does not work:

If the table cells each contain only the number, and in other cases the number is part of a paragraph, you could change to expression to 

^(\u+)(\d+)$

--changing the beginning and ending codes makes the search target only the Article-Numbers that are an entire paragraph by themselves.

 

Likes

translate

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
Advocate ,
Dec 17, 2020 Dec 17, 2020

Copy link to clipboard

Copied

Hi Susan!

 

7 years ago, limited but just enough here:

 

https://www.rolanddreger.net/de/249/highlight-grep-in-indesign/

 

Other thing that has nothing to see with Roland Dreger's Script*! …

Soon, you could use this new Grep syntax:

 

Find: \<(\u+)(\d+)\>(?#Tables)

Replace by: $1~-$2

 

(^/)  The Jedi

 

[* "Tables" and "Live" very clever features imagined in this so cool Script.]

Likes

translate

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 Beginner ,
Dec 17, 2020 Dec 17, 2020

Copy link to clipboard

Copied

@FRIdNGE

Unfortunately there is no difference in the results between

\<(\u+)(\d+)\>(?#Tables)

and

\<(\u+)(\d+)\>

But thanks for the mentioned script, it helps.

Likes

translate

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
Advocate ,
Dec 17, 2020 Dec 17, 2020

Copy link to clipboard

Copied

I've written "Soon" not "now!  =D

… and sure, this new syntax has no more effect comparised to Susan's grep code/

 

Use Roland's script for now!

 

(^/)

Likes

translate

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 Beginner ,
Dec 17, 2020 Dec 17, 2020

Copy link to clipboard

Copied

Hm, this option doesnt show the complete number of hits. It shows a very small amount of results. Nevertheless, the approach is very helpful and I will continue testing till the correct result. Thanks for your help...

Likes

translate

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