Skip to main content

The PreTeXt Guide

Subsection 4.1.2 Cross-References and Paragraphs

There are several devices for creating cross-references. Generally, these are unwise (or banned) in titles, and if allowed may be inactive in certain portions of an electronic output format (such as when migrating to a Table of Contents).

<url>, linking external resources.

This is a cross-reference to some item separate and distinct for your document.
A Uniform Resource Locator (URL) is, loosely speaking, an Internet address for some item. Presentation depends on the capabilities of the output format to serve the resource. There is a mandatory attribute, @href, that contains the full URL, including a protocol (such as http://). Used as an empty tag, the visual text will be the exact contents of the @href attribute. So, http://www.example.com can be achieved with
<url href="http://www.example.com"/>
You may also wish to provide some text other than the actual URL, which you can specify as the content of the <url> element. For example, IANA Test Site 2  can be achieved with
<url href="http://www.example.com">IANA Test Site</url>
In order to have a URL occur in print output in a useful way, and in electronic output in an active way, the @visual attribute can be used to display the visual portion as verbatim text in a footnote. So illustrating again, we get example.com from
<url href="http://www.example.com" visual="example.com"/>
Notice the necessity and/or desirability of marking the text in a way that distinguishes it as literal text.
Note also that this tag is meant for external resources, so see the <xref> element (below) or Section 4.5 for ways to link internally (i.e. within your document).

<xref>, cross-references.

This is a cross-reference to some item contained within your document.
Extensive and intuitive capabilities for cross-referencing are a primary feature of PreTeXt. Typical use is an empty tag with the @ref attribute specifying the value of an @xml:id on the target of the cross-reference. This should work easily without much more instruction, but familiarize yourself with the details in Section 4.5 to get the most out of some the available options.

<idx>, index target.

This indicates that the containing structure (theorem, example, etc.), or top-level paragraph, should be the target of an entry of the index (a special sort of cross-reference). See Section 3.22 and Section 4.25 for general details.

<notation>, index target.

This indicates that the containing definition, or top-level paragraph, should be the target of an entry of the list of notation (a special sort of cross-reference). See Section 3.22 and Section 4.26 for general details.
www.example.com