Skip to main content

The PreTeXt Guide

Section 22.1 Cross references

PreTeXt provides a robust set of features for internal cross referencing. If you’re familiar with , the equivalent of \label is to use an @xml:id. For example, the opening tag for this section is <section xml:id="basics-s-xref">. Instead of the \ref used by , we use <xref> in PreTeXt. So we can type <xref ref="basics-s-xref"/> to create a reference to this subsection: Section 22.1. There are lots of options to control what text and number appear when you use <xref>. The default is @text with value type-gobal, which produces something like “Subsection 3.3” or “Theorem 3.1.4”. The type is “Subsection” or “Theorem”, and the global number is 3.3 or 3.1.4. (Global is in contrast to local, which would be just 3 or 4, respectively, for these examples.) Section 4.5 goes into greater detail about how to change settings for how cross references appear, which you can do for your entire document as well as for individual cross references that require different treatment.