如何在 Manim 中操作乳胶列表中的每个项目

问题描述 投票:0回答:3

我正在尝试在 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

python latex manim
3个回答
1
投票

我在 GitHub 存储库上开了一个问题,发现使用

BulletedList
类的更有前途的解决方案。我认为如果使用索尼的解决方案
$\\bullet$
,所有项目都将居中(或需要手动重新定位)并且我们希望项目向左对齐。


0
投票

我是 manim 的新手,尝试时无法让它工作(所以我不知道为什么)。但是,您可以使用一种解决方法。

在数学模式下,您可以使用命令

$\\bullet$
在前面创建点。所以,调整你的程序:

        list_of_content = TextMobject(
        '$\\bullet$ a \\\\',
        '$\\bullet$ b \\\\',
        '$\\bullet$ c \\\\'
        )

记住换行符,这样一切都不在同一条线上。


0
投票

我不知道你们是否还需要这个但是添加 r' egin{矩阵} 1 & 2 \ 3 & 4 nd{矩阵}' r 说将其解释为原始字符串,因此您不必添加转义字符。

© www.soinside.com 2019 - 2024. All rights reserved.