A Tikz diagram such as
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\path (0,0) node[draw] (A) {A};
\path (2,0) node[draw] (B) {B};
\draw (A) -- (B) node[midway,above = 0 em] {via};
\end{tikzpicture}
\end{document}
when processed with (pdf)LaTeX gives
while using TeX4ht extracts only the text, giving a conversion to
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<!-- html -->
<meta name="src" content="test.tex">
<meta name="date" content="2011-11-17 09:21:00">
<link rel="stylesheet" type="text/css" href="test.css">
</head><body>
<!--l. 8--><p class="noindent" > ABvia
</body></html>
With more complex Tikz input, TeX4ht turns parts of the picture into separate .png
files. What is the best way to get TeX4ht to convert the entire Tikz environment into a single graphic in the output? I've already tried using the Tikz externaliation library, but this does not compile successfully. (Note: Output as for example an SVG would also be fine - the key thing it to maintain the layout.)
For clarity, the result of trying to use externalization with Tikz is:
===== 'mode=convert with system call': Invoking 'latex -halt-on-error -interact
ion=batchmode -jobname "test-figure0" "\def\tikzexternalrealjob{test}\input{tes
t}" && dvips -o "test-figure0".ps "test-figure0".dvi' ========
! Package tikz Error: Sorry, the system call 'latex -halt-on-error -interaction
=batchmode -jobname "test-figure0" "\def\tikzexternalrealjob{test}\input{test}"
&& dvips -o "test-figure0".ps "test-figure0".dvi' did NOT result in a usable o
utput file 'test-figure0' (expected one of .epsi:.eps:.ps:). Please verify that
you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'.
Sometimes it is also named 'write 18' or something like that. Or maybe the com
mand simply failed? Error messages can be found in 'test-figure0.log'. If you c
ontinue now, I'll try to typeset the picture.
See the tikz package documentation for explanation.
Type H <return> for immediate help.
...
l.11 \end{tikzpicture}
?
The diagram is part of a larger page, so the aim to to process the text part as normal but have the Tikz part treated differently (as a picture or as an SVG: whatever is better).
.png
format (although I've been told that SVG is the future). I can use a script to do multiple runs if necessary, but was rather hoping to set up the.tex
file such that TeX4ht did the entire job itself. An answer showing an appropriate workflow using standard LaTeX plus TeX4ht would, I think, also be valid. – Joseph Wright♦ Nov 17 '11 at 12:46