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?
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
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?
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.
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
--changing the beginning and ending codes makes the search target only the Article-Numbers that are an entire paragraph by themselves.
7 years ago, limited but just enough here:
Other thing that has nothing to see with Roland Dreger's Script*! …
Soon, you could use this new Grep syntax:
Replace by: $1~-$2
(^/) The Jedi
[* "Tables" and "Live" very clever features imagined in this so cool Script.]
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!
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...