Allow for LaTeX in DecimalNumber, e.g. for units

This commit is contained in:
Grant Sanderson 2024-11-25 11:01:38 -07:00
parent c6b9826f84
commit 5b88d2347c

View file

@ -22,7 +22,12 @@ if TYPE_CHECKING:
@lru_cache() @lru_cache()
def char_to_cahced_mob(char: str, **text_config): def char_to_cahced_mob(char: str, **text_config):
return Text(char, **text_config) if "\\" in char:
# This is for when the "character" is a LaTeX command
# like ^\circ or \dots
return Tex(char, **text_config)
else:
return Text(char, **text_config)
class DecimalNumber(VMobject): class DecimalNumber(VMobject):