0

I am trying to use tikz in manim. The version of manim I used is 3feb2019. I have added necessary packages into tex_template file. But it throws an error:

IndexError: list index out of range

I have no idea to solve this bug. Could anyone help me?

enter image description here

EDIT: Here are the codes I tried to render.

# These are in the example_scenes.py file
class TikzMobject(TextMobject):
    CONFIG = {
        "stroke_width":3,
        "fill_opacity":0,
        "stroke_opacity":1
        }

class TikzExample3(Scene):
    def construct(self):
    example_tex = TikzMobject(
        r"""
\begin{tikzpicture}
\draw (-1,0)--(1,0);
\end{tikzpicture}
    """
    )
    self.play(Write(example_tex))
    self.wait()

I have tried both latest version of manim and the 3feb version but it just threw the same error:list index out of range. And I can compile the tikz codes in the output tex file. The platform I used is Windows.

user450201
  • 119
  • 3
  • See [this](https://www.youtube.com/watch?v=VPYmZWTjHoU&list=PL2B6OzTsMUrwo4hA3BBfS7ZR34K361Z8F&index=12) – TheoremOfBeethoven Feb 21 '20 at 03:55
  • @TheoremOfBeethoven It doesn’t work. The Problem still exists. By the way, the platform I use is Windows. Do you have any other suggestions? – user450201 Feb 22 '20 at 05:03
  • First check if you really have Tikz installed, if so, try using the most recent version of Manim. It would also be good if you shared the code you are trying to render, maybe you are making a mistake in code. – TheoremOfBeethoven Feb 22 '20 at 20:15

1 Answers1

0

I have already tried it on 2 Windows and it works perfectly, it is likely that you have not configured your tex_template.tex correctly, or that you are using an old version of Python (at least Python 3.7.3 is required), here are the proof that it works for me.

enter image description here

tex_template.tex configuration:

\documentclass[preview]{standalone}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{setspace}
\usepackage{tipa}
\usepackage{relsize}
\usepackage{textcomp}
\usepackage{mathrsfs}
\usepackage{calligra}
\usepackage{wasysym}
\usepackage{ragged2e}
\usepackage{physics}
\usepackage{xcolor}
\usepackage{microtype}
\usepackage{tikz} %<------------------------- TIKZ PACKAGE
\DisableLigatures{encoding = *, family = * }
%\usepackage[UTF8]{ctex}
\linespread{1}

\begin{document}

YourTextHere

\end{document}

OUTPUT

enter image description here

TheoremOfBeethoven
  • 1,864
  • 6
  • 15
  • Sorry to bother you. I have solved this problem. I changed the first line of textemplate with \documentclass[preview,dvisvgm]{standalone} and this time it worked. But I don’t know the reason. Thank you for your kindness again. – user450201 Feb 25 '20 at 03:15