tikz and latex for web illustrations

Today I wanted to make an illustration for which the correct tool was tikz. I was writing for the web. Can I use tikz to put stuff on the web?

HELL YES. There's a pdf2svg which gives vector graphics output.

/pages/study/hassett/chapter-3/tree.svg

I've used \documentclass{standalone} in my LaTeX source, so that it generates only the image. Here's the source for this particular drawing. Then I've added a Makefile:

latex/tikz-and-latex-for-web-illustrations/Makefile (Source)

all: tree.svg tree2.svg table2.svg table3.svg
        touch $@
        # $^ -> finished $@ at $(shell date)

%.svg: %.pdf
        pdf2svg $^ $@
        # $^ -> finished $@ at $(shell date)

%.pdf: %.tex
        latexmk -pdf $^ < /dev/null
        # $^ -> finished $@ at $(shell date)

IGNORED = $(shell git ls-files --ignored --exclude-standard --others)

clean:
        rm -rfv $(IGNORED)
        # $^ -> finished $@ at $(shell date)

The nikola build system picks the file up automatically, because of the magic of symbolic links. The previous post goes into some detail about getting a single process to build the LaTeX stuff at the same time as the nikola stuff.