amsthm package¶
- class amsthm.DocOptions(theorems: dict[str, NewTheorem] = <factory>, counter_depth: int = 0, counter_ignore_headings: set[str] = <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[str]¶
- classmethod from_doc(doc: Doc) DocOptions [source]¶
- property latex: str¶
- theorems: dict[str, NewTheorem]¶
- property theorems_set: set[str]¶
- property to_panflute: panflute.elements.RawBlock¶
- 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: str¶
Name in pandoc div classes.
It cannot have space.
- property counter_name: str¶
- env_name: str¶
- property latex: str¶
- 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¶
- 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¶
- 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.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.parse_info(info: str | None) list[Element] [source]¶
Convert theorem info to panflute AST inline elements.
- 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.