Cross-references between sub-documents

So I’m working with a master document and several sub documents. Now I’d like to link to references from a sub document to another sub document.

I can choose to select the path of the sub document, then the reference is valid only in the sub document.

If I specify a local reference (omitting the path, hence it acts as a local reference for that sub document), then the reference will be valid only in the master document. Not in the sub document, because there is no such reference.

a) Is there a workaround for this, so that references are valid in both sub documents and master documents? Or is there a macro I could use to pre-process all the links in a sub document before using it in the master document, that creates local references?

b) Is it possible to hide the error message that a reference is not valid in a sub document?

Thanks in advance.

There is a section in the Writer Guide v4.0 dedicated to explain how to do this (refer Ch. 13, pp. 377-380). Are you using a bookmark or a set reference to mark the destination?

UPDATE: It is possible to work around the cross-reference limitation between sub-documents but it is inelegant. These are the methods indicated in the Writer Guide.

If the requirement is to cite a sub-document from within the master document:

  1. In the sub-document, at the required location (or highlighting the required range), Insert > Cross-reference… > Cross-references tab > Type of “Set reference” / “Bookmarks” > enter a meaningful Name > click Insert. Refer my answer here for further detail on these marks.
  2. In the master document, Insert > Cross-reference… > Cross-references tab > Type of “Insert reference” / “Bookmarks” > select the required mark > click Insert. This is a workaround for bug fdo#44931.

If the requirement is to cite a sub-document from within another sub-document:

  1. In the anchoring sub-document, at the required location (or highlighting the required range), Insert > Cross-reference… > Cross-references tab > Type of “Set reference” (a bookmark will not work) > enter a meaningful Name > click Insert.
  2. In the citing sub-document, Insert > Cross-reference… > Cross-references tab > Type of “Insert reference” > enter the previously created Name (ignore the Selection) > click Insert. In the sub-document this cross-reference will not display correctly (as it has no contextual understanding of the destination) but it will display as expected in master view.

I am still trying to determine if this cross-reference issue (between sub-documents) is an ODF limitation or an implementational one.

1 Like

Thank you for your answer, but that’s exactly the way I do it. The problem is that the links are hidden only in editor mode (when writing), not when printing or generating a PDF file. Hence I cannot use the sub documents as an independent entity.

I use both. The benefit of bookmarks and hyperlinks is that they simply won’t work (in opposite to show an error message) in the sub document, but will work in the master document.

Thanks for clarifying. You may need to attach an example to your question for others to look at. If it is reproducible then we may need to raise a bug. Bug fdo#44931 is possibly related to the issue you are experiencing, but not quite the same as it deals with ToC entries (linking from master > sub-document).