1

I tried to compile a tex file with a lot of math formulae. I tried

tex4ebook -c test.cfg -f epub+dvisvgm_hashes test

with the test.tex

\documentclass{amsart}

\begin{document}
Two formulae displayed:
\[e^{i\pi}+1=0\]
and
\[\sum_{n=1}^\infty\frac1{n^2}=\frac{\pi^2}6\]
let's see the effect.
\end{document}

the test.mk4

if mode == "draft" then
  Make:htlatex {}
else
  -- Make:add("biber","biber ${input}")
  Make:htlatex {}
  -- Make:biber {}
  Make:htlatex {}
  Make:htlatex {}
end

Make:tex4ht{}
Make:t4ht{}

The test.cfg

\Preamble{xhtml,pic-align}
 \Configure{Picture}{.svg}  
 \makeatletter
 \makeatother
 \DeclareRobustCommand{\[}{\begin{equation*}}
 \DeclareRobustCommand{\]}{\end{equation*}}
 \begin{document}
 \EndPreamble

where the extension dvisvgm is used to accelerate the production of svg images, and it complained

...texmf-dist/scripts/make4ht/extensions/dvisvgm_hashes.lua:251: attempt to concatenate field 't4ht_par' (a nil value)

I looked at dvisvgm_hashes.lua, and inserted the code

if v.params.t4ht_par == nil then
  v.params.t4ht_par = ""
end

into

for _,v in ipairs(make.build_seq) do
  if v.params.t4ht_par == nil then
    v.params.t4ht_par = ""
  end
  if v.name == "t4ht" then
    v.params.t4ht_par = v.params.t4ht_par .. " -p"
  end
end

Then I compiled and it complained a lot of not-found errors during Copy: cp test###x.svg test-epub/OEBPS/ ... and the content.opf contains test###x.svg which does not exist. Seemingly it is due to an incompatibility of tex4ebook and dvisvgm_hashes. I look for a workaround.

  • could you please also add a TeX MWE? – michal.h21 Mar 29 at 20:47
  • @michal.h21 Added. – Yai0Phah Mar 30 at 13:10
1

This seems like a bug in the dvisvgm_hashes extension. The fixed version is available in the make4ht repository.

Quick fix without need to update the extension is to drop the Make:t4ht {} line from the build file. It isn't useful in your case anyway, because it is executed automatically by both make4ht and tex4ebook. You should include it in the build file only in the case if you wanted to pass some custom parameters.

This build file is the same as your original one, but it doesn't suffer from the error:

if mode == "draft" then
  Make:htlatex {}
else
  -- Make:add("biber","biber ${input}")
  Make:htlatex {}
  -- Make:biber {}
  Make:htlatex {}
  Make:htlatex {}
end
  • There are still warnings like cp: cannot stat 'test0x.svg': No such file or directory and the existence of test0x.svg in content.opf – Yai0Phah Apr 2 at 16:58
  • @FrankScience ah I see. it should be fixed by the recent make4ht update – michal.h21 Apr 2 at 20:34

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.