Highlighted

Find and swap position of period/footnote

New Here ,
Jul 06, 2020

Copy link to clipboard

Copied

Hi everyone,

 

Hoping someone can help out. I have a document with about 200 references (footnotes). I need to swap the position of the full stop (or period) so that it appear after the footnote.

 

For example, the current layout is:

Sentence.Footnote

(Or with numbers: Sentence.12)

And I need:

SentenceFootnote.

(Sentence12.)

 

Is there a way to use find and replace to swap these around? I can easily find the instances by using 

.^F

but I don't know enough to code the swap. I don't fancy manually searching through 200 references to fix them all!

 

Any help would be very much appreciated.

Thanks

Andy

Adobe Community Professional
Correct answer by Peter Kahrel | Adobe Community Professional

There must be scripts around to do that. but it's easier to rekey it than to look for it:

 

app.findGrepPreferences = app.findChangeGrepOptions = null;
app.findGrepPreferences.findWhat = '[[:punct:]]~F';
found = app.documents[0].findGrep();
for (i = found.length-1; i >= 0; i--) {
   found[i].characters[0].move (LocationOptions.AFTER, found[i].characters[1]);
}

This one swaps any punctuation and a following footnore number. Maybe the script should cater for strings of punctuation.

 P.

TOPICS
How to, Print, Scripting, Type

Views

93

Likes

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

Find and swap position of period/footnote

New Here ,
Jul 06, 2020

Copy link to clipboard

Copied

Hi everyone,

 

Hoping someone can help out. I have a document with about 200 references (footnotes). I need to swap the position of the full stop (or period) so that it appear after the footnote.

 

For example, the current layout is:

Sentence.Footnote

(Or with numbers: Sentence.12)

And I need:

SentenceFootnote.

(Sentence12.)

 

Is there a way to use find and replace to swap these around? I can easily find the instances by using 

.^F

but I don't know enough to code the swap. I don't fancy manually searching through 200 references to fix them all!

 

Any help would be very much appreciated.

Thanks

Andy

Adobe Community Professional
Correct answer by Peter Kahrel | Adobe Community Professional

There must be scripts around to do that. but it's easier to rekey it than to look for it:

 

app.findGrepPreferences = app.findChangeGrepOptions = null;
app.findGrepPreferences.findWhat = '[[:punct:]]~F';
found = app.documents[0].findGrep();
for (i = found.length-1; i >= 0; i--) {
   found[i].characters[0].move (LocationOptions.AFTER, found[i].characters[1]);
}

This one swaps any punctuation and a following footnore number. Maybe the script should cater for strings of punctuation.

 P.

TOPICS
How to, Print, Scripting, Type

Views

94

Likes

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
Jul 06, 2020 0
New Here ,
Jul 06, 2020

Copy link to clipboard

Copied

Some example images of the text as it is:

Screenshot 2020-07-06 at 20.51.12.png

 

 

And how it should look after:

Screenshot 2020-07-06 at 20.51.51.png

 

Likes

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
Reply
Loading...
Jul 06, 2020 0
Adobe Community Professional ,
Jul 06, 2020

Copy link to clipboard

Copied

There must be scripts around to do that. but it's easier to rekey it than to look for it:

 

app.findGrepPreferences = app.findChangeGrepOptions = null;
app.findGrepPreferences.findWhat = '[[:punct:]]~F';
found = app.documents[0].findGrep();
for (i = found.length-1; i >= 0; i--) {
   found[i].characters[0].move (LocationOptions.AFTER, found[i].characters[1]);
}

This one swaps any punctuation and a following footnore number. Maybe the script should cater for strings of punctuation.

 P.

Likes

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
Reply
Loading...
Jul 06, 2020 1
New Here ,
Jul 07, 2020

Copy link to clipboard

Copied

Hi Peter,

 

Many thanks for your reply. It took me a little while to figure out what to do with that code – I'm a complete novice when it comes to scripts! But once I had figured out how to get it into a suitable format and imported in to InDesign, it worked like a charm. So thanks again. 

 

The only improvement would be if it could specify which type of punctuation – in this case I had some brackets and quotation marks that got swapped along with the full stops.

 

Andy

Likes

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
Reply
Loading...
Jul 07, 2020 0
Adobe Community Professional ,
Jul 07, 2020

Copy link to clipboard

Copied

If you want to swap just the period and the footnote marker, use this:

'\\.~F'

 And to use some spcific punctuation, more than one, e.g. period, comma, and semicolon, place them in brackets:

'[.,;]~F'

 P.

Likes

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
Reply
Loading...
Jul 07, 2020 0