FLM Feature flm.feature.math¶
Provides display math environments and equation references for FLM.
Supports equation, align, gather (and their starred variants) as
display math environments with automatic equation numbering, \label /
\tag support, and the \eqref macro for cross-referencing equations.
- class flm.feature.math.MathEnvironment(environmentname, is_numbered=None)¶
Bases:
FLMEnvironmentSpecBaseSpec info for a display-math environment (e.g.
equation,align).Parses the environment body in math mode, recognises
\label,\tag,\nonumber, and\\inside the body, and renders numbered or unnumbered display equations. Numbered environments register equation references via therefsfeature when available.- get_flm_doc()¶
- make_body_parsing_state_delta(token, nodeargd, arg_parsing_state_delta, latex_walker, **kwargs)¶
- make_body_parser(token, nodeargd, arg_parsing_state_delta)¶
- postprocess_parsed_node(node)¶
- render(node, render_context)¶
- recompose_pure_latex(node, recomposer)¶
- class flm.feature.math.MathEqrefMacro(macroname='eqref', ref_type='eq', **kwargs)¶
Bases:
FLMMacroSpecBaseSpec info for the
\eqrefmacro that cross-references numbered equations.This is a delayed-render macro: on the first pass it records the reference, and the actual display text is resolved after all equation numbers have been assigned.
- delayed_render: bool | Callable[[LatexNode, TypeRenderContext], bool] = True¶
Whether this node needs to be rendered at the delayed rendering stage, i.e., after a first pass through the document. This is the case, for instance, for
\refcommands etc. for which the entire document needs to have been traversed at least once beforehand. See the delayed render mechanism in the documentation for theflmdocument.FLMDocumentclass.Set to True or False to determine whether or not the node needs a delayed render. Set to a callable func(node, render_context) -> bool to compute at render time whether the node should be delayed or not.
- allowed_in_standalone_mode: bool = False¶
Reference commands are definitly not allowed in standalone mode
- get_flm_doc()¶
- postprocess_parsed_node(node)¶
- prepare_delayed_render(node, render_context)¶
- render(node, render_context)¶
- recompose_pure_latex(node, recomposer)¶
- class flm.feature.math.FeatureMath(counter_formatter: None | TypeCounterFormatter | Literal['alph', 'Alph', 'roman', 'Roman', 'arabic', 'fnsymbol', 'unicodesuperscript', 'unicodesubscript'] | TypeFormatNumTemplate | TypeCounterFormatterSpecDict = None, math_environment_names: Sequence[str] | None = None, eqref_macro_name: str | None = 'eqref', eqref_ref_type: str = 'eq')¶
Bases:
FeatureFeature for mathematical typesetting with numbered display equations.
Registers configurable math environments (e.g.,
equation,align,gather) and the\eqrefmacro. Starred environments are unnumbered; non-starred environments support\label,\tag, and\nonumber. Optionally integrates with therefsandnumberingfeatures.- feature_title: str | None = 'Mathematical typesetting: equations and equation references'¶
Descriptive name or title for this feature.
- feature_flm_doc()¶
- feature_optional_dependencies: Set[str] | Sequence[str] | None = ['refs', 'numbering']¶
If non-None, then this is a list (or set) of feature names that may enhance the functionality of the present feature. If these features are activated, they will be initialized prior to the present feature.
- feature_default_config: Mapping = {'counter_formatter': {'delimiters': ('(', ')'), 'format_num': {'template': '${arabic}'}, 'join_spec': 'compact', 'prefix_display': {'capital': {'plural': 'Equations~', 'singular': 'Equation~'}, 'plural': 'Eqs.~', 'singular': 'Eq.~'}}}¶
The default configuration tree for this feature. The
runmodule uses these defaults when no configuration is specified for a given feature. Recall that the configuration is a dictionary of key/value pairs that will be specified byrunas keyword arguments to the constructor of the feature instance. If you create feature instances yourself, then you’re responsible anyways for the arguments you specify to the constructor, and you are responsible for honoring or ignoring the values in feature_default_config.
- class RenderManager(feature_document_manager, render_context, **kwargs)¶
Bases:
FeatureRenderManagerBase- initialize(counter_formatter: None | TypeCounterFormatter | Literal['alph', 'Alph', 'roman', 'Roman', 'arabic', 'fnsymbol', 'unicodesuperscript', 'unicodesubscript'] | TypeFormatNumTemplate | TypeCounterFormatterSpecDict = None)¶
- new_numbered_display_math(node, lineno, custom_tag_flm_text=None)¶
- add_latex_context_definitions()¶
- flm.feature.math.FeatureClass = <class 'flm.feature.math.FeatureMath'>¶
Feature for mathematical typesetting with numbered display equations.
Registers configurable math environments (e.g.,
equation,align,gather) and the\eqrefmacro. Starred environments are unnumbered; non-starred environments support\label,\tag, and\nonumber. Optionally integrates with therefsandnumberingfeatures.