pub trait Referenceable: Send + Sync {
// Required method
fn points(&self, node: &NodeRef<'_, Flm>) -> Vec<RefPoint>;
}Expand description
The aspect that declares the reference points a node carries: the places in it that a reference can point at.
The refpoints feature reads this aspect on every node whose element
declares it, and the refs feature (crate::stdlib::features::refs)
collects the labels written for each point and computes the anchors. Any
element may declare the aspect, so a construct that a third-party feature
declares is referred to exactly like a standard heading.
See Referencing for the places that point at a reference point.
Required Methods§
Sourcefn points(&self, node: &NodeRef<'_, Flm>) -> Vec<RefPoint>
fn points(&self, node: &NodeRef<'_, Flm>) -> Vec<RefPoint>
The reference points of this occurrence, in document order.
Each point declares the label types it accepts
(RefPoint::accepts); a construct with no fixed set of label types
declares AcceptedRefTypes::Any.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Referenceable for DeftermElement
One reference point per term definition: the term’s computed label, each
alias’s, then the labels the author wrote. The computed labels are counted
as such (RefPoint::computed), so that the types LABEL_TYPES the
point accepts apply to the written labels alone. The point’s content is
the term, and it is anchored on its first label: the label computed from
the term, or, where the term is empty (and so computes no label), the
first alias’s label or the first written label.
Source§impl Referenceable for FloatElement
One reference point per float (reference points, labels and
anchors):
impl Referenceable for FloatElement
One reference point per float (reference points, labels and anchors):
- of the reference kind of the float type’s name;
- carrying the labels written in the float’s body, which must be of the type’s accepted label types;
- numbered in the type’s counter and counter style where the type’s numbering policy numbers the float;
- showing, where the float has no number and has a caption, the caption’s
alternative text, else the caption’s full content where its argument is
one group or one token
(
Caption::shown_content); - with the anchor
<type>-<number>(figure-1), else the anchor of its first label (figure-photo), else none (AnchorPolicy::FromValue).
impl Referenceable for HeadingElement
Source§impl Referenceable for ItemElement
Declares one reference point per \item that begins an item of a list,
and none for any other \item. The point’s labels are the \label
fields written after the \item, of the label type item; its anchor is
derived from its first label or, for an unlabeled item, from its
position.
impl Referenceable for ItemElement
Declares one reference point per \item that begins an item of a list,
and none for any other \item. The point’s labels are the \label
fields written after the \item, of the label type item; its anchor is
derived from its first label or, for an unlabeled item, from its
position.
An untagged item of a numbered list kind declares a number source
(NumberSource): the list kind’s counter; the scoped instances under
which it is counted (below), outermost first; the counter style of its
list’s depth, whose number format is the depth’s reference template; the
advance of level 0 by one; and, as the number template, the list’s own
reference template where the list writes one
(ListOptions::ref_template). The item’s counter value is therefore
recorded in the form a reference to it shows, and the list’s rule writes
the label beside the item from the same record.
§The content the reference point carries
A reference to an item shows what is shown beside the item, so the point carries the item’s label as its content wherever the label is not a number:
- for a tagged item, its tag, however it is written (
\item[Custom],\item[tag=Custom],\item[tag={Custom}]); such an item declares no number source, so it is counted in no counter; - for an untagged item of an unnumbered list, the list’s own label where
its bracket writes one that can be used (
[-],[label=*],[label={--}]), and otherwise the label template its list kind declares for the depth, by default the bullet•of anitemize. A list’s own label that holds a placeholder (label=#{arabic},[1.]) is an error on an unnumbered list (LabelNamesNumber); the item shows the depth’s label instead, and a reference to the item shows the same; - for any other item, nothing: its number is what a reference shows.
This content is not a node of the document that the point could refer to
(a bullet comes from the configuration, and Custom in tag=Custom
shares a run of characters with its key), so the point carries it as a
small tree of its own (ContentRef::Synthesized). The bullet’s tree is
built once per configured template, when the registry is built, and
shared by every item that shows it. A tag or a list’s own label is copied
into a new tree each time the points are computed, which the
refpoints feature does once per
run.
§The scoped instances under which an item is counted
Each list is a scoped instance of its list kind’s counter (see
scoped instances),
and a nested list’s instance is numbered within the number of the item
that holds it. A tagged item has no number, so no list can be numbered
within it. An item is therefore counted under its own list and, among the
enclosing lists of the same list kind, under each one whose item holding
the nested list is untagged. A list held by a tagged item, or written
before the first \item of the enclosing list, is numbered within the
nearest untagged item of its list kind further out; where there is none,
it is an outermost instance. The nesting depth, which selects the counter
style, still counts every enclosing list of the list kind. In an
enumerate, \item[T] \begin{enumerate}\item x\end{enumerate} therefore
numbers x as (i) regardless of the items before T, and no nesting
joiner writes a number of the enclosing list.
Source§impl Referenceable for MathEnvironment
The reference points of a display-math environment: one per equation line,
in the order the lines are written (lines::equation_lines), including
the lines that cannot be numbered.
impl Referenceable for MathEnvironment
The reference points of a display-math environment: one per equation line,
in the order the lines are written (lines::equation_lines), including
the lines that cannot be numbered.
A line that can be numbered (a line of an unstarred environment with no
\nonumber) keeps the labels written on it and accepts the
LABEL_TYPES. It states:
- a number source when it carries no
\tagand the feature’s configuration numbers equations (MathConfig::numbered_equations): theCOUNTER, theCOUNTER_STYLEand one level to advance, so that a reference to the line shows its number; - the content of its
\tagwhen it carries one, and no number source: a reference to the line shows the tag as the author wrote it, formatting included, and the line counts in nothing.
A line with a \tag therefore states no number source and still keeps its
labels, because a reference to it shows the tag.
A line that cannot be numbered (every line of equation*, align* and
gather*, and a line marked \nonumber) keeps no label and accepts no
label type, so no reference resolves to it and no safe label is assigned
for a \label written on it. Such a \label or \tag is reported once,
when the body is parsed, as flm.math.label-without-number
(lines::LabelWithoutNumber); a \ref to that label is then
unresolved. The line is still a reference point, so that a tool can walk
every line of every environment, and it still has an anchor.
Every line’s anchor follows AnchorPolicy::Auto with the prefix
ANCHOR_PREFIX: the anchor of its first label, or one derived from its
position. A line’s mathematics is never stated as content, because a
reference shows a number or a tag, never a formula.
impl Referenceable for TheoremElement
One reference point per theorem, carrying the theorem’s labels. For a numbered kind, the point is numbered in its class’s counter, shown in the kind’s counter style and anchored on its number. For an unnumbered kind, the point is numbered by nothing and accepts no label.
impl Referenceable for XnoteElement
The two points of ref_points, labeled by the \label commands of the
optional argument (labels_of; anything else the argument holds is
ignored here and reported by the xnote’s lowering rule), and showing the
content argument where it is inline.