[tex4ht] add package animate makes some math disappear from web page
Nasser M. Abbasi
nma at 12000.org
Fri Jan 1 07:15:56 CET 2016
I found another strange problem with tex4ht.
When I include \usepackage{animate}, some math do not show up
in the web page. Empty space shows up! The svg file is bad.
Here is a MWE that shows the problem.
------------------------------------------
\documentclass[11pt]{article}%
\usepackage[T1]{fontenc}
\usepackage{amsmath,mathtools}
\usepackage{animate} %This package makes math go away!
\begin{document}
This is a test
\begin{align*}
r_p &= r_{earth} + \text{alt}
\end{align*}
\end{document}
----------------------------
Compiled with
make4ht -u -c ./nma.cfg -e ./main.mk4 foo.tex
Also same problem if I add "--lua" option above. No difference.
THe problem is that the svg image created for the equation does not look
right. Here it is:
--------------------------------------
<?xml version='1.0'?>
<!-- This file was generated by dvisvgm 1.9.2 -->
<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
<g id='page1' transform='matrix(1.15 0 0 1.15 0 0)'/>
</svg>
------------------------
If I remove the animate package and recompile, now the equation shows up
just fine and the svg image file is correct and has much more information
in it than the above. A correct svg file. Here is part of it
--------------------
<?xml version='1.0'?>
<!-- This file was generated by dvisvgm 1.9.2 -->
<svg height='12.2654pt' version='1.1' viewBox='181.969 129.793 87.3202 12.2654' width='87.3202pt' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
<defs>
<path d=
....
----------------------------
Why is including animate package causes this math problem?
I am pasting below both nma.cfg and main.mk4 so this email
will contain everything to reproduce this problem. I hope someone
can reproduce it. This shows on firefox and chrome. Using TL 2015
on Linux mint.
--- nma.cfg---
\Preamble{ext=htm,charset="utf-8",p-width,pic-align}
\begin{document}
\DeclareGraphicsExtensions{.svg,.png}
\Configure{Picture}{.svg}
\makeatletter
\newcommand\emwidth{10}
\newcommand\CalcRem[1]{\strip at pt\dimexpr(#1)/\emwidth}
\Configure{graphics*}
{svg}
{\Picture[pict]{\csname Gin at base\endcsname.svg
\space style="width:\CalcRem{\Gin at req@width}em;"
}%
\special{t4ht+ at File: \csname Gin at base\endcsname.svg}
}
\makeatother
\EndPreamble
--------------------------
--- main.mk4---
Make:add("dvisvgm","dvisvgm -v1 -n -c 1.15,1.15 -p 1- ${input}.idv")
Make:htlatex {packages = "\\RequirePackage[dvipdfmx]{graphicx}"}
local max_count = 5
local image_pattern
local function file_exists(fn)
local f = io.open(fn,"r")
if f == nil then return false else f:close() return true end
end
local function search_file(input, ext, count)
local pattern = count > 0 and "%s-%0"..count.."i." or "%s."
pattern = pattern .. ext
local filename = string.format(pattern, input, 1)
if file_exists(filename) then
return pattern
elseif count < 0 then return nil
else
return search_file(input, ext, count - 1)
end
end
local img_count = 0
local function locate_file(par,ext)
if image_pattern then
img_count = img_count + 1
return string.format(image_pattern, par.input, img_count)
else
image_pattern = search_file(par.input, ext, max_count)
if not image_pattern then
print("Cannot locate output svg pattern")
return nil
end
return locate_file(par, ext)
end
end
Make:htlatex{}
Make:htlatex{}
Make:htlatex{}
Make:tex4ht{}
Make:t4ht{}
Make:dvisvgm{}
Make:image("svg$",function(arg)
arg.input = arg.source:gsub(".idv$","")
local fn,msg = locate_file(arg, "svg")
if not fn then
print("Image processing error: "..msg)
else
arg.filename = fn
local cmd = "mv ${filename} ${output}" % arg
print(cmd)
os.execute(cmd)
end
end
)
---------
Too many package conflicts. Too little time.
--Nasser
More information about the tex4ht
mailing list