18 Replies Latest reply: Feb 16, 2014 3:58 AM by Karin Enskog Ali RSS

    Loosing Footnotes when placing word in InDesign

    renti 2013

      Hi everyone,

       

      I seem to have a problem that has been discussed before, but there is no suitable answer with a real solution.

       

      When importing (placing) a word file (.rtf), some of the notes are misplaced, namely the number of the footnote looks like a spuare with a pink highlight, while the text of the note is moved to the next footnote, misplacing the footnotes from their proper location.

       

      Does anyone have a solution? Many have had this problem, but I couldn't find any real solutions.

        • 1. Re: Loosing Footnotes when placing word in InDesign
          Ellis home Community Member

          Enable Preflight: Windows/Output/Preflight and see if there's a description of an error. That might give you a clue.

          • 2. Re: Loosing Footnotes when placing word in InDesign
            renti 2013 Community Member

            Hi,

            Thanks for the answer, but it doesn't detect it as a problem.

             

            However, I found some other advices on other forums, wich led me to reinstall older versions of InDesign. The Word file seemed to work fine when placed in the same indd file but opened in InDesign 4. Afterwards I just saved the file, opened it in ID 5.5 and it was fine.

             

            This just might be the solution. It seems there is a bug in ID Cs 5.5. I hope it will work on other problem files too.

            • 3. Re: Loosing Footnotes when placing word in InDesign
              renti 2013 Community Member

              Still having problems. They are not so many, but still no complete soluntion.

              Anyone?

              • 4. Re: Loosing Footnotes when placing word in InDesign
                [Jongware] MVP

                The ID version that imports footnotes without (as many) problems is not CS4 -- which I use on a daily basis, problems and all -- but CS3. It seems things got only worse with later versions, rather than better.

                 

                I've as much as given up *totally* on trying to import footnotes. Instead, I adopted the following workaround: always convert all footnotes to endnotes in Word; import into ID; convert endnotes back to Footnotes.

                 

                It's a hassle, but not as big as trying to import the same problematic document over and over, only to find it didn't work again.

                 

                The only thing this workflow stumbles on is when an author changed the note numbering style in Word. InDesign doesn't import it 'wrong' or 'not' or 'with errors', no, instead InDesign crashes.

                • 5. Re: Loosing Footnotes when placing word in InDesign
                  AnneMarie Concepcion ACP

                  How are you converting endnotes back into footnotes?

                   

                  AM

                  • 6. Re: Loosing Footnotes when placing word in InDesign
                    [Jongware] MVP

                    Hi AM,

                     

                    With a script of course -- the reverse of Peter Kahrel's FootnoteToEndnote. It scans for the exact text "(Endnotes)", which should be somewhere in your document, and counts how many 'notes' it is followed by.

                     

                    It does so by looking for paragraphs starting with numbers, where each next one should increment by 1.

                     

                    Then it does the same for superscripted numbers. Any numbers out of sequence are ignored, so in a sequence of text "note¹, a² + b² = c², note², note³", the first superscripted 1 and 2 are found, then the superscripted 3 at the end. Usually, this is not a problem -- only rarely I have found it to pick up the wrong number. (And then you can be pretty sure the right number occurs somewhere before the next note.)

                     

                    It also circumvents the downright idiotic "import failure" where you get a blasted superscripted square instead of the right number.

                     

                    If it finds exactly the same number of superscripts and notes, it moves the text into position. If the target position occurs inside a table, it places the new note immediately before this table. (One thing I found is that a script can and will place a footnote inside a table. It's just that ... InDesign doesn't mentally cope very well with this.)

                     

                    It works at a blistering pace, in InDesign CS4, for notes up to in the hundreds, and barely makes an error. It nicely circumvents my eternal quandary of (1) does this journal use footnotes or endnotes?, and (2) why oh why does CS4 such a crappy job of importing footnotes? As well as -- bonus! -- (3) for some jobs I have to convert endnotes into footnotes. All I have to do is move the notes section to the end, add a line "(Endnotes)" before them, and run it.

                     

                    Here is the script. (... looking forward to "New in CC! Convert Endnotes to Footnotes, See, We Are Listening To You!".)

                     

                    //DESCRIPTION:Convert Endnotes to Footnotes
                    // A Jongware Script 31-May-2013
                    // Free to Use but Do Not Remove the above lines or change it into your name.
                    
                    app.findGrepPreferences = null;
                    app.findGrepPreferences.findWhat = '^\\(Endnotes\\)$';
                    var startNotesAt = app.activeDocument.findGrep();
                    if (startNotesAt.length == 0)
                    {
                              alert ('Unable to locate "(Endnotes)", is this in the document at all?');
                              exit();
                    }
                    if (startNotesAt.length != 1)
                    {
                              alert ('Found more than one text "(Endnotes)", that cannot be right can it?');
                              exit();
                    }
                    
                    startNotesAt = startNotesAt[0];
                    
                    noteText = startNotesAt.parentStory.characters.itemByRange(startNotesAt.characters[-1].index+2, startNotesAt.parentStory.characters.length-1).paragraphs.everyItem().getElements();
                    
                    nNote = 0;
                    i=0;
                    while (i<noteText.length)
                    {
                              nnum = noteText[i].contents.match(/^\d+/);
                              if (nnum && Number(nnum)==(nNote+1))
                              {
                              //          alert ('so this must be note '+String(nNote+1)+':\r'+noteText[i].contents);
                                        nNote++;
                                        i++;
                                        continue;
                              }
                              noteText.splice(i,1);
                    }
                    // alert ('Recognized '+nNote+' notes');
                    
                    app.findGrepPreferences = null;
                    app.findGrepPreferences.findWhat = '\\x{FFFD}|\\d+';
                    app.findGrepPreferences.position = Position.SUPERSCRIPT;
                    var noteRefs = app.activeDocument.findGrep();
                    
                    i = 0;
                    while (i < noteRefs.length)
                    {
                              if (noteRefs[i].parentStory == startNotesAt.parentStory &&
                                        noteRefs[i].index > startNotesAt.index)
                              {
                              //          alert ('disregarding '+noteRefs[i].contents+' (inside notes)');
                                        noteRefs.splice(i,1);
                                        continue;
                              }
                              if (noteRefs[i].contents == "\uFFFD")
                              {
                                        i++;
                                        continue;
                              }
                              if (Number(noteRefs[i].contents) != i+1)
                              {
                              //          alert ('disregarding '+noteRefs[i].contents+' (out of order)');
                                        noteRefs.splice(i,1);
                                        continue;
                              }
                              i++;
                    }
                    
                    // alert (noteRefs.length);
                    /* for (i=0; i<noteRefs.length; i++)
                    {
                              if (noteRefs[i].contents == "\uFFFD")
                                        noteRefs[i].contents = String(i+1);
                    } */
                    
                    if (noteRefs.length != nNote)
                    {
                              alert ("Found "+noteRefs.length+" superscripted numbers, but recognized "+nNote+" notes. Something is wrong, can't go on like this.");
                              exit();
                    }
                    
                    var noteFrames = [];
                    for (i=nNote-1; i>=0; i--)
                    {
                              noteFrames[i] = app.activeDocument.textFrames.add();
                              noteText[i].parentStory.characters.itemByRange(noteText[i].characters[0].index, noteText[i].parentStory.characters.item(-1).index).move (LocationOptions.AT_BEGINNING, noteFrames[i].texts[0]);
                              while (noteFrames[i].parentStory.characters[-1].contents == '\r')
                                        noteFrames[i].parentStory.characters[-1].remove();
                              lengthOfPrefix = noteFrames[i].parentStory.paragraphs[0].contents.match(/^\d+\.?\s*/)[0].length;
                              noteFrames[i].parentStory.characters.itemByRange(noteFrames[i].parentStory.characters[0].index, noteFrames[i].parentStory.characters[0].index+lengthOfPrefix-1).remove();
                    }
                    
                    for (i=nNote-1; i>=0; i--)
                    {
                              if (noteRefs[i].parent instanceof Cell)
                              {
                                        newNote = noteRefs[i].parentStory.footnotes.add(LocationOptions.BEFORE, noteRefs[i].parentStory.insertionPoints[noteRefs[i].parent.parent.storyOffset.index-1]);
                              } else
                              {
                                        newNote = noteRefs[i].parentStory.footnotes.add(LocationOptions.BEFORE, noteRefs[i].insertionPoints[0]);
                                        noteRefs[i].contents = '';
                              }
                              noteFrames[i].parentStory.move (LocationOptions.AFTER, newNote.texts[0]);
                              noteFrames[i].remove();
                    }
                    
                    • 7. Re: Loosing Footnotes when placing word in InDesign
                      AnneMarie Concepcion ACP

                      Thanks Jongware!

                       

                      I may include it in a video I'm recording this week at lynda.com if

                      that's okay with you.

                       

                      "Making InDesign and Word Work Together Nicely Without Going Insane" is

                      my suggested title but I think they'll vanilla it a bit....

                       

                      AM

                       

                      <mailto:forums_noreply@adobe.com>

                      June 11, 2013 3:02 PM

                       

                      >

                            Re: Loosing Footnotes when placing word in InDesign

                       

                      created by <http://forums.adobe.com/people/%5BJongware%5D>

                      in /InDesign/ - View the full discussion

                      <http://forums.adobe.com/message/5399471#5399471

                       

                      • 8. Re: Loosing Footnotes when placing word in InDesign
                        [Jongware] MVP

                        AnneMarie Concepcion wrote:

                         

                        Thanks Jongware!

                         

                        I may include it in a video I'm recording this week at lynda.com if

                        that's okay with you.

                         

                        Sure, no prob.

                        • 9. Re: Loosing Footnotes when placing word in InDesign
                          [Ariel] Community Member

                          Great concept, Theun!

                           

                          A book I'm working on right now, though, has endnotes (in InDesign

                          already) whose numbering restarts with each chapter. This is a fairly

                          common pattern.

                           

                          So, in the endnotes section, we've got "Endnotes for Chapter 1", and

                          these are numbered from 1 to 89 (say). Then comes the next section:

                          "Endnotes for Chapter 2", and these are numbered from 1 to 50.

                           

                          So with each chapter, the endnotes restart at 1.

                           

                          If I've followed your explanation, your script as it stands won't work

                          for such a pattern, right?

                           

                          Ariel

                          • 10. Re: Loosing Footnotes when placing word in InDesign
                            [Jongware] MVP

                            [Ariel] wrote:

                             

                            If I've followed your explanation, your script as it stands won't work

                            for such a pattern, right?

                             

                            Right (= "no"). It's only meant to circumvent Word import problems -- hence, it searches for the exact string "(Endnotes)".

                             

                            The safe way: move the text of each of your chapters to a temporary new document, add the Endnotes line and the notes themselves, then run my script. Then move the entire text back into place into your main document.

                             

                            (thinking -- after all, it's a pretty smart script)

                            Since your notes restart at each chapter, you might be able to make it work first-to-last chapter. That is, add the Endnotes line marker, move the 'notes from your first chapter after this, and run the script. It should replace only the numbers in the first chapter with proper footnotes. If this worked, move the notes for chapter 2 to the end, rinse & repeat.

                             

                            Do Not Attempt with your actual document -- test this on a copy!

                             

                            Message was edited by: [Jongware]

                            • 11. Re: Loosing Footnotes when placing word in InDesign
                              [Ariel] Community Member

                              I think what I'll do, with your permission, is modify the script a little:

                               

                              First, as this book is already typeset (I'm converting it to ePub), all

                              the note references have a character style applied -- so no need to

                              search for superscript, I can just search for the applied char style.

                               

                              Then, I'll simply change it so that it only does its searches within the

                              selected story, rather than throughout the document. (Each chapter

                              occupies a separate story in this book).

                               

                              So I can just copy-paste the relevant endnotes to the end of each

                              chapter, and then run the script several time for each chapter (or even

                              loop through the stories....)

                               

                              May I modify your script to do this?

                               

                              Many thanks,

                              Ariel

                              • 12. Re: Loosing Footnotes when placing word in InDesign
                                [Jongware] MVP

                                Sure, go ahead. It sounds like you know what you're doing

                                • 13. Re: Loosing Footnotes when placing word in InDesign
                                  Karin Enskog Ali

                                  Hi there,

                                   

                                  I am experiencing the footnote problem discussed here and was recommended to use this script by a helpful InDesign Secrets forum member. I run InDesign CS5.5 on OSX 10.8.5.  Hands up, I have never run a script before - so excuse the newbie. I am sure my error is basic but I'm clearly doing something wrong!

                                   

                                  This is what I did:  I copied the script above into Text Edit and saved it in the scripts panel with a jsx extension (I’m ASSUMING it’s a Java script? Maybe this is my error?). I then created a new InDesign doc and placed the Word document, where I had previously performed the footnote to endnote conversion.

                                   

                                  The script is visible in the scripts panel and I can start it, but I immediately get a runtime error. “JavaScript Error! Error Number: 8, Error String: Syntax error, Engine: main, File: /Applications/Adobe InDesign CS5.5/Scripts/Scripts Panel/Convert Endnotes to Footnotes.jsx, Line 1/…/”

                                   

                                  Any ideas?

                                   

                                  Many thanks!!

                                  • 14. Re: Loosing Footnotes when placing word in InDesign
                                    [Jongware] MVP

                                    Karin,

                                     

                                    It is a Javascript so apparently you are doing nothing wrong. But, good thing you mention "TextEdit"!

                                     

                                    By default TextEdit saves new documents as "Formatted text", and InDesign cannot handle that for scripts. Can you try again and when copying the text into TextEdit, before saving make sure "Plain text" is selected under the menu "Formatting"? (Sorry, from memory. I'm not behind a Mac right now so the exact wording may differ.)

                                    • 15. Re: Loosing Footnotes when placing word in InDesign
                                      Laubender MVP

                                      In TextEdit app there is a toggle keyboard shortcut for this:

                                       

                                      Shift + Cmd + T

                                       

                                       

                                      Uwe

                                      • 16. Re: Loosing Footnotes when placing word in InDesign
                                        Karin Enskog Ali Community Member

                                        Thank you! I now don't get the runtime error anymore!

                                         

                                        What I do get now (again, this is probably due to my being new to scripts), as soon as I kick the script off, is this message: "Found more than one text (Endnotes). This can't be right, can it?". Then I go OK and that's it, the script doesn't run.

                                         

                                        Really appreciate your help.

                                        • 17. Re: Loosing Footnotes when placing word in InDesign
                                          [Jongware] MVP

                                          Karin, good to see you're making progress.

                                           

                                          My guess is the script is correct ... After importing text from Word, it scans the file for the exact text string "(Endnotes)". That is what InDesign inserts after importing all regular text, right before the notes.

                                           

                                          There usually is only one string "(Endnotes)" -- as far as I am aware! -- but if there is more than one, the script cannot continue: it needs the notes exactly in the format it expects. Everything right after this text is supposedly part of the end-note section, all the way up to the end of the text.

                                           

                                          I can imagine three scenario's:

                                           

                                          1. You have a weird Word document, and it contains more than a single (Endnotes) section. No solution -- how is the script to know which endnote numbered "1" belongs to which superscripted number "1"?

                                           

                                          2. You imported more than a single Word document, all with endnotes, into the same document into InDesign. Same problem as #1. Try importing one document at a time and process its notes immediately, or import the document into a temporary (empty) InDesign file, process notes, then copy to your final document.

                                           

                                          3. You have a weird author and s/he inserted the exact text "(Endnotes)" somewhere in the plain text.

                                          • 18. Re: Loosing Footnotes when placing word in InDesign
                                            Karin Enskog Ali Community Member

                                            Hi Jongware,

                                             

                                            You were right: something is definitely weird, and it's not the script, not even Wordt! IN FACT, I think it's an InDesign bug. The problem happens at the place stage. The Word document has all the endnote references (in this case 32) in the right place once I've done the footnote to endnote conversion. And it has the endnote numbers in the right places too. But when the document is placed (using autoflow) the endnotes are divided up into different parts of the InDesign document! 9 places in fact! And some of the notes are placed within overset text (?!) I think this must be another Word import bug. The other bug that I have come across when I use autoflow to place a document is that portions of the content freezes and cannot be selected.

                                             

                                            Having decided to deal with this separately, I tested the script on a document that only contained two endnotes. This time, I got the error message "Found 0 superscripted numbers, but recognized 2 notes. Someting is wrong, can't go on like this." And sure enough, InDesign hadn't imported the endnote numbers.

                                             

                                            BUT: what I did then was - I converted the Word document into RTF. And VOILA, the script works!

                                             

                                            (The rtf format seems to bring other problems. Wiith large docs it crashes my system and for this particular doc I notice that bullet points become squares. I can easily resolve these  missing glyphs, just hope I will not discover too many other issues.)

                                             

                                            So thank you, Jongware! The problem that I brought up originally is solved andf I'm v happy about that!

                                             

                                            As an aside: do other people use autoflow to place documents? Is it just me, or is it known to  actually not work v well?