[tex4ht-commits] [SCM] tex4ht updated: r1224 - trunk/lit

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Wed Oct 26 16:03:21 CEST 2022


Author: michal_h21
Date: 2022-10-26 14:03:21 +0000 (Wed, 26 Oct 2022)
New Revision: 1224

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-4ht.tex
Log:
fixed handling of environments in documents included using \subfile

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2022-10-25 20:53:26 UTC (rev 1223)
+++ trunk/lit/ChangeLog	2022-10-26 14:03:21 UTC (rev 1224)
@@ -1,3 +1,9 @@
+2022-10-26  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-4ht.tex (subfiles.4ht): fixed handling of environments
+	inside TeX files included using \subfile.
+	https://github.com/michal-h21/make4ht/issues/84
+
 2022-10-25  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-4ht.tex (fontmath.4ht, plain.4ht),

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2022-10-25 20:53:26 UTC (rev 1223)
+++ trunk/lit/tex4ht-4ht.tex	2022-10-26 14:03:21 UTC (rev 1224)
@@ -4977,31 +4977,34 @@
 \endinput
 >>> \AddFile{9}{subfiles}
 
-We use the original version of \Verb|\subfiles at renewEndDocument|, the only 
-change is that we added the \Verb|\choose:begin| redefinition. It is necessary
-to prevent processing of the document after \Verb|\end{document}| in the 
-included subfile.
+The Subfiles package redefines handling of LaTeX environments.
+Because the included TeX files contain \Verb|\end{document}|,
+it causes immediate stop of the main file processing. 
 
+We must test for environment names in the included document,
+and set \Verb|\choose:begin| to grab the second argument,
+which will prevent the stop of the processing.
+
+
 \<subfiles enddocument\><<<
+\def\subfiles:end{%
+  \def\:temp{document}
+  \ifx\@currenvir\:temp
+    \let\choose:begin\@secondoftwo%
+    \subfiles at restoreEndFrom\:gobble
+  \fi%
+}
+
 \def\:tempa#1{%
   \ifcsname subfiles at end\endcsname
-  \else
-    \subfiles at saveEndTo\subfiles at end
-  \fi
-  \let\choose:begin\@secondoftwo
-  \expandafter\def\csname end \endcsname##1{%
-    \romannumeral
-    \subfiles at StrIfEqTF{##1}{document}{%
-      \z@
-      \subfiles at restoreEndFrom\subfiles at end
-      #1%
-    }{%
-      \expandafter\expandafter\expandafter\z@\subfiles at end{##1}%
-    }%
-  }%
+\else
+  \subfiles at saveEndTo\subfiles at end
+\fi
+\pend:defI\end\subfiles:end
 }
 
 \HLet\subfiles at renewEndDocument\:tempa
+
 >>>
 
 \Section{url.sty}



More information about the tex4ht-commits mailing list.