Return-Path: Delivered-To: rainer Received: from h2774747.stratoserver.net (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) by h2774747.stratoserver.net (Dovecot) with LMTP id OVxgO5m7GV95aAAA4+3H6A for ; Thu, 23 Jul 2020 18:32:26 +0200 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by h2774747.stratoserver.net (8.15.2/8.15.2/Debian-3) with ESMTP id 06NGWOOt026743 for ; Thu, 23 Jul 2020 18:32:25 +0200 Received: from relay.uni-heidelberg.de ([129.206.100.212]) by mx-ha.gmx.net (mxgmx017 [212.227.15.9]) with ESMTP (Nemesis) id 1MK2Jg-1kFl3X1MCM-00Lemu for ; Thu, 23 Jul 2020 18:32:17 +0200 Received: from listserv.uni-heidelberg.de ([129.206.100.94]) by relay.uni-heidelberg.de with ESMTP; 23 Jul 2020 18:32:17 +0200 Received: from listserv (localhost [127.0.0.1]) by listserv.uni-heidelberg.de (Postfix) with ESMTP id 719E81284E7; Thu, 23 Jul 2020 18:32:07 +0200 (CEST) Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 17.0) with spool id 44358359 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Thu, 23 Jul 2020 18:32:07 +0200 Delivered-To: LATEX-L@listserv.uni-heidelberg.de Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.119.212]) by listserv.uni-heidelberg.de (Postfix) with ESMTP id 4F8FD128488 for ; Thu, 23 Jul 2020 18:32:07 +0200 (CEST) X-IronPort-MID: 72248491 X-IronPort-RemoteIP: 5.35.249.60 X-IronPort-SenderGroup: UNKNOWNLIST X-IronPort-MailFlowPolicy: $ACCEPTED X-IronPort-Reputation: 5.2 IronPort-PHdr: =?us-ascii?q?9a23=3AB5UPmxCYki+D2o55n+F+UyQJPHJ1kqjoPgMT9p?= =?us-ascii?q?ssgq5PdaLmxZn5IUjD/qw90A3TUIHS+qgCluzX9qDtWGAN5ZyM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7zM1ooI07SAxAyFWjzgylC7vZKvwN0WVXQpBmO6jBPcKstRa6?= =?us-ascii?q?l1JNlZAmCrLsGmgNl3gYLgHXJVpgb6VgE2nfSxcB/XVGTTmAhZ1EAZu3uiwH?= =?us-ascii?q?rqyzVoniFstrCY3iHF36LlbhVVY2M=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0A8AgBwuhlfmDz5IwVgHgEBCxIMQIM?= =?us-ascii?q?cUYFLIwQLLIQziQGIGQ+bewsBAQEBAQEBAQEGAQEsAQIEAQGETAKCGgIcBwE?= =?us-ascii?q?ENBMCAwEBAQMCBQEBBQEBAQIBAwMEFAEBAQEBBg0LBimFYwyFcgIBAwEBIRU?= =?us-ascii?q?IAQE4DwsaAiYCAlcFAQ0IAQGDIoJ+AwGuHoEygwEBAQWCSoNTgTcJgQ4qiHi?= =?us-ascii?q?DfA+BTD+BOII7Lj6BF4Y8gmCPIxESiymaRCkHgmCBCAQLmEYFKJE7jiCFS6t?= =?us-ascii?q?PAgQCBAUCFYFqgXp9gyxQGQ2OHhqIa4VEPzM3AgYIAQEDCU8KAQGMbgSCQgE?= =?us-ascii?q?B?= X-IronPort-AV: E=Sophos;i="5.75,387,1589234400"; d="scan'208";a="72248491" X-MGA-submission: =?us-ascii?q?MDFN9zWBrabjXkfuQgqDKqC7T307dlZTgY6Oui?= =?us-ascii?q?OR6d/DAcsOjrsVkGR+DpR7duuh+uGIfj0Hol9D1LJ6iSQ95dv2rJGSOi?= =?us-ascii?q?D3J7jnpBke+4pIX2PRRKLZEG783/BhnO2cKwFQViqCcz7cvwj6z8wOZm?= =?us-ascii?q?4qI8IYilSAXrB62xcFPNjbVg=3D=3D?= Received: from comedy.dante.de ([5.35.249.60]) by relay2.uni-heidelberg.de with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 23 Jul 2020 18:32:08 +0200 Received: from Franks-MBP.fritz.box (p200300cbaf441c0079554bfcac460869.dip0.t-ipconnect.de [IPv6:2003:cb:af44:1c00:7955:4bfc:ac46:869]) (authenticated bits=0) by comedy.dante.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 06NGW4v0016192 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 23 Jul 2020 18:32:06 +0200 References: <20200723020053.jq6lnwl7k23htouz@vento15post8> User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-DANTE-Spam-Score: 1.17 (*) KHOP_HELO_FCRDNS,NICE_REPLY_A,SPF_FAIL,SPF_HELO_NONE X-Scanned-By: MIMEDefang 2.78 on 81.169.212.23 X-Scanned-By: MIMEDefang 2.79 Message-ID: <14abf2ad-c403-639c-aebd-a42caaea04bc@latex-project.org> Date: Thu, 23 Jul 2020 18:32:04 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Frank Mittelbach Subject: Re: Guidelines on the new hook management -- tex4ht To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-Spam-Flag: NO X-UI-Filterresults: notjunk:1;V03:K0:Hg/5pOWI/iE=:3uUVb4SwpaR7AWXk1eU0Xdt4GU LJ8eDKG5LW6iylK8iMP+oBq1J2iQ9xQ9nGg5hAOooN+i75vJltTmAjPjGFbjYgnQlooPs7hFd CtkcPCF/72hVa8NBgzAlBsn27pUomvrb6F7ixsU8FVDO/UslLnLmoe98ZYwJZOpYqHjuvdhb/ OOMIZDNe1oEyck2/8RMhWutiSRrb7i8t3LyICslQUvaCCEEoWUaiPro6cG7GFCucZ2blCWjLR s5j82Eoanb7H5Q7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X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:sfLN0ugrbms=:VKn1bZseqjmSFQCrbOAGDY yoXg0StCUnu311gchfqtUPEs4+5FjEpJvigSMq1seHMnHyzNu8qYfeAdfKujth4XOnp9XqPEZ IyKnPBX8A2UjVXiRdXZy/b/g4XJcPVIcap7yT5PsUbucayCjGJLsRSSXHgeQir/EF/80T/Ct6 zrUJjHFtYSA3VZszTdLQz+mx18CgjHqgrbF9Vu3jq8M3AohXoTAoz3ZqhS9cRvhJD7QT/syJQ J1iqMTSNtF2sKEhJIcoxAWfJbiuGkT2CR/yJB+npDScarWQntxYNT7kRwMGEBM1O1NGG37mlL SYeqdRsAOy/snu5sI6WLIUB0px428W9KQH4pH3gU4B+QQ1Un+Kg+nvThR7T+M1i+CHad7pYLl LYTAx4WyVmg8/RqXlLcpzfs7oQwO0EdcWALC649zUbPeOZrJOVUsDl1noz7t3Eja+OqcW/9Fn ie0r5W/32bUOKkfQKjYpM+/Nxux5UqI= Status: R X-Status: X-Keywords: X-UID: 8216 Am 23.07.20 um 09:07 schrieb Michal Hoftich: > Hi all, > >> Inspired by issue #900 on the PGF/TikZ repo [1], I'd like to kick off >> the discussion on how to correctly integrate the new hook management >> system into existing LaTeX package codebases. > > I've just tested latex-dev with TeX4ht and I can confirm that it > fatally crashes with latex-dev. > so it does, but then this isn't really surprising when looking at what tex4ht patches and at what level. I can't claim that I understand the details of what it does, I only looked very briefly now. But basically the main issue is that in the old LaTeX \document started out with \endgroup to cancel the \begingroup issued by \begin As \begin now offers hooks this \endgroup has moved into \begin to avoid that the hook code is not canceled by the end of the group. The second issue is that the tex4ht calls \begin{document} inside \begin{document} again. There is also a call to \end{document} inside \document which doesn't do much other than breaking now. Furthermore LaTeX's enddocument hook is directly modified (and not through \AtEndDocument and that fails because it is below the official interfaces. ------------ So to get tex4ht back up and running again only a small change to \document is necessary: %FMi drop those lines from \document % % \expandafter\let\csname enddocument\endcsname\empty % \end{document}% Because of the double call to \begin{document} that leaves us with an open group at the end of the document. So either we need to explicitly close that group at end document, e.g. \AddToHook{enddocument/end}{\endgroup} or probably better make a second change in the \document redefinition and add it there: %FMi close the group started by \begin{document} on second call % \let\document\o:document \def\document{\endgroup\o:document}% ------------ Concerning the other issue in latex.4ht there is \let\o:enddocumenthook\@enddocumenthook \def\@enddocumenthook{\HtmlEnv \Configure{newpage}{}% \o:enddocumenthook \at:docend \csname export:hook\endcsname } and \@enddocumenthook isn't used any longer. So the redef goes to /dev/null The idea here seems to be that \HtmlEnv\Configure{newpage}{}% should be before the content of \AtEndDocument and \at:docend \csname export:hook\endcsname A possible replacement therefore using the hook management would be \AddToHook{env/document/end} {\HtmlEnv\Configure{newpage}{}} \AddToHook{enddocument/afterlastpage} {\at:docend \csname export:hook\endcsname} However this fails because tex4ht also overwrites the code for \begin and \end and therefore the generic hooks env/... lost So without correcting/updating the redefinitions for \begin \end it has to be \AddToHook{enddocument} {\HtmlEnv\Configure{newpage}{}} \AddToHook{enddocument/afterlastpage} {\at:docend \csname export:hook\endcsname} ------------------ with that everything seems to be working. However, a lot of the lowlevel patching code inside tex4ht seems to be only necessary because environment hooks are not available, so after adjusting \begin and \end to use the kernel definitions it should be possible to simplify a lot by simply using appropriate "env/foo/before" and "env/foo/after" hooks. frank