Skip to main content

Module citations

Module citations 

Source
Expand description

The citations feature: citing works by key, numbering the cited works in order of first citation, showing a citation mark where each citation is written, and listing the cited works after the document’s content.

§What an author writes

\cite[note]{key1,key2} cites the works whose citation keys are key1 and key2; it is shown as a citation mark, such as [1,3–5], that holds the numbers of the cited works, each number a link to the work in the list of cited works. \R[flags]\cite{keys} writes the citation as a noun of its sentence: a word, ref.~ for one number and refs.~ for several, comes before the citation mark (the citation counter style holds the words; see “The configuration” below), so \R\cite{a,b} reads refs.~[1,2]. After the content, the list of cited works shows each work’s citation entry, such as Knuth, The Art of Computer Programming, 1984, labeled with its number. The language guide describes both commands for authors (Citations).

§Citation keys and notes

A citation key refers to a cited work: it is the FLM code written for it between the braces of \cite, kept as typed. The whitespace handling and the typographic substitutions of the document’s text do not apply between those braces, because the keys argument is declared with an opaque wrapper (ArgDef::with_opaque_wrapper): the quotes and the dashes of a citation key stay as written. When the citation key is read, it is recomposed from the parsed nodes, with every run of whitespace made one space and the ends trimmed (spelling_identity): arxiv:1234.5678, knuth84, manual:{A. Author, "Some title" -- 2024}. A comma inside a group, a command’s argument or a formula belongs to the citation key, and a citation key may hold a command. The feature reads no meaning into a citation key: the citation providers decide what it refers to (see “Citation entries and citation providers” below).

A note is the optional argument of a \cite: content shown after the numbers ([31; Thm 4]). It belongs to every citation key of that call.

§Citation chunks

\cite calls written directly one after the other, with nothing between them but spaces, a single line break and comments, are one citation chunk, shown as one citation mark. A citation chunk is one \cite node (CITE, flm.citations.cite) whose last argument, a tack-on argument (the trailing argument that absorbs field macros written after a construct; see fields) named MORE_ARG, holds the further calls as fields named cite (CITE_FIELD). A paragraph break, a ~ or a \ , or any other content ends the citation chunk.

read_chunk reads a citation chunk as a list of items, each a citation key and the note of its call, in the order written: \cite{b}\cite[Thm 4]{a,c} gives (b), (a, Thm 4), (c, Thm 4). The keys argument of a call is parsed FLM code, split at the commas that are outside every group (\cite{a,{b,c},d} gives a, {b,c}, d); each part is recomposed into its citation key, and an empty part is skipped. Because a citation key is recomposed from the nodes rather than copied from the source text, a citation key that a user definition writes into a \cite is the one the expansion produced: \cite{manual:\emph{#1}}, used with the argument {Title}, gives manual:\emph{Title}.

\R (REFCITE, flm.citations.refcite) takes an optional flags argument (S for the capitalized word, Refs.~; I for no word) and, as a field of its tack-on argument CITATION_ARG, the \cite written directly after it, together with that call’s further calls. In \R[S]{\cite{a}} the \cite is inside a group, so the \R holds no citation.

The citation keys and the flags are not words of the text around them (ApartFromText); the notes are. A heading without a label gets an identifier encoded from the text of its title; when the title holds \cite[Thm 4]{a}, that text is the title’s own words and Thm 4, without the citation key a.

§Cited works, numbers and identifiers

A cited work is the article or book that a citation key refers to. Two citation keys may refer to one work (arXiv:1211.1037 and arxiv:1211.1037), and only a citation provider can know it: its answer gives the work’s identity, one spelling that every citation key of the work shares (CitationAnswer). The library compares identities as characters. A citation key that no citation provider answered refers to the work whose identity is the citation key as written, so a citation key spelled exactly like a work’s identity is a citation key of that work.

The collect stage flm.citations.collect (COLLECT) walks every citation chunk of the document in document order and records each distinct citation key at its first citation, with where it is first cited, in the table KEYS (flm.citations.keys).

After the citation providers have been asked (below), the retrieve stage numbers the cited works (number_works): one work per distinct identity, in the order of the first citation of any of its citation keys. It writes the table CITATIONS (flm.citations): for each citation key, its work’s number, its work’s identifier citation-<n> and its work’s identity, the citation keys of one work sharing all three. The numbers therefore depend only on the document and on the citation providers’ answers. The identifier prefix IDENTIFIER_PREFIX, citation-, belongs to this feature, and no other feature creates identifiers with it. A cited work is not a reference point, and a citation is not a reference: nothing refers to a cited work by label.

§The citation mark

stage_mark stages (builds into the lowered tree; see Lowerer) a citation chunk’s citation mark: a span of role MARK_ROLE (a role is a name on a presentation node that says what it is; see roles and kind tokens) whose numbers are links of kind cite to their works’ identifiers, with the delimiters and the join texts outside the links. The items without a note come first, in one group, their numbers sorted and compressed into ranges as the citation counter style says (see “The configuration” below) ([1–3,5]); then one group per distinct note, in the order of the note’s first appearance. With a, b, c, d, e cited in that order earlier, \cite{c,b}\cite[Thm 4]{a}\cite{d}\cite[Thm 4]{e} reads [2–4][1,5; Thm 4]. Each work appears once in a group: with arXiv:1211.1037 and arxiv:1211.1037 one work, \cite{arXiv:1211.1037,arxiv:1211.1037} reads [1].

The citation mark of a \cite is attached to the content before it (kind token ATTACHED): the whitespace written before \cite is removed, the spaces ~ and \ included (word~\cite{a}, word ~ \cite{a} and word \cite{a} read alike), and a no-break space is written before the citation mark (space_before), as a character in a span of role SPACE_ROLE, under the bracketed form of the citation mark and under the in-place placement; under the superscript form nothing is written (the form and the placement are settings of the configuration; see “The configuration” below). The content around a citation mark is not read: a \cite at the start of a paragraph or after ( also has its space written, and an author writes \R[I]\cite{a} there instead. The citation mark of an \R is standalone (kind token STANDALONE): shown inline, never raised, with no space written before it and none removed.

§Citation entries and citation providers

The citation entry of a cited work (CitationEntry) is what is shown for it: inline content written with the commands of the registry’s language (text, \emph, a link, a formula), which may not declare a label (see CitationEntry). The library performs no input or output: the citation entries come from citation providers (CitationProvider), which the host contributes to the service slot PROVIDERS_SLOT (flm.citations.providers; see service_slot and services). The service slot takes any number of citation providers and the feature never requires one. A citation provider returns, for a citation key, an answer holding its citation entry, “not mine”, or an error.

The retrieve stage flm.citations.retrieve (RETRIEVE) asks the citation providers about the cited keys, in the order of precedence of the service slot (the providers of the feature placed last in the feature order first, each feature’s in the order it contributed them, the host’s last; PROVIDERS_SLOT): the first citation provider receives every citation key in one call, in order of first citation (CitationProvider::answer_all), and each later one receives, in one call, the citation keys that every citation provider before it answered “not mine”. A citation provider written for one citation key at a time implements CitationProvider::answer alone. The first citation provider that claims a citation key decides it: its answer (CitationAnswer: the citation entry and the work’s identity), or an error that is final for that citation key. The stage writes the table ENTRIES (flm.citations.entries): for each citation key, its answer or the reason it has no citation entry (MissingEntry); then it numbers the cited works. Each citation entry is read as the document would show it, with user definitions expanded, and is refused when it holds a citation or block content (a paragraph break, a list, a heading). A citation key with no citation entry is numbered and shown in citation marks like any other.

A citation provider makes a citation entry from FLM source (ProviderCx::parse_entry) or from parts (EntryPiece, ProviderCx::build_entry): characters, FLM source, emphasis, strong importance and links. Each part with a meaning is written as the command of the feature that owns that meaning (\emph, \textbf, \href), so the citation entry is shown exactly as the same content written in FLM.

§The check that every cited key has a citation entry

The check stage flm.citations.check (CHECK) reports every cited key that has no citation entry (NoEntry), one report per citation key, even when several citation keys refer to one work. It provides a member of the collection flm.validated, which every workflow demands (asks the plan to run a stage that provides it; see PlanRequest::demand), so the check runs under every workflow, the check workflow included; because it reads the citation entries, the citation providers are asked under every workflow.

§The list of cited works

The bibliography is a piece (BIBLIOGRAPHY, flm.citations.bibliography): a document-level synthesized value that a backend places beside the document’s content (Piece), here after it. It holds a heading (the configured title, References by default, at the configured level, 2 by default; no heading where the configuration sets no title) and one citation entry per cited work, in the order of the numbers, each labeled with its number ([1]) and carrying its work’s identifier. The citation entry shown for a work is the one answered for the citation key under which the work was first cited; a work with no citation entry shows a dropped mark (a flm.pres.dropped node; see recovery) in its place.

build_list builds such a list from any set of cited works; the builder stage flm.citations.build-bibliography (BUILD_BIBLIOGRAPHY) calls it over every cited work of the document. The feature contributes the piece’s declaration to the pieces feature’s service slot as a peer contribution (FeatureBuilder::peer_slot): without the pieces feature, the list is built and no backend places it. Two pieces placed after the content are placed in the order their features contributed them; among the standard features (stdlib::add_features) the xnotes feature comes first, so the list of cited works follows the lists of xnotes (notes set apart from the running text, such as footnotes; see xnotes). On the latex-recomposed backend (latex), no list is placed and no citation entry is written: LaTeX writes its own list of cited works there.

§The placements of the citation entries

The configuration’s placement (CitationPlacement) decides where the citation entries are shown. Under listed, the default, the bibliography is placed after the content and the citation marks show numbers. Under in place, a citation mark shows, for each item in the order written, the item’s citation entry between the citation counter style’s delimiters, then the note separator and the note: [Knuth, 1984][Lamport, 1994; Thm 4]. The citation mark then holds no link and carries the kind token IN_PLACE, and no list is placed. A \cite writes its no-break space before an in-place citation mark, and an \R writes its word.

§The configuration

CitationsConfig is the feature’s configuration, fixed when the registry is built (configuration). It holds:

  • the placement of the citation entries (see above);
  • the form of a citation mark (MarkForm): bracketed, the default, or superscript. Under the superscript form, no delimiters are written wherever numbers are shown, the numbers of a \cite are raised, and those of an \R stay inline. The form has no effect under the in-place placement;
  • the citation counter style, the counter style (CounterStyleDecl) that writes the numbers of the cited works, the delimiters, the texts joining several numbers and the words \R writes. This feature compiles it when the registry is built, and the counter styles a host sets in the numbering feature’s configuration (NumberingConfig::styles) do not replace it;
  • the heading above the list of cited works (its title and its level, or no heading);
  • the text written before a note.

§What the feature registers

  • Elements: \cite (CITE) and \R (REFCITE), available in text mode; the synthesized list and list-entry elements of the bibliography (BIBLIOGRAPHY, BIBLIOGRAPHY_ENTRY), which no author writes.
  • The argument role KEY_ARG_ROLE (flm.citations.key), which states that an argument holds citation keys (ArgDef::role): the role of the keys argument of \cite and of the cite fields of \cite and \R.
  • Tables: KEYS, ENTRIES, CITATIONS and the piece table BIBLIOGRAPHY (bibliography_table).
  • Stages, all of document scope: collect (COLLECT); retrieve (RETRIEVE), which reads what collect writes; and the bibliography’s builder (BUILD_BIBLIOGRAPHY) and check (CHECK, which also provides the capability of that name), which read what retrieve writes.
  • The service slot PROVIDERS_SLOT, which the host fills with citation providers.
  • The settings of the feature (see “The configuration”).
  • The stylesheet flm.citations.style (html::stylesheet) and the definition piece flm.latex.def.citations (latex::definition_piece), the latter contributed to the style file’s service slot as a peer contribution.
  • Lowering rules: on every backend, the general rules of \cite and \R (CITE_RULE, REFCITE_RULE), which stage the citation mark, and of the list of cited works (BIBLIOGRAPHY_RULE), which stages a block holding a heading and a labeled list. The general rules of \cite and \R require the feature’s style identifier flm.citations.style (html::STYLE), which on the html backend names the stylesheet, so a page holding no citation does not carry it. On the latex-recomposed backend, rules (latex) that write a citation as the author wrote it through three LaTeX hooks, and write nothing for the list. The rendering guide shows the output on each backend (Citations, Citations in HTML, Citations in the recomposed LaTeX).
  • A build hook (LateInit) that compiles the citation counter style, the note separator and the title of the list: a text that is not valid FLM fails the registry build.

§Dependencies

The feature requires the element index (the index feature, index), whose table the stages walk, and the presentation vocabulary of the lowering feature. It does not depend on the numbering feature (it uses the counter-style code, not the counters), nor on refs or xnotes. The latex-recomposed backend, the LaTeX family’s constructs and the pieces feature are peer declarations (PeerName) and peer contributions: the feature builds without them, with its rules for an absent backend set aside (excluded from rule selection; see PeerName).

§Map of the items

Modules§

html
The stylesheet of the citations feature on the html backend, flm.citations.style (stylesheet), and the markup it selects on.
latex
The lowering rules of the citations feature for the latex-recomposed backend (the recomposed LaTeX): a citation is written back as the author wrote it, through three LaTeX hooks, and the list of cited works is left to LaTeX.
latex_rendered
The definition piece of the citations feature on the latex-rendered backend, flm.latex.def.flmx.citations (piece).

Structs§

BibliographyRule
The body of the general rule of the list element BIBLIOGRAPHY, BIBLIOGRAPHY_RULE, the default on every backend except the recomposed LaTeX. It stages (builds into the lowered tree; see Lowerer)
Chunk
A citation chunk as read_chunk returns it: its items in the order written, and the mistakes of its calls.
CitationAnswer
A citation provider’s answer for a citation key it knows: the work’s citation entry, the work’s identity, and warnings for the author.
CitationEntries
The value of the table ENTRIES: the cited keys of the document, in order of first citation, each with the result of the retrieve stage (Retrieval).
CitationEntry
The citation entry of one cited work: what the list of cited works shows for it, and what a citation mark shows for it under the in-place placement (CitationPlacement::InPlace).
CitationItem
One item of a citation chunk: a citation key, and the note of the call it was written in.
CitationProviderError
Why a citation provider could not answer for a citation key it claims, in the citation provider’s own words. The retrieve stage reports it in the Error ProviderFailed, and no later citation provider is asked about that citation key.
CitationRequest
What the retrieve stage asks a citation provider about one cited key.
Citations
The citations feature (FlmFeature): it registers the elements \cite and \R, the collect, retrieve, check and bibliography-builder stages with their tables (the cited keys, the citation entries, the cited works, the bibliography piece), the service slot of the citation providers, and the lowering rules of the citation marks and of the list of cited works on every backend, the html backend and the recomposed LaTeX. The module documentation describes the feature in full.
CitationsConfig
The configuration of the citations feature: where the citation entries are shown, the form of a citation mark, the citation counter style, the heading of the list of cited works, and the text between the numbers and a note.
CiteRule
The body of the general rule of \cite, CITE_RULE: it stages the space that the form calls for (space_before) in a span of role SPACE_ROLE, then the citation chunk’s attached citation mark (stage_mark). It reports the citation chunk’s writing mistakes (report_mistakes), and requires the feature’s style identifier STYLE.
CitedKeys
The value of the table of cited keys (KEYS). It contains every citation key that the document cites, once, in order of first citation, that is, in the order in which the citation keys first appear in the document.
CitedWork
A CitedWork contains the number, the identifier and the identity of a cited work. The table of cited works (CitedWorks) stores a CitedWork for each citation key, and the citation keys that refer to the same work have equal CitedWork values.
CitedWorks
The value of the table of cited works (CITATIONS). It contains every citation key that the document cites, in order of first citation, each with the cited work (CitedWork) that it refers to. Citation keys with the same identity refer to the same work (see CitedWork::identity). The function number_works creates this value.
EntryCites
The error that is reported when the citation entry for a citation key contains a citation (flm.citations.entry-cites).
EntryNotInline
The error that is reported when the citation entry for a citation key is not inline content (flm.citations.entry-not-inline).
ListedEntry
The payload of a node of the entry element (BIBLIOGRAPHY_ENTRY): the work’s citation key, number and identifier, and whether its citation entry is missing (the node then holds nothing).
ListedWork
One cited work of a list, as build_list takes it: its citation key, number and identifier, and its citation entry, or None for a work with no citation entry.
MarkSettings
The feature’s settings as the lowering rules read them: the configuration, and its texts (the citation counter style, the note separator and the title of the list of cited works) compiled when the registry is built.
NoCitation
Error raised when a \R is not immediately followed by \cite (flm.citations.no-citation). The \R command must immediately be followed by a valid \cite{..} command invocation, as in \R\cite{bib:myref} or \R[I]\cite{bib:myref,bib:myref2}. Reported by the lowering rule for \R when \R is invoked. In such a case, the \R expands to a dropped mark (flm.pres.dropped).
NoEntry
The error that is reported when a cited key has no citation entry (flm.citations.no-entry).
NoKey
The error that is reported when a \cite call has an empty argument (id flm.citations.no-key). An argument that contains only commas and whitespace counts as empty.
NoProvider
The error that is reported when a document cites works and no citation provider is set up (flm.citations.no-provider).
ProviderCx
The context the retrieve stage gives a citation provider together with the requests: the built language of the registry, through which the citation provider makes its citation entries into content of the document’s vocabulary (parse_entry, build_entry), and the scope under which it reports its slow work on the progress sheet of the build (progress).
ProviderFailed
The error that is reported when a citation provider fails to retrieve the citation entry for a citation key (flm.citations.provider-failed).
ProviderWarning
The warning that is reported for each warning text that a citation provider adds to its answer for a citation key (flm.citations.provider-warning).
RefCiteRule
The body of the general rule of \R, REFCITE_RULE: it stages the citation counter style’s word in the variant the flags select, singular or plural by StagedMark::shown, in a span of role WORD_ROLE, then the citation chunk’s standalone citation mark (stage_mark). It writes no word under the flag I or for a dropped mark, and nothing before the word. It reports an \R with no \cite directly after it (NoCitation), the flags it does not define (UnknownFlag) and the citation chunk’s writing mistakes (report_mistakes). It requires the feature’s style identifier STYLE.
StageFailed
The error that is reported when a stage of the citations feature fails (id flm.citations.stage-failed).
StagedMark
What stage_mark staged, and how many numbers the citation mark holds.
Uncollected
Error raised when a citation key is cited only outside the trees of the document, so that it has no number (condition id flm.citations.uncollected).
UnknownFlag
The error that is reported when the flags argument of \R contains an unknown flag (flm.citations.unknown-flag).

Enums§

ChunkMistake
A mistake in the writing of one call of a citation chunk, found by read_chunk; the call contributes no item. report_mistakes reports each one as a diagnostic.
CitationElement
The per-value data of the two elements: whether a node is a \cite or an \R, the two kinds of node that carry a citation chunk.
CitationPlacement
Where the citation entries of the cited works are shown. In settings data, listed or in-place.
EntryPiece
One part of the content of a citation entry that a citation provider builds with ProviderCx::build_entry: characters, FLM source, or a group of parts with a meaning (emphasis, strong importance, a link).
MarkForm
How a citation mark shows the numbers of the works its citation chunk cites, where the citation entries are listed after the content (CitationPlacement::Listed); it has no effect under the in-place placement. In settings data, bracketed or superscript.
MissingEntry
The reason why a cited key has no citation entry.
Reading
Where a citation chunk is read: in a lowering rule or in a stage. The two differ in how they treat citation keys that hold a placeholder of a user definition’s template (\cite{arxiv:#1} inside a template). Such citation keys are not known until the template is expanded, because a placeholder has no spelling of its own.
Retrieval
The result of the retrieve stage for one cited key: the answer of a citation provider, or the reason why the citation key has no citation entry.
Standing
How a citation mark is placed in its sentence: attached to the content before it (\cite) or standing alone (\R).

Constants§

ATTACHED
The kind token of the citation mark of a \cite, attached: the citation mark belongs to the content before it, and the space that its form calls for is written before it.
BIBLIOGRAPHY
The name flm.citations.bibliography, used for four things: the synthesized element of a list of cited works, the role of the block that list lowers to, the piece that places the list of every cited work after the content, and that piece’s table (bibliography_table).
BIBLIOGRAPHY_ENTRY
The name of the synthesized element of one entry of a list of cited works, flm.citations.bibliography.entry: a node of it holds the citation entry’s content and carries a ListedEntry as its payload.
BIBLIOGRAPHY_ENTRY_RULE
The name of the general lowering rule of the entry element, flm.citations.bibliography.entry.lower.default. A list entry is lowered by its list’s rule; this rule fails with a structure error when a list entry is lowered on its own.
BIBLIOGRAPHY_RULE
The name of the general lowering rule of the list element, flm.citations.bibliography.lower.default (BibliographyRule), the default on every backend.
BUILD_BIBLIOGRAPHY
The name of the bibliography’s builder stage, flm.citations.build-bibliography, which writes the piece table BIBLIOGRAPHY.
CAPITAL_FLAG
The flag of \R that selects the capitalized word (the citation counter style’s variant CAPITAL_VARIANT), S.
CAPITAL_VARIANT
The name of the citation counter style’s variant of words that the flag S of \R selects, capital: Ref.~ and Refs.~ rather than ref.~ and refs.~.
CHECK
The name of the check stage and of the capability it provides, flm.citations.check. The capability is a member of the collection flm.validated, which every workflow demands (asks the plan to run a stage that provides it; see PlanRequest::demand), so the check runs under every workflow.
CITATIONS
The name of the table of cited works, flm.citations, whose value is a CitedWorks. The retrieve stage RETRIEVE writes this table. The lowering rules of \cite and \R read the number and the identifier of each cited work from this table, and the stage BUILD_BIBLIOGRAPHY reads it to build the list of cited works.
CITATION_ARG
The name of \R’s tack-on argument, citation, which holds the \cite written directly after the \R as a field named CITE_FIELD.
CITE
The name of the element of \cite, flm.citations.cite. One node of it carries one citation chunk: its own call and the calls written directly after it, held in its tack-on argument MORE_ARG.
CITE_FIELD
The name of the field that each further call of a citation chunk is read as, cite: \cite{a}\cite{b} is one \cite node whose argument MORE_ARG holds one field named cite. The \cite written after an \R is also a field of this name, in the argument CITATION_ARG.
CITE_RULE
The name of the general lowering rule of \cite, flm.citations.cite.lower.default (CiteRule), the default on every backend.
COLLECT
The name of the collect stage, flm.citations.collect. This stage records every citation key that the document cites in the table KEYS.
ENTRIES
The name of the table of the citation entries, flm.citations.entries. The table (CitationEntries) contains, for each cited key, its citation entry or the reason why it has none.
ENTRY_NUMBER_ROLE
The role of the span that holds an entry’s label in a list of cited works (its number written through the citation counter style), flm.citations.entry.number.
FEATURE
The feature’s registered name, citations.
FLAGS_ARG
The name of \R’s optional flags argument, flags.
IDENTIFIER_PREFIX
The prefix of the identifier of a cited work, citation-. The identifier of the work numbered 3 is citation-3.
INLINE_FLAG
The flag of \R that writes no word, only the citation mark, I.
IN_PLACE
The kind token of a citation mark under the in-place placement, in-place, which the span carries after ATTACHED or STANDALONE: the citation mark shows the citation entries.
KEYS
The name of the table of cited keys, flm.citations.keys, whose value is a CitedKeys. The collect stage COLLECT writes this table. The retrieve stage RETRIEVE and the check stage CHECK read it.
KEYS_ARG
The name of a call’s citation keys argument, keys.
KEY_ARG_ROLE
The argument role of citation keys, flm.citations.key: the role of the keys argument (KEYS_ARG) of \cite and of the cite fields that \cite and \R take.
KIND_CITATIONS
The kind token that a list of cited works carries on its block and on its list, citations; also the name given to the list’s heading (HeadingPayload::name).
LINK_KIND
The kind of every link from a citation mark to a cited work, cite.
MARK_ROLE
The role of a citation mark’s span, flm.citations.mark.
MORE_ARG
The name of the tack-on argument of \cite that holds the further calls of its citation chunk, more.
NOTE_ARG
The name of a call’s optional note argument, note.
NO_BREAK_SPACE
The no-break space (U+00A0) written before an attached citation mark, under the bracketed form and under the in-place placement.
PROVIDERS_SLOT
The name of the service slot of the citation providers, flm.citations.providers (declared with service_slot). It takes any number of CitationProvider values, asked in the order of precedence (Services::services_by_precedence_named): the providers of the feature placed last in the feature order first, each feature’s in the order it contributed them, and the host’s last. The feature declares it and never requires a contribution: a registry with no citation provider builds, every cited key of its documents then has no citation entry, and the retrieve stage reports NoProvider once per document that cites a work.
REFCITE
The name of the element of \R, flm.citations.refcite. One node of it carries the citation chunk written directly after the \R, shown as a noun of its sentence with the citation counter style’s word before its citation mark.
REFCITE_RULE
The name of the general lowering rule of \R, flm.citations.refcite.lower.default (RefCiteRule), the default on every backend.
RETRIEVE
The name of the retrieve stage, flm.citations.retrieve. This stage obtains the citation entries from the citation providers, and writes the tables ENTRIES and CITATIONS.
SPACE_ROLE
The role of the span that holds the space written before the citation mark of a \cite (space_before), flm.citations.space.
STANDALONE
The kind token of the citation mark of an \R, standalone: the citation mark is a part of its sentence, shown inline, with nothing written before it.
STYLE_NAME
The name of the citation counter style, flm.citations.style.citation (default_style). The citation counter style is the feature’s own counter style; a configuration read from settings data keeps this name.
WORD_ROLE
The role of the span that holds the word \R writes before its citation mark, flm.citations.word.

Traits§

CitationProvider
A citation provider: a service that answers cited keys with their works’ citation entries and identities. A host contributes citation providers to the service slot PROVIDERS_SLOT.

Functions§

bibliography_table
Returns the handle of the bibliography’s piece table, BIBLIOGRAPHY: the builder stage writes it, and a backend that places pieces reads it.
build_list
Builds the list of works, in the order given, and returns it as a synthesized value’s tree. The tree holds one node of the list element BIBLIOGRAPHY, whose children are one node of the entry element BIBLIOGRAPHY_ENTRY per work. Each entry node carries its ListedEntry and holds a copy of its citation entry’s content as the synthesized value’s own content (ValueContent::Own), or nothing for a work with no citation entry. The new nodes take anchor’s span and parsing state.
calls
Returns every call of the citation chunk that node carries, in the order written: the first call (leading_call), then the further calls held in its argument MORE_ARG. Each call holds the arguments NOTE_ARG and KEYS_ARG. Returns an empty list where leading_call returns None.
cite_args
The argument declarations of \cite, in order: the note (NOTE_ARG), the citation keys (KEYS_ARG), and the further calls of the citation chunk (MORE_ARG).
cite_element
The element value of every \cite node (one value, shared by all of them), as the feature registers it.
default_style
Returns the default citation counter style, named STYLE_NAME: arabic numbers, the delimiters [ and ], the compact join (1,2 and 1–3,5), ranges on, and the words ref.~ and refs.~, with the variant CAPITAL_VARIANT holding Ref.~ and Refs.~.
feature
The citations feature constructed from the default configuration (CitationsConfig::new).
leading_call
Returns the first call of the citation chunk that node carries: the \cite node itself, or the field cite written after an \R. Returns None for an \R with no \cite directly after it, and for a node of neither element.
number_works
Numbers the cited works of the citation keys keys, and returns the result as the value of the table of cited works (CITATIONS).
read_chunk
Reads the citation chunk that node carries (a \cite node, or an \R node through the field written after it) as a list of items, each a citation key and its call’s note, in the order written. It serves both elements, in a lowering rule and in a stage (reading).
refcite_args
The argument declarations of \R, in order: the flags (FLAGS_ARG), then the tack-on argument CITATION_ARG, which takes the \cite written directly after the \R as a field named cite with \cite’s three arguments. \R[S]\cite{a,b}\cite{c} therefore reads as one citation chunk, and \R[S]{\cite{a}} holds no citation, because the \cite is inside a group.
refcite_element
The element value of every \R node (one value, shared by all of them), as the feature registers it.
report_mistakes
Reports each mistake that read_chunk found in chunk as an Error at the span of its call (ChunkMistake::NoKey as NoKey).
space_before
Returns the text written before the citation mark of a \cite under config: a no-break space (NO_BREAK_SPACE) under the bracketed form, and under the in-place placement regardless of the form; None under the superscript form of the listed placement. Nothing is ever written before the citation mark of an \R.
stage_mark
Stages the citation mark of chunk (what is shown in the text for the citation chunk) and returns it with the count of numbers it holds. This is the only function that stages a citation mark; the rules of \cite and of \R call it.

Type Aliases§

CitationResult
What a citation provider returns for one citation key: Ok(Some(answer)) for a citation key it serves, Ok(None) (“not mine”) for a citation key it does not serve, so that the next citation provider is asked, or an error for a citation key it claims and could not answer.