9 Replies Latest reply on Jun 21, 2017 7:24 AM by [Jongware]

    Change footnote numbering

    Dative Level 1

      The current endnote numbering in the book begins at one and continues on throughout the book, I need it to begin again at each chapter. They're all set to a character style, is there any way I can change them all at once? Possibly using GREP or scripting? I will also need to change the endnote numbering at the end.

        • 1. Re: Change footnote numbering
          Ian Blogs Level 3

          Go to type-footnote options and you can change the starting position of footnotes eg. page, spread or section.

          • 2. Re: Change footnote numbering
            Dative Level 1

            They're not set up as actual footnotes, they hadn't been styled as such and they're not linked to anything, they're just numbers in superscript that correspond to a separately styled endnotes section at the end.

            • 3. Re: Change footnote numbering
              Ian Blogs Level 3

              Oh well! I will have to leave it to people who are better at me in scripting.

              • 4. Re: Change footnote numbering
                Willi Adelberger Most Valuable Participant

                I do normally endote footnote numbers as numbered lists referenced as cross reference in the text by number only. I have a prargraph style which restarts with 1 and I use it there.

                2 people found this helpful
                • 5. Re: Change footnote numbering
                  Dative Level 1

                  I don't fully understand what you mean by this, but it may be correct. I currently have a superscript class with numbers going from 1 - 400 sporadically placed throughout the text, I was looking for a quick way (perhaps using GREP or a script) to change them to restart at the beginning of a new chapter. I don't know how using a paragraph style would help. They are NOT set up as 'footnotes' They're just numbers.

                  • 6. Re: Change footnote numbering
                    [Jongware] Most Valuable Participant

                    Well, you did call them "footnotes" in your title

                     

                    I've done this before, despite the lack of proper endnotes in InDesign. It takes a couple of scripts but they should be easy to find.

                     

                    1. Change all endnotes to footnotes.

                    2. Adjust the numbering.

                    3. Change all footnotes to endnotes.

                     

                    Note (no pun intended) that you need to keep an eye out on what the scripts do, exactly. The last step, Foot-to-endnote, is not a straightforward operation if the endnotes need appear at the end of each chapter. In such a case I'd probably temporary cut each chapter and paste it in a new document, change the 'notes to their opposites, and cut 'n paste back.

                     

                    If all endnotes are going at the end of your document then it should be fairly straightforward.

                    2 people found this helpful
                    • 7. Re: Change footnote numbering
                      Dative Level 1

                      Yeah sorry that's my fault!


                      What I mean is they technically should be footnotes but they're not set up using the 'footnotes' option on InDesign

                       

                      Ignore whether or not they're footnotes or endnotes, they may as well just be numbers in the text, they're not linked to the endnotes or anything, they're just superscript numbers within the text. So if you were faced with having numbers 1-400 as a superscript character style within the text, can you think of an easy way to change them so they restart at the beginning of a new chapter.

                      • 8. Re: Change footnote numbering
                        [Jongware] Most Valuable Participant

                        Then I'd look into a custom written script. A possible problem is that it would need to know where each chapter starts!

                         

                        Here is the easiest use case: manually select each chapter's text one at a time, run script. The script subtracts the correct amount -- found through the first superscripted number in that selection -- from all the superscripts in that selection.

                         

                        That'd be fairly straightforward to write as well as rather safe to run (I'd try to make it reject numbers out of range), but it hinges on this: (1) Can you select the consecutive text for each chapter? Or -- a worse case -- does the text live in non-contiguous, non-threaded text frames? (2) Do you have not too many chapters? I imagine it would be no bother for up to 10 selections, and more manual work for 10 to 20 chapter, and a real bore for yet more than that. On the plus side, you'd only have to do this once per book, and the script itself ought to be very fast on each selection.

                         

                         

                        Hold the press, I have a better idea!

                        All that it requires is a list of the first superscript number per chapter. Then, this (as yet) hypothetical script can simply go over each styled number and find out the correct value by looking it up in that list. ("Hypothetical", only at the moment. I need to stuff a bit o'food in my gullet but will give it a go somewhere tonight.)

                        1 person found this helpful
                        • 9. Re: Change footnote numbering
                          [Jongware] Most Valuable Participant

                          (Oof ... just one night later and this is on the 3rd page of questions. Perhaps it's easier to post a question here than to find something in the Online Help?)

                           

                          Adjust the top two variables in the following script to your document's needs: fill in the exact name of your "Note" character style, and the current number of the first note for each chapter. Then run the script.

                           

                          Best is to first test it on a copy! If something goes wrong, there may be no way to restore the original text. Even if you think "ah then I'll just Undo this", you may find that there are too many changes – it's rare but I have hit the Undo Stack limit in the past –, or InDesign crashes, saving the 'current' state in the mean time, and when reopening you'll find the changes are committed and no longer can be un-done.

                           

                          With the above firm in mind, here is the script. I didn't have any suitable sample with the same characteristics so I had to construct an artificial test case, but it worked correctly on that.

                           

                          // ------ adjust these for your document
                          var firstPerChapterList = [ 1, 4, 7, 11 ];
                          var characterStyleName = "note";
                          // ------ then run the following code
                          app.findGrepPreferences = null;
                          app.findGrepPreferences.appliedCharacterStyle = app.activeDocument.characterStyles.item(characterStyleName);
                          app.findGrepPreferences.findWhat = "\\d+";
                          list = app.activeDocument.findGrep();
                          firstPerChapterList.sort(function(a,b){ return b - a; });
                          while (list.length)
                          {
                           item = list.pop();
                           value = Number(item.contents);
                           for (i=0; i<firstPerChapterList.length; i++)
                           {
                            if (value >= firstPerChapterList[i])
                            {
                            item.contents = String(value - firstPerChapterList[i] + 1);
                            break;
                            }
                           }
                          }
                          
                          1 person found this helpful