amsthm package

class amsthm.DocOptions(theorems: dict = <factory>, counter_depth: int = 0, counter_ignore_headings: set = <factory>)[source]

Bases: object

Document options.

Param

counter_depth: can be n=0-6 inclusive. n means n+1 numbers shown in non-LaTeX outputs. e.g. n=1 means x.y, where x is the heading 1 counter, y is the theorem counter. Should be used with parent_counter to match LaTeX and non-LaTeX output.

counter_depth: int = 0
counter_ignore_headings: set
classmethod from_doc(doc: Doc)DocOptions[source]
property latex
reset_theorem_counters()None[source]
theorems: dict
property theorems_set
property to_panflute
class amsthm.NewTheorem(style: str, env_name: str, text: str = '', parent_counter: str | None = None, shared_counter: str | None = None, numbered: bool = True)[source]

Bases: object

property class_name

Name in pandoc div classes.

It cannot have space.

property counter_name
env_name: str
property latex
numbered: bool = True

A LaTeX amsthm new theorem.

Parameters

parent_counter – for LaTeX output, controlling the number of numbers in a theorem. Should be used with counter_depth to match LaTeX and non-LaTeX output.

parent_counter: str | None = None
shared_counter: str | None = None
style: str
text: str = ''
to_panflute_theorem_header(options: DocOptions, id: str | None, info: str | None)list[pf.Element][source]

Return a theorem header as panflute AST.

This mutates options.theorem_counters, options.identifiers in-place.

class amsthm.Proof(style: str = 'proof', env_name: str = 'proof', text: str = 'proof', parent_counter: str | None = None, shared_counter: str | None = None, numbered: bool = False)[source]

Bases: amsthm.NewTheorem

env_name: str = 'proof'
numbered: bool = False

A LaTeX amsthm new theorem.

Parameters

parent_counter – for LaTeX output, controlling the number of numbers in a theorem. Should be used with counter_depth to match LaTeX and non-LaTeX output.

parent_counter: str | None = None
shared_counter: str | None = None
style: str = 'proof'
text: str = 'proof'
to_panflute_theorem_header(options: DocOptions, id: str | None, info: str | None)list[pf.Element][source]

Return a theorem header as panflute AST.

amsthm.action1(elem: Element, doc: Doc)pf.RawBlock | None[source]
amsthm.action2(elem: Element, doc: Doc)pf.Str | pf.RawInline | None[source]
amsthm.amsthm(elem: Element, doc: Doc)None[source]

General amsthm transformation working for all document types.

Essentially we replicate LaTeX amsthm behavior in this filter.

amsthm.amsthm_latex(elem: Element, doc: Doc)pf.RawBlock | None[source]

Transform amsthm defintion to LaTeX package specifications.

amsthm.collect_ref_id(elem: Element, doc: Doc)None[source]

Only collect all amsthm environment id.

This should be used before the amsthm_latex filter. This is done in 2 passes as the id may be cited/referenced earlier than definition. Consider this as pre-process of ref for LaTeX output.

options.identifiers modified in-place.

amsthm.finalize(doc: Doc)None[source]
amsthm.main(doc: Doc | None = None)None[source]
amsthm.parse_info(info: str | None)list[Element][source]

Convert theorem info to panflute AST inline elements.

amsthm.prepare(doc: Doc)None[source]
amsthm.resolve_ref(elem: Element, doc: Doc)pf.Str | None[source]

Resolve references to theorem numbers.

Consider this as post-process ref for general output formats.