• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

Superscripting endnotes in Imported Word doc/GREP?

Engaged ,
Sep 04, 2020 Sep 04, 2020

Copy link to clipboard

Copied

Hi. Using  ID 15.1.2 on Win10/1904.

I'm importing a series of Word docs from my author (usally bringing them in as RTF, but have tried .DOCX -- both seem to work). The Word docs include properly formatted Word endnotes. ID imports these well -- the endnotes go to the end of the ID doc, and the references in the text appear as superscript. (They are not formatted as character style superscript, but I can find the numbers and change them, as I do with BF and Italic.)

However, sometimes references come in long strings -- 2, 34, 43, 104. In this case, the numbers are superscript (and I can find them) but the commas between them are NOT superscript. (The commas ARE properly superscript in the original Word doc, but somehow this does not get placed correctly by ID.)

I would like to search for these strings of numbers and format them -- and the commas between them -- as the defined character format superscript. I suspect that GREP is the answer, but being a wretched GREP newbie, I'm at a loss to define the correct expression.

Can anyone help?

Thanks.

-j

TOPICS
How to , Import and export

Views

182

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 04, 2020 Sep 04, 2020

You can find numbers separated by a comma, but you can't find superscripted numbers separated by a non-superscripted comma. You need a script for that: find all numbers (digits,really) separated by a comma and if both numbers are superscripted, superscript the comma (and the following space as well). Here's the script:

 

app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = '\\d, \\d';
commas = app.documents[0].findGrep();
for (i = 0; i < commas.length; i++) {
  if (commas[i].charac
...

Votes

Translate

Translate
Community Expert ,
Sep 04, 2020 Sep 04, 2020

Copy link to clipboard

Copied

LATEST

You can find numbers separated by a comma, but you can't find superscripted numbers separated by a non-superscripted comma. You need a script for that: find all numbers (digits,really) separated by a comma and if both numbers are superscripted, superscript the comma (and the following space as well). Here's the script:

 

app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = '\\d, \\d';
commas = app.documents[0].findGrep();
for (i = 0; i < commas.length; i++) {
  if (commas[i].characters[0].position === Position.SUPERSCRIPT && commas[i].characters[-1].position === Position.SUPERSCRIPT) {
    commas[i].characters.itemByRange (1,2).position = Position.SUPERSCRIPT;
  }
}

P. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines