Cross-references in Python docx

Viewed 619

I am attempting to use Python docx to write a document that contains cross-references in its text. What I mean by a cross reference is a reference to a number (and, as the case may be, name of the caption of a paragraph/section), with such reference being an active field that updates in case the order of the paragraphs changes.

My example (cross-references in bold)

  1. Introduction

    Some introduction section text...

  2. Analysis

    As already discussed in Clause 1 (Introduction) above...

Would it please be possible to make a short demonstration of how we can use docx to make a simple cross-reference (e.g. like the one in my example above).

I was not able to find anything reasonable on this, I came across this thread with a promising label Cross-referenceable figure numbers by section with python docx, but what it actually says is that the person asking the question had already learned how to make-cross references on github and asks a peculiarity dealing with order of cross-references in tables, that has very limited application to what is actually written in the question. The github thread to which it pointed (a) was again dealing with rather niche issue involving tables and (b) was full of answers that either were not properly formatted and were not visible or were erroneous and were being corrected and reposted and it was really difficult to make sense of it.

If we could deal with the question here in a comprehensible manner I believe it would be helpful to a lot of folks :). Thank you beforehand!

0 Answers
Related