[tex4ht] [bug #592] inconsistent font sizes used for subsubsection/paragraph titles in tex4ht. How to fix?

2023-04-18 Thread Michal Hoftich
Update of bug #592 (project tex4ht):

 Open/Closed:Open => Closed 


___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



[tex4ht] [bug #553] Error message with hyperref & \url

2023-04-18 Thread Michal Hoftich
Update of bug #553 (project tex4ht):

 Open/Closed:Open => Closed 


___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



[tex4ht] [bug #477] Support for new LaTeX hook management

2023-04-18 Thread Michal Hoftich
Follow-up Comment #12, bug #477 (project tex4ht):

There is some discussion about the new LaTeX tagging project and TeX4ht:
https://github.com/latex3/latex2e/discussions/1019 

We will need to make some changes to TeX4ht sources to support the metadata
block used before \documentclass, because TeX4ht is inactive at that moment,
so it doesn't track loaded files. It caused problems with my tests, namely
because it loaded the Amsmath package. There can be potentially much more
problems.

___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



Re: [tex4ht] [bug #477] Support for new LaTeX hook management

2023-04-18 Thread Ulrike Fischer
Hello Michal,

> We will need to make some changes to TeX4ht sources to support the metadata
> block used before \documentclass, because TeX4ht is inactive at that moment,
> so it doesn't track loaded files. It caused problems with my tests, namely
> because it loaded the Amsmath package. There can be potentially much more
> problems.

while there certainly can/will be problems, this error here seems to be 
unrelated to \DocumentMetadata. I get an error with make4ht also for this:

\documentclass{article}

\AddToHook{begindocument/before}{\RequirePackage{amsmath}}

\begin{document}
abc
\end{document}


Ulrike



Re: [tex4ht] [bug #477] Support for new LaTeX hook management

2023-04-18 Thread Michal Hoftich
Hello Ulrike,

> while there certainly can/will be problems, this error here seems to be
> unrelated to \DocumentMetadata. I get an error with make4ht also for this:
>

thanks for this example. You are right. It seems that packages added
in \AddToHook{begindocument/before} or \AtBeginDocument are ignored
too. It is strange because I thought .4ht files captured them, but
they are not.

I was able to fix these hooks issues by manually calling:

\ifdefined\UseHook
\UseHook {begindocument/before}
\UseHook {begindocument}
\RemoveFromHook{begindocument/before}
\RemoveFromHook{begindocument}
\fi

in redefinition of the \document command in tex4ht.sty. I wonder if it
wouldn't break something else, as in the original version of
\document, the begindocument hook is called much later, after setting
various variables. It can break some things in theory. However, the
variables are mainly related to line width and similar stuff, which
don't matter much in the conversion process.

It doesn't fix the issue with \DocumentMetadata, but that can be fixed
by loading tex4ht.sty earlier by make4ht.

Best regards,
Michal


Re: [tex4ht] [bug #477] Support for new LaTeX hook management

2023-04-18 Thread Ulrike Fischer
>> while there certainly can/will be problems, this error here seems to be
>> unrelated to \DocumentMetadata. I get an error with make4ht also for this:
>>

> thanks for this example. You are right. It seems that packages added
> in \AddToHook{begindocument/before} or \AtBeginDocument are ignored
> too. It is strange because I thought .4ht files captured them, but
> they are not.

> I was able to fix these hooks issues by manually calling:

> \ifdefined\UseHook
> \UseHook {begindocument/before}
> \UseHook {begindocument}
> \RemoveFromHook{begindocument/before}
> \RemoveFromHook{begindocument}
> \fi

This won't fix the error with \DocumentMetadata as the 
testphase code loads there amsmath not with the standard hooks but in 
our own hook:

\tl_gput_right:Nn \@kernel@before@begindocument
  { \RequirePackage { amsmath } }
  
(which doesn't look right, but moving it to 
\@kernel@after@begindocument@before doesn't work either). 

We could probably load amsmath earlier, but naturally the problem 
could reappear with other packages or code.

> in redefinition of the \document command in tex4ht.sty. I wonder if it
> wouldn't break something else, as in the original version of
> \document, the begindocument hook is called much later, after setting
> various variables. It can break some things in theory. However, the
> variables are mainly related to line width and similar stuff, which
> don't matter much in the conversion process.


Well I know that rewriting such patches is hard, but this \document
redefinition looks very fragile. Sadly I can't make a concrete suggestion
how to change it as I have no idea what all the code is doing and what
should come before and after other things.

Ulrike



Re: [tex4ht] [bug #477] Support for new LaTeX hook management

2023-04-18 Thread Michal Hoftich
>
> This won't fix the error with \DocumentMetadata as the
> testphase code loads there amsmath not with the standard hooks but in
> our own hook:
>
> \tl_gput_right:Nn \@kernel@before@begindocument
>   { \RequirePackage { amsmath } }
>
> (which doesn't look right, but moving it to
> \@kernel@after@begindocument@before doesn't work either).
>
> We could probably load amsmath earlier, but naturally the problem
> could reappear with other packages or code.
>

when I tried to call this command together with the other two hooks in
tex4ht.sty, it produced a fatal error. Amsmath was loaded, but there
were other errors related to the tagging code.

I will need to investigate it more, but the only thing that I found to
work so far is to require tex4ht.sty right at the beginning of the
processing, and to redefine \DocumentMetadata to do nothing.

>
> Well I know that rewriting such patches is hard, but this \document
> redefinition looks very fragile. Sadly I can't make a concrete suggestion
> how to change it as I have no idea what all the code is doing and what
> should come before and after other things.

Yes, it will be fragile, unfortunately. This is the code that loads
.4ht files and then calls the original \document:


\ifx \config:file\empty
   \def\:temp{\ifx \config:opt\:UnDef
   \edef\config:opt{\ifx \config:file\empty html\fi}\fi
\expandafter\Preamble\expandafter{\config:opt
   }\csname begin\endcsname{document}\EndPreamble
}%
\else
   \def\:temp{\input \config:file\relax
}%
\fi \:temp

It checks if the .cfg file was required, if it wasn't, it will call
\Preamble, \begin{document}, and \EndPreamble. The config file needs
to call these commands too, but it can also contain \Configure
commands used before \begin{document}, so it depends on the fact that
.4ht files should be loaded at that moment. I've also tried to call
original \begin{document} before this code block, but it produced more
errors. So again, something to investigate more.

Best regards,
Michal