FLM Feature flm.feature.theorems¶
Theorem-like environments for FLM documents.
Provides LaTeX-style theorem, lemma, proposition, definition, proof, and
related environments with configurable numbering, shared counters, labels,
and cross-references. Multiple pre-defined environment sets (simpleset,
defaultset, richset) are available.
- class flm.feature.theorems.TheoremEnvironment(environmentname, theorem_spec, theorem_type_spec, allowed_ref_label_prefixes)¶
Bases:
FLMEnvironmentSpecBase- is_block_level: bool | None = True¶
If this flag is set to True, then elements of this type are always parsed as separate block-level elements (e.g., a section heading, an enumeration list, etc.)
If this flag is None, then the spec does not commit as to whether the node produces a block-level or inline-level element. It is strongly recommended you then manually set the flm_is_block_level attribute on the node object to True or False, since the default implementation of finalize_node() won’t be able to do it.
- body_contents_is_block_level: bool | None = True¶
Applicable only to environment specifications. Specifies whether or not the body contents of the body should be parsed as block-level code or not. By default, environment contents are parsed in the same mode as the surrounding content.
- 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.theorems.FeatureTheorems(environments: str | Mapping[str, Mapping[str, Mapping[str, Any]]] | None = None, theorem_types: Mapping[str, TypeTheoremTypeDef] | None = None, shared_counter_formatter: None | TypeCounterFormatter | Literal['alph', 'Alph', 'roman', 'Roman', 'arabic', 'fnsymbol', 'unicodesuperscript', 'unicodesubscript'] | TypeFormatNumTemplate | TypeCounterFormatterSpecDict = None, allowed_ref_label_prefixes: Sequence[str] | None = None)¶
Bases:
FeatureFeature providing theorem-like environments (theorem, lemma, proof, etc.) with automatic numbering, optional shared counters across theorem types,
\label/\refsupport, and relation references (e.g. “Proof of Theorem 1”).- feature_dependencies: Set[str] | Sequence[str] | None = ['refs']¶
If non-None, then this is a list (or set) of feature names that must also be used in a given
FLMEnvironmentinstance for the present feature to function as intended. These dependency features will be initialized prior to the present feature.
- feature_optional_dependencies: Set[str] | Sequence[str] | None = ['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 = {'allowed_ref_label_prefixes': ['thm', 'prop', 'cor', 'lem', 'rem', 'def', 'dfn', 'x', 'topic'], 'environments': {'definitionlike': {'definition': {'title': {'abbreviated': {'plural': 'Defs.', 'singular': 'Def.'}, 'lowercase': 'definition'}}, 'remark': {'title': {'abbreviated': {'plural': 'Rems.', 'singular': 'Rem.'}, 'lowercase': 'remark'}}}, 'prooflike': {'proof': {'title': {'abbreviated': {'plural': 'Proofs', 'singular': 'Proof'}, 'lowercase': 'proof'}}}, 'theoremlike': {'conjecture': {'title': {'abbreviated': {'plural': 'Conjs.', 'singular': 'Conj.'}, 'lowercase': 'conjecture'}}, 'corollary': {'title': {'abbreviated': {'plural': 'Cors.', 'singular': 'Cor.'}, 'lowercase': 'corollary'}}, 'lemma': {'title': {'abbreviated': {'plural': 'Lems.', 'singular': 'Lem.'}, 'lowercase': 'lemma'}}, 'proposition': {'title': {'abbreviated': {'plural': 'Props.', 'singular': 'Prop.'}, 'lowercase': 'proposition'}}, 'theorem': {'title': {'abbreviated': {'plural': 'Thms.', 'singular': 'Thm.'}, 'lowercase': 'theorem'}}}}, 'shared_counter_formatter': 'arabic', 'theorem_types': {'definitionlike': {'counter_formatter': None, 'heading_title_post': ')', 'heading_title_pre': ' (', 'numbered': True, 'shared_numbering': True, 'theorem_heading_level': 'theorem', 'title_enable_relation_ref': False}, 'prooflike': {'body_final_content': '\xa0□', 'numbered': False, 'title_enable_relation_ref': True}, 'theoremlike': {'body_final_content': '', 'counter_formatter': None, 'heading_title_post': ')', 'heading_title_pre': ' (', 'numbered': True, 'shared_numbering': True, 'theorem_heading_level': 'theorem', 'title_enable_relation_ref': False}}}¶
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()¶
- add_latex_context_definitions()¶
- flm.feature.theorems.FeatureClass = <class 'flm.feature.theorems.FeatureTheorems'>¶
Feature providing theorem-like environments (theorem, lemma, proof, etc.) with automatic numbering, optional shared counters across theorem types,
\label/\refsupport, and relation references (e.g. “Proof of Theorem 1”).