4 Replies Latest reply on Sep 20, 2011 7:13 AM by David W. Goodrich

    Once more on right-aligning footnote numbers with GREP

    David W. Goodrich Level 3

      For some jobs I want the footnote numbers in the notes to align on the period that I have IDCS4's Footnote Options add (along with an en-space) as the Separator between the note number and the text of the note.  No big deal if I define the footnote paragraph style with an "Align to Decimal" tab and then insert that tab at the start of the note.  I recently bumped into this thread from 2009 where RodneyA described this in more detail, and Eugene Tyson added a GREP search to automate adding the tab: replace (~F) with \t$1.


      I cannot get this to work in IDCS4.  Did it work in earlier versions?  Earlier this year Jongware explained that GREP cannot replace a footnote marker, only look ahead or behind the marker to replace whatever.  Unfortunately, in my footnotes there's nothing ahead of the footnote marker for GREP to replace until I manually put my tab there.  Adding those tabs to hundreds of notes by hand isn't so bad (jumping with Ctrl + arrow keys), and ID's propensity for occasionally eating a note means I need to check them all anyway.  But am I wrong in thinking that if I want to automate adding the tabs I'll need to do so via JSX?




        • 1. Re: Once more on right-aligning footnote numbers with GREP
          David W. Goodrich Level 3

          Sorry, I managed to lose the Jongware reference -- and I guess the new Jive version doesn't permit editing.

          • 2. Re: Once more on right-aligning footnote numbers with GREP
            Peter Spier Most Valuable Participant (Moderator)

            I think you should still have half an hour to edit unless someone responds...

            • 3. Re: Once more on right-aligning footnote numbers with GREP
              [Jongware] Most Valuable Participant

              David, when stating you cannot get something to work it's important you also tell why


              But when I tried your "replace (~F) with \t$1" for myself it became real obvious straight away: the code ~F does not only indicate "the footnote reference number" but also the footnote itself in the text. So, while it works in the sense that you get a tab before the footnote number code, you get loads of extra tabs in your text as a bonus.


              There are several ways to circumvent this. The most obvious is to limit the replace operation to just the paragraphs styled with your footnote style. If that's a unique one (mine usually is), it'll work straight away. That's Eugene's first answer in the previous thread -- possiblly you forgot to set this Paragraph style in the Find Format field.


              Another way is to only add a tab when the footnote number code is at the start of a line:




              replace with




              (You are correct in noticing the "lookbehind" trick cannot be reversed to a lookahead for just 'start of line followed by the footnote number code'. It's a Limitation of InDesign's particular flavor of GREP.)

              This one may fail if you ever have a footnote at the start of a paragraph


              Yet another way is to try to make use of the vertical position of the footnote number code. If your references are in superscript (which is fairly regular) and the numbers in the notes themselves are not (which they may or may not be), you can look for


              ~F (+ position: normal)


              and replace with itself plus a tab before, as above. (A variant could be to use a character style for the superscripted references and look for [None] character style to pick up the ones inside the footnotes.)

              • 4. Re: Once more on right-aligning footnote numbers with GREP
                David W. Goodrich Level 3

                Yes, I should have mentioned that I, too, use a special footnote paragraph style that I have ID apply to the notes.  I tried again just now, stepping through the notes one by one, replacing ~F with \t$0.  Nothing.  Not only did the file look the same,  ID reported the file as unchanged.  But if I hit Change All the GREP replacement works!


                I'm vaguely aware of differences in Change vs. Change All (I seem to recall that applying a paragraph style to whole paragraphs via Change All can zap local formatting).  And certainly I've been burned by using Change All without sufficiently testing my parameters with Change.  But this is a case where caution is counter-productive.  Live and learn.


                Thanks for your help,