[英]How to manipulate each item in a latex list in Manim
我正在嘗試在 Manim 中操作 latex 列表中的每個項目(例如更改顏色,設置運動動畫),但它不會讓我這樣做。 我可以將 latex 公式分解為多個部分,但為什么我不能對 latex 列表做同樣的事情?
這是我的代碼:
class TitleAndListOfContent(Scene):
def construct(self):
list_of_content = TextMobject(
'\\begin {itemize}',
'\\item a',
'\\item b',
'\\item c',
'\\end {itemize}',
)
self.play(Write(list_of_content))
self.wait()
和回溯:
Traceback (most recent call last):
File ".../manim/manimlib/extract_scene.py", line 155, in main
scene = SceneClass(**scene_kwargs)
File ".../manim/manimlib/scene/scene.py", line 75, in __init__
self.construct()
File "my_scene.py", line 33, in construct
'\\end {itemize}',
File ".../manim/manimlib/mobject/svg/tex_mobject.py", line 148, in __init__
self, self.arg_separator.join(tex_strings), **kwargs
File ".../manim/manimlib/mobject/svg/tex_mobject.py", line 44, in __init__
self.template_tex_file_body
File ".../manim/manimlib/utils/tex_file_writing.py", line 21, in tex_to_svg_file
dvi_file = tex_to_dvi(tex_file)
File ".../manim/manimlib/utils/tex_file_writing.py", line 72, in tex_to_dvi
"See log output above or the log file: %s" % log_file)
Exception: Xelatex error converting to xdv. See log output above or the log file: media/Tex/a64dc4dc7f5621bd.log
作為參考,我想要達到的視覺效果是這樣的: https://youtu.be/BOMNd-bRQ4A?t=31
我是 manim 的新手,嘗試時無法正常工作(所以我不知道為什么)。 但是,您可以使用一種解決方法。
在數學模式下,您可以使用命令$\\bullet$
在前面創建點。 因此,調整您的程序:
list_of_content = TextMobject(
'$\\bullet$ a \\\\',
'$\\bullet$ b \\\\',
'$\\bullet$ c \\\\'
)
記住換行符,所以所有內容都不在同一行。
我在 GitHub 存儲庫上打開了一個問題,並使用BulletedList
class 找到了一個更有希望的解決方案。 我認為如果使用索尼的解決方案$\\bullet$
,所有項目都將居中(或需要手動重新定位)並且我們希望項目與左側對齊。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.