Re: [tex4ht] BUG: xcolor tex4ht

2019-04-11 Thread Michal Hoftich
Hi Deimi,

I've found the issue - it was necessary to insert tex4ht hooks in
\AtBeginDocument. The sample on TeX.sx now works with the updated driver. I
haven't tested the results with TikZ manual yet.

Best,
Michal


Re: [tex4ht] BUG: xcolor tex4ht

2019-04-10 Thread Deimantas Galcius

  
  
On 4/10/19 10:08 PM, Michal Hoftich
  wrote:


  
Does it help if you set:
1. 'dvilualatex' compiler instead of 'latex' (probably you'll need \usepackage[T1]{fontenc} for TL2019)
2. \usepackage{luatex85} (for compatibility: pgfsys-dvips.def driver uses \pdfsavepos macro, while in luatex it's \savepos)?

  
  
Thanks for the suggestion. The result seems to be same with all three
major engines. I am sure we will see more of such errors with TikZ
manual, as there is over 1000 figures.


Hi Michal, 

I didn't try with TikZ manual, but with the shifted circles
  problem in 
https://tex.stackexchange.com/a/482913/2891
My output is: 




best, -- deimi





  



Re: [tex4ht] BUG: xcolor tex4ht

2019-04-10 Thread Michal Hoftich
Hi Deimi,

>
> Does it help if you set:
> 1. 'dvilualatex' compiler instead of 'latex' (probably you'll need 
> \usepackage[T1]{fontenc} for TL2019)
> 2. \usepackage{luatex85} (for compatibility: pgfsys-dvips.def driver uses 
> \pdfsavepos macro, while in luatex it's \savepos)?


Thanks for the suggestion. The result seems to be same with all three
major engines. I am sure we will see more of such errors with TikZ
manual, as there is over 1000 figures.

Best,
Michal


Re: [tex4ht] BUG: xcolor tex4ht

2019-04-10 Thread Deimantas Galcius

On 4/9/19 4:41 PM, Michal Hoftich wrote:

what could cause the issue with circles moved
slightly to the right in this answer?:

https://tex.stackexchange.com/a/482913/2891


Hi Michal,

Does it help if you set:
1. 'dvilualatex' compiler instead of 'latex' (probably you'll need 
\usepackage[T1]{fontenc} for TL2019)
2. \usepackage{luatex85} (for compatibility: pgfsys-dvips.def driver uses 
\pdfsavepos macro, while in luatex it's \savepos)?

best regards, -- deimi



Re: [tex4ht] BUG: xcolor tex4ht

2019-04-10 Thread Michal Hoftich
>
> Ah, there seems to be lot of issues. The compilation fails with fatal
> error, but most of the document had been generated, up to section "94
> Mathematical Expressions".


I've found that when I commented out all math-operator environments
containing "`" character in pgfmanual-en-math-parsing.tex, like:

\begin{math-operator}{{\char`\&}{\char`\&}}{infix}{and}

then the compilation runs. So it is necessary to fix this environment
definition in order to get the manual.

Best,
Michal


Re: [tex4ht] BUG: xcolor tex4ht

2019-04-10 Thread Michal Hoftich
> I would really appreciate that!  The main difficulty I have is that TeX4ht
> hooks into all kinds of macros which results in altered expansion behaviour
> which blows up all over the place.  For the xcolor problems I have found some
> workarounds, prior to your patches, which can be found on my tex4ht branch.
>
> https://github.com/hmenke/pgf/tree/tex4ht
>

Ah, there seems to be lot of issues. The compilation fails with fatal
error, but most of the document had been generated, up to section "94
Mathematical Expressions".

You definitely want to replace htlatex with make4ht in the Makefile.
It has much more features. I would add the following line to the
Makefile:

make4ht -u $(doc).tex "2"

I  would also remove the \CutAt command from the config file, as it
doesn't work correctly.

With the alternative driver mentioned in my TeX.sx answer, I can get
1144 SVG images. I don't think it is all, as some code samples lack
the images. Some samples seems wrong, for example the cover image. The
SVG conversion step is quite slow because of the huge number of
images. Because we experienced such slow compilations in the past,
I've created the `dvisvgm_hashes` extension for make4ht.
Unfortunately, it hangs for some reason, so I was not able to speed up
the compilation. I will need to explore this issue more.

It will be really necessary to create new configurations for  custom
commands used in the manual. in order to insert custom HTML code. Here
is some information how it can be done:

https://github.com/michal-h21/helpers4ht/wiki/tex4ht-tutorial

Some custom CSS will be necessary as well, but that can be added  when
everything works.

> Hm, that might or might not be the case.  Since the problem seems to be
> driver-dependent it indicates a PGF/TikZ problem, but I agree, it will be
> difficult to isolate.

It uses the dvips driver and dvisvgm for the conversion, all the
driver does is to add the tex4ht instruction that requires DVI to
image conversion. That part of the DVI file is then extracted as a new
page to a separate DVI file with a .idv extension, which is then
processed using dvisvgm.

Best regards,
Michal


Re: [tex4ht] BUG: xcolor tex4ht

2019-04-09 Thread Henri Menke
On 10/04/19 9:22 AM, Michal Hoftich wrote:
>> Thank you very much.  Does that also fix the
>> \AtBeginDocument{\definecolor{...}} issue?  Unfortunately the PGF/TikZ manual
>> still doesn't build with TeX4ht, but that is not related to xcolor now.
>>
> 
> It should fix that. The main issue was the color name anyway. But I am
> sure there are other issues with the manual. I've tried to convert it
> using tex4ht two years ago and failed, mainly because the compilation
> was too slow on my machine. I think some issues can be fixed using the
> dvisvgm4ht driver:
> 
> https://github.com/michal-h21/dvisvgm4ht
> 
> It seems to produce much better results  than the default driver.
> Externalization should work too. I can help, but I am busy this week
> with writing article for BachoTeX, next week should be better.

I would really appreciate that!  The main difficulty I have is that TeX4ht
hooks into all kinds of macros which results in altered expansion behaviour
which blows up all over the place.  For the xcolor problems I have found some
workarounds, prior to your patches, which can be found on my tex4ht branch.

https://github.com/hmenke/pgf/tree/tex4ht

> 
> 
>> That is the first time I see this problem.  Unfortunately, chemfig is an
>> extremely complex package by itself, so I don't really know how those circles
>> are drawn.  It must have to with that because if I just draw circles with 
>> TikZ,
>> no shift occurs.  If it is possible for you to create a MWE without chemfig,
>> you can report it on the PGF/TikZ bugtracker.
> 
> I am sure that hunting for this bug would be quite difficult, it
> really seems like a problem in chemfig.

Hm, that might or might not be the case.  Since the problem seems to be
driver-dependent it indicates a PGF/TikZ problem, but I agree, it will be
difficult to isolate.

Cheers, Henri

> 
> Best,
> Michal
> 




Re: [tex4ht] BUG: xcolor tex4ht

2019-04-09 Thread Michal Hoftich
> Thank you very much.  Does that also fix the
> \AtBeginDocument{\definecolor{...}} issue?  Unfortunately the PGF/TikZ manual
> still doesn't build with TeX4ht, but that is not related to xcolor now.
>

It should fix that. The main issue was the color name anyway. But I am
sure there are other issues with the manual. I've tried to convert it
using tex4ht two years ago and failed, mainly because the compilation
was too slow on my machine. I think some issues can be fixed using the
dvisvgm4ht driver:

https://github.com/michal-h21/dvisvgm4ht

It seems to produce much better results  than the default driver.
Externalization should work too. I can help, but I am busy this week
with writing article for BachoTeX, next week should be better.


> That is the first time I see this problem.  Unfortunately, chemfig is an
> extremely complex package by itself, so I don't really know how those circles
> are drawn.  It must have to with that because if I just draw circles with 
> TikZ,
> no shift occurs.  If it is possible for you to create a MWE without chemfig,
> you can report it on the PGF/TikZ bugtracker.

I am sure that hunting for this bug would be quite difficult, it
really seems like a problem in chemfig.

Best,
Michal


Re: [tex4ht] BUG: xcolor tex4ht

2019-04-09 Thread Henri Menke
On 10/04/19 1:41 AM, Michal Hoftich wrote:
> Hi Henri,
> 
>> There is a bug in tex4ht color support which causes a compilation
>> error when the color name is same as a color scheme name. You would
>> get the same error with \textcolor{rgb} for example. I hope to fix
>> that tomorrow.
> 
> I hopefully fixed the issues. I've updated the sources, the updated
> color.4ht and xcolor.4ht files are attached.

Thank you very much.  Does that also fix the
\AtBeginDocument{\definecolor{...}} issue?  Unfortunately the PGF/TikZ manual
still doesn't build with TeX4ht, but that is not related to xcolor now.  

> Btw, do you know what could cause the issue with circles moved
> slightly to the right in this answer?:
> 
> https://tex.stackexchange.com/a/482913/2891

That is the first time I see this problem.  Unfortunately, chemfig is an
extremely complex package by itself, so I don't really know how those circles
are drawn.  It must have to with that because if I just draw circles with TikZ,
no shift occurs.  If it is possible for you to create a MWE without chemfig,
you can report it on the PGF/TikZ bugtracker.

Cheers, Henri

> 
> Best regards,
> Michal
> 




Re: [tex4ht] BUG: xcolor tex4ht

2019-04-09 Thread Michal Hoftich
Hi Henri,

> There is a bug in tex4ht color support which causes a compilation
> error when the color name is same as a color scheme name. You would
> get the same error with \textcolor{rgb} for example. I hope to fix
> that tomorrow.

I hopefully fixed the issues. I've updated the sources, the updated
color.4ht and xcolor.4ht files are attached.

Btw, do you know what could cause the issue with circles moved
slightly to the right in this answer?:

https://tex.stackexchange.com/a/482913/2891

Best regards,
Michal


xcolor.4ht
Description: Binary data


color.4ht
Description: Binary data


Re: [tex4ht] BUG: xcolor tex4ht

2019-04-08 Thread Michal Hoftich
Hi Henri

>
> \documentclass{article}
> \usepackage{xcolor}
> \begin{document}
> \textcolor{gray!100}{Lorem ipsum.}
> \end{document}
>

There is a bug in tex4ht color support which causes a compilation
error when the color name is same as a color scheme name. You would
get the same error with \textcolor{rgb} for example. I hope to fix
that tomorrow.

Best regards,
Michal


Re: [tex4ht] BUG: xcolor tex4ht

2019-04-08 Thread Henri Menke
Workaround:

\documentclass{article}
\usepackage{xcolor}
\begin{document}
\textcolor{gray!100}{Lorem ipsum.}
\end{document}

On 9/04/19 9:06 AM, Henri Menke wrote:
> Thank you Karl, but that has nothing to do with the TeX4ht problems.
> 
> I was able to fix the first problem by simply moving the \definecolor outside
> of \AtBeginDocument.  Now I have another problem, illustrated by the following
> MWE.  This works all nice and fine with my default engine LuaTeX, but fails
> with htlatex.  This seems to be a rather longstanding problem, because
> searching for the error message brought up this old thread from 2012 with zero
> replies: https://tug.org/pipermail/tex4ht/2012q4/000653.html
> 
> Cheers, Henri
> 
> ---
> 
> \documentclass{article}
> \usepackage[usenames]{xcolor}
> \begin{document}
> \textcolor{gray}{Lorem ipsum.}
> \end{document}
> 
> 
> ! Argument of \HColor:gray has an extra }.
>  
> \par 
> l.7 \textcolor{gray}{Lorem ipsum.}
> 
> On 9/04/19 5:58 AM, Karl Berry wrote:
>> This particular construction is actually part of the PGF/TikZ manual
>> and currently prevents the manual from typesetting.
>>
>> FWIW, I just reverted pgf in TeX Live to its previous release. -k
>>
> 




Re: [tex4ht] BUG: xcolor tex4ht

2019-04-08 Thread Henri Menke
Thank you Karl, but that has nothing to do with the TeX4ht problems.

I was able to fix the first problem by simply moving the \definecolor outside
of \AtBeginDocument.  Now I have another problem, illustrated by the following
MWE.  This works all nice and fine with my default engine LuaTeX, but fails
with htlatex.  This seems to be a rather longstanding problem, because
searching for the error message brought up this old thread from 2012 with zero
replies: https://tug.org/pipermail/tex4ht/2012q4/000653.html

Cheers, Henri

---

\documentclass{article}
\usepackage[usenames]{xcolor}
\begin{document}
\textcolor{gray}{Lorem ipsum.}
\end{document}


! Argument of \HColor:gray has an extra }.
 
\par 
l.7 \textcolor{gray}{Lorem ipsum.}

On 9/04/19 5:58 AM, Karl Berry wrote:
> This particular construction is actually part of the PGF/TikZ manual
> and currently prevents the manual from typesetting.
> 
> FWIW, I just reverted pgf in TeX Live to its previous release. -k
> 




Re: [tex4ht] BUG: xcolor tex4ht

2019-04-08 Thread Karl Berry
This particular construction is actually part of the PGF/TikZ manual
and currently prevents the manual from typesetting.

FWIW, I just reverted pgf in TeX Live to its previous release. -k


Re: [tex4ht] BUG: xcolor tex4ht

2019-04-07 Thread Henri Menke
On 8/04/19 1:54 PM, Nasser M. Abbasi wrote:
> On 4/7/2019 7:44 PM, Henri Menke wrote:
>> Dear list,
>>
>> When I try to typeset the following MWE with LaTeX everything works fine, 
>> but it crashes with htlatex from TeX4HT.
>> I have emailed the xcolor developer about this as well because I don't know
>> whether the problem is in xcolor or in color.4ht.
>>
>> When you reply, please CC to me because I'm not subscribed to the list.
>>
>> Cheers, Henri
>>
>> \documentclass{article}
>> \usepackage{xcolor}
>> \AtBeginDocument{\definecolor{gray}{gray}{.5}}
>> \begin{document}
>> \end{document}
>>
>> ---
>>
>> ! Missing number, treated as zero.
>> 
>> X
>> l.4 \begin{document}
>>
>>
>>
>>
>>
> 
> What is the reason to write
> 
> \AtBeginDocument{\definecolor{gray}{gray}{.5}}
> 
> vs.
> 
> \definecolor{gray}{gray}{.5}

I actually don't know what is the reason.  The point is that at some point in
history it must have worked (probably around 2006) and now it doesn't work
anymore.  This particular construction is actually part of the PGF/TikZ manual
and currently prevents the manual from typesetting.

https://github.com/pgf-tikz/pgf/blob/adb729aadc0565b0de9a69186a967a0422704e6b/doc/generic/pgf/version-for-tex4ht/pgfmanual-tex4ht.cfg#L21-L33

Cheers, Henri

> 
> ?
> 
> --Nasser
> 




Re: [tex4ht] BUG: xcolor tex4ht

2019-04-07 Thread Nasser M. Abbasi

On 4/7/2019 7:44 PM, Henri Menke wrote:

Dear list,

When I try to typeset the following MWE with LaTeX everything works fine, but 
it crashes with htlatex from TeX4HT.
I have emailed the xcolor developer about this as well because I don't know
whether the problem is in xcolor or in color.4ht.

When you reply, please CC to me because I'm not subscribed to the list.

Cheers, Henri

\documentclass{article}
\usepackage{xcolor}
\AtBeginDocument{\definecolor{gray}{gray}{.5}}
\begin{document}
\end{document}

---

! Missing number, treated as zero.

X
l.4 \begin{document}







What is the reason to write

\AtBeginDocument{\definecolor{gray}{gray}{.5}}

vs.

\definecolor{gray}{gray}{.5}

?

--Nasser


[tex4ht] BUG: xcolor tex4ht

2019-04-07 Thread Henri Menke
Dear list,

When I try to typeset the following MWE with LaTeX everything works fine, but 
it crashes with htlatex from TeX4HT.
I have emailed the xcolor developer about this as well because I don't know
whether the problem is in xcolor or in color.4ht.

When you reply, please CC to me because I'm not subscribed to the list.

Cheers, Henri

\documentclass{article}
\usepackage{xcolor}
\AtBeginDocument{\definecolor{gray}{gray}{.5}}
\begin{document}
\end{document}

---

! Missing number, treated as zero.
 
   X
l.4 \begin{document}