FLM Features

FLM organizes its functionality into features — pluggable modules that define macros, environments, and specials. Features are the mechanism by which FLM provides (and lets you customize) the available markup.

FLM is a framework, not a fixed language. The macros and environments available in your documents depend entirely on which features are loaded. You can enable or disable any feature, configure its behavior, or write your own custom features.

How Features Work

Each feature is a Python class inheriting from Feature. A feature:

  • Defines macros, environments, and/or specials via its add_latex_context_definitions() method.

  • May provide a DocumentManager for per-document state (e.g., managing numbering or collecting footnotes).

  • May provide a RenderManager for per-render state.

  • Can declare dependencies on other features.

Default Features

The following features are enabled by default when using the flm command-line tool (via the built-in default_config.yaml).

Note

When using the Python API with standard_features(), some of these features (notably theorems) default to disabled and must be explicitly enabled. The command-line tool’s default configuration enables a broader set of features than the standard_features() helper.

Feature

Description

Syntax Reference

baseformatting

Text emphasis, bold, character escapes, paragraph breaks, non-breaking spaces.

Text Formatting

href

Hyperlinks: \href, \url, \email.

Hyperlinks

verbatim

Verbatim and code typesetting: \verbcode, \verbtext, verbatimcode, verbatimtext environments.

Verbatim and Code

math

Mathematics: inline \( ... \), display environments (equation, align, gather), \eqref.

Mathematics

headings

Sectioning commands: \section, \subsection, etc.

Headings

enumeration

Lists: enumerate, itemize, description environments.

Lists

refs

Cross-reference management: \ref, \hyperref.

Cross-References

endnotes

Endnotes and footnotes: \footnote.

Footnotes

floats

Figures and tables: figure, table environments with captions and numbering.

Figures and Graphics

graphics

Graphics inclusion: \includegraphics.

Figures and Graphics

defterm

Definition terms: defterm environment, \term macro.

Definition Terms

theorems

Theorems, lemmas, proofs, and related environments.

Theorems and Proofs

Opt-In Features

The following features are available but must be explicitly enabled in the configuration:

Feature

Description

Syntax Reference

substmacros

Custom substitution macros defined via configuration.

Substitution Macros

quote

Block quote environments with attribution.

Block Quotes

cells

Table-like cell layout.

Tables and Cells

citations

Citations (via the flm-citations extension package).

Citations

annotations

Inline annotations and comments.

See flm.feature.annotations

markup

Custom text formatting macros and semantic block environments.

See flm.feature.markup

Enabling and Configuring Features

Features are configured in your flmconfig.yaml or in the document’s YAML front matter. See Feature Configuration for the full details.

Enable a feature with default options:

flm:
  features:
    quote: {}

Disable a feature:

flm:
  features:
    theorems: false

Configure a feature with custom options:

flm:
  features:
    endnotes:
      categories:
        - category_name: footnote
          counter_formatter: roman
          heading_title: 'Footnotes'
          endnote_command: 'footnote'

Using Features from Extension Packages

External features can be loaded by using their fully qualified Python module path as the feature name in the configuration:

flm:
  features:
    'my_extension_package.my_feature': {}

Or by importing the package’s default configuration with $import:

$import:
  - pkg:my_extension_package

Writing Custom Features

You can write your own features by creating a Python class that inherits from Feature. The key method to implement is add_latex_context_definitions(), which returns a dictionary of macros, environments, and specials to register.

See the FLM “Features” - Extensions API documentation and the source code of the built-in features in the flm/feature/ directory for examples.