Eq

Tags to render equations

class disseminate.tags.eqs.Eq(*args, block_equation=False, **kwargs)

Bases: disseminate.tags.img.Img

The inline equation tag

Render an equation in native LaTeX (.tex targets) or into a rendered SVG image using LaTeX (.html targets).

Attributes
aliasesTuple[str]

A list of strs for other names a tag goes by

activebool

If True, the Tag can be used by the TagFactory.

block_equationbool

If True, the equation will be rendered as a LaTeX block equation using a math environment. ex: begin{equation}…end{equation} If False, the equation will be rendered as a LaTeX inline equation. ex: “ensuremath{y=x}

html_fmt(attributes=None, context=None, method='html', **kwargs)

Convert the tag to an html string or html element.

Parameters
contentOptional[Union[str, List[Union[str, list, Tag]]]

Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.

attributesOptional[Union[str, Attributes]]

Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.

format_funcOptional[str]

The format function to use with by formatted_content when formatting sub-tags.

methodOptional[str]

The rendering method for the string. ex: ‘html’ or ‘xml’

levelOptional[int]

The level of the tag.

Returns
htmlstr or html element

A string in HTML format or an HTML element (lxml.builder.E).

tex_fmt(content=None, attributes=None, mathmode=False, **kwargs)

Format the tag in LaTeX format.

Parameters
contentOptional[Union[str, List[Union[str, list, Tag]]]

Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.

attributesOptional[Union[str, Attributes]]

Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.

mathmodeOptional[bool]

If True, the tag will be rendered in math mode. Otherwise (default) latex text mode is assumed.

levelOptional[int]

The level of the tag.

Returns
tex_stringstr

The formatted tex string.