From 68f3c84435a5acb687802bfd1882dc8ac107854b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 26 Oct 2022 21:20:53 +0000 Subject: \subfile fixes, tex4ht r1224 git-svn-id: svn://tug.org/texlive/trunk@64828 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/generic/tex4ht/ChangeLog | 6 ++++ .../source/generic/tex4ht/tex4ht-4ht.tex | 41 ++++++++++++---------- Master/texmf-dist/tex/generic/tex4ht/subfiles.4ht | 31 ++++++++-------- .../texmf-dist/tex/generic/tex4ht/usepackage.4ht | 4 +-- 4 files changed, 45 insertions(+), 37 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/source/generic/tex4ht/ChangeLog b/Master/texmf-dist/source/generic/tex4ht/ChangeLog index c9fb24a9d0f..dddf63f672b 100644 --- a/Master/texmf-dist/source/generic/tex4ht/ChangeLog +++ b/Master/texmf-dist/source/generic/tex4ht/ChangeLog @@ -1,3 +1,9 @@ +2022-10-26 Michal Hoftich + + * 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 * tex4ht-4ht.tex (fontmath.4ht, plain.4ht), diff --git a/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex b/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex index e70774e2031..d7c9840d4ad 100644 --- a/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex +++ b/Master/texmf-dist/source/generic/tex4ht/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. + \<<< +\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} diff --git a/Master/texmf-dist/tex/generic/tex4ht/subfiles.4ht b/Master/texmf-dist/tex/generic/tex4ht/subfiles.4ht index 9ec296607c0..f3ea1ff24cd 100644 --- a/Master/texmf-dist/tex/generic/tex4ht/subfiles.4ht +++ b/Master/texmf-dist/tex/generic/tex4ht/subfiles.4ht @@ -1,4 +1,4 @@ -% subfiles.4ht (2022-04-04-07:06), generated from tex4ht-4ht.tex +% subfiles.4ht (2022-10-26-13:32), generated from tex4ht-4ht.tex % Copyright 2022 TeX Users Group % % This work may be distributed and/or modified under the @@ -16,28 +16,27 @@ % % If you modify this program, changing the % version identification would be appreciated. -\immediate\write-1{version 2022-04-04-07:06} +\immediate\write-1{version 2022-10-26-13:32} + +\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 + \Hinput{subfiles} \endinput diff --git a/Master/texmf-dist/tex/generic/tex4ht/usepackage.4ht b/Master/texmf-dist/tex/generic/tex4ht/usepackage.4ht index b576e894b49..f39875a881b 100644 --- a/Master/texmf-dist/tex/generic/tex4ht/usepackage.4ht +++ b/Master/texmf-dist/tex/generic/tex4ht/usepackage.4ht @@ -1,4 +1,4 @@ -% usepackage.4ht (2022-10-25-13:59), generated from tex4ht-4ht.tex +% usepackage.4ht (2022-10-26-13:32), generated from tex4ht-4ht.tex % Copyright 2003-2009 Eitan M. Gurari % Copyright 2009-2022 TeX Users Group % @@ -17,7 +17,7 @@ % % If you modify this program, changing the % version identification would be appreciated. -\immediate\write-1{version 2022-10-25-13:59} +\immediate\write-1{version 2022-10-26-13:32} \def\:temp{tex4ht}\ifx \:temp\@currname \:warning{\string\usepackage{tex4ht} again?} -- cgit v1.2.3