Skip to content

Commit

Permalink
defer subfiles {document} redefinition after main file starts mainmat…
Browse files Browse the repository at this point in the history
…ter (#2324)
  • Loading branch information
dginev authored Feb 16, 2024
1 parent 07bec65 commit 8046a13
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/LaTeXML/Package/subfiles.sty.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ use warnings;
use LaTeXML::Package;

#======================================================================
# Redefine \documentclass to do nothring
# Redefine \documentclass to do nothing
DefMacro('\documentclass OptionalSemiverbatim SkipSpaces Semiverbatim []', undef);
# And {document} environment likewise
DefEnvironment('{document}', "#body", beforeDigest => sub {
AssignValue(inPreamble => 0);
return; });
# And {document} environment likewise, but only after the main document starts.
AtBeginDocument(sub {
DefEnvironment('{document}', "#body", beforeDigest => sub {
AssignValue(inPreamble => 0);
return; });
});
# Define \subfiles to be \input
Let('\subfile', '\input');

Expand Down

0 comments on commit 8046a13

Please sign in to comment.