mirror of
https://github.com/3b1b/manim.git
synced 2025-08-21 05:44:04 +00:00
Merge remote-tracking branch 'upstream/master' into shaders
This commit is contained in:
commit
ed9a4bd9eb
1 changed files with 7 additions and 8 deletions
|
@ -65,6 +65,8 @@ class SingleStringTex(VMobject):
|
||||||
if self.math_mode:
|
if self.math_mode:
|
||||||
new_tex = "\\begin{align*}\n" + new_tex + "\n\\end{align*}"
|
new_tex = "\\begin{align*}\n" + new_tex + "\n\\end{align*}"
|
||||||
|
|
||||||
|
new_tex = self.alignment + "\n" + new_tex
|
||||||
|
|
||||||
tex_config = get_tex_config()
|
tex_config = get_tex_config()
|
||||||
return tex_config["tex_body"].replace(
|
return tex_config["tex_body"].replace(
|
||||||
tex_config["text_to_replace"],
|
tex_config["text_to_replace"],
|
||||||
|
@ -72,10 +74,7 @@ class SingleStringTex(VMobject):
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_modified_expression(self, tex_string):
|
def get_modified_expression(self, tex_string):
|
||||||
result = self.alignment + " " + tex_string
|
return self.modify_special_strings(tex_string.strip())
|
||||||
result = result.strip()
|
|
||||||
result = self.modify_special_strings(result)
|
|
||||||
return result
|
|
||||||
|
|
||||||
def modify_special_strings(self, tex):
|
def modify_special_strings(self, tex):
|
||||||
tex = tex.strip()
|
tex = tex.strip()
|
||||||
|
@ -153,9 +152,6 @@ class SingleStringTex(VMobject):
|
||||||
class Tex(SingleStringTex):
|
class Tex(SingleStringTex):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"arg_separator": "",
|
"arg_separator": "",
|
||||||
# Note, use of isolate is largely rendered
|
|
||||||
# moot by the fact that you can surround such strings in
|
|
||||||
# {{ and }} as needed.
|
|
||||||
"isolate": [],
|
"isolate": [],
|
||||||
"tex_to_color_map": {},
|
"tex_to_color_map": {},
|
||||||
}
|
}
|
||||||
|
@ -174,9 +170,12 @@ class Tex(SingleStringTex):
|
||||||
def break_up_tex_strings(self, tex_strings):
|
def break_up_tex_strings(self, tex_strings):
|
||||||
# Separate out any strings specified in the isolate
|
# Separate out any strings specified in the isolate
|
||||||
# or tex_to_color_map lists.
|
# or tex_to_color_map lists.
|
||||||
|
substrings_to_isolate = [*self.isolate, *self.tex_to_color_map.keys()]
|
||||||
|
if len(substrings_to_isolate) == 0:
|
||||||
|
return tex_strings
|
||||||
patterns = (
|
patterns = (
|
||||||
"({})".format(re.escape(ss))
|
"({})".format(re.escape(ss))
|
||||||
for ss in it.chain(self.isolate, self.tex_to_color_map.keys())
|
for ss in substrings_to_isolate
|
||||||
)
|
)
|
||||||
pattern = "|".join(patterns)
|
pattern = "|".join(patterns)
|
||||||
pieces = []
|
pieces = []
|
||||||
|
|
Loading…
Add table
Reference in a new issue