2

Is there any way of finding and replacing footnotes inside punctuation with the same number footnote outside the punctuation? I don't mind doing separate find and replaces for all conceivable types of punctuation (full stops, commas, exclamation and question marks) but if I have to do it all manually it's going to take days as there are thousands of footnotes and almost all of them have been placed inside punctuation, i.e. footnote then full stop rather than the footnote after the full stop. I know there is a GREP to find the footnotes but I can't find a way of getting it to replace the footnote with the same footnote, or of leaving the footnote and moving the punctuation. Thanks in advance!

2

So basically you have two groups: a footnote and a punctuation.
Turn them into marking subexpression by wrapping them with parenthesis.
Then, you'll be able to recall them in order to swap them:

Find

(~F)([.,?!~e])

Change to

$2$1

You'll notice I added ~e in the character class. It's the metacharacter for ellipsis.

Edit:
There's a posix metacharacter called [[:punct:]] that includes all punctuation signs. I would advice not to use it because it catches signs you (1) might not want to catch.

Some examples: enter image description here

Additional thought: in case you did set up your footnotes as per the example above (number followed by a dot), do not forget to untick "include footnotes" in the Find/replace panel.

(1) Please note that, as a Frenchman, I don't know the English rules about footnotes placement. Apparently they are different from ours...

| improve this answer | |
  • Brilliant, thank you so much! Just so I understand how this works, the $1 indicates the first listed subexpression and the $2 indicates the second listed subexpression? – Daniel James Smith Feb 18 at 11:11
  • 1
    That's exactly it :-) – Vinny Feb 18 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.