summaryrefslogtreecommitdiff
path: root/crates/typst-library
diff options
context:
space:
mode:
authorAndrew Voynov <37143421+Andrew15-5@users.noreply.github.com>2025-06-24 16:00:51 +0300
committerGitHub <noreply@github.com>2025-06-24 13:00:51 +0000
commitd4be7c4ca54ce1907ce5f7af8a603cf3f4c5a42f (patch)
tree62c9950451752b2e07926cbd9efe5e7f2b33631e /crates/typst-library
parentf162c371017f0d503cfae8738cbbf505b9f11173 (diff)
Add page reference customization example (#6480)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-library')
-rw-r--r--crates/typst-library/src/model/reference.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/typst-library/src/model/reference.rs b/crates/typst-library/src/model/reference.rs
index 6fddc56c..17f93b7c 100644
--- a/crates/typst-library/src/model/reference.rs
+++ b/crates/typst-library/src/model/reference.rs
@@ -79,6 +79,36 @@ use crate::text::TextElem;
/// reference: `[@intro[Chapter]]`.
///
/// # Customization
+/// When you only ever need to reference pages of a figure/table/heading/etc. in
+/// a document, the default `form` field value can be changed to `{"page"}` with
+/// a set rule. If you prefer a short "p." supplement over "page", the
+/// [`page.supplement`]($page.supplement) field can be used for changing this:
+///
+/// ```example
+/// #set page(
+/// numbering: "1",
+/// supplement: "p.",
+/// >>> margin: (bottom: 3em),
+/// >>> footer-descent: 1.25em,
+/// )
+/// #set ref(form: "page")
+///
+/// #figure(
+/// stack(
+/// dir: ltr,
+/// spacing: 1em,
+/// circle(),
+/// square(),
+/// ),
+/// caption: [Shapes],
+/// ) <shapes>
+///
+/// #pagebreak()
+///
+/// See @shapes for examples
+/// of different shapes.
+/// ```
+///
/// If you write a show rule for references, you can access the referenced
/// element through the `element` field of the reference. The `element` may
/// be `{none}` even if it exists if Typst hasn't discovered it yet, so you