For things like papers, tutorials, books, LaTeX is still where it's at, but for HTML I'd like to be able to
do things like commutative diagrams... how to make this work without duplicating effort?
My LaTeX foo has become rusty over the years, but despite much searching, there seems to no alternative. So here is a little note on how to TikZ pictures to PNG.

##
TikZ for drawing diagrams

TikZ (TikZ is kein Zeichenprogramm) is probably the most powerful LaTeX package to graphics. There are supporting packages for commutative diagrams.

##
Exporting TikZ to PNG

After some searching I found the following way: use the "standalone" document class...

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{cd}
\begin{document}
\begin{tikzcd}
& X \arrow[dl] \arrow[d, dotted] \arrow[dr] & \\
A & A \times B \arrow [l] \arrow{r}& B
\end{tikzcd}
\end{document}

... together with the convert tool (imagemagick):

product.png: product.tex
pdflatex $<
convert -density 600x600 product.pdf \
-quality 90 -resize 1080x800 -strip $@

## The product

And this is what we get:

## No comments:

Post a Comment