# [tex4ht] [bug #309] tex4ht does not work with package savetrees

Nasser M. Abbasi nma at 12000.org
Thu Jun 9 23:16:41 CEST 2016

On 6/9/2016 9:25 AM, Michal Hoftich wrote:
>> I love the idea. IMHO it's a proper way of doing.
>> It' far better that  "\ifdefined\HCode"  conditional in tex file.
>>
>
> Sure, the conditional compilation should be the last resort. There is
> a patch for savetrees and fontspec, as I said, it needs testing, as
> there is potentially dangerous change. Also, fontspec-alt4ht.sty isn't
> on CTAN yet, as it doesn't have proper documentation. Also, I've
> changed xhlatex calls in the Makefile to mk4ht xhlatex, as xhlatex
> script seems to be missing in TL.
>
> Michal
>

something we should do.

This leaves the user spending time wondering why the package
they are using do not do anything as it does with pdf.

And what if someone in the future fixes the package so it
works with HTML. We have now to again update tex4ht and allow
the package to be re-loaded again?

I can come up with many packages, where things simply do not
work now with tex4ht as they do with pdf. My code is full of
\ifdefined\HCode to work around these, but at least, now
I can see the effect, and not use such a package in tex4ht
and do something else.

I think it is much better to simply have document or just a list, as
in readme.txt, which says which packages are known not to work with
tex4ht.

A user can lookup this document to see if the package is supposed
to work or not in tex4ht. This is much better than silently not load the
package. I do not like it when a system silently does things
and the user do not know about it.

Here is another case of package tcolorbox simply not working at all
in tex4ht, while it works ok with pdf. The HTML output is all wrong.
One can come with many more examples like these:

------------------------------
\documentclass[12pt]{book}%
\usepackage[T1]{fontenc}
\usepackage{color}
\usepackage{listings}
\usepackage{tcolorbox}
\tcbuselibrary{listings}
\usepackage{matlab-prettifier}
\definecolor{bg}{RGB}{240,240,240}
\usepackage{upquote} %to fix string quotes

\newtcblisting{matlab}[1]{
colback=bg,
size=minimal,
hbox,
listing only,
listing options={
style=Matlab-editor,
basicstyle=\ttfamily#1,
breaklines         = false,
escapechar         = ,
mlshowsectionrules = true
},
}

\begin{document}
\begin{matlab}{\small}
clear all;
m_zeros = [-1 -2];
m_poles = [0 -4 -6];
gain  = 5;
sys   = zpk(m_zeros,m_poles,gain);
[num,den] = tfdata(sys,'v');
printsys(num,den,'s')
\end{matlab}
\end{document}
-----------------------------------------

Compile with make4ht foo.tex and compare the output to lualatex foo.tex

Ok, so now I know this package does not work with tex4ht. So I have
to use the magic \ifdefined\HCode and do something else. But at
least I now know.

This is all my 2 cents ofcourse.

--Nasser

`