# [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:

http://tex.stackexchange.com/questions/95701/syntax-error-when-using-tex4ht-on-latex-file-that-uses-the-standalone-package

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

(/usr/local/texlive/2014/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2014/texmf-dist/tex/generic/xkeyval/keyval.tex)))
! 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

https://bitbucket.org/martin_scharrer/standalone/raw/635aacfa0e8f2cba4f4086f4f15d57791b18bf64/standalone.sty

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:

--------------------------------
\documentclass[11pt]{article}%
\usepackage{standalone}% use the patched package!
\usepackage{amsmath,mathtools}
\begin{document}
This is a test
\begin{align*}
x  &= r + 1
\end{align*}
\end{document}
------------------------

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

thanks,

--Nasser