Skip to content

TikZ on Google Colab #2

@g-i-o-r-g-i-o

Description

@g-i-o-r-g-i-o

Maybe you can take into consideration colab users, and add some info on running tikz on colab?

You install latex, and that's easy, but then there are some problems visualizing the graphs. Maybe I'll solve those problems myself while actually studying, or there is a bigger compatibility problem?

import os
import time # per stampare data di modifica dei file
path = "/content/drive/MyDrive/Colab Notebooks/murphy_book1_14"
os.chdir(path)

files = os.listdir()  # List files in the current directory
print(files)  # Print the list of files
%%bash

apt update --quiet

apt install imagemagick --quiet

apt install pdf2svg --quiet

apt install texlive texlive-latex-extra --quiet

# !pip install git+git://github.com/mkrphys/ipython-tikzmagic.git --quiet
pip install git+https://github.com/mkrphys/ipython-tikzmagic.git --quiet
%load_ext tikzmagic

# new cell
%%tikz -S test_output.tikz -f svg
\draw (0,0) rectangle (1,1);
\filldraw (0.5,0.5) circle (.1);

most of your examples outputs are "cut" by colab, why?

Image

can't even select correctly, damn sumatra :-)

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions