How do I insert a cross reference to a paragraph with a user-defined style

I don’t like the default paragraph styles. I don’t want to modify the defaults.

I have created styles myself called myTitle and mySubtitle.

I wish to create a cross-reference to a paragraph with one of these styles. How do I do so?

Paragraph styles have nothing to do with cross-references (except the special Heading n paragraphs used to create the TOC). You can cross-reference any location in your document.

The first step is to identify the “source” location. You can do it in two ways:

  • Set cross-reference

    • Select the range you want to identify as a source
    • Insert>Cross-reference; the dialog should open in the Cross-references tab
    • In Type, click on *Set Reference
    • Give it a name in the Name box
    • Press OK

Note: the range may be reduced at a spot position if you don’t intend to reference the content of the selection, i.e. you’re interesetd only in the page number or chapter number

  • Bookmark

    Normally, bookmarks are intended for quick scrolling to different positions in the document but they may also be used as reference sources.

    • Select the range you want to identify as a source
    • Insert>Bookmark
    • Give it a meaningful Name instead of “Bookmark 123”
    • Press Insert

The second step is using the reference to insert one of its attributes in the text.

  • At the position where you want this attribute, Insert>Cross-reference, Corss-references tab
  • In Type, click on Insert Reference or Bookmarks depending on how you defined the source
  • In Insert reference to, click on Page for the page number, Chapter for the chapter number or Reference for the source text.
  • Press Insert

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

special Heading n paragraphs

… which are only special in the sense they have pre-configured outline level. Any paragraph with an outline level other than Text would appear both in ToC, and in Headings section of Cross-references tab of Fields dialog.

Thanks. I had hoped to be able to add the paragraph contents and “above/below” as I can from a numbered paragraph (the main type of source that I use). It seems not to be possible with references and I couldn’t make cross-references to bookmarks work.

Fortunately my section contained numbered paragraphs and it struck me I ought to specify the number in the cross-reference so I ended up retyping the subsection name and using my old friend a cross-reference to a numbered paragraph to generate above/below. I guess I could look into defining my own field to generate the text of both the subsection name and the cross-reference, but I feel I’ve wasted enough time on this issue already!

Thanks again.

I didn’t went through all the “Insert reference to” possibilities. Above/below works equally well with any cross-references.

In the question itself, you mention a myTitle (BTW, why don’t you customise built-in Title; built-in styles are freely customisable) which, I assume, formats your document title. If you need this title page headers, TOC heading and other locations, you can define it File>Properties, Description tab, Title box and insert it as a cross-reference of the DocInformation tab, Title type. This way, title edition is much easier and does incur the risk of damaging the definition range of the bookmark or set reference.

I’m wary of changing the default styles. In my experience (i.e. it may have happened once upon a time using some text editing system; I really can’t remember), things break unexpectedly if you modify the default and sometimes it’s actually impossible to restore the default and you don’t notice for a few weeks, by which time you’ve forgotten what you changed etc. etc. I find it safer just to create new styles and make them do the things I know I want them to do.

When I tried, with version 6.3.6.2, I hadn’t seen that I could use above/below; thanks for pointing it out. It seems I could use a Reference and a Field in combination to get the text and above/below.

What would the field for? Fields are fine for variable information like date, time, filename, page count, … but when text content is concerned, you’re better off with xrefs. There are exceptions though. Which specific field do you want to use combined with an xref?

I have a section headed “Issues/Queries”, which has style mySubtitle. I want to add some text somewhere that says “See Issues/Queries above.”

In the future, I might move the section to the end of the document. That’s fine, because by defining a reference at the start of the section (thanks again for telling me about these), and inserting an “above/below” cross reference, that will be changed automatically.

Also, in the future, I might want to change the section title to be “Issues and Queries”. I’d like the text of the cross reference to change automatically as well. Since I still haven’t found a way to insert a cross-reference to a reference that would include the full text of the paragraph containing the reference (which I can do if referring to a numbered paragraph), I could introduce a “user variable” field with the section heading text and include that in both places. (See what I mean about having wasted enough time on this already? :slight_smile: )

To capture content, the Set Reference or Bookmark must be defined on a selected range of character/words. The Reference data type will echo the content of the range. That’s as simple as that.

If you create a reference/bookmark on a cursor position, you have no range, therefore no content. You can only insert page or chapter number + above/below.

Don’t go for variables unless you really want an “auto-modifying” document. Variables are not really handy and you need a dedicated area to configure them. A better replacement is File>Properties, Custom Properties tab. The definitions are stored in a well-defined dialog, outside the text itself (but internal to the document). The properties are inserted from the DocInformation tab of the fields/cross-references dialog.

But since properties are “global”, you won’t get the above/below flag. In your case, the set reference/bookmark is the best option.

Thank you again! You are quite right, I was simply Setting Reference to a point rather than to selected text. Now I have set a reference to some text, I can include the cross-reference in precisely the way I would expect. Thanks yet again, and congratulations on your patience.