summaryrefslogtreecommitdiff
path: root/support/TeX4ht/source
diff options
context:
space:
mode:
Diffstat (limited to 'support/TeX4ht/source')
-rw-r--r--support/TeX4ht/source/ChangeLog6
-rw-r--r--support/TeX4ht/source/tex4ht-4ht.tex41
2 files changed, 28 insertions, 19 deletions
diff --git a/support/TeX4ht/source/ChangeLog b/support/TeX4ht/source/ChangeLog
index c9fb24a9d0..dddf63f672 100644
--- a/support/TeX4ht/source/ChangeLog
+++ b/support/TeX4ht/source/ChangeLog
@@ -1,3 +1,9 @@
+2022-10-26 Michal Hoftich <michal.h21@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@gmail.com>
* tex4ht-4ht.tex (fontmath.4ht, plain.4ht),
diff --git a/support/TeX4ht/source/tex4ht-4ht.tex b/support/TeX4ht/source/tex4ht-4ht.tex
index e70774e203..d7c9840d4a 100644
--- a/support/TeX4ht/source/tex4ht-4ht.tex
+++ b/support/TeX4ht/source/tex4ht-4ht.tex
@@ -1,4 +1,4 @@
-% $Id: tex4ht-4ht.tex 1223 2022-10-25 20:53:26Z michal_h21 $
+% $Id: tex4ht-4ht.tex 1224 2022-10-26 14:03:21Z michal_h21 $
% tex tex4ht-4ht or ht tex tex4ht-4ht
%
% Copyright 2009-2022 TeX Users Group
@@ -4977,31 +4977,34 @@ as it leads to a fatal error.
\endinput
>>> \AddFile{9}{subfiles}
-We use the original version of \Verb|\subfiles@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@restoreEndFrom\:gobble
+ \fi%
+}
+
\def\:tempa#1{%
\ifcsname subfiles@end\endcsname
- \else
- \subfiles@saveEndTo\subfiles@end
- \fi
- \let\choose:begin\@secondoftwo
- \expandafter\def\csname end \endcsname##1{%
- \romannumeral
- \subfiles@StrIfEqTF{##1}{document}{%
- \z@
- \subfiles@restoreEndFrom\subfiles@end
- #1%
- }{%
- \expandafter\expandafter\expandafter\z@\subfiles@end{##1}%
- }%
- }%
+\else
+ \subfiles@saveEndTo\subfiles@end
+\fi
+\pend:defI\end\subfiles:end
}
\HLet\subfiles@renewEndDocument\:tempa
+
>>>
\Section{url.sty}