Expand description
The refs feature: labels and references. An author attaches a label to a
construct with \label{sec:intro} and refers to it with \ref{sec:intro},
and the feature turns each reference into a link to the labeled place,
showing that place’s number or title.
The terms are those of the concepts overview, Reference points, labels and
anchors:
a reference point (RefPoint) is one
place in a document that can be referred to, numbered, or given an anchor
(a heading, an equation line, a theorem, a footnote); a label is the text
an author attaches to it with \label{type:label}; an anchor is the
identifier a link points at, computed once for every point (ANCHORS);
and a reference site (RefSite) is one
place that points at a reference point, such as a \ref.
§What an author writes
\label{type:label}, written right after a construct that accepts labels (\section{Introduction}\label{sec:intro}). The label type is the part before the colon and says what sort of place the label marks; each construct accepts a fixed set of types (a heading acceptssecandtopic). A label may be written only once in a document. A\labelis a field, a macro that the construct before it reads as data, so it is available only after a construct that declares it.\ref[options]{type:label}, a reference that shows what its target has to show: its number, else its content (a heading’s title, for instance), else the label as written. Several targets may be written in one\ref, separated by commas (\ref{eq:a,eq:b}), and are shown as one list. The options choose the wording of the word before a number:noprefixleaves that word out,Sasks for the capitalized wording where the counter style (how the numbering feature shows a counter’s value; see counters and counter styles) declares one, and any other key asks for the wording variant of that name (abbreviated,lowercase,capital).\hyperref[type:label]{text}, a reference that shows the author’s own text instead of what the target has to show.
The syntax guide shows these commands from an author’s side, under Labels and references.
§What a reference displays
A reference point states the two things a reference to it may show: a
number source (NumberSource), the
counter and the counter style it is numbered by, where it can be numbered
at all; and content of the document, where it has any. For each target, a
\ref shows the first of these that exists:
- the number this document gave the point;
- else the point’s content;
- else the label the reference was written with, as written.
A point that states a number source may still receive no number in a run:
no numbering feature is registered, nobody declares its counter, or a
counter it is numbered within has no value yet. A point that ends up with
neither a number nor content has nothing to show (an unnumbered float with
no caption, an equation in a registry without the numbering feature), and a
reference to it is the Error NothingToShow (flm.refs.nothing-to-show).
The number is read from the counter table of the
numbering feature, which the
\ref lowering rule reads optionally, through a peer declaration
(PeerName): in a registry without that
feature, a reference shows the point’s content or its label. The counter
style of the point decides what a number looks like
(the word before it, the delimiters around it, how several numbers are
joined), and the options written on a \ref choose among the wording
variants that the style declares. The key S asks for the variant
CAPITAL_VARIANT where the style declares it and for the usual wording
otherwise. Any other key asks for the variant of its own name, and where
the counter style of a numbered target does not declare that variant, the
reference is the Error UndeclaredVariant.
A \ref with several targets is written as one list. Its first items
are the numbers, one item per counter style, each written by that style
with consecutive numbers collapsed into a range; then come the other
targets, one item each, in the order the reference wrote them. The items
are joined by the texts of the feature’s configuration, RefsConfig:
Eq. (1) and Thm. 1.1, Eq. (1), Thm. 1.1, and A note. Another feature
that shows a reference from a command of its own calls
lower_reference, which writes the items.
A point’s content (a heading’s title, for instance) is copied out of the
frozen tree into a synthesized
value, a small tree
held in a table, when the anchors stage writes the point’s target. Content
that the point’s element built itself because no node of the tree holds it
(the bullet beside a list’s item,
ContentRef::Synthesized)
is already such a tree and is shared rather than copied. The \ref rule
splices the synthesized value into the nodes it stages (builds into the
lowered tree; see Lowerer): the value is first
brought up to date by value
catch-up, which runs the
plan’s rewrites and the per-tree stages the lowering depends on over the
value alone, and is then lowered through the rules. A \ref written inside
a heading’s title therefore resolves exactly like one written in the body.
§What the feature registers
The refs feature (Refs, a FlmFeature)
registers:
- Two elements.
REF(flm.ref), the\refelement, andHYPERREF(flm.hyperref), the\hyperrefelement. A node of either declares its reference sites through theReferencingaspect, one per target, and goes through the same stages; the two differ in what they display. The feature registers no element for the\labelwritten after a construct: like every tack-on field, its node carries the language’s field element (FIELD). - A scoped package. A scoped package
(
ScopedPackageDef) is a set of element declarations that can be written only inside the environment bodies and arguments whose declarations refer to it by name (scoped packages).LABEL_PACKAGE(flm.refs.label, built bylabel_package) holds\labelas a command, for the arguments that refer to it, such as the optional argument of\footnote. - Two argument roles. An argument role states what an argument holds
(
ArgDef::role).TARGET_ARG_ROLE(flm.refs.target) is the role of the target argument of\refand\hyperref, the label or labels a reference points to.DEFINED_LABEL_ARG_ROLE(flm.refs.defined-label) is the role of the argument of\label, the label it attaches to a construct, in the\labelfield and in the scoped package’s\labelcommand. - Four tables.
LABELS(flm.labels): the first point that wrote each label, the labels written more than once, and the labels refused for their type.ANCHORS(flm.anchors): each point’s anchor, or none.REF_TARGETS(flm.refs.targets): for each label, the point, its link target and what a reference to it shows.REF_RESOLUTIONS(flm.refs.resolutions): how each reference site resolved. - An external table.
EXTERNAL_INDEX(flm.refs.external-index): labels of other documents, with their link targets and the content a reference to them shows. An external table is a table that no stage of the run writes: the caller installs its value when the run is constructed (Externals). The resolve stage reads it when the caller has installed it. - Four stages.
SCANrecords the first point that wrote each label;ANCHORS_STAGEgives every point its anchor and writes the targets;RESOLVEresolves every reference site;CHECK_LABELSreports the duplicate labels and the labels of a type their point does not accept. The check provides the capability of its own name, a member of theflm.validatedcollection of capabilities, which every standard workflow demands (asks the plan to provide; seePlanRequest). The documentation of each constant says what its stage reads and writes. - Render options.
RefsRenderOptions, set per render request: whether an unresolved reference is an Error or a Warning. - A configuration.
RefsConfig, the texts that join the items of a reference to several targets. A feature’s configuration is the plain Rust value the feature is constructed from; it is fixed when the registry is built (settings, options and configuration). - Lowering rules, per backend. On every backend,
REF_RULElowers a\refto aflm.pres.linkto each target, around the number, the content or the label it shows, andHYPERREF_RULElowers a\hyperrefto a link around the author’s text; a target that nothing resolves becomes aflm.pres.spanstyled as an unresolved reference instead of a link. The HTML backend writes the link as an<a>element (References in HTML). On thelatex-recomposedbackend, the rules of the submodulelatexare the default instead: they leave the resolution to LaTeX and write\label,\flmRefand\flmHyperrefaround safe labels (see Recomposing to LaTeX below). - The stages and tables of the recomposed LaTeX, in the submodule
safe_labels: the safe labels the recomposed LaTeX writes in place of the document’s labels.
§Anchors
An anchor is the identifier a link points at for a reference point. The
element of the point chooses how it is formed
(AnchorPolicy), and the anchors
stage computes it once:
<type>-<label>from the first label the point keeps:sec-intro(label_anchor);<prefix>--<title>for an unlabeled heading:sec--Introduction(title_anchor);<prefix>--<position><four letters>for an unlabeled point whose element asks for its position (an equation line, a list item, an xnote):eq--8otbcfor the eighth equation line (auto_anchor);<prefix>-<numbers>from the number the document gave the point, for an element that asks for it (a theorem, a float):theorem-2-3(value_anchor); a point the document did not number takes its first label instead;- an identifier the element gives itself, used as given.
The element states the prefix, so that the anchor of a point begins the
same way whether it was labeled or not. The prefix, the parts of a label,
a title and a number text go through one encoder, encode_anchor: a text
made only of ASCII letters, digits, .,
- and single spaces is reproduced exactly, each space written _; any
other text is stripped of accents, every run of other characters is
replaced by _ or -, and ~ and six hexadecimal digits of a hash of the
text as written are appended. No counter
takes part in a label’s anchor, so one label always yields one anchor,
regardless of what else the document contains.
An anchor made from a title is never refused: where another point already
holds the anchor it would take (another heading with the same title, or a
point whose anchor encodes alike), it takes the next free number
(sec--Introduction-2), and nothing is reported. Any other anchor that
another point already holds is a collision: the Error AnchorCollision
is reported, the first point keeps the anchor, and the second gets none.
§Label types
A reference point declares which label types may be written for it
(RefPoint::accepts): a heading
accepts sec and topic, so \section{X}\label{eq:x} defines no label. A
point that declares
AcceptedRefTypes::Any accepts
every type; a feature declares it for a construct that fixes no set. A
label of a type the point does not accept defines nothing: no reference
resolves through it, and a point whose every label was refused gets no
anchor from a label. CHECK_LABELS reports it as
LabelTypeNotAccepted (flm.refs.label-type-not-accepted).
A text that is not spelled type:label at all is no label: the construct
keeps it among the point’s
malformed texts, and the
label scan reports it at the field where it was written, as BadLabel
(flm.refs.bad-label). The scan reports a \ref or \hyperref target
that is not spelled type:label the same way.
§Duplicate labels and unresolved references
A label written for two points is the Error DuplicateLabelCondition
(flm.refs.duplicate-label), reported by CHECK_LABELS: the first point
in document order keeps the label. This depends on the document alone.
A reference that nothing resolves is reported as Unresolved
(flm.refs.unresolved): an Error by default, a Warning under
RefsRenderOptions with unresolved: allow. Either way, the reference
shows its own text marked as unresolved: the label text for a \ref, the
author’s text for a \hyperref. In a plan that renders nothing, such as
one of the check workflow, it is always
a Warning, because whether a label resolves is decided per render, and a
render may install an index of labels defined in other documents.
§Declaring a labeled construct in another feature
A feature gives one of its constructs labels in three steps:
- The element’s last argument is
label_fields_arg, the trailing tack-on argument (the trailing argument that absorbs field macros;ArgStdKind::TackOn) that holds the\labelfields, so that\thing{…}\label{x:y}parses. The argument of the\labelfield has the argument roleDEFINED_LABEL_ARG_ROLE, which this feature declares; the other feature declares that role as a peer (FeatureBuilder::peer_argument_role), so that a registry without the references feature still builds. - The element carries the
Referenceableaspect, whose implementation reads those fields withlabel_uses, splits them withpoint_labels, and returns the point (or points) the node declares. - Each point states the label types it accepts in its
acceptsfield: a list of types, orAcceptedRefTypes::Anyfor a construct that fixes none.
A construct with a recomposition rule of its own writes its labels there
with stage_label and stage_label_group (submodule latex). No
other rule writes a label, because a field node that reaches a backend is
an error.
Two kinds of \label are not tack-on fields. Inside a display-math
environment’s body, the math feature declares \label as a command of
its own (math::lines); inside an
argument that refers to the scoped package LABEL_PACKAGE (a construct
whose labels are written in an argument of their own, as in
\footnote[\label{fn:x}]{…}), this feature’s package declares it. Both
are field nodes of the same field name: label_use reads
one such node, and label_uses_in reads every one of a run of nodes.
§Recomposing to LaTeX
The latex-recomposed backend writes the document back as LaTeX and
leaves the resolution of references to LaTeX. LaTeX label keys must avoid
certain characters, so the recomposed LaTeX writes a safe label
(SafeLabels) in place of each FLM label: ref1, ref2, … in the order
the document first mentions the labels. The submodule safe_labels holds
the document-scope stage SAFE_LABELS_STAGE, which writes the table
SAFE_LABELS (flm.labels.safe), and the per-tree stage
VALUE_SAFE_LABELS_STAGE, which writes the table VALUE_SAFE_LABELS
(flm.labels.safe.value) for the references of a synthesized value. The
submodule latex holds the recomposition rules REF_LATEX_RULE and
HYPERREF_LATEX_RULE, the helpers stage_label and
stage_label_group that a labeled construct’s own rule writes its labels
with, and the render options RefsRecomposeOptions. This feature
registers those rules too; it declares the backend and the two LaTeX
constructs they stage as peer declarations
(PeerName), so that a registry without
the LaTeX features still builds, with those rules set aside (excluded from
rule selection). The
rendering guide describes the result under References and safe
labels.
§Items for other features
- Declaring and reading labels:
label_fields_arg,label_field,label_uses,label_uses_in,label_use,point_labels,field_text,label_package. - Reading references:
ref_targets,hyperref_target,reference_targets,split_targets,ref_display_options,ref_args,hyperref_args. - Showing a reference from another command:
lower_reference; what a reference to a label shows, for a host:designation,Designation. - Anchors:
encode_anchor,label_anchor,title_anchor,auto_anchor,value_anchor; copying content into a synthesized value:content_value,value_of. - Writing labels and references in the recomposed LaTeX:
stage_label,stage_label_group,stage_labels_with_display_text,target_spelling,label_spelling,stage_spelling,read_target_at_lowering,reference_type_words,stage_reference_type_setup.
Re-exports§
pub use content::CopyError;pub use content::auto_anchor;pub use content::content_value;pub use content::encode_anchor;pub use content::label_anchor;pub use content::title_anchor;pub use content::value_anchor;pub use content::value_of;pub use latex::HYPERREF_LATEX_RULE;pub use latex::HyperrefLatexRule;pub use latex::LABEL_COMMAND;pub use latex::LabelSpelling;pub use latex::REF_LATEX_RULE;pub use latex::RefLatexRule;pub use latex::RefsRecomposeOptions;pub use latex::SafeLabelMode;pub use latex::ZCREF_COMMAND;pub use latex::label_spelling;pub use latex::read_target_at_lowering;pub use latex::reference_type_words;pub use latex::stage_label;pub use latex::stage_label_group;pub use latex::stage_labels_with_display_text;pub use latex::stage_ref_options;pub use latex::stage_reference_type_setup;pub use latex::stage_spelling;pub use latex::target_spelling;pub use safe_labels::REF_DOMAIN;pub use safe_labels::SAFE_LABELS;pub use safe_labels::STAGE as SAFE_LABELS_STAGE;pub use safe_labels::SafeLabels;pub use safe_labels::SafeLabelsStage;pub use safe_labels::VALUE_SAFE_LABELS;pub use safe_labels::VALUE_STAGE as VALUE_SAFE_LABELS_STAGE;pub use safe_labels::ValueSafeLabels;pub use safe_labels::ValueSafeLabelsStage;pub use safe_labels::label_key;pub use safe_labels::value_name;
Modules§
- latex
- The LaTeX side of the
refsfeature: the recomposition rules that write\refand\hyperrefback as LaTeX for thelatex-recomposedbackend, the helpers with which a construct’s own rule writes its labels, and the render optionsRefsRecomposeOptionsthat shape both. - safe_
labels - Safe labels: the keys that the recomposed LaTeX writes in place of the
document’s own labels, numbered in document order by a stage of the
refsfeature and recorded in the tableSAFE_LABELS.
Structs§
- Anchor
Collision - The error that is reported when two reference points receive the same
anchor (
flm.refs.anchor-collision). - Anchors
- The anchors table,
flm.anchors(ANCHORS): every reference point of the document with the anchor the anchors stage (ANCHORS_STAGE) computed for it, or no anchor when the point has nothing to form one from (no label it keeps, under a policy that needs one) or when an earlier point already holds the same one. - BadLabel
- The error that is reported when a label, or a target of a
\refor a\hyperref, does not have the formtype:label(idflm.refs.bad-label). - Display
Unavailable - The error that is reported when the content that a reference displays for
a reference point cannot be copied (id
flm.refs.display-unavailable). - Duplicate
Label - A label written for two reference points, as
Labelsrecords it. The label scan (SCAN) records the fact; the label check (CHECK_LABELS) reports it asflm.refs.duplicate-label. - Duplicate
Label Condition - The error that is reported when a label is defined twice in a document
(
flm.refs.duplicate-label). This is the case when the same label is written for two different reference points, such as two headings. - External
Index - The external index,
flm.refs.external-index(EXTERNAL_INDEX): from a label of another document to its target. - External
Target - A target of the external index: where a link to a label of another document leads, and what a reference to it shows. What it shows is content (a synthesized value), not a string, so that a reference to another document is rendered the same way as one inside this document.
- Hyperref
Element - The per-value data of the
flm.hyperrefelement, and the element’sReferencingimplementation: it returns the one reference site a\hyperrefnode declares, or none when its target is not spelledtype:label. See the module documentation. - Hyperref
Rule - The implementation of
HYPERREF_RULE: it stages the text the author wrote inside aflm.pres.linkto the target, or inside aflm.pres.spanstyled as an unresolved reference where nothing resolved the target. See the module documentation. - Label
Type NotAccepted - The error that is reported when a label has a type that the labeled
construct does not accept (id
flm.refs.label-type-not-accepted). - Label
Use - One
\labelwritten on a node, aslabel_uses,label_uses_inandlabel_usereturn it: the text as written, the span of the\labelnode, and the label when the text is spelledtype:label. - Labels
- The label table,
flm.labels(LABELS): for every label, the first point that wrote it; the labels written more than once; and the labels refused because the point they were written for does not accept their type. - Nothing
ToShow - The error that is reported when a reference refers to a reference point
that has neither a number nor content to display (id
flm.refs.nothing-to-show). - Point
Display - The two things a reference to a point may show, as the anchors stage
(
ANCHORS_STAGE) records them: the number source and the content that theRefPointstates, with the content copied out of the document. - RefElement
- The per-value data of the
flm.refelement, and the element’sReferencingimplementation: it returns the reference sites a\refnode declares, one per target spelledtype:label. See the module documentation. - RefResolutions
- The resolutions table,
flm.refs.resolutions(REF_RESOLUTIONS): how every reference site resolved, for every node whose element carries theReferencingaspect. - RefRule
- The implementation of
REF_RULE: it stages what each target of the reference shows (its number, its content or its label), linked to that target, as one list joined by the texts ofRefsConfig. See the module documentation. - RefTarget
- What a label resolves to inside the document: the point that keeps it,
the link target (
#followed by the anchor) and what a reference to it shows. - RefTarget
Text - One target written in a reference command: the text as written, with the
whitespace around it trimmed, and the label when that text is spelled
type:label. - RefTargets
- The targets table,
flm.refs.targets(REF_TARGETS): from a label to what it resolves to inside the document. It combines the label table and the anchors, and the anchors stage (ANCHORS_STAGE), which runs once for the document, writes it. A label whose point received no anchor (a point that lost an anchor collision, or that has nothing to form an anchor from) has no entry, so a reference to it resolves to nothing in the document. - Refs
- The
refsfeature (FlmFeature): it registers the\refand\hyperrefelements, the scoped package of\label, six stages (four that check and resolve labels and references, and two that serve the recomposed LaTeX), the tables they write, the render options and the lowering rules. See the module documentation. - Refs
Config - The configuration of the
refsfeature: the texts that join the items of a reference to several targets. - Refs
Render Options - The render options of the
refsfeature. They are set per render request (crate::model::options). - Refused
Label - A label whose type the point it was written for does not accept, as
Labelsrecords it. The label scan (SCAN) records the fact; the label check (CHECK_LABELS) reports it asflm.refs.label-type-not-accepted. - SiteId
- The identity of one reference site: the address of the node that declares it and the site’s index among that node’s sites.
- Stage
Failed - The error that is reported when a stage of the
refsfeature fails because of an error in the program (idflm.refs.stage-failed). - Undeclared
Variant - The error that is reported when a
\refasks for a wording variant that the counter style of a target does not declare (idflm.refs.undeclared-variant). - Unresolved
- The error that is reported when a reference refers to an undefined label
(
flm.refs.unresolved). A label is defined when it is written for a reference point of the document, or when it is listed in the external index (EXTERNAL_INDEX) that the caller installed for the run.
Enums§
- Designation
- What a reference to a label shows, as
designationgives it: the number, the content or the label of the module documentation’s “What a\refshows”. - Resolution
- How one reference site resolved.
- Unresolved
Refs - The severity with which a reference to an undefined label is reported
(
Unresolved). This is the type of the optionunresolvedofRefsRenderOptions.
Constants§
- ABBREVIATED_
VARIANT - The counter style variant of the abbreviated words,
abbreviated(Lem.~4rather thanLemma~4), which\ref[abbreviated]{…}requests. - ANCHORS
- The typed name of the anchors table,
flm.anchors, anAnchors, which the anchors stage (ANCHORS_STAGE) writes. - ANCHORS_
STAGE - The name of the anchors stage,
flm.refs.anchors. - CAPITAL_
KEY - The key of a
\ref’s options that asks for the capitalized wording,S. - CAPITAL_
VARIANT - The counter style variant that the key
CAPITAL_KEYselects,capital: the wording a counter style declares for a reference that opens a sentence (Equation~(3)rather thanEq.~(3)). - CHECK_
LABELS - The name of the label check stage,
flm.refs.check-labels, and of the capability that this stage provides. - DEFINED_
LABEL_ ARG_ ROLE - The argument role of a label that a
\labelattaches to a construct,flm.refs.defined-label: the role of the argument of the\labelfield (label_field) and of the\labelcommand of the scoped packageLABEL_PACKAGE. The feature declares it; a feature whose declarations hold either declares the role as a peer (FeatureBuilder::peer_argument_role), so that a registry without this feature still builds. - EXTERNAL_
INDEX - The typed name of the external index,
flm.refs.external-index, anExternalIndex: an external table, whose value the caller installs when it constructs the run (Externals), and which no stage writes. - FEATURE
- The feature’s registered name,
refs. - FIELDS_
ARG - The name of the trailing tack-on argument a construct holds its
\labelfields in,fields: the argumentlabel_fields_argdeclares andlabel_usesreads. - HYPERREF
- The
\hyperrefelement’s type name,flm.hyperref. - HYPERREF_
RULE - The name of the
\hyperreflowering rule,flm.hyperref.lower.default, whose implementation isHyperrefRule: the default forflm.hyperrefon every backend exceptlatex-recomposed. - LABELS
- The typed name of the label table,
flm.labels, aLabels, which the label scan (SCAN) writes. - LABEL_
FIELD - The
\labelfield’s name,label: what an author writes after the backslash, and the name under which a construct declares the field. - LABEL_
PACKAGE - The name of the scoped package that holds
\labelas a command,flm.refs.label: an argument whose declaration refers to it (ArgDef::scoped) accepts\label{type:label}. Seelabel_package. - LINK_
KIND - The kind token written on the link that a
\refor a\hyperrefproduces,ref: it tells a backend, or a stylesheet, that the link comes from a reference (see the payload conventions). The HTML backend writes it asdata-flm-kind="ref". - LOWERCASE_
VARIANT - The counter style variant of the words written all in lowercase,
lowercase(lemma~4rather thanLemma~4), which\ref[lowercase]{…}requests. - NO_
PREFIX_ KEY - The key of a
\ref’s options that leaves out the word before a number (the prefix, such as “Eq.”),noprefix. - OPTIONS_
ARG - The name of a
\ref’s options argument,options. - REF
- The
\refelement’s type name,flm.ref. - REF_
RESOLUTIONS - The typed name of the resolutions table,
flm.refs.resolutions, aRefResolutions, which the resolve stage (RESOLVE) writes and the lowering rules of references read. - REF_
RULE - The name of the
\reflowering rule,flm.ref.lower.default, whose implementation isRefRule: the default forflm.refon every backend exceptlatex-recomposed. - REF_
TARGETS - The typed name of the targets table,
flm.refs.targets, aRefTargets, which the anchors stage (ANCHORS_STAGE) writes and the resolve stage (RESOLVE) reads. - RESOLVE
- The name of the resolve stage,
flm.refs.resolve. - SCAN
- The name of the label scan stage,
flm.refs.scan. - TARGET_
ARG - The name of the target argument of a
\ref, a\hyperrefand a\label,target: the argument that holds the label. - TARGET_
ARG_ ROLE - The argument role of a label that a reference points to,
flm.refs.target: the role of the target argument (TARGET_ARG) of\refand\hyperref. The feature declares it; a feature with a reference command of its own sets it on that command’s target argument and, so that a registry without this feature still builds, declares the role as a peer (FeatureBuilder::peer_argument_role), as themathfeature does for\eqref. - TEXT_
ARG - The name of the argument holding a
\hyperref’s displayed text,text.
Functions§
- auto_
anchor - The anchor formed from a point’s position, for an unlabeled point such as
an equation line:
<prefix>--<position><four letters>, as ineq--8otbc. - content_
value - The synthesized value of the content reference
contentonnode: the nodesContentRef::nodesdesignates, copied throughvalue_of;Ok(None)when the reference designates nothing onnode. - designation
- Returns what a reference to the label
label, whose target in this document istarget, shows: what a\ref{label}written with no display option shows, decided by the code thatlower_referencedecides it with.countersis the run’s counter table (COUNTERS), absent where the numbering feature is not registered or did not run; a target is then shown by its content or its label. - encode_
anchor - Encodes one text for an anchor (the identifier a link points at; see
ANCHORS): a label’s type, the label after the colon, or a heading title’s plain text. - feature
- The
Refsfeature with the default configuration, ready to be listed in a package entry (PackageEntry). - field_
text - The text of a
\labelnode (the characters of its target argument, trimmed), orNonewhen the node is not a\labelfield, has no target argument, or holds something that is not characters: a command, or a placeholder of a user definition’s template that was not expanded (chars_text). The text is not checked for thetype:labelspelling. - hyperref_
args - The arguments of
\hyperref, in order: the optional target label, then the text to display for it. - hyperref_
element - The element value of every
\hyperrefnode, shared asref_element’s is for every\refnode. - hyperref_
target - The target of a
\hyperrefnode (the label written in the brackets) as characters with the whitespace around it trimmed, and the label when that text is spelledtype:label. - label_
anchor - The anchor formed from a label:
<type>-<label>, each part throughencode_anchor. - label_
field - The
\labelfield oflabel_fields_arg: repeatable, with one character-group argument namedTARGET_ARG. A construct that accepts other fields beside\labellists this one among them in its own tack-on argument, which it declares under the nameFIELDS_ARGso thatlabel_usesreads it. - label_
fields_ arg - The trailing tack-on argument that a labeled construct declares as its
last argument, so that
\thing{…}\label{x:y}parses: one repeatable\labelfield with one character-group argument, under the names thatlabel_usesreads (FIELDS_ARG,LABEL_FIELD,TARGET_ARG). - label_
package - The scoped package
LABEL_PACKAGE, declared byowner: one command,\label{type:label}, whose one character-group argument is namedTARGET_ARGand whose element is namedflm.field(field_element), so that its node is a field node namedLABEL_FIELD, whichlabel_usereads as it reads a tack-on\label. - label_
use - Reads one
\labelnode, wherever it is written (a field absorbed by a labeled element, the\labelcommand themathfeature declares inside a display-math environment’s body, or the command of the scoped packageLABEL_PACKAGE): its text as written, its span, and the label when the text is spelledtype:label.Nonewhennodeis not a\labelnode, has no target argument, or holds something that is not characters (field_text). - label_
uses - Every
\labelfield written onnode, in itsFIELDS_ARGargument, in document order. Empty for a node with no such argument. - label_
uses_ in - Every
\labelnode ofnodes, in their order, read aslabel_usesreads the fields written on a node. A construct whose labels are written in a run of nodes of their own calls it: the content of an argument that refers to the scoped packageLABEL_PACKAGE, such as the optional argument of\footnote. Every other node of the run is skipped; a construct that must refuse anything but labels in that argument looks for the other nodes itself. - lower_
reference - Lowers a reference to
targets, with the display optionsdisplay, into the items it shows: a command of another feature calls this function to show a reference exactly as a\refdoes, instead of writing that behavior again. - point_
labels - Splits the
\labels a construct read into the two lists a reference point holds: the labels spelledtype:label, in the order they were written, and the texts that are not, each with the span to report it at and its position in the whole list. - ref_
args - The arguments of
\ref, in order: the key-value options, then the target label. A feature declaring a reference-like command of its own can reuse this list. - ref_
display_ options - A
\refnode’s display options, read from its key-value options argument: a key other thanNO_PREFIX_KEYrequests the wording variant of its own name (the last such key wins), andNO_PREFIX_KEYleaves out the word before a number. An absent or unreadable argument gives the default options. - ref_
element - The element value of every
\refnode. It is one shared value, like the label field’s, so that no caller can create a second element value of typeflm.ref(an element is identified by its value, not by its name). - ref_
targets - The targets of a
\refnode, in the order they were written: its target argument read as characters and split at the commas (split_targets). - reference_
targets - The targets of
nodewhen it is a\refor a\hyperref:ref_targetsfor a\ref, the one target ofhyperref_targetfor a\hyperref, andNonefor any other node. - split_
targets - The targets written in the text of a reference’s target argument: the text split at the commas, each part trimmed and parsed as a label.
- title_
anchor - The anchor formed from a title, for an unlabeled heading:
<prefix>--<title>, each part throughencode_anchor. - value_
anchor - The anchor formed from the number the document gave a point:
<prefix>-<numbers>, as intheorem-2-3. - value_
of - Copies
nodesinto a synthesized value under the recursion guard policyguard, as content of the document shown a second time (ValueContent::Shown): the content that a reference shows of the point it designates.anchoris a node of the tree that holdsnodes(usually the node that carries the point);nodesmust belong toanchor’s tree, and whennodesis empty, the copy’s root takes its span and parsing state fromanchor. It callscopy_run_into_value.