2

I'm trying to make tex4ht produve svg-pictures instead of the normal png ones. I'm working with MiKTeX 2.9 under Windows 10.

I tried the following tex-file (mwe.tex):

\documentclass{book}
\begin{document}
  $$5x - y = 1$$
\end{document}

with the following config-file (myhtml.cfg):

\Preamble{html}
    \Configure{Picture}{.svg}
\begin{document}
\EndPreamble

To get svg-images I tried putting

G.svg
Gdvisvgm -n -p %%2 -s %%1 > %%3

into the tex4ht.env as suggested here, and then running

htlatex mwe.tex "myhtml"

When the system call

dvisvgm -n -p 1 -s mwe.idv > mwe0x.svg

is made by htlatex, an error-window pops up, saying that dvisvgm.exe is not working anymore.

But the thing is, when I type 'dvisvgm -n -p 1 -s mwe.idv > mwe0x.svg' directly into the command window, it works just fine.

I also tried using make4ht as suggested here, which didnt work either: it produces an svg of size 0 Bytes.

  • I would forget about using tex4ht.env. I use svg images with tex4ht. But generate them directly using pdf2svg during the build process. Example how to do this is here Detailed description of my tex4ht setup this is what I do now and it works very well for me. – Nasser Dec 8 '15 at 0:49
  • Thanks for the suggestion. Did you do something different at the time you wrote your comment? (The document you provided a link to says it has been updated on July 1) – Adrian Aug 13 '16 at 18:58
  • I tried to make it work today again, again without success. The problem still seems to be that when htlatex/make4ht call dvisvgm it doesn't work properly. Whether I used the standard Make:image("svg$","dvisvgm -n -p ${page} -c 1.4,1.4 -s ${source} > ${output}") your version with Make:add("dvisvgm","dvisvgm -v1 -n -c 1.15,1.15 -p 1- ${input}.idv") or even something using os.execute("dvisvgm -v7 -n -c 1.15,1.15 -p 1- ${input}.idv") ... All the svg files are empty, if any are produced at all. The latter doesn't even print anything on the screen, despite the -v7 – Adrian Aug 13 '16 at 19:17
  • I update these pages all the time. So I do not remember what I added or improved. But basically, if you follow the instructions on that page, you should get svg images of you graphics for use with tex4ht. You need to use the correct .cfg and correct main.mk4, these files are on the same page. You have to convert the graphics from pdf to svg first. All these instruction on the page above. Again, I do not use ex4ht.env at all any more. – Nasser Aug 13 '16 at 20:53
  • On your web page it sounds like that's what you do for external images which are included via \includegraphics. I've been doing that as well, for example with externalized tikzpictures. My problem lies with the images of displayed math, arrays, matrices and so on. Have I misunderstood something? – Adrian Aug 14 '16 at 7:43
1

I uninstalled everything concerning tex and then tried the make4ht approach described here again, this time using a fresh installation of TeX Live. It works now. I probably messed something up in my previous MiKTeX installation.

  • I probably should have tried that right away... Anyway, is this "accepting my own answer"-resolution the way to go here or should I somehow seek deletion of the question (since the value it holds for future readers is quite questionable)? – Adrian Aug 16 '16 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.