Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError on TransformMatchingTex when use another latex font #2136

Open
xiaoni0v0 opened this issue May 28, 2024 · 0 comments
Open

IndexError on TransformMatchingTex when use another latex font #2136

xiaoni0v0 opened this issue May 28, 2024 · 0 comments

Comments

@xiaoni0v0
Copy link

When I use Tex and play TransformMatchingTex animations, an error occurred.
The error is: IndexError: list index out of range.

Code and Error

Code:

a = Tex(r'a+b=c').scale(3)
b = Tex(r'a+b=c,c\in\mathbb{Z}').scale(3)
self.add(a)
self.play(TransformMatchingTex(a, b, matched_keys=['a+b=c']))

Error:

           WARNING  Estimated size of a+b=c,c\in\mathbb{Z}   tex_mobject.py:222
                    does not match true size                                   

...

  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "E:\Programs\python_tips_animation\.venv\Scripts\manimgl.exe\__main__.py", line 7, in <module>
  File "E:\Programs\python_tips_animation\manimlib\__main__.py", line 25, in main
    scene.run()
  File "E:\Programs\python_tips_animation\manimlib\scene\scene.py", line 163, in run
    self.construct()
  File "E:\Programs\python_tips_animation\for_tips\learning_transform_match.py", line 10, in construct
    self.play(TransformMatchingTex(a, b, matched_keys=['a+b=c']))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Programs\python_tips_animation\manimlib\animation\transform_matching_parts.py", line 135, in __init__
    *self.matching_blocks(source, target, matched_keys, key_map),
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Programs\python_tips_animation\manimlib\animation\transform_matching_parts.py", line 166, in matching_blocks
    if target[j] in sub_target.family_members_with_points():
       ~~~~~~^^^
  File "E:\Programs\python_tips_animation\manimlib\mobject\svg\string_mobject.py", line 551, in __getitem__
    return super().__getitem__(value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Programs\python_tips_animation\manimlib\mobject\mobject.py", line 399, in __getitem__
    return self.split().__getitem__(value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: list index out of range

It's very strange that when I remove the specified font \mathbb{Z} and just use Z, the errors and warnings disappear.

Environment

OS System: Win 10
manim version: Latest Version of Manim
python version: 3.12.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant