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

Identifying/Mapping TOC text anchors

Community Expert ,
Apr 16, 2022 Apr 16, 2022

Copy link to clipboard

Copied

Is there any straightforward way to identify the automatically generated text anchor for any TOC entry? I generate a TOC that works fine for both the print edition and the EPUB/Kindle side TOC. It creates 120-odd text anchors of the name style '_idTOCAnchor-34'.

 

In theory, I can do internal references using these anchors... but in practice, the order and numbering seem to be almost random. ...Anchor-1, for example, goes to the last section heading in the document, and I haven't been able to make any sense out of the numeric order.

 

So if I want to link to a section titled "End Material" on page 195, without going and setting a specific text anchor of known name, how do I identify that heading's TOC anchor number? (It seems with all the various menus and palettes and such, this should be much easier... but I'm stumped.)

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)
TOPICS
EPUB , How to

Views

138

Likes

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 , Apr 16, 2022 Apr 16, 2022

The order is probably not random. The anchors must be added from back to front, and they are numbered ascending, so they appear to be in reverse order.

You can use this script to map anchors:

https://creativepro.com/files/kahrel/indesign/text_anchors.html

P.

Likes

Translate

Translate
Community Expert ,
Apr 16, 2022 Apr 16, 2022

Copy link to clipboard

Copied

The order is probably not random. The anchors must be added from back to front, and they are numbered ascending, so they appear to be in reverse order.

You can use this script to map anchors:

https://creativepro.com/files/kahrel/indesign/text_anchors.html

P.

Likes

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 16, 2022 Apr 16, 2022

Copy link to clipboard

Copied

Excellent — thank you!

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)

Likes

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 18, 2022 Apr 18, 2022

Copy link to clipboard

Copied

So, other than this comprehensive mapping... is there any way to identify a specific text anchor? If you're working with hidden characters shown, and there's a blue colon indicating an anchor, is there any way to identify that anchor? I've tried a number of things and nothing in the standard UI seems to present that info. Am I missing something, or would it take a similar script to produce the anchor ID?

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)

Likes

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 19, 2022 Apr 19, 2022

Copy link to clipboard

Copied

LATEST

nothing in the standard UI seems to present that info

InDesign's interface for text anchors is useless.

To obtain the id of a selected text anchor you can use this script:

anchors = app.documents[0].hyperlinkTextDestinations.everyItem().getElements();
for (i = 0; i < anchors.length; i++) {
  if (anchors[i].destinationText == app.selection[0].insertionPoints[0]) {
    alert (anchors[i].id);
    exit();
  }
}
alert ('Select a text anchor');

P.

Likes

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