Re: [tex4ht] Too many DVI errors. stack empty at pop command, conficts, bm package, siunitx, dvilualatex

2016-01-01 Thread Michal Hoftich
Hi Karl,

On Fri, Jan 1, 2016 at 11:56 PM, Karl Berry  wrote:
> I'm not sure if you determined if all of this is a dvisvgm bug,
> but if not:
>
> Here is a MWE, which shows the issue. What happens is that
> DVI creates corrupted DVI file or has an error making the dvi.
>
> When dviluatex (or any engine) creates a corrupted DVI file (i.e.,
> dvitype cannot successfully read it), under any reasonable
> circumstances, it's certainly an error.
>

For the file minimal.tex, I've got the error regardless of the used
engine, and the DVI file doesn't seem corrupted, both dvitype and
dviasm can open it. Also dvipng can convert it. But PS specials are
used, so that might be the culprit.

This is really strange, xfrac uses \raisebox from graphicx package,
this seems to be possible source of the PS specials. When I've tried
to add `\usepackage[dvipdfmx]{graphicx}`, dvisvgm compiled the
document without problems. This explains why Nassed didn't get an
error, because there was explicit
`\RequirePackage[dvipdfmx]{graphicx}` in the .mk4 file.

So this one seems like dvisvgm error. Could anyone try to run
minimal.tex with both dvilualatex and latex and dvisvgm?

Now back to Nasser's case, there are more problems it seems:

1. you should define image format to be svg in the .cfg file:

\Configure{Picture}{.svg}

otherwise you compile the images to svg, but in the document png are requested.

2. you used the wrong .mk4 file, you should use the previous one:

---

Make:add("dvisvgm","dvisvgm -n -TS1.25,1.25 -c 1.2,1.2 -p 1- ${input}.idv")

local max_count = 5
local image_format = "${input}-${zeroes}${page}.${ext}"
local oneimage_format = "${input}.${ext}"


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 locate_file(par,ext, count)
  local count = count or 0
  par.ext = ext
  local zeroes = string.rep("0",count)
  par.zeroes = zeroes
  if count > max_count then
local one = oneimage_format % par
if file_exists(one) then
  return one
else
  return false, "max_count exceeded"
end
  end
  local fn = image_format % par
  if file_exists(fn) then
return fn
  else
return locate_file(par, ext, count+1)
  end
end


if mode=="draft" then
  Make:htlatex {}
else
  Make:htlatex {}
  Make:htlatex {}
  Make:htlatex {}
end
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
)
---

3. The strange thing is that dvisvgm can convert foo.dvi, but not
foo.idv. So it seems that corrupted file is created by tex4ht

4. when bm package is not used, the compilation goes without problems.
There is bm.4ht file, so we should investigate it further.

Best regards,
Michal


Re: [tex4ht] Too many DVI errors. stack empty at pop command, conficts, bm package, siunitx, dvilualatex

2016-01-01 Thread Karl Berry
I'm not sure if you determined if all of this is a dvisvgm bug,
but if not:

Here is a MWE, which shows the issue. What happens is that
DVI creates corrupted DVI file or has an error making the dvi.

When dviluatex (or any engine) creates a corrupted DVI file (i.e.,
dvitype cannot successfully read it), under any reasonable
circumstances, it's certainly an error.

However, the LuaTeX developers fixed the previous DVI-generation bug,
and it could well be related.  Unfortunately, we'd have to compile from
the original source to get the fix, and I don't see that happening.
I could report it to them to try, except:

Here is MWE

As discussed last time: to debug, the LuaTeX people need an invocation
of dvilua(la)tex, not an invocation of make4ht.

Best,
Karl


Re: [tex4ht] Too many DVI errors. stack empty at pop command, conficts, bm package, siunitx, dvilualatex

2016-01-01 Thread Nasser M. Abbasi

On 1/1/2016 3:34 PM, Michal Hoftich wrote:



I am using Fedora 23, but binaries are provided by TL, so it should be
identical. Could anyone else report their results?



There is 32 vs. 64 bit os. I am on 64 bit. if you are on 32 bit OS,
You are using TL 2015 but 32 bit. this might be a difference to consider.

may be someone else can try and see what they get. Good suggestion.

--Nasser









Re: [tex4ht] Too many DVI errors. stack empty at pop command, conficts, bm package, siunitx, dvilualatex

2016-01-01 Thread Michal Hoftich
>
> No. dvisvgm needs to be build from sources for Linux which I
> did not do. Still using TL 2015 version. 1.9.2 as is.
>

I have the same version

>
> You might be using different build of dvisvgm, i.e. different OS
> and this could cause this difference?
>

I am using Fedora 23, but binaries are provided by TL, so it should be
identical. Could anyone else report their results?

>


Re: [tex4ht] Too many DVI errors. stack empty at pop command, conficts, bm package, siunitx, dvilualatex

2016-01-01 Thread Nasser M. Abbasi

On 1/1/2016 3:08 PM, Michal Hoftich wrote:

Thanks but I am not getting the core dump on my end? TL 2015
fresh update.



That's weird, I have freshly updated TL as well..



If you like me to try something else, please let me know.


I've got the SIGSEGV error also with your sample file


That is strange. We have different setup somewhere?



btw, there is new version of dvisvgm by Martin Gieseking just
annouced. Current version we are using on TL 2015 is 1.9.2,
but the new versio is 1.14  2015-12-28. But TL will not
update to new one until TL 2016. So it needs to be manually
build for TL 2015 if we to use it now. Binaries only for
windows and mac. I might have some bug fixes also.


Are you using the new version?
Michal



No. dvisvgm needs to be build from sources for Linux which I
did not do. Still using TL 2015 version. 1.9.2 as is.

Here is screen shot of my terminal, and the log file and the
dvi file here if you like to verify

http://12000.org/tmp/010116/

I am using 64 bit linux mint:


lsb_release -a

No LSB modules are available.
Distributor ID: LinuxMint
Description:Linux Mint 17.2 Rafaela
Release:17.2
Codename:   rafaela

You might be using different build of dvisvgm, i.e. different OS
and this could cause this difference?

--Nasser

 


Re: [tex4ht] Too many DVI errors. stack empty at pop command, conficts, bm package, siunitx, dvilualatex

2016-01-01 Thread Michal Hoftich
> Thanks but I am not getting the core dump on my end? TL 2015
> fresh update.
>

That's weird, I have freshly updated TL as well..

>
> If you like me to try something else, please let me know.

I've got the SIGSEGV error also with your sample file
>
> btw, there is new version of dvisvgm by Martin Gieseking just
> annouced. Current version we are using on TL 2015 is 1.9.2,
> but the new versio is 1.14  2015-12-28. But TL will not
> update to new one until TL 2016. So it needs to be manually
> build for TL 2015 if we to use it now. Binaries only for
> windows and mac. I might have some bug fixes also.

Are you using the new version?
Michal


Re: [tex4ht] Too many DVI errors. stack empty at pop command, conficts, bm package, siunitx, dvilualatex

2016-01-01 Thread Nasser M. Abbasi

On 1/1/2016 5:31 AM, Michal Hoftich wrote:

Hi Nasser,

it seems that it is caused by the xfrac package. A really minimal
example is following:


\documentclass[12pt]{report}%
\usepackage[T1]{fontenc}
\usepackage{xfrac}

\begin{document}
\[ \sfrac{a}{b} \]
\end{document}


compiled with

latex minimal.tex
dvisvgm minimal.dvi

we got:

processing page 1
   page size: 12.0124pt x 548.966pt (4.22189mm x 192.94mm)
   page written to minimal.svg
1 of 1 page converted in 0.34971 seconds
Neoprávněný přístup do paměti (SIGSEGV) (core dumped [obraz paměti uložen])

(yes that Czech message is about unauthorized memory access)

In this simple case the svg file seems fine, but in your more
complicated case it is really garbage. So I think it should be
reported to dvisvgm maintainers.

To temporarily fix your code, I would add something like:

\renewcommand\sfrac[2]{#1/#2}

until it's fixed.

Best regards,
Michal



Thanks but I am not getting the core dump on my end? TL 2015
fresh update.

-

cat foo.tex


\documentclass[12pt]{report}%
\usepackage[T1]{fontenc}
\usepackage{xfrac}

\begin{document}
\[ \sfrac{a}{b} \]
\end{document}


latex foo.tex


This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded 
format=latex)
 restricted \write18 enabled.
entering extended mode
.
Output written on foo.dvi (1 page, 700 bytes).



dvisvgm foo.dvi

pre-processing DVI file (format 2)
processing page 1
  page size: 12.0124pt x 548.966pt (4.22189mm x 192.94mm)
  page written to foo.svg
1 of 1 page converted in 0.272353 seconds



ls -l foo.dvi


-rwxrwxrwx 1 me me 700 Jan  1 13:54 foo.dvi
---

Here is the file listing

*File List*
  report.cls2014/09/29 v1.4h Standard LaTeX document class
  size12.clo2014/09/29 v1.4h Standard LaTeX file (size option)
 fontenc.sty
   t1enc.def2005/09/27 v1.99g Standard LaTeX file
   xfrac.sty2015/12/20 v6326 L3 Experimental split-level fractions
   expl3.sty2015/12/20 v6326 L3 programming layer (loader)
expl3-code.tex2015/12/20 v6326 L3 programming layer
 l3dvips.def2015/11/11 v6250 L3 Experimental driver: dvips
 amstext.sty2000/06/29 v2.01
  amsgen.sty1999/11/30 v2.0
graphicx.sty2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty2014/10/28 v1.15 key=value parser (DPC)
graphics.sty2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
trig.sty1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg2010/04/23 v1.9 graphics configuration of TeX Live
   dvips.def2014/10/14 v3.0j Driver-dependent file (DPC,SPQR)
l3keys2e.sty2015/12/20 v6326 LaTeX2e option processing using LaTeX3 keys
textcomp.sty2005/09/27 v1.99g Standard LaTeX package
  ts1enc.def2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
  xparse.sty2015/12/20 v6326 L3 Experimental document command parser
xtemplate.sty2015/12/20 v6326 L3 Experimental prototype document functions
  ts1cmr.fd2014/09/29 v2.5h Standard LaTeX font definitions
 ***


which dvisvgm

/usr/local/texlive/2015/bin/x86_64-linux/dvisvgm


If you like me to try something else, please let me know.

btw, there is new version of dvisvgm by Martin Gieseking just
annouced. Current version we are using on TL 2015 is 1.9.2,
but the new versio is 1.14  2015-12-28. But TL will not
update to new one until TL 2016. So it needs to be manually
build for TL 2015 if we to use it now. Binaries only for
windows and mac. I might have some bug fixes also.

--Nasser




Re: [tex4ht] Too many DVI errors. stack empty at pop command, conficts, bm package, siunitx, dvilualatex

2016-01-01 Thread Michal Hoftich
Hi Nasser,

it seems that it is caused by the xfrac package. A really minimal
example is following:


\documentclass[12pt]{report}%
\usepackage[T1]{fontenc}
\usepackage{xfrac}

\begin{document}
\[ \sfrac{a}{b} \]
\end{document}


compiled with

latex minimal.tex
dvisvgm minimal.dvi

we got:

processing page 1
  page size: 12.0124pt x 548.966pt (4.22189mm x 192.94mm)
  page written to minimal.svg
1 of 1 page converted in 0.34971 seconds
Neoprávněný přístup do paměti (SIGSEGV) (core dumped [obraz paměti uložen])

(yes that Czech message is about unauthorized memory access)

In this simple case the svg file seems fine, but in your more
complicated case it is really garbage. So I think it should be
reported to dvisvgm maintainers.

To temporarily fix your code, I would add something like:

\renewcommand\sfrac[2]{#1/#2}

until it's fixed.

Best regards,
Michal



[tex4ht] Too many DVI errors. stack empty at pop command, conficts, bm package, siunitx, dvilualatex

2015-12-31 Thread Nasser M. Abbasi


This is follow up on the make4ht errors I was getting,
"max_count exceeded". But since I finally found the conflict
that was causing it, and it is all related to DVI problems,
I thought to start new thread.

Here is a MWE, which shows the issue. What happens is that
DVI creates corrupted DVI file or has an error making the dvi.
This in turn causes make4ht to show the errors. So the source
of the problem is in the dvi.

There are so many conflicts between some packages. It all
happens when using the --lua option with make4ht.

So this might be another bug in dvilualatex but I'll leave the
experts to decide.

Here is MWE
--
\documentclass[12pt]{report}%
\usepackage[T1]{fontenc}
\usepackage{amsmath,mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{xfrac}
\usepackage{bm}

\sisetup{
  fraction-function   = \sfrac,
  load-configurations = abbreviations ,
  per-mode= fraction  ,
  number-unit-product = \text{\, }
}

\begin{document}
\begin{align*}
 V_{\infty_a} &= \sqrt{V_A^2 + v_{moon}^2 -
  2 V_A v_{moon} \cos{\gamma_A} }\\
  &= \SI{1.18226}{\km\per\second}
\end{align*}

$r_{bo}=\SI{1760}{\km}$ \footnote{the same value used in~part~II}.
\end{document}


Compile using

make4ht  --lua -u -e main.mk4 foo.tex

(the main.mk4 file is the one thanks to Michal he just send,
which I also paste at the end below so this email will be self contained
and has everything to reproduce this)

Here is the output of the above command:


...
t4ht.c (2012-07-25-19:28 kpathsea)
t4ht -p
  foo.dvi
(/usr/local/texlive/2015/texmf-dist/tex4ht/base/unix/tex4ht.env)
Entering foo.lg
Entering foo.css
Entering foo.tmp
Make4ht: dvisvgm -v1 -n -c 1.15,1.15 -p 1- foo.idv
DVI error: stack empty at pop command<===  !!!
Make4ht: tex4ht  -cunihtf -utf8 foo can be executed only 1x
Make4ht: t4ht  -p foo.dvi can be executed only 1x
Parse LG
parse_lg process file: foo.html
--

Here are some variations:

1)  removing the bm packages removes the error!
Why does the bm package have anything to do with is?

2) removing the code that does the \sisetup also removes the DVI error.

3) commenting out the \usepackage[T1]{fontenc} now gives
DVI error: invalid DVI file instead of stack empty at pop command.

4)commenting out the \footnote remove the stack empty
at pop command error! i.e. replacing the line

$r_{bo}=\SI{1760}{\km}$\footnote{the same value used in~part~II}.

with

$r_{bo}=\SI{1760}{\km}$

what does \footnote has to do with all of this, I have no idea.

If I keep at this, I can come up with more variations. But
for now, I am able to resolve the issue I had in my main build.

I simply removed the \sisetup code, and now everthing build fine!
no more errors from make4ht and DVI is happy.

I hope someone is able to repduce this also. I am using TL 2015,
fresh update of all packages.

Here is main.mk4 (Michal Hoftich, version 12/31/2015)
--
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
)


--Nasser