a Grep search for Footnotes

1,376 views
Skip to first unread message

Michel Raj

unread,
Sep 28, 2011, 6:22:07 AM9/28/11
to indesi...@googlegroups.com
In the book I'm working on, the authors did put the footnotes numbers in the text after the "»" and the editors wants them before...
"»1" instead of "1»"

Searching for
(»)(~F)
and replacing by
$2$1

doesn't work, because the note is lost in the replacement and I get the "<?>" instead of the note number...

Any idea ?

TIA
Michel

William Adams

unread,
Sep 28, 2011, 7:17:08 AM9/28/11
to indesi...@googlegroups.com

You can either script this, so that one finds each note in turn, cuts it, moves the cursor, then pastes it back in place, or you can dump to Adobe Tagged Text and do the change there --- might be able to do it in .idml, but I'm finding that even less easy to work w/ than .inx.

William

--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

Harbs

unread,
Sep 28, 2011, 7:35:36 AM9/28/11
to indesi...@googlegroups.com
Try doing it in two steps:

Find: ‭(?<=»~F)(.)‬
Change: »$1

Find: ‭»(?=~F)
Change to nothing

Harbs
http://www.in-tools.com
Innovations in Automation

> --
> you are subscribed to "InDesign talk" on Google Groups, to post: send email to indesi...@googlegroups.com, to unsubscribe: send email to indesign-tal...@googlegroups.com, for more options visit http://groups.google.com/group/indesign-talk

Michel Raj

unread,
Sep 28, 2011, 8:28:28 AM9/28/11
to indesi...@googlegroups.com
Thanks, this doesn't work, but I'll try to go in a similar way.

In fact, my texts are more precisely
"anyword »1"
so there's a non breaking space just after the word, and the number is of course superscript as it's the calling number of the note.

Otherwise, I'll do the changes in a .inx

Thanks
Michel

Michel Raj

unread,
Sep 28, 2011, 8:46:19 AM9/28/11
to indesi...@googlegroups.com
Tried again what you said and now it works...
This look ahead way is the way to go !
Thanks again.

Michel Raj

unread,
Sep 28, 2011, 9:18:13 AM9/28/11
to indesi...@googlegroups.com
Oh and just one more thing...

I had to include the end of § in the search, so I just changed (.) in (.|\r)

I found this as I had a different number of results between the two steps. ;-)

Thanks again.
Michel

Le 28 sept. 2011 à 13:35, Harbs a écrit :

Roy McCoy

unread,
Sep 28, 2011, 9:44:02 AM9/28/11
to indesi...@googlegroups.com
William wrote:

You can either script this, so that one finds each note in turn,
cuts it, moves the cursor, then pastes it back in place, or you can
dump to Adobe Tagged Text and do the change there --- might be able
to do it in .idml, but I'm finding that even less easy to work w/
than .inx.

Harbs' two-step GREP seems to beat this, though it could also be
scripted and I'll do that in AppleScript as an exercise, though a
script offers no immediate advantage for a single application of it.

tell application "Adobe InDesign CS5.5"
  set find grep preferences to nothing
  set change grep preferences to nothing
  set find what of find grep preferences to "~s(?=»~F)"
  set change to of change grep preferences to ""
  change grep document 1
  set find what of find grep preferences to "(?<=»~F)(.)"
  set change to of change grep preferences to "»$1"
  change grep document 1
  set find what of find grep preferences to "»(?=~F)"
  set change to of change grep preferences to "~|~|"
  change grep document 1
  set find what of find grep preferences to "(?<=~F)»"
  set change to of change grep preferences to "~s»"
  change grep document 1
  set find grep preferences to nothing
  set change grep preferences to nothing
end tell

I modified the sequence to keep Michel's nonbreaking space
before the guillemet and to add a little space before the
footnote reference. It could likely be simplified, and I
haven't checked it with his last (.|\r) amendment.

Speaking of scripting, I didn't mention it before in this list
but Shirley Hopkins' AppleScripting InDesign CS5 and CS5.5 came off
the press a couple of weeks ago. It's excellent and I'm sure people
on this list will want to have it. The Amazon order page is at http://astore.amazon.com/yourscriptdoc-20/detail/1463797656,
but if you order direct from http://www.yourscriptdoctor.com you
get a CD included with the PDF of the book, scripts, and resources
for testing. William and I both went over PDF proofs of the book,
so it's pretty clean if we do say so ourselves.


Roy
Reply all
Reply to author
Forward
0 new messages