3b1b / 3b1b/manim

IndexError on TransformMatchingTex when use another latex font

Abierto
#2,136 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
93.8k
Forks
7.7k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

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

### Code and Error
**Code**:
```python
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 "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "E:\Programs\python_tips_animation\.venv\Scripts\manimgl.exe\__main__.py", line 7, in
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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.