首页 > 解决方案 > 如何在 Manim 中操作乳胶列表中的每个项目

问题描述

我正在尝试在 Manim 中操作乳胶列表中的每个项目(例如更改颜色,设置运动动画),但它不会让我这样做。我可以将乳胶配方分成几部分,但为什么我不能对乳胶列表做同样的事情?

这是我的代码:

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

标签: pythonlatexmanim

解决方案


我在 GitHub 存储库上打开了一个问题,并使用BulletedList类找到了一个更有希望的解决方案。我认为如果使用索尼的解决方案$\\bullet$,所有项目都将居中(或需要手动重新定位),我们希望项目向左对齐。


推荐阅读