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