Kill CONFIG in mtex_mobject.py

This commit is contained in:
Grant Sanderson 2022-12-16 10:54:14 -08:00
parent 9ad370a04b
commit ea4a47aeef

View file

@ -32,24 +32,34 @@ SCALE_FACTOR_PER_FONT_POINT = 0.001
class MTex(StringMobject): class MTex(StringMobject):
CONFIG = { tex_environment: str = "align*"
"font_size": 48,
"alignment": "\\centering",
"tex_environment": "align*",
"tex_to_color_map": {},
"template": "",
"additional_preamble": "",
}
def __init__(self, tex_string: str, **kwargs): def __init__(
self,
tex_string: str,
font_size: int = 48,
alignment: str = R"\centering",
template: str = "",
additional_preamble: str = "",
tex_to_color_map: dict = dict(),
**kwargs
):
# Prevent from passing an empty string. # Prevent from passing an empty string.
if not tex_string.strip(): if not tex_string.strip():
tex_string = "\\\\" tex_string = R"\\"
self.tex_string = tex_string self.tex_string = tex_string
super().__init__(tex_string, **kwargs) self.alignment = alignment
self.template = template
self.additional_preamble = additional_preamble
self.tex_to_color_map = tex_to_color_map
self.set_color_by_tex_to_color_map(self.tex_to_color_map) super().__init__(
self.scale(SCALE_FACTOR_PER_FONT_POINT * self.font_size) tex_string,
**kwargs
)
self.set_color_by_tex_to_color_map(tex_to_color_map)
self.scale(SCALE_FACTOR_PER_FONT_POINT * font_size)
@property @property
def hash_seed(self) -> tuple: def hash_seed(self) -> tuple:
@ -206,6 +216,4 @@ class MTex(StringMobject):
class MTexText(MTex): class MTexText(MTex):
CONFIG = { tex_environment: str = ""
"tex_environment": None,
}