mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Kill CONFIG in mtex_mobject.py
This commit is contained in:
parent
9ad370a04b
commit
ea4a47aeef
1 changed files with 24 additions and 16 deletions
|
@ -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,
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue