manim.mobject.svg.tex_mobject.SingleStringMathTex

class SingleStringMathTex(tex_string, stroke_width=0, fill_opacity=1.0, background_stroke_width=0, background_stroke_color='#000000', should_center=True, height=None, organize_left_to_right=False, tex_environment='align*', tex_template=None, **kwargs)[source]

Bases: manim.mobject.svg.svg_mobject.SVGMobject

Elementary building block for rendering text with LaTeX.

Tests

Check that creating a SingleStringMathTex object works:

>>> SingleStringMathTex('Test')
SingleStringMathTex('Test')

Methods

get_modified_expression

get_tex_string

init_colors

Initializes the colors.

modify_special_strings

organize_submobjects_left_to_right

path_string_to_mobject

Converts a SVG path element’s d attribute to a mobject.

remove_stray_braces

Makes MathTex resilient to unmatched braces.

Attributes

animate

Used to animate the application of a method.

depth

The depth of the mobject.

height

The height of the mobject.

width

The width of the mobject.

init_colors(propagate_colors=True)[source]

Initializes the colors.

Gets called upon creation. This is an empty method that can be implemented by subclasses.

path_string_to_mobject(path_string, style)[source]

Converts a SVG path element’s d attribute to a mobject.

Parameters
  • path_string (str) – A path with potentially multiple path commands to create a shape.

  • style (dict) – Style specification, using the SVG names for properties.

Returns

A VMobject from the given path string, or d attribute.

Return type

VMobjectFromSVGPathstring

remove_stray_braces(tex)[source]

Makes MathTex resilient to unmatched braces.

This is important when the braces in the TeX code are spread over multiple arguments as in, e.g., MathTex(r"e^{i", r"\tau} = 1").