Sunday, July 12, 2015

indesign scripting - How do I automate placing footnote references in specific places?


I'm working on a book and I have to format a lot of .pdf text in InDesign as part of the book. A lot of formatting problems can be fixed using GREP. However, I don't think it's possible to use GREP to input footnote references in specific places.


I work as follows: I open a .pdf file in Google docs, then I copy paste the text from Google docs to InDesign. The problem arises with a text such as the following:



In het algemeen geldt dat degene die beslist over de doeleinden en de inzet van een camera als verantwoordelijke wordt aangemerkt.4 Er kunnen meerdere verantwoordelijken zijn.5 In sommige gevallen is wettelijk bepaald wie als verantwoordelijke wordt aangemerkt.6



The original footnote references are reverted to plain text (numbers) and it is very time-consuming to delete the number, insert a footnote reference and then paste the footnote information at the bottom of the page.


If it were possible, I could just open GREP, then in the 'Find what' box I could put "\.\d" (assuming the footnote number doesn't exceed 9) and change it to a footnote reference. Is there an easy way to do this with InDesign scripting? I don't mind copy-pasting the footnote information, I think that would be very hard to automate given the random position of footnote information in the text. I would just like a way to automate inserting the footnote reference in the body text. I have no programming experience unfortunately so any help would be very much appreciated.



Answer





  1. Insert a footnote anywhere.

  2. Cut it.

  3. In the GREP Find/Replace box, set Find What to \.\d+ and Change To to .~c.

  4. Press "Change All". (Or perhaps "Change, Find Next" until done, if you are not totally sure you want all of these digits replaced with a footnote.)


The + in the Find GREP code is to pick up as many digits as there are. The code ~c in the Replace field is Contents of the Clipboard, which is why you had to put one in there as the first step. This is the code for "including formatting"; if you find you have to fix the formatting too often, you can also use ~C, which pastes without formatting.


This find-and-replace routine inserts empty footnotes; you still have to move the proper text into each manually. If the footnotes appear as separate paragraphs at the "bottom" of each original page, there may not be a scriptable way to fix them all at once.


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...