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:


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

  • 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? Apr 5, 2011 at 17:13
  • Also, there's no need to hate on HTML and markdown. They have their uses. :-) Apr 5, 2011 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. Apr 5, 2011 at 17:21
  • 1
    @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, 2011 at 19:58
  • Please can you include an example! As I said, I've not had any trouble with this at all so without an example to test, it's hard to know why your TikZ diagrams are being ignored. (Also, I think you need to write my name as I do for the notification system to work: @Andrew Stacey) Apr 5, 2011 at 20:49

2 Answers 2


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, 2011 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, 2011 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. Apr 5, 2011 at 16:15
  • 1
    @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, 2011 at 16:16
  • 1
    @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, 2011 at 21:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .