CreativePro Forum
Join our community of graphic designers, publishers, and production artists from around the world. Our members-only forum is a great place to discuss challenges and find solutions!
- You must be logged in to reply to this topic.Login
Changing the format of an Index
Tagged: index, non-breaking space, Surnames
- This topic has 9 replies, 4 voices, and was last updated 12 years ago by
Tom Pardy.
-
AuthorPosts
-
-
December 24, 2013 at 12:07 am #66492
Tom Pardy
MemberOK, so it is Christmas Eve (do Americans call it “Holiday Eve”?) and nobody wants to work hard. So I don’t mind if it takes a few days before someone gives me an answer.
My problem is this. I have a genealogical document that lists a few thousand (I suspect about 5,500) individuals, all of whom are members of an extended family. This document has an alphabetical index of all these people (very handy for anyone doing genealogical research) but the problem is that the names, even though they are in alphabetical order of surnames, are written in the customary western format of firstgivenname, middlegivenname, surname. I would prefer that the index listed people with their surname first. Here is a sample of the current formatting, taken from the “S” listings (I hope these people appreciate the fame they are gaining by my listing them here):
Valma Lavinia Scott 2264
Daniel Patrick Scully 10774
Frank David Seaton 10834
Tamra Seaton 10835
Tony Seaton 10836
Alison Seeley 3710
Allan Clifford Seeney 2840The number at the end is a means of identifying that individual in the genealogical software from which the index was constructed. It is not part of the problem. In each case, the surname has a character style (Index Surname) and the number has a different character style (Index ID No).
What I want to achieve is a list that looks like this
Scott, Valma Lavinia 2264
Scully, Daniel Patrick 10774
Seaton, Frank David 10834
Seaton, Tamra 10835
Seaton, Tony 10836
Seeley, Alison 3710
Seeney, Allan Clifford 2840In other words, I want to select the surname, move it to the beginning of the paragraph, place a comma after it and (if necessary) a space between the comma and the first of the given names. Yes, I can do this by hand, but for five-and-a-half-thousand? Come on!
Perhaps one of you glyph experts (of whom I have great admiration because it is utterly comfusing to me) or even one of you script experts (which I find even more confusing so I regard you with awe) can give me a much simpler solution than doing them one at a time over the next several weeks?
Thanks in advance.
-
December 24, 2013 at 4:03 am #66493
Chris Thompson
MemberSounds like a data processing job for something database-y:
Take the text out of InDesign, separate into a table of columns (space-separated), sort out the two-namers from the three-namers and adjust, then reorder the columns of the table.
Import back as a table, apply the styles to text in the relevant columns, then convert the table back to text and done.Unless someone has a grep or scripting way to do it within InDesign?
Edit: if they don’t, get in touch and I’ll volunteer.
-
December 24, 2013 at 7:55 am #66494
Tom Pardy
MemberHmmm. Thanks for the suggestion.
The information is already in a table format and the names are just in the first column. There are four other columns covering such matters as date of birth, date of death and other genealogical information. I am hesitant to take the name data out as it could become disjointed from the rest of the data.
I will wait to see what other suggestions come up when people gradually recover from too much celebration and come back to reading this forum. It is not rushing to meet a deadline and, in fact, I have been slowly working my way through the list doing it by hand in the meantime. But I do appreciate your help.
-
December 24, 2013 at 8:02 am #66495
Chris Thompson
MemberOK, fair enough.
You could always take the entire database and process just the name column into separate columns as described above. Would be an improvement to the source data too (always easier to put small chunks back of data together in whatever way you want than to take large chunks apart!)
Good luck,
Chris -
December 25, 2013 at 3:08 am #66498
Gert Verrept
MemberTry these. I didn’t manage to do it in one grep for all, I had to use a grep for 3 names and one for 2 names.
For 3 names:
Change
(\w+)( \w+ )(\w+)(?= \d+)
replace
$3, $1 $2
For 2 names:
Change
(\w+ )(\w+)(?= \d+)
Replace
$2, $1Did a test with a few names and it seems to work, but maybe someone can do it in one trick
Gert
-
December 25, 2013 at 3:51 am #66499
Tom Pardy
MemberThank you, Gert.
I tried the first step (ie., the ones with three names) and it sort-of worked. But it changed the surnames (now shown as the first name with a comma following) to normal text and changed the last of the given names to the character style for surnames. That needs to be ironed out.
I didn’t try the formula for two names because it seems to me that it is likely to pick up the last two names of all the previously-changed three-name entries and swap those two names around, inserting another comma. Could I get around that by inserting a ^p before the grep expression in both the “find” and “replace” slots? (I am a babe-in-the-woods when it comes to grep.)
I am also curious to see what other suggestions people may come up with when they return from the holiday break.
-
December 25, 2013 at 6:00 am #66500
Gert Verrept
MemberIndeed,
I didn’t (and unfortunately don’t) had the time to check it out completely. I just adapted a grep we made some time ago for a similar problem (but with always the same sequence).
I hope the others can correct the problem more properly.
I think it’s best to run the grep first and then the styling. -
December 27, 2013 at 11:14 pm #66513
Tom Pardy
MemberPosting this further query for the same genealogical document I am working on will serve to bring this to the top again. I am still keen to hear of further suggestions on the problem of moving surnames, but have another question.
In the main body of my document, many of the names have a tiny graphic inserted inline immediately after them (do you really need to know its nature?), normall separated from them by an ordinary space (generated by the space bar). Fairly frequently these inline graphics are followed immediately (no space) by a comma. Mostly that causes no problems but, if the graphic happens to fall at the end of a line, the comma flips down to the next line — not a good look. Not quite so bad, but not what I actually want, if the name happens to come at the end of a line, the tiny graphic (with or without a following comma) flips down to the next line. Inserting a non-breaking space between the name and the tiny graphic does not prevent this happening.
Is there some way I can force the comma to remain with the graphic that precedes it? If I insert a hair space, they do stick together but is this the only way to achieve it? And can I force the graphic (with a space) to remain with the name that precedes it?
-
December 28, 2013 at 7:39 am #66515
David BlatnerKeymasterYou could do a regular search for
^a,and apply the No Break style to it. That code is “any anchored object followed by a comma”As for Gert’s grep code above: Wow, I completely forgot that grep find/change would do that. How annoying! It’s like it dissociates the styling with the text. Weird! That is probably why in the SortParagraphs.jsx script, there is a way to do it with or without paying attention to the formatting.
Personally, I think the trick of breaking it into a table and manipulating it in Excel is a pretty good one. Pariah S. Burke wrote an article about doing something like that in InDesign Magazine a while back… must have been in 2008, because I referenced it in this post: https://creativepro.com/alphabetize-data-in-tables.php
-
December 28, 2013 at 8:42 pm #66519
Tom Pardy
MemberHmmm… Thanks for your reply, David. Sadly, the tiny graphic is not an anchored object, simply an inline object. It is a small rectangle, inside which is the registration number of that individual. Do inline objects count as anchored objects or would they need to be specifically designated as anchored? I don’t know that I have the patience to go through the entire document looking for each one — there are hundreds of them and not all that many happen to fall at the end of lines.
It was interesting to go back to that 2008 post and to realise how far InDesign has come in the last five years. Imagine, many of us were only using CS2 back then! Does it even still work on current operating systems?
The sorting question has kinda become academic now in that, while waiting for a possible solution, I have been steadily working through the index one-at-a-time and making a manual conversion. The task is now done (yes, all 4,920 entries — I must be mad!) and I am now interested in any further suggestions simply to store the information “in my hatband” (as an earlier generation would have said) for future reference.
-
-
AuthorPosts
- The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
