Copy link to clipboard
Copied
Hi,
As far as I know it is not automated (unlike the Index Create an index in InDesign (adobe.com))
Have you looked at point 2 (scroll down a bit) from Insert and manage cross-references in InDesign (adobe.com)
Alternatively, you might be lucky and find a script (look at Solved: How create CrossReference link to paragraphs or te... - Adobe Support Community - 4710059)
Copy link to clipboard
Copied
Hi,
As far as I know it is not automated (unlike the Index Create an index in InDesign (adobe.com))
Have you looked at point 2 (scroll down a bit) from Insert and manage cross-references in InDesign (adobe.com)
Alternatively, you might be lucky and find a script (look at Solved: How create CrossReference link to paragraphs or te... - Adobe Support Community - 4710059)
Copy link to clipboard
Copied
Thanks for the response, unfortunately all those options are way to time consuming for a large book. I can't understand why indesign lacks on this type of automation.
Copy link to clipboard
Copied
Hi @DexAlpenglow:
Adobe will consider adding features that are requested by a user, and upvoted by others. You can log this as a feature request here: https://indesign.uservoice.com.
For now, Eric is correct: the options are an index with multiple markers, multiple cross-references or a script.
~Barb
Copy link to clipboard
Copied
It's quite disturbing that I would have to recommend such a useful feature for reference books. How did indesign ever become the standard in the industry is beyond me.
Copy link to clipboard
Copied
Scriptable! …
(^/) The Jedi
Copy link to clipboard
Copied
> How did InDesign ever become the standard in the industry is beyond me.
Two factors. One: there's no real competition. Two: InDesign's scripting support is stellar. There's not much that you can't script. What you're after is pretty straightforward to script. The main problem is going to be how you want to constrain the references. In the Oregon example, should all occurrences of Oregon be included?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Here's a script, a bit rudimentary, but it does the job. As I said, it's pretty straightforward. The core of the script is in fact quite short, most of it is auxiliary things like checking and comments. A script like this can be done in various ways, the script below is just one possibility. It created InDesign cross-references so if the text changes all you need to do is to update the cross-references.
The script doesn't cater for referenced text that's deleted, but that can be added. The easiest is to delete all \(see page.+?\) and run the script again.
First, create a cross-reference format and call it xref. Use only the page-number variable:
Then where you want the cross-reference to appear, enter (see page) and place the cursor between the e and the ). Then run the script. A small dialog is displayed, enter the term you want cross-referenced (e.g. Oregon). Click OK and the references are added.
(function () {
var indd = app.documents[0];
var cr_format = indd.crossReferenceFormats.item ('xref');
var find, found;
var source, destination;
var i;
if (!app.selection || !(app.selection[0] instanceof InsertionPoint)) {
alert ('Select an insertion point');
exit();
}
find = prompt ('Enter a search term', '', 'Cross-references');
if (!find) {
exit();
}
app.findTextPreferences = app.findChangeTextOptions = null;
app.findChangeTextOptions.properties = {
caseSensitive: true,
wholeWord: true,
searchBackwards: false,
}
app.findTextPreferences.findWhat = find;
found = indd.findText();
// More than one cross-ref: pluralise 'page'
if (found.length > 1) {
app.selection[0].contents = 's ';
} else {
app.selection[0].contents = ' ';
}
for (i = found.length-1; i >= 0; i--) {
// Ignore the selected paragraph
if (found[i].paragraphs[0] == app.selection[0].paragraphs[0]) {
continue;
}
// Create a cross-reference: a source (an xref source),
// a destination (a text anchor), and a hyperlink
source = indd.crossReferenceSources.add (app.selection[0], cr_format);
destination = indd.hyperlinkTextDestinations.add (found[i]);
indd.hyperlinks.add (source, destination);
// Don't add a comma after the last cross-ref
if (i > 1) {
app.selection[0].contents = ', ';
}
}
}());
P.
Copy link to clipboard
Copied
that replacent I mentioned -- \(see page.+?\) -- deletes the whoile parenthetical, which is wrong: you want to delete just the cross-references, so use
\(see page\K.+?(?=\))
instead.