Description of bug / unexpected behavior
Previously, if you wanted to put a long sentence on the screen you could break it up into multiple lines using triple quotation marks and substrings_to_isolate would still pick up all of the pieces you wanted to highlight. Since PR #4515 that is no longer the case. Now it only picks up on substrings in the first line of the string.
Expected behavior
substrings_to_isolate should work on multi-line strings.
How to reproduce the issue
Code for reproducing the problem
from manim import *
class SubstringsTest(Scene):
def construct(self):
multiline_string = Tex(
"""This is a very long string,
which will test how well the new implementation of Tex handles such long strings.""",
substrings_to_isolate=[
"This",
"implementation"
],
tex_template=TexFontTemplates.libertine
)
print(multiline_string.get_part_by_tex("This"))
print(multiline_string.get_part_by_tex("implementation"))
self.play(Write(multiline_string))
Note how in the log output below it doesn't separate out the second substring on the second line, only the first substring on the first line. Then when you do get_part_by_tex it returns None for the second substring.
Logs
Terminal output
Manim Community v0.20.1
[02/28/26 08:17:16] INFO Writing \special{dvisvgm:raw <g tex_file_writing.py:110
id='unique000'>}\special{dvisvgm:raw <g
id='unique000substring'>}This\special{dvisvgm:raw
</g>} is a very long string, \special{dvisvgm:raw
</g>} to media/Tex/71f2c05dd57efc72.tex
VGroup of 4 submobjects
None
Description of bug / unexpected behavior
Previously, if you wanted to put a long sentence on the screen you could break it up into multiple lines using triple quotation marks and
substrings_to_isolatewould still pick up all of the pieces you wanted to highlight. Since PR #4515 that is no longer the case. Now it only picks up on substrings in the first line of the string.Expected behavior
substrings_to_isolateshould work on multi-line strings.How to reproduce the issue
Code for reproducing the problem
Note how in the log output below it doesn't separate out the second substring on the second line, only the first substring on the first line. Then when you do
get_part_by_texit returnsNonefor the second substring.Logs
Terminal output