• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

GREP code to find commas between endnotes

Explorer ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

Hello

 

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.

TOPICS
How to

Views

791

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
Community Expert ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

What version of ID are you using?

Can you show us some sample text? Are there any styles applied?

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
Guide ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

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

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
Explorer ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

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).

 

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
Community Expert ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

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.

 

 

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
Community Expert ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

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.

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
Guide ,
Apr 29, 2021 Apr 29, 2021

Copy link to clipboard

Copied

Peter, just read me (my previous comment)!

~U is the Grep code for the end note marker (a little bugged, especially playing with looks).

Btw, e.g.:

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!

 

(^/)  😉

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
Explorer ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

Sadly I have tried your code and it doesn't find any instances. is 'superscript' a name of a characterstyle of just its characteristic?

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
Guide ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

See my first comment!

 

(^/)

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
Community Expert ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

LATEST

FRIdNGE,

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.

 

@EricaSholycow,

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.

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