A little while ago I made this post. Because of that I can automate placing footnote references where they are needed. Now the problem is that the actual footnote texts are just placed randomly in the text. So it might look like this at some point in the text:

1 This is usually due to radiation on Mars

2 See also: S. Soddus, a guide to the universe

Then there will be some text in between and a page later you'll get

3 Some more footnote text about the universe

4 You get the point

So now I would really love to find a way to automatically cut-paste each text and place it with their respective footnote references. By using the technique described in the linked post, I've created empty footnotes at the bottom of the pages. Now I'd like to fill in the first footnote with the footnote text "This is usually due to radiation on Mars" and so on for all the empty footnotes until they're all filled with the right text.

It's easy to use a regular expression (GREP) to find all the footnote texts:


Now the command should be: for each found value of 'd' in this regular expression, cut the text directly behind it (until the end of the paragraph) and place it with the footnote matching the same value for 'd'. However, I have never made a script before so could anybody help me out?

Your Answer

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

Browse other questions tagged or ask your own question.