# LaTeX generated website with TikZ diagrams

I am trying to generate my static website with LaTeX to avoid tedious/verbose HTML and underpowered markdown languages.

I know of latex2html and htlatex/TeX4ht for generating documents in the HTML format from LaTeX but neither are working with TikZ.

Does anyone here know how to get the TikZ diagrams working? Any tips on using LaTeX for static websites is also much appreciated.

EDIT: I now generate SVGs from the TikZ diagrams by inserting this line into my latex source:

\def\pgfsysdriver{pgfsys-tex4ht.def}


I like the idea of using SVG because of the resolution independence but I worry about the browser support.

-
@andreasw: It's not necessary to sign your questions (as there is already a box with your username below it) or to begin them with a greeting. –  lockstep Apr 5 '11 at 16:00
If I understand correctly you want to write an entire web page in LaTeX, not just graphics and equations. In that case htlatex is probably the best out there. Can you describe what's not working with this approach? –  Matthew Leingang Apr 5 '11 at 17:13
Also, there's no need to hate on HTML and markdown. They have their uses. :-) –  Matthew Leingang Apr 5 '11 at 17:14
Can you explain in more detail what's going wrong with the TikZ diagrams? An example might help. I've been merrily converting TikZ diagrams to SVG for months now with narry a problem. –  Loop Space Apr 5 '11 at 17:21
@andrew-stacey, matthew-leingang The TikZ diagrams are ignored by htlatex. I am trying to have the TikZ figures converted to another format like png and linked from within the html. –  andreasw Apr 5 '11 at 19:58

My solution is far from perfect, but it has been simple and good enough for my needs.

I wrote a handout for a programming course using Sphinx (a documentation generator that uses reST as a markup language), and the diagrams using TikZ. The TikZ figures are compiled automatically and converted to PNG when generating the website.

For example, take a look at this page to see how the result looks like.

You can also take a look at the Makefile I use to compile the TikZ figures into PNG (.tex → .pdf using rubber, .pdf → .png using convert)

-

There is QuickLaTeX which allows the simple inclusion of (La)TeX math and also TikZ pictures inside WordPress websites. However, this wont help you much if you don't use WordPress.

For normal websites you could use the standalone class to convert TikZ pictures to PNG images which can then be included. See Compile a latex document into a png image that's as short as possible. for further information.

-
I was just saying much the same thing :-) –  Joseph Wright Apr 5 '11 at 16:10
@andreasw: There are several plugins for WordPress - the reason I've picked QuickLaTeX for my own blog is that the LaTeX stuff is done on their server, and returned as an image. So there is no installation or similar to do. –  Joseph Wright Apr 5 '11 at 16:12
@Joseph, andreasw: Maybe the same interface could also be used to include TikZ pictures as images into normal websites. Maybe worth asking Pavel Holoborodko, the author of QuickLaTeX, about it. –  Martin Scharrer Apr 5 '11 at 16:15
@Martin: Very true. Pavel is very responsive - he did a few bug fixes for me when I mentioned QuickLaTeX in my blog, and uncovered some issues! –  Joseph Wright Apr 5 '11 at 16:16
@Andrew: Not sure I follow in the context of Tikz diagrams! (In the general case, conversion of arbitrary LaTeX to other formats is pretty tough, so it's not exactly an easy problem to solve anyway.) –  Joseph Wright Apr 5 '11 at 21:07