[tex4ht] SVG figures cause font styling to be lost

Nasser M. Abbasi nma at 12000.org
Mon Jun 1 01:33:28 CEST 2015


I can't tell why it does not work when including the tex
source code for the tikz pic.

But here is a workaround. The result is in a zip with my .cfg included
which is at this link:

http://12000.org/tmp/053105/bobs_figures.zip

I changed your latex file to be to include the image itself
instead of include the tikz code. This means some pre-processing
is needed:

-------------------------------------------
\documentclass{article}
\usepackage{graphicx}
\begin{document}

Here \textbf{is} a \texttt{circuit} for \textit{you}.

\begin{figure}[!ht] \centering
\includegraphics[width=0.5\paperwidth]{book_figs/t_circuit}
\caption{Here \textbf{is} a \texttt{circuit} for \textit{you}.}
\end{figure}

Here \textbf{is} a \texttt{circuit} for \textit{you}.
\end{document}
-----------------

Then made the tikz file to be self contained document:

----------------------------------
\documentclass{standalone}
\ifdefined\HCode
\def\pgfsysdriver{pgfsys-tex4ht.def}
\fi
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=2.54]
.....
\end{tikzpicture}
\end{document}
-----------------------------

Then compiled it

pdflatex t_circuit.tex

then convert to svg using

pdf2svg t_circuit.pdf t_circuit.svg

and now build the main tex file using:

make4ht -d html -c nma.cfg my_fig.tex

Now it work. The fonts changes correclty below the image.

The zip file has the .cfg and the generated HTML so you can see the result.

Again, I do not know why it does not work when including the tikz source
code directly.

--Nasser

On 5/31/2015 4:14 PM, Bob Plantz wrote:
> > I use Dwight Aplevich's circuits macros to create drawings, which produces
> > .tex files. htlatex creates great svg files for the drawings. However,
> > after the first such drawing, all font styling (bold, italic, etc.) is lost.
> >
> > I have traced the problem to a switch from <span> to <tspan> in the html
> > code at the point of the first use of svg. Is there a workaround for this
> > bug?
> >
> > I have attached an example. I'm using texlive 2014 in Ubuntu 15.04. The
> > attached example can be expanded with
> >        tar xvfz bobs_figures.tgz
> > Then
> >        cd bobs_figures
> >        htlatex my_fig.tex
> > gives the example.
> >
> > The problem still exists when I use make4ht.
> >
> > --Bob
> >




More information about the tex4ht mailing list