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

Multiple Page cross reference

Explorer ,
May 17, 2023 May 17, 2023

Copy link to clipboard

Copied

In a paragraph I want to create a cross reference to list all the pages that contain the word "Oregon". Something like this:
Oregon is a state in the pacific northwest (see pages 85,96, 105)
 
But is seems like to do this I would have to create multiple text anchors or multiple cross references to achieve this which will make this task very time consuming and prone to human error on a larger scale book. Is there a way to create a a cross reference that will search the entire document for the word "Oregon" and show all the pages it is listed on, similar to an index to achieve the desired effect in the example above?
TOPICS
How to

Views

830

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 , May 17, 2023 May 17, 2023

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)

 

Votes

Translate

Translate
Community Expert ,
May 17, 2023 May 17, 2023

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)

 

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 ,
May 17, 2023 May 17, 2023

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. 

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 ,
May 17, 2023 May 17, 2023

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

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 ,
May 17, 2023 May 17, 2023

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.

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 ,
May 18, 2023 May 18, 2023

Copy link to clipboard

Copied

Capture d’écran 2023-05-18 à 10.50.50.png

 

Scriptable! …

 

(^/)  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
Community Expert ,
May 19, 2023 May 19, 2023

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?

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 ,
May 19, 2023 May 19, 2023

Copy link to clipboard

Copied

Yes, I would like to be able to find all occurrences of Oregon or any other
word or phrase that I want to include.

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 ,
May 20, 2023 May 20, 2023

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:

PeterKahrel_0-1684574306672.png

 

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.

 

 

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 ,
May 21, 2023 May 21, 2023

Copy link to clipboard

Copied

LATEST

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.

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