question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Experimental use of Tikz on MacOS Sierra

See original GitHub issue

Hello everyone, my problem is that when I use the tikz package in Windows and GNU/Linux they works well. However, when I want to use it on a MacOS Sierra, or use a similar package one (circuitikz, listings, etc.) it does not recognize the drawings, but in the other operating systems it works correctly. This is the error. If I compile it directly with PDFLaTeX, it works normally. Thank you.

Writing "\centering \begin{tikzpicture}
            \draw(0,0)--(3,3);
            \draw(0,0)--(1,4);
            \end{tikzpicture}" to /Users/raulvazquez/Documents/Daniel/manim_3b1b/manim-master/manimlib/files/Tex/219303c0b522abfb.tex



Traceback (most recent call last):
  File "/Users/raulvazquez/Documents/Daniel/manim_3b1b/manim-master/manimlib/extract_scene.py", line 155, in main
    scene = SceneClass(**scene_kwargs)
  File "/Users/raulvazquez/Documents/Daniel/manim_3b1b/manim-master/manimlib/scene/scene.py", line 52, in __init__
    self.construct()
  File "example_scenes.py", line 103, in construct
    """).set_stroke(WHITE,5)
  File "/Users/raulvazquez/Documents/Daniel/manim_3b1b/manim-master/manimlib/mobject/svg/tex_mobject.py", line 146, in __init__
    self.break_up_by_substrings()
  File "/Users/raulvazquez/Documents/Daniel/manim_3b1b/manim-master/manimlib/mobject/svg/tex_mobject.py", line 183, in break_up_by_substrings
    sub_tex_mob.move_to(self.submobjects[last_submob_index], RIGHT)
IndexError: list index out of range

On Arch Linux:

19

TikzMobject is the same that TextMobject but the stroke is 5.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
zimmermantcommented, May 4, 2019

The reason the manim version looks like a triangle instead of a pair of lines has to do with the default configuration of how SVG objects are drawn. Use set_fill to set the opacity of the line to zero and make sure you have a non-zero stroke_width and a stroke_color set. I think this will give you the manim output you want.

1reaction
Elteoremadebeethovencommented, May 5, 2019

@quark67 try this:

class TikZ2(Scene):
    CONFIG = {
        "stroke_width" : 0.5,
        "stroke_color" : YELLOW
        }
    def construct(self):
        tikzcode = TexMobject("\\text{hello}",
            "\\tikz\\draw[red] (0,0) -- (1,2) -- (2,1);",
            "\\text{world}")
        tikzcode[1].set_fill(opacity=0)
        tikzcode[1].set_stroke(None,2)
        tikzcode[1].set_color(RED)
        self.add(tikzcode)

We can’t set the color by TeX commands, so, we have to set the color with commands of manim. I like more this code:

class TikZ3(Scene):
    def construct(self):
        tikzcode = TextMobject(r"""hello,
            \begin{tikzpicture}
            "\draw (0,0) -- (1,2) -- (2,1);
            \end{tikzpicture},
            world""")
        tikzcode[6:-6].set_fill(None,0) \
                      .set_stroke(None,2) \
                      .set_color(RED)
        self.add(tikzcode)

Result: TikZ3

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use AUCTeX to create a PNG file of a TikZ picture ...
I would like to use AUCTeX to create a PNG image of a TikZ picture using the standalone package. I use macOS Sierra....
Read more >
TikZ and pgf
16.1 When Should One Use TikZ for Generating Plots? ... In a sense, when you use pgf you “program” your graphics, just as...
Read more >
tensorflow Mac OS gpu support - Stack Overflow
I wrote a little tutorial on compiling TensorFlow 1.2 with GPU support on macOS. I think it's customary to copy relevant parts to...
Read more >
An unsuccessful attempt to use CairoSVG to generate small ...
For me, running under MacOS Sierra, the SVG graphics ecosystem created by "brew install svg2pdf", together with Inkscape (version 0.91), ...
Read more >
TikZ package - Overleaf, Online LaTeX Editor
An online LaTeX editor that's easy to use. No installation, real-time collaboration, version control, hundreds of LaTeX templates, and more.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found