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
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
...
Copy link to clipboard
Copied
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.