[tex4ht] new problem with standalone conflicting with tex4ht after new TL refresh, svg math do not get produced

Nasser M. Abbasi nma at 12000.org
Fri Jan 1 08:05:38 CET 2016

Something seems to have changed in TL since I did a full
update 2 days ago. I am seeing too many new problems.

I just found out that standalone package no longer works
well with tex4ht. I am using a special patched standalone package
in order to make it work with tex4ht, else one gets a error
using the official TL standalone with tex4ht. Here is the relevent post:


-------- from old post ----
When using standalone package, this error will show up with tex4ht only

   ! Extra \else.
   l.227     \else
   ? x

Martin Scharrer was kind enough to patch standalone.sty so that it not
longer give the above syntax error with tex4ht. I have been using this
for last 2 years. Here is the patched package


Without the above, I can't do anything, since I use standalone for everything
with tex4ht and I depend on it for everything to pull all the files
into one document.

Ok, here is the issue.

I  just found out, that including this package, now the math also
gets missed up! Here is a MWE (but must use the patched standalone.sty
in the above link, else it will not compile with tex4ht:

\usepackage{standalone}% use the patched package!
This is a test
x  &= r + 1

Compileed with

make4ht --lua   -u  -c ./nma.cfg -e ./main.mk4 foo.tex

And again, now the equation do not show up in the html file generated.

Commenting out the  standalone, bring the math back, and correct svg
image gets produced.

Similar problem with what happens when loading the animate package. Very strange.

I do not understand what is going on really. I hope someone can try to
reproduce this. To make this email self contained, I also include
the .cfg and main.mk4 below. But please remember to use the patched
standalone.sty file in the link above. It can go to the same folder
as the above MWE.

--- nma.cfg---

\newcommand\CalcRem[1]{\strip at pt\dimexpr(#1)/\emwidth}
              {\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}

--- 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

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
      return search_file(input, ext, count - 1)

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)
      image_pattern =  search_file(par.input, ext, max_count)
      if not image_pattern then
        print("Cannot locate output svg pattern")
        return nil
      return locate_file(par, ext)


    arg.input = arg.source:gsub(".idv$","")
    local fn,msg = locate_file(arg, "svg")
    if not fn then
      print("Image processing error: "..msg)
      arg.filename = fn
      local cmd = "mv ${filename} ${output}" % arg



More information about the tex4ht mailing list