Expand description
The textstyles feature: the inline formatting commands \emph, \textbf,
\textit and \texttt.
The guide to the language describes these commands for authors (inline formatting).
§What an author writes
Each command takes one mandatory argument, its content, and marks that content
with one inline style: \emph{…} is semantic emphasis, \textbf{…} bold
weight, \textit{…} italic shape and \texttt{…} a monospaced face. The
content is ordinary document content (text, references, mathematics, other
formatting commands). A command is inline: it is part of the paragraph it is
written in and keeps the whitespace around it. The commands are declared in
text mode only; inside mathematics, the math
feature declares its own \textbf, \textit and \texttt (see
math::text).
§What the feature registers
The textstyles feature (TextStyles, a FlmFeature) registers:
- the element type
TEXT_STYLE(flm.textstyle): the four commands form one family, declared as one element type with one element value per command (elements and aspects): each element value carries aTextStyleElement, whoseTextStylesays which style the command applies; - the lowering rule
RULE(flm.textstyle.lower.default), the default on every backend, and the recomposition rule oflatexfor thelatex-recomposedbackend.
TextStyle is the feature’s own list of styles. The presentation elements
use a separate list, SpanStyle; the lowering rule converts one into the
other (TextStyle::span_style), so that the element never refers to a
presentation type.
§What a formatting command becomes on each backend
- Default rule (
RULE, used by thetextandhtmlbackends): the rule stages (builds into the lowered tree; seeLowerer) aflm.pres.spannode whose payload carries theSpanStyle, over the argument lowered through the rules. textbackend: it prints the span’s content; the style has no form in plain text and is left out.htmlbackend: it writes the span as the HTML contract states forflm.pres.span(CONVENTIONS): an<em>,<strong>,<i>or<code>element by the style.latex-recomposedbackend: the rule oflatexwrites the command back as the LaTeX macro of the same name.
A backend that has no way to show a style writes the content without it.
§Map of the module
TextStyles— the feature;featurereturns it for a package entry.TEXT_STYLE,TextStyle,TextStyleElement— the element type and the data of each element value.RULE,TextStyleRule— the default lowering rule and its body.latex— the recomposition rule for thelatex-recomposedbackend.literals— the sibling feature that declares the commands standing for one character.
Modules§
- latex
- The recomposition rule of the
textstylesfeature for thelatex-recomposedbackend: each formatting command is written back as the LaTeX macro of the same name.
Structs§
- Text
Style Element - The data of one element value of
flm.textstyle: the style that the command applies. - Text
Style Rule - The body of
RULE: it stages aflm.pres.spannode whose payload carries the command’sSpanStyle(TextStyle::span_style), over the command’s argument lowered through the rules. - Text
Styles - The
textstylesfeature: it registers the four formatting commands, their default lowering rule and the recomposition rule oflatex. See the module documentation.
Enums§
- Text
Style - The inline style a formatting command applies: one value per command of the
textstylesfeature.
Constants§
- FEATURE
- The feature’s registered name,
textstyles. - RULE
- The name of the default lowering rule of
TEXT_STYLEon every backend,flm.textstyle.lower.default, whose body isTextStyleRule. - TEXT_
STYLE - The name of the element type of the four formatting commands,
flm.textstyle. The data of each element value is aTextStyleElement.
Functions§
- feature
- The
TextStylesfeature as a shared value, ready to be listed in a package entry.