Skip to content

Cross References

Press supports referencing elements within a document by ID, displaying page numbers, and creating citations for academic or technical reports.

Element IDs

Assign a unique identifier to any element with the id attribute:

xml
<h1 id="methodology">Methodology</h1>

Referencing Content

Use <ref /> to display the outline index of a referenced element:

xml
<p>As described in section <ref id="methodology" />, we used a mixed-methods approach.</p>

This renders the index of the element with id="methodology" at the current outline level.

Displaying Page Numbers

Use <page-number /> with an id attribute to display the page where an element appears:

xml
<p>See <ref id="methodology" /> on page <page-number id="methodology" />.</p>

Without an id, <page-number /> displays the current page number:

xml
<frame text-align="center" font-size="9pt">
  Page <page-number /> of <total-pages />
</frame>

The Outline Attribute

The outline attribute registers elements into named collections for iteration:

xml
<h1 outline="sections">Introduction</h1>
<h1 outline="sections">Analysis</h1>
<h1 outline="sections">Conclusion</h1>

These can then be iterated in a table of contents. See the Table of Contents guide. If level is not included, the outline entry is automatically added as a sibling to the current level.

Example: A Technical Report

xml
<press>
  <document format="A4" page-margin="2cm">
    <repeat flow="body">
      <page>
        <flow name="body" />
        <frame v-align="bottom" height="fill" text-align="center" font-size="9pt">
          Page <page-number />
        </frame>
      </page>
    </repeat>
  </document>

  <flows>
    <body>
      <h1 id="intro">Introduction</h1>
      <p>This report presents findings from a three-year environmental
        monitoring programme 1.</p>
      <frame-break />
      <h1 id="method">Methodology</h1>
      <p>Data collection followed established protocols 2. As outlined in the introduction
        (page <page-number id="intro" />), the study covered
        three distinct regions.
      </p>
    </body>
  </flows>
</press>