Tex not appearing after coloring
- Linguagem predominante
- Python
- Estrelas
- 93.9k
- Forks
- 7.7k
- Merge médio
- 2d 13h
- PRs com merge (30d)
- 4
Descrição
Hi! I'm having some trouble with `TexMobject` when using `tex_to_color_map`.
```python
class Test(Scene):
def construct(self):
tex = TexMobject(
"\\frac{\\partial E}{\\partial y_1}",
"=& \\frac{\\partial}{\\partial y_1} \\frac{1}{n} \\Big[ (y^*_1 - y_1)^2 + (y^*_2 - y_2)^2 + \\cdots + (y^*_n - y_n)^2 \\Big] \\\\",
"=& \\frac{\\partial}{\\partial y_1} \\frac{1}{n} (y^*_1 - y_1)^2 \\\\",
"=& \\frac{2}{n} (y_1 - y^*_1)",
tex_to_color_map={
"y^*_1": BLUE,
"y^*_2": BLUE,
"y^*_n": BLUE,
"y_1": RED,
"y_2": RED,
"y_n": RED
}
)
self.play(Write(tex)) # last part of the equation does not appear
self.wait()
```
If I don't use `tex_to_color_map` it works as one would expect, otherwise the last part of the equation is not displayed.
Also, if I use `self.add(tex)` instead of `self.play(Write(tex))` then it works.
Another issue is that when I set `tex_to_color_map` then the indexing behaves strangely.
Doing `self.play(Write(tex[0]))` without `tex_to_color_map` correctly displays the tex in the first string, but when it is set it will only display a subpart of the first string.
Maybe I am missing something here...
Amazing library by the way! Thank you!
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Olhe para a classe TexMobject em manim/mobject/svg/tex_mobject.py, focando em como tex_to_color_map é processado e como isso afeta a indexação e o rendering de substrings. O bug se manifesta ao usar a animação Write versus direct add. Comece reproduzindo o problema com a cena de teste fornecida e, em seguida, rastreie a lógica de mapeamento de cores para ver por que a última parte desaparece e a indexação quebra.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Domínio
- computer-graphics
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 45/100