3b1b / 3b1b/manim

Tex not appearing after coloring

オープン
#1,298 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
93.8k
フォーク
7.7k
PR マージ指標
PR 指標を取得中

説明

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!

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。