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.)
—
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.
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.
Copy link to clipboard
Copied
Excellent — thank you!
—
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?
—
Copy link to clipboard
Copied
> 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.