I have a document that has many footnotes and endnotes. Some of these have commas between the entries but the commas all have regular formatting rather than the desired superscript formating. I would like to create a GREP code to find the commas between endnotes and apply the superscript format but my code seems to ignore the digits in the endnotes. Any help would be appreciated! Thank you.
What version of ID are you using?
Can you show us some sample text? Are there any styles applied?
End Notes Grep Style: ~U,~U + superscript
Corrected: include this Grep style “~U,~U” associated to the char style “Endnote Reference” (that includes the superscript) inside the para style “Body”
(^/) The Jedi
version InDesign 2021 16.1
I can't really show sample text, but the paragraph has a "Body" paragraph style applied, the endnotes have an "Endnote reference" character style (superscript) applied and the commas between the endnotes have no character style applied, so they just follow the paragraph style (which isn't superscript).
It's relatively easy to find commas between digits: (?<=\d),(?=\d) is one possibility, but I don't think there is any way with GREP to identify the digits directly as end note references, nor can I find a way to locate superscript characters followed or preceeded by non-superscript characters using GREP. Simply changing commas between digits risks changing thousands separators or other comma separated numbers.
That said, you could step though the find/change one at a time to be sure you are only affecting the end notes (and you cannot specify the character style since it is not applied to the commas), or perhaps better to ask this question in the scripting forum as I suspect a scripted solution IS a possibility.
Here's another thought, but it's not elegant:
Search for \d+ with the character style.
Change to something like ****$0****
(that puts four asterisk on either side of the end note number -- anything that won't normally appear next to a digit can be used instead of the asterisks)
Now, assuming you using the four asterisks, search for \*\*\*\*,\s*\*\*\*\* (which will match even if there's also a space after the comma) and change the change format to the end note character style. Make sure no formatting is specified in the Find format.
Finally, search for \*\*\*\* with the end note character style and leave the change field blank to remove the **** from the references.
Peter, just read me (my previous comment)!
~U is the Grep code for the end note marker (a little bugged, especially playing with looks).
Grep Find: .(?!.) + superscript
... will find any char in superscript not followed by a char in superscript.
Grep Find: (?<!.). + normal
... could find any char in “normal” position not preceded by a char in ... superscript!
Sadly I have tried your code and it doesn't find any instances. is 'superscript' a name of a characterstyle of just its characteristic?
See my first comment!
I don't currently have a CC version of ID installed on my road computer (which I'm using now), and ~U is not supported in CS6 (no endnotes), nor could I find any reference to it in my various resources, so I'm glad to know that works.
And the negative look-ahead/look-behind is a very clever way to find a "normal" comma surrounded by superscript. Wish I'd thought of it.
Superscript can be specified as a text attribute, or you can use the name of whatever style you assigned to the superscript markers (better). If you are not getting matches with my code you may have entered it incorrectly (it might not come through correctly in an email, for example), or you may not have specified the find and change formatting correctly for each query.