Offset subdocument headings

Is there a way to offset the heading level of sub-documents? For example, a sub-document with a Heading 1 could be assigned a “+1” offset so it appears as a Heading 2 in the final doc?

Use case here is being able to combine standalone topics into a compiled document with an arbitrary structure.

Thanks!

This can’t easily be done. It requires a tricky manipulation of styles. And I don’t guarantee that chapter numbering is still correct.

Remember that when “printing” (here “printing” any means of producing the final document: printing or exporting it to e.g. PDF), style configuration is taken in the master document, not in the sub-documents. This means styles with the same name may have different settings.

Your shared sub-documents must be prepared in a specific way where headings are concerned. Since you plan to offset the headings, you can’t use Heading n family otherwise you’ll have havoc in your final document.

  • Create your own heading hierarchy as a family of “Docz Heading n” family where n is the heading level (as usual) and z is an optional tag in case your various subdocuments may be inserted at different levels
    To be clearer, imagine sub-doc A is offset by 2 while sub-doc B is offset by 1. You need two families of “Docz Heading n” to avoid inconsistencies, one for A, say “Doc1 Heading n”, one for B, say “Doc2 Heading n”. Obviously this becomes unmanageable when the number of independent sub-docs grows.
    If all your sub-docs will ever be inserted with the same offset, only a single alternate heading hierarchy suffices.
    Assign an outline level to these styles to facilitate sub-doc writing. Outline level will be changed in the master.
    Don’t bother for numbering (unless you use it to check your sub-doc structure). It will not be used in the master, at least as is.
  • Build your master as usual
  • Modify the paragraph styles in the master
    • Create the used “Docz Heading n” to supersede those in the sub-docs
    • Assign the target outline levels to the styles
      With the previous example, “Doc1 Heading 1” is level 3 and “Doc2 Heading 1” is at level 2.
    • Numbering the inserted sub-docs in sequence with chapter numbering is probably doomed to fail but have a try.
      • Define a custom list style for this and link the “Docz Heading n” to it.
      • The key point will be to reach the correct list level in the heading. This probably needs to edit the sub-docs headings from the master. This is why I think it is doomed to fail.
      • You’ll need also to bypass the used number(s) if you have other headings at the same level after the sub-doc.
        Create hidden Heading n paragraphs (with only a space for the heading) to cause chapter number incrementation.

All in all, I think the short answer should be “no, this is not possible” though I understand the need for it.

If your sub-documents could be always inserted at some pre-defined level, it would be simpler to style directly the sub-docs with an offset Heading n.

Thanks @ajlittoz, sounds like this would be using existing mechanisms for something way beyond their intended use.

I think my solution will be to author in org-mode, which supports this natively, then convert the collated/rendered document to ODT to prettify it.