# [tex4ht] erorr code 256, possible perl error code, come up with using --lua option with make4ht, error --- Improper dvi file

Nasser M. Abbasi nma at 12000.org
Sat Dec 5 20:13:04 CET 2015

An update.

I found one way to reproduce the error very easily by making
one change in the Matlab code in the listing inside the Latex
file. So this seems to be an encoding issue.

I'll show an example of what causes this error to show up. In
the file KERNEL.tex, at line 24 to line 26, you'll see these 3 lines
(inside the listing environment)

----------------------------------------
function k_local=getk(a,b)

k_local = [k11  k12 k13 k14;
----------------------------------------

The above gives an error
Make4ht: Fatal error. Command tex4ht returned exit code 256

if I simply remove the blank line in between, so it is now like this:

----------------------------------------
function k_local=getk(a,b)
k_local = [k11 k12 k13 k14;
----------------------------------------

And recompile, then tex4ht is happy ! no error code 256.

Not only that, if I also change these lines to be like this

----------------------------------------
function klocal=getk(a,b)

klocal = [k11 k12 k13 k14;
----------------------------------------

Where now the empty line is there, but I removed the underscore '_'
in the names, now the error goes away also!

I hope someone can be able to verify this on their end also.

The KERNEL.tex, nma.cfg and main.mk4 are in same place:

http://12000.org/tmp/103115/

The command again is:

make4ht -u --lua -c ./nma.cfg -e ./main.mk4 KERNEL.tex "htm,3,pic-align,notoc*" -d KERNEL

The layout of the Latex file is same:

\documentclass[]{report}%
\usepackage{ae,aecompl}%conflict here !
\usepackage{listings}
\begin{document}
\lstset{numbers=none}
\begin{lstlisting}
... matlab code...
\end{lstlisting}
\end{document}

ps. This  issue is not important for me actually any more, as I have
removed \usepackage{ae,aecompl} from my include file, and this
solves the problem.

indicate some other more serious problem somewhere else.

thanks,
--Nasser

On 12/4/2015 5:08 PM, Nasser M. Abbasi wrote:
> I found the conflict!  And also got a better error. It comes from
>
>    /usr/local/texlive/2015/texmf-dist/tex4ht/ht-fonts/unicode/charset/unicode.4hf
>
> --- error --- Improper op while scanning font defs in postamble
> Make4ht: Fatal error. Command tex4ht returned exit code 256
>
> It is something to do with
>
> \usepackage{ae,aecompl}
>
> and also when using --lua option at the same time.
>
> If I remove the above package, or remove --lua, tex4ht compiles ok.
>
> This only shows up with including Matlab code using the listings package.
>
> The MWE looks like this:
>
> ----------------------------
> \documentclass[]{report}%
> \usepackage{ae,aecompl}
> \usepackage{listings}
> \begin{document}
> \lstset{numbers=none}
> \begin{lstlisting}
> ... matlab code...
> \end{lstlisting}
> \end{document}
> ----------------------------
>
> That is all !
>
> I am trying to find which part of the Matlab code is causing this
> erorr, but so far having hard time. But will try later more.
>
> It is now all self contained. I put the Matlab code
> inside the latex file. So one file. No additional anything
> needed. No includes. It is called KERNEL.tex, same folder, here it is
>
> http://12000.org/tmp/103115/
>
> Same compile command:
>
> make4ht -u --lua -c ./nma.cfg -e ./main.mk4 KERNEL.tex "htm,3,pic-align,notoc*" -d KERNEL
>
> (/usr/local/texlive/2015/texmf-dist/tex4ht/base/unix/tex4ht.env)
> (/usr/local/texlive/2015/texmf-dist/tex4ht/ht-fonts/unicode/charset/unicode.4hf)
> --- error --- Improper op while scanning font defs in postamble
> Make4ht: Fatal error. Command tex4ht returned exit code 256
>
> May be the above will help some expert figure the issue behind this.
>
> I do not know why I had \usepackage{ae,aecompl} in there now.
> I have large include file where I load all the packages so I
> do not have to worry about these things. But this seems to cause
> problems somethimes due to conflicts.
>
> Thank you,
> --Nasser
>
>
> On 12/4/2015 3:14 PM, Nasser M. Abbasi wrote:
>> On 12/4/2015 2:11 PM, William F Hammond wrote:
>>> On Thu, Dec 3, 2015 at 1:19 PM, Nasser M. Abbasi <nma at 12000.org> wrote:
>>>
>>> I just put a new zip file with this missing .tex included file:
>>>
>>>
>>> OK, that helps.  I also had to go looking online for mcode.sty.
>>>
>>
>> Sorry. I'll add this to the zip file soon.
>>
>>> It builds with make4ht if I remove the \subimport-ing for e97 and e98.
>>> In fact, I had trouble with one of those (I think) in building pdf with
>>> pdftex -- a complaint about a double superscript that I did not want to
>>> take the time to find after a small bit of looking.  I don't know why we
>>> should expect tex4ht to support \subimport.  (Does it?)  Beyond that, I
>>> think I see package conflicts with e97
>>>     and e98 ... packages loaded followed by the \input of commonlatex which
>>> loads some of the same.
>>>
>>
>> Thanks!  Yes. It is a package conflict !  I am trying now to make
>> a MWE to show this. It is in one of these 2 files that I subimport.
>>
>>
>> Now for the issue of subimport. It does with with tex4ht. I use
>> standalone package and subimport very heavily in all my documents.
>>
>> I forgot to mention that one needs a patched standalone package
>> to make it work with tex4ht. It is a long story. But Martin Scharrer
>> was kind enough to patch the standalone package to make it work
>> with tex4ht few years ago. It is not yet in the main TL 2015 tree.
>>
>> So each time I make new TL, I download the patch and replace
>> the current standalone.sty with the patched one.
>>
>> https://bitbucket.org/martin_scharrer/standalone/raw/635aacfa0e8f2cba4f4086f4f15d57791b18bf64/standalone.sty
>>
>> I'll add this to the zip file also so it is all self contained.
>>
>> Here is the related question on tex stackexchange with Martin explaining
>> the issue in the comment.
>>
>> http://tex.stackexchange.com/questions/95701/syntax-error-when-using-tex4ht-on-latex-file-that-uses-the-standalone-package
>>
>> Again, standalone and subimport work with tex4ht. But one needs to use
>> the above .sty file, not the one that comes with TL 2015.
>>
>> I am trying now to find which package loading is causing the
>> conflict. I narrowed down the latex file to only this:
>>
>> -----------------------------------------------
>> \documentclass[12pt,notitlepage]{report}%
>> \input{commonlatex}
>> \usepackage{standalone}
>> \usepackage{import}
>> \begin{document}
>> \subimport{problems/e97/}{e97}
>> \subimport{problems/e98/}{e98} % in here seems to be the problem
>> \end{document}
>> -------------------------------------------
>>
>> And the above causes the error code to show.
>>
>> I will update the mailing list once I find where the conflict is
>> and make new zip file.  We are getting close!
>>
>>> The HTML document I made (one big file without e97 and e98) looks
>>> reasonable.  I ran it through the validator for my private SGML profile of
>>> HTML5, and from that I have several comments.
>>>
>>> There are about 500 img open tags with a loose semi-colon between attribute
>>> specs, probably due to some issue in one of your tex4ht configs.  In fact,
>>> they are all
>>>
>>>           class="math";align="absmiddle"
>>>
>>> There are 7 complaints about </p> tags for which p is not open.
>>>
>>> Aside from that I would suggest for HTML5 (one is suppoosed to see an HTML5
>>> document as a DOM object with two serializations, one xml) that the element
>>> names SCRIPT and IMG and the img attribute names SRC, ALT, and WIDTH all be
>>> lower case, cf. \HCode for mma_movie_100.
>>>
>>>                -- Bill
>>>
>>
>> Thank you,
>> --Nasser
>>
>
>